我遇到了如何在ggplotly中定位主标题和图例的问题。我希望我的主标题位于图表的顶部并保持对齐。我还希望我的图例位于图表的底部中心
这是我的代码
<embed ng-src="{{cont}}" style="width:100px;height:100px;"></embed>
答案 0 :(得分:3)
我没有找到任何标题问题的解决方案。看看这是否有助于您了解图例。
p <- ggplot(combined_data, aes(Month_Names, y = Actual_volume,
group = TrendName,
color = TrendName)) +
geom_line() +
labs(x=" ",y=" ") +
labs(title = "New plot title") +
theme(plot.title = element_text(family = "Trebuchet MS", color="blue",
size=18,
margin = margin(10, 0, 10, 0)),
legend.position = "bottom",
legend.title = element_blank(),
#axis.text.x = element_text(angle = 45, hjust = 1)
axis.text.x = element_blank(),
axis.ticks.x = element_blank()
)
ggplotly(p) %>%
layout(title = "New plot title",
#xaxis = list(showticklabels = FALSE),
legend = list(orientation = "h",
y = 0, x = 0))