I dati che sto visualizzando ha senso solo se si tratta di numeri interi.come forzare matplotlib per visualizzare solo numeri interi sull'asse Y
I.e. 0,2 di un record non ha senso in termini del contesto delle informazioni che sto analizzando.
Come si impone a Matplotlib di utilizzare solo numeri interi sull'asse Y. Cioè 1, 100, 5 ecc.? non 0,1, 0,2 ecc.
for a in account_list:
f = plt.figure()
f.set_figheight(20)
f.set_figwidth(20)
f.sharex = True
f.sharey=True
left = 0.125 # the left side of the subplots of the figure
right = 0.9 # the right side of the subplots of the figure
bottom = 0.1 # the bottom of the subplots of the figure
top = 0.9 # the top of the subplots of the figure
wspace = 0.2 # the amount of width reserved for blank space between subplots
hspace = .8 # the amount of height reserved for white space between subplots
subplots_adjust(left=left, right=right, bottom=bottom, top=top, wspace=wspace, hspace=hspace)
count = 1
for h in headings:
sorted_data[sorted_data.account == a].ix[0:,['month_date',h]].plot(ax=f.add_subplot(7,3,count),legend=True,subplots=True,x='month_date',y=h)
#set bottom Y axis limit to 0 and change number format to 1 dec place.
axis_data = f.gca()
axis_data.set_ylim(bottom=0.)
from matplotlib.ticker import FormatStrFormatter
axis_data.yaxis.set_major_formatter(FormatStrFormatter('%.0f'))
#This was meant to set Y axis to integer???
y_formatter = matplotlib.ticker.ScalarFormatter(useOffset=False)
axis_data.yaxis.set_major_formatter(y_formatter)
import matplotlib.patches as mpatches
legend_name = mpatches.Patch(color='none', label=h)
plt.xlabel("")
ppl.legend(handles=[legend_name],bbox_to_anchor=(0.,1.2,1.0,.10), loc="center",ncol=2, mode="expand", borderaxespad=0.)
count = count + 1
savefig(a + '.png', bbox_inches='tight')
Non sono sicuro del motivo per cui si sta svendendo. È una domanda buona e chiara con una risposta non molto ovvia (oltre l'impostazione manuale dei ticks, che è inflessibile). –