更改标题在R中的位置

时间:2019-06-08 17:00:56

标签: r plotly

我为正在使用的数据集创建了世界地图,但是该图的标题位于图表上方,并且两者之间有很大的空间。

plotted chart


map_World <- list(
  scope = 'world',
  lakecolor = toRGB('white'))

Map4 <- plot_geo(regions) %>%
  add_trace(
    z = ~column1.x, locations = ~`ISO`,
    color = ~column1.x, colors = c("red", "blue", "green")
  ) %>%
  colorbar(title = "Legend",x = 1, y = 0.8) %>%
  layout(title = "Sub indices for the different dimensions",
         geo = map_World)

我希望标题位于图表的正上方,但它不起作用。

1 个答案:

答案 0 :(得分:0)

我相信您可以调整图表标题属性:

https://github.com/plotly/plotly.js/pull/3276

尝试为您的布局添加以下内容:

layout(title = list(text = "Sub indices for the different dimensions", y = 0.8),
         geo = map_World)