Skip to content Skip to sidebar Skip to footer

Is There A Way To Show Persian Date In X-axis Of Matplotlib Plot

I want to plot a dataframe in which the index consists of datetime values based on Iranian calendar. I want to set the x-axis labels as following: import matplotlib.dates as mdates

Solution 1:

you can use plotly instead of matplotlib here is a simple example :

import datetime
import plotly.express as px

base = datetime.datetime.today()
date_list = [base + datetime.timedelta(days=x) for x inrange(200)]
nums = list(range(200))

fig = px.line(x=date_list, y=nums)
fig.update_xaxes(calendar='jalali')
fig.show()

output is like this figure: enter image description here

Post a Comment for "Is There A Way To Show Persian Date In X-axis Of Matplotlib Plot"