python - Matplotlib : Consistent Y-Axis across 4 Separate Line Plots -
i have 4 dictionaries dictionaries of lists.
this being used plot volume per month of various entities multiple line plots.
each dictionary key has value list of 12 values each representing volume of corresponding month
have 4 dictionaries : d1, d2, d3 , d4.
sample value of dictionary element - [239, 138, 271, 175, 29, 0, 0, 0, 0, 2, 24, 62]
how ensure same y-axis value (sharey ?) across 4 ?
rcparams.update({'figure.autolayout': true}) plt.figure(figsize=(16,9), dpi=600) plt.margins(0.075) labels = [] plt.ylabel('volume') plt.xlabel('months') plt.title('monthwise volume per queue', {'family' : 'arial black', 'weight' : 'bold', 'size' : 22}) in d2: plt.plot([1,2,3,4,5,6,7,8,9,10,11,12], d2[i]) labels.append(i) months = ["", "january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"] plt.xticks(range(len(months)), months, rotation='vertical') plt.legend(labels, ncol=1, loc='upper left', bbox_to_anchor=[0.5, 1.1], columnspacing=1.0, labelspacing=0.0, handletextpad=0.0, handlelength=1.5, fancybox=true, shadow=true)
i think using yticks property in:
plt.yticks(sharey) #where sharey list of values
Comments
Post a Comment