Setting Yaxis in Matplotlib using Pandas -


using pandas plot in i-python notebook, have several plots , because matplotlib decides y axis setting them differently , need compare data using same range. have tried several variants on: (i assume i'll need apply limits each plot.. since can't 1 working... matplotlib doc seems need set ylim, can't figure syntax so.

df2250.plot(); plt.ylim((100000,500000)) <<<< if insert ; int not callable ,  if leave out invalid syntax. anyhow, neither right... df2260.plot() df5.plot() 

pandas plot() returns axes, can use set ylim on it.

ax1 = df2250.plot() ax2 = df2260.plot() ax3 = df5.plot()  ax1.set_ylim(100000,500000) ax2.set_ylim(100000,500000) etc... 

you can pass axes pandas plot, plotting in same axes can done like:

ax1 = df2250.plot() df2260.plot(ax=ax1) etc... 

if want lot of different plots, defining axes on forehand , within 1 figure might solution gives control:

fig, axs = plt.subplots(1,3,figsize=(10,4), subplot_kw={'ylim': (100000,500000)})  df2260.plot(ax=axs[0]) df2260.plot(ax=axs[1]) etc... 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -