Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 212032

Add text shadow/outline to text labels in R plotly

$
0
0

I'd like to see if I can add a black outline to white text in a plotly chart in R.

I found the following link describing how it could be done in plotly.js but not sure it can be done in R as of yet. https://github.com/plotly/plotly.js/issues/1597

Here's a sample chart.

library(plotly)

plot_ly(x = c('Product A', 'Product B', 'Product C'), 
        y = c(20, 14, 23), 
        type = 'bar', 
        marker = list(color = 'rgb(158,202,225)',
                           line = list(color = 'rgb(8,48,107)', width = 1.5))) %>%
  add_annotations(text = c(20, 14, 23),
                  x = c('Product A', 'Product B', 'Product C'),
                  y = c(20, 14, 23)/2,
                  xref = "x",
                  yref = "y",
                  font = list(family = 'Arial',
                              size = 14,
                              color = 'rgb(245, 246, 249)'),
                  showarrow = FALSE)

Sample Plot


Viewing all articles
Browse latest Browse all 212032

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>