Skip to content

Commit 2349a7d

Browse files
committed
Merge branch 'master' of https://github.com/ropensci/plotly
2 parents 8324fae + 72b4811 commit 2349a7d

File tree

6 files changed

+75
-2
lines changed

6 files changed

+75
-2
lines changed

NEWS.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,18 @@ This is minor patch release with a few minor bug fixes and updates test expectat
4444

4545
## IMPROVEMENTS
4646

47-
* All HTTP requests are now retried upon failure (#1656)
47+
* All HTTP requests are now retried upon failure (#1656, @jameslamb).
48+
49+
* R linebreaks (`\n`) in _factor labels_ are now translated to HTML linebreaks (`<br />`), too. Before, this conversion was only done for colums of type character. ([#1700](https://github.com/ropensci/plotly/pull/1700), @salim-b).
4850

4951
* R linebreaks (`\n`) in _factor labels_ are now translated to HTML linebreaks (`<br />`), too. Before, this conversion was only done for colums of type character. ([#1700](https://github.com/ropensci/plotly/pull/1700), @salim-b)
5052

5153
## BUG FIXES
5254

5355
* `ggplotly()` now handles discrete axes of a `facet_wrap` and `facet_grid` correctly when there is only one category in panels > 1 (#1577 and #1720).
5456

57+
* `ggplotly()` now correctly accounts for linebreaks in tick label text when computing plot margins (#1791, @trekonom).
58+
5559
* `ggplotly()` now handles `element_blank()` and `factor()` labels in positional scales correctly (#1731 and #1772).
5660

5761
# 4.9.2.1

R/ggplotly.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,9 @@ gg2list <- function(p, width = NULL, height = NULL,
806806

807807
# do some stuff that should be done once for the entire plot
808808
if (i == 1) {
809-
axisTickText <- longest_element(axisObj$ticktext)
809+
# Split ticktext elements by "\n" to account for linebreaks
810+
axisTickText <- strsplit(as.character(axisObj$ticktext), split = "\n", fixed = TRUE)
811+
axisTickText <- longest_element(unlist(axisTickText))
810812
side <- if (xy == "x") "b" else "l"
811813
# account for axis ticks, ticks text, and titles in plot margins
812814
# (apparently ggplot2 doesn't support axis.title/axis.text margins)
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)