简体   繁体   中英

Change title position in plotly R

I created the world map for the dataset I am working with however, the title of the plot is way above the chart and there is a huge space in between.

绘制图表


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)

I expect the title to be right above the chart but it is not working.

I believe you can adjust the chart title attributes:

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

Try for your layout something like:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM