python - Setting the y-axis range makes the ytics labels to change by being multiplied by a factor -


in below script, if run without setting y axis range, final plot following:

enter image description here

if set y-axis range via:

plt.ylim(-941.510, -941.505) 

or via:

axes = plt.gca() axes.set_ylim([-941.510, -941.505]) 

i following:

enter image description here

the tics on y-axis not longer appear -941.495, -941.500, etc in scale, multiplied number given in left corner (-9.415e2).

how achieved similar y-axis configuration 1st plot, there no multiplication factor?

code:

import numpy np scipy.optimize import curve_fit import matplotlib.pyplot plt matplotlib.font_manager import fontproperties  # intial candidates fit: e0_init = -941.510817926696 v0_init = 63.54960592453 b0_init = 76.3746233515232 b0_prime_init = 4.05340727164527  def bm(x, e0, v0, b0, b0_prime):          return  e0+ (2.293710449e+17)*(1e-21)*( (9.0/16.0)*(v0*b0) * (  (((v0/x)**(2.0/3.0)-1.0)**3.0)*b0_prime  + ((v0/x)**(2.0/3.0)-1)**2  *  (6.0-4.0*(v0/x)**(2.0/3.0))  ))  # variable: fu_vat = 18.0  # data: v_vate_w, e_vate_w = np.loadtxt('./compilation_eos.out', skiprows = 1).t e_vate_w = e_vate_w/fu_vat v_vate_w = v_vate_w/fu_vat   init_vals = [e0_init, v0_init, b0_init, b0_prime_init] popt_vate_w, pcov_vate_w = curve_fit(bm, v_vate_w, e_vate_w, p0=init_vals)   # plotting fitting curves: #          scattered points:  p7 = plt.scatter(v_vate_w, e_vate_w, color='green', marker="^", facecolors='none', label='', s=100) p8, = plt.plot(v_vate_w, bm(v_vate_w, *popt_vate_w), 'k--', label='')  fontp = fontproperties() fontp.set_size('small')  plt.legend((p7, p8 ),("data", "fit"  ), prop=fontp)  #axes = plt.gca() plt.xlabel('x') plt.ylabel('y') #axes.set_ylim([-941.510, -941.505]) #plt.ylim(-941.510, -941.505) plt.show() 


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -