This is an old question but maybe it might be useful for someone with the same problem than Rafael and me. I had this problem and I asked to the Plotly Community about how I can change the date language and the answers has been really helpful.
Note that I edited your question to insert your code in a code block to ease the reading of it.
First of all try to check what is your current locale settings with the locale module of Python:
import locale
locale.getlocale()
If you get something different than the one you want to use, you can set the one you want for dates and time with locale.setlocale(). For example:
locale.setlocale(locale.LC_TIME, 'es_ES')
You can test this new locale works fine testing it with the datetime module as follows:
import datetime
today = datetime.datetime.now()
datetime.datetime(2020, 2, 14, 10, 33, 56, 487228)
today.strftime('%A %d de %B, %Y')
'viernes 14 de febrero, 2020'
Then you can try to reformat your data using datetime and strftime. In your case it might be something similar to:
dates = [datetime.datetime(2015, 1, 1).strftime('%A %d de %B, %Y'),
datetime.datetime(2015, 1, 2).strftime('%A %d de %B, %Y')]
This works for me on iPython:
In [1]: import locale
In [2]: locale.setlocale(locale.LC_TIME, "es_ES.utf8")
Out[2]: 'es_ES.utf8'
In [3]: import datetime
In [4]: dates = [datetime.datetime(2015, 1, 1).strftime('%A %d de %B, %Y'),
...: datetime.datetime(2015, 1, 2).strftime('%A %d de %B, %Y')]
In [5]: dates
Out[5]: ['jueves 01 de enero, 2015', 'viernes 02 de enero, 2015']
Then if you want to use it in x axis, you can call dates inside x:
trace1 = Scatter(
x=dates,
y=['14.7414', '14.7414'],
...
)
It works for me! And I hope it works for you too.
If you need a different format for the date I recommend you to read the documentation about date-time microformats of D3. I also recommend you to read the thread How to change date language? I opened on Plotly Community Forum, because the answers are very useful and are the ones which helped me to solve my issue and to answer this question. You can also check this notebook shared in the thread, in which one of the users who answer me show how to solve the issue if you are using a pandas dataframe.
Excuse me for a lot of this stuff I am linking, but it might be very useful too to read about the methods to update axis in Plotly documentation, because you can update the format of the axis you want with as follows:
fig.update_xaxes(tickformat='%d-%b-%Y')
I want to credit to empet and eliasdabbas, users of the Plotly Community, for their answers!