我正在使用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')
图表外观:
答案 0 :(得分:1)
看起来与此问题Left-align chart title in plotly类似, 只需在此处稍微修改answer,也应该适用于此。
SELECT DISTINCT ON (question_id) * FROM "attempts" WHERE "attempts"."user_id" = 1 ORDER BY "attempts"."question_id" ASC, "attempts"."created_at" DESC
来源: