我想绘制一个dataframe,其中由基于伊朗日历index的值组成。datetime
我想将x-axis标签设置如下:
import matplotlib.dates as mdates\n\naxes.scatter(df_day.index.values, df_day.loc[:, item], marker=\'.\')\naxes.xaxis.set_major_formatter(dates.DateFormatter(\'%d-%b %H:%M\'))\nRun Code Online (Sandbox Code Playgroud)\n考虑到我想用波斯语打印月份的名称,而不是Georgian日历的默认值,例如 Jun或Aug。
我使用jdatetime来转换datetime波斯日历,但该plot函数不将其值作为x-axis索引。然后我使用jalaali创建了一个datetime基于波斯日历的情节,该日历接受它。
现在的问题是如何将x-axis标签打印为波斯月份名称?因为我想要这种格式:
dates.DateFormatter(\'%d-%b %H:%M\')\nRun Code Online (Sandbox Code Playgroud)\n有什么办法可以做到这一点吗?
\n更新
\n我使用区域设置来访问 POSIX 区域设置数据库和功能,如下所示:
\nimport locale \n\nlocale.setlocale(locale.LC_ALL, \'fa_IR\')\nRun Code Online (Sandbox Code Playgroud)\n但它只是改变了字母表中Georgian月份的名称,而不是显示诸如或 之类的名称。EnglishPersianjalali\xd9\x81\xd8\xb1\xd9\x88\xd8\xb1\xd8\xaf\xdb\x8c\xd9\x86\xd8\xa7\xd8\xb1\xd8\xaf\xdb\x8c\xd8\xa8\xd9\x87\xd8\xb4\xd8\xaa
任何线索表示赞赏。
\n