ggvis icon indicating copy to clipboard operation
ggvis copied to clipboard

Axis labels overlap with graph and axis title when rotated

Open shreyasgm opened this issue 8 years ago • 0 comments

When axis labels are rotated, ggvis should automatically move the axis title to avoid overlaps with labels.

This is what we would want:

ggplot(iris, aes(x = Species,y = Sepal.Length)) +
  geom_bar(stat="identity") +
  theme(axis.text.x=element_text(angle = 90,vjust = 0))

ggplot2-axis-example

In ggvis, when axis labels are rotated, they overlap with both the axis title, and the graph itself:

iris %>%
    ggvis(x = ~Species, y = ~Sepal.Length) %>%
    layer_bars() %>%
    add_axis("x",properties = axis_props(labels = list(angle = -90)))

ggvis-axis-example1

Even with the "align" property, the label still overlaps with the axis title:

iris %>%
  ggvis(x = ~Species, y = ~Sepal.Length) %>%
  layer_bars() %>%
  add_axis("x",properties = axis_props(labels = list(angle = -90,align = "right")))

ggvis-axis-example2

shreyasgm avatar Apr 21 '16 15:04 shreyasgm