Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 52552f7

Browse filesBrowse files
trekonomcpsievert
andauthored
Add fix to take account of linebreaks in yaxis ticklabels. (#1791)
* Add fix to take account of linebreaks in yaxis ticklabels. * Remove unnecessary sapply. * Add test linebreaks are taken into account. * Update R/ggplotly.R Co-authored-by: Carson Sievert <cpsievert1@gmail.com> * Update R/ggplotly.R Co-authored-by: Carson Sievert <cpsievert1@gmail.com> Co-authored-by: Carson Sievert <cpsievert1@gmail.com>
1 parent 9a856ae commit 52552f7
Copy full SHA for 52552f7

File tree

Expand file treeCollapse file tree

5 files changed

+70
-1
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+70
-1
lines changed

‎R/ggplotly.R

Copy file name to clipboardExpand all lines: R/ggplotly.R
+3-1Lines 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)
+1Lines changed: 1 addition & 0 deletions
Loading
+1Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.