I'm writing an R shiny app on a black background and need to change all plotly text to white. For some reason my code is not working:
output$plotly_bar<- renderPlotly({
plot_ly(FAID_mexico, x = ~Funding_Agency_Acronym,
y = ~FAID_mexico$Current_Amount,
textfont = list(color = '#FFFFFF'),
color = ~FAID_mexico$Policy_Area,
textfont = list(color = '#FFFFFF')) %>%
layout(plot_bgcolor='black')%>%
layout(paper_bgcolor='black')
})
texfont should be the function that changes all text color.
Add your color
to text
in layout
and it should work.
%>% layout(font = list(color = '#FFFFFF'))
library(plotly)
p <- plot_ly(data = iris,
x = ~Sepal.Length,
y = ~Petal.Length,
marker = list(size = 10,
color = 'rgba(255, 182, 193, .9)',
line = list(color = 'rgba(152, 0, 0, .8)',
width = 2))) %>%
layout(plot_bgcolor = 'black',
paper_bgcolor = 'black',
font = list(color = '#00FFFF'))
p
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