I am working with Plotly using R and am having trouble centering the title over the pie chart. The title looks like it is a little off to the right. Is there a way to do this and move it left or closer to the middle of the pie chart?
This is the code:
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')
What the chart looks like:

Looks similar to this question, Left-align chart title in plotly, just slightly modifying the answer here, should work for this too.
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)
)
source:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With