我正在使用R来处理Plotly,并且在将标题居中放置在饼图上时遇到了问题。标题看起来有点偏右。有没有办法做到这一点,并将其向左移动或更靠近饼图的中间?
代码如下:
label_names = c('Feeds','All Others')
numbers = c(first_reported, not_first_reported)
pie_colors <- c('rgba(173,216,230,1)', 'rgba(0,0,139,1)')
plot_ly(labels=label_names, values=numbers, type='pie',
insidetextfont = list(color = '#FFFFFF'),
marker = list(colors=pie_colors)) %>%
layout(title = 'Portion of Feeds')
图表的外观:
发布于 2019-03-22 12:18:31
看起来与这个问题类似,Left-align chart title in plotly,只需稍微修改一下这里的answer,也应该可以解决这个问题。
plot_ly(labels=label_names, values=numbers, type='pie',
insidetextfont = list(color = '#FFFFFF'),
marker = list(colors=pie_colors)) %>%
add_annotations(
y=1.05,
x=0.5,
text="Portion of Feeds",
showarrow=F,
font=list(size=15)
)
来源:
https://stackoverflow.com/questions/55169336
复制相似问题