I am struggling to find a method that will bold my pie chart labels in plotly. Does anyone know how to bold the labels of a plotly pie chart? Here is my code:
t <- list(
family = "Ariel",
size = 15,
color = 'black')
fig <-plot_ly()
#####Fall/Winter Concentration
fig <-fig%>% add_pie(concWDper,
labels = concWDper$Compounds,
values = concWDper$Concentration,
type = 'pie',
sort = FALSE,
textinfo = '',
textfont = list(color = '#000000'),
marker = list(colors = c("#9E0142", "#D53E4F",
"#F46D43","#FDAE61", "#FEE08B", "#FFFFBF", "#E6F598",
"#ABDDA4", "#66C2A5", "#3288BD", "#5E4FA2")),
domain = list(x = c(0, 0.5), y = c(0.75, 1)))
#####Spring/Summer Concentration
fig <-fig%>% add_pie(concSPDper, labels = concSPDper$Compounds,
values = concSPDper$Concentration, type = 'pie',sort = FALSE,
textinfo = '', textfont = list(color = '#000000'),
marker = list(colors = c("#9E0142", "#D53E4F", "#F46D43",
"#FDAE61", "#FEE08B", "#FFFFBF", "#E6F598", "#ABDDA4", "#66C2A5", "#3288BD", "#5E4FA2")),
domain = list(x = c(0.5, 1), y = c(0.75, 1)))
fig <-fig %>%layout(font=t,showlegend = T,
grid=list(rows=3, columns=2),
xaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
yaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE))
fig
Here is some example data: https://docs.google.com/spreadsheets/d/1yarGI5ee5ST_uzeQI-Xa2lk681d24vbIurUl6Rj58YY/edit?usp=sharing
Bold labels could be achieved via the attribute
texttemplate
like so:texttemplate = '<b>%{label}</br></br>%{percent}</b>'
To adjust the margins make use of layout attribute
margin
, e.g.Using the example data from here:
EDIT Now with your data