更改情节 R 中的标题位置

tro*_*th 3 r plotly

我为我正在使用的数据集创建了世界地图,然而,图的标题在图表上方,中间有很大的空间。

绘制的图表


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)
Run Code Online (Sandbox Code Playgroud)

我希望标题正好在图表上方,但它不起作用。

Ben*_*Ben 8

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

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

尝试您的布局,例如:

layout(title = list(text = "Sub indices for the different dimensions", y = 0.8),
         geo = map_World)
Run Code Online (Sandbox Code Playgroud)