Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Legend title not shown in horizontal orientation #1704

Closed
richierocks opened this issue Feb 21, 2020 · 1 comment
Closed

Legend title not shown in horizontal orientation #1704

richierocks opened this issue Feb 21, 2020 · 1 comment

Comments

@richierocks
Copy link

The legend title is not shown for legends in horizontal orientation.

Here's a line plot with a legend.

library(ggplot2)
library(plotly)

plt <- ggplot(Orange, aes(age, circumference, group = Tree, color = Tree)) + 
  geom_line()

The plotly version with a vertical legend correctly displays the title.

ggplotly(plt)

Screenshot 2020-02-21 13 37 33

If I change to horizontal orientation, the title is no longer present

ggplotly(plt) %>% 
  layout(
    legend = list(
      orientation = "h"
    )
  )

Notice that the word "Tree" is not present in this image.

Screenshot 2020-02-21 13 38 53

This is a low priority bug since there is a workaround: you can manually specify the legend title.

ggplotly(plt) %>% 
  layout(
    legend = list(
      orientation = "h", 
      title = list(text = "Tree")
    )
  )

Screenshot 2020-02-21 13 42 07

@cpsievert
Copy link
Collaborator

Duplicate of #1049 (there's a WIP #1697)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants