matplotlib.dates nombres de dates en abscisse fixe
Bonjour,
j'aimerais avoir un nombre de date fixe sur mon abscisse, malheureusement je ne trouve pas la solution ...
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| major_formatter = matplotlib.dates.DateFormatter('%d/%m/%y')
major_locator = matplotlib.dates.AutoDateLocator(minticks=10, maxticks=10)
fig, ax = matplotlib.pyplot.subplots()
matplotlib.pyplot.plot_date(x_l, y_l, linestyle='solid', linewidth=0.25, markersize=0.5)
ax.xaxis.set_major_locator(major_locator)
ax.xaxis.set_major_formatter(major_formatter)
ax.xaxis.set_tick_params(rotation=30, labelsize=10)
image_bytes = io.BytesIO()
matplotlib.pyplot.savefig(image_bytes, format="png", dpi=400)
matplotlib.pyplot.close(fig)
image_bytes.seek(0)
await ctx.send(file=discord.File(image_bytes, "result.png")) |
où x_l est une liste de datetime.date et y_l une liste d'entier, j'obtient ça :
https://cdn.discordapp.com/attachmen...539/result.png
Je n'arrive pas à avoir un nombre fixe de dates régulièrement espacées.
Merci