In R plotly, if I plot a basic time series:
library(plotly)
today <- Sys.Date()
tm <- seq(0, 600, by = 10)
x <- today - tm
y <- rnorm(length(x))
plot_ly(x = ~x, y = ~y, mode = 'lines', text = paste(tm, "days from today"))
I get a plot where in the x-axis the date is in format "month/year". So I currently get "oct 2017", Jan 2018", "Apr 2018", and so on. The problem is, if I run
format(today,'%d %B %Y')
I get "28 mars 2019" because my locales are french. How to tell plotly to use the current locale to display axis ? I would like to get, as tick labels, "Avr 2018" instead of "Apr 2018" for instance.
You can change the locale for plotly with config
plot_ly(x = ~x, y = ~y, mode = 'lines', text = paste(tm, "days from today")) %>% config(locale = 'fr')