python - Matplotlib: Remove scientific notation in subplot -


i want create figure 4 subplots. each plot in row shares same y axis , plots in same column share same x axis. on each axis use scientific notation. while can remove numbers of ticks ticklabel_format, not remove exponent @ axis. ax1.xaxis.set_visible(false), 1e5 @ x-axis removed tick marks. how can remove 1ex @ subplots share axis 1 while keeping tick marks? example, how rid of 1e5 , 1e2 in subplot 2?

import numpy np import matplotlib.pyplot plt  fig = plt.figure()  ax3 = fig.add_subplot(223) ax1 = fig.add_subplot(221, sharex = ax3) ax4 = fig.add_subplot(224, sharey = ax3) ax2 = fig.add_subplot(222, sharex = ax4, sharey = ax1)  #first plot x = np.arange(0, 10**5, 100) y = x ax1.plot(x,y) ax1.set_title('subplot 1')  # third plot y = -x ax3.plot(x,y) ax3.set_title('subplot 3')  #second plot x = np.arange(0, 100) y = 10**3 * x + 100 ax2.plot(x,y) ax2.set_title('subplot 2')  #fourth plot y = -10**3 * x - 100 ax4.plot(x,y) ax4.set_title('subplot 4')  ax4.ticklabel_format(style = 'sci', axis='x', scilimits=(0,0)) ax3.ticklabel_format(style = 'sci', axis='x', scilimits=(0,0)) ax1.ticklabel_format(style = 'sci', axis='y', scilimits=(0,0)) ax3.ticklabel_format(style = 'sci', axis='y', scilimits=(0,0))  plt.setp(ax1.get_xticklabels(), visible=false) plt.setp(ax2.get_xticklabels(), visible=false) plt.setp(ax2.get_yticklabels(), visible=false) plt.setp(ax4.get_yticklabels(), visible=false)  plt.show() 

returns:

enter image description here

if add these lines each of axes (ax1 example):

ax1.xaxis.get_offset_text().set_visible(false) ax1.yaxis.get_offset_text().set_visible(false) 

this remove scientific notation text both axis.


Comments

Popular posts from this blog

php - Passing multiple values in a url using checkbox -

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -