forked from tdamdouni/Pythonista
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstep-graph.py
More file actions
21 lines (15 loc) · 702 Bytes
/
step-graph.py
File metadata and controls
21 lines (15 loc) · 702 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# coding: utf-8
# https://forum.omz-software.com/topic/2964/matplotlib-step-graphic-xaxis-generates-one-month-too-much
# https://www.dropbox.com/s/fj6l70kzbtwknt6/Fichier%2024-03-16%2013%2053%2018.jpeg?dl=0
import matplotlib.pyplot as plt
ax.step(x,y,'-',where='pre',label=yyyy_prec+' ['+str(ymax)+']',color=colors[color_index-1])
plt.legend(loc=9,fontsize=10)
months = mdates.MonthLocator(range(1,13), bymonthday=1, interval=1) # every month
ax.xaxis.set_major_locator(months)
monthsfmt = mdates.DateFormatter('%b')
ax.xaxis.set_major_formatter(monthsfmt)
ax.yaxis.tick_left()
ax.yaxis.tick_right()
ax.grid(True)
# Resolved
# ax.set_xticklabels((...)) and set last tick label as an empty string