Home > Enterprise >  Python Plot yyplot scientific notation not working
Python Plot yyplot scientific notation not working

Time:04-09

I have the code running properly, producing a plot but I don't see the scientific notation. Don't know why?

code:

fig,ax1 =  plt.subplots()
ax1.plot(x,y,'-',color=yclr)
ax1.ticklabel_format(style='sci', axis='y')
ax2 = ax1.twinx()
ax2.plot(x,yy,'-',color=yyclr)
ax2.ticklabel_format(style='sci', axis='y')
plt.show()  

Plot: enter image description here

CodePudding user response:

Passing scilimits=(0, 0) to ticklabel_format should trigger it.

fig,ax1 =  plt.subplots()
ax1.plot(x,y,'-',color=yclr)
ax1.ticklabel_format(style='sci', axis='y', scilimits=(0, 0))
ax2 = ax1.twinx()
ax2.plot(x,yy,'-',color=yyclr)
ax2.ticklabel_format(style='sci', axis='y', scilimits=(0, 0))
plt.show()
  • Related