Black Lives Matter. Please consider donating to Black Girls Code today.

Pie Chart Margins seems hard-coded in plotly 4.6 (CRAN version)


I am using plotly R library to create pie charts and in the latest CRAN version 4.6 it seems there is some default hardcoded margins, padding added to it. I am not able to override the margins, padding through layout configuration also :slight_smile:

Example :
USPersonalExpenditure <- data.frame(“Categorie”=rownames(USPersonalExpenditure), USPersonalExpenditure)
data <- USPersonalExpenditure[,c(‘Categorie’, ‘X1960’)]
plot_ly(data, labels = ~Categorie, values = ~X1960, type = ‘pie’) %>%
layout(title = ‘United States Personal Expenditures by Categories in 1960’)

The above code is making pie chart without any padding or margins in plotly 4.5.6 but in 4.6 there is a default margin, padding added to it.

I tried to remove the margins but it doesn’t seem to have any effect :slight_smile:

plot_ly(data, labels = ~Categorie, values = ~X1960, type = ‘pie’) %>%
layout(title = ‘Tes Graph’, margin = list(t = 0, b = 0, l = 0, r = 0, pad = 0))

Can you please help me if I am missing something? Its spoiling the formating of my report which was perfect with version 4.5.6