Matplotlib - data disappears when I switch to a semi-log chart

I am trying to build a basic semi-log graph using pyplot and matplotlib, with the y axis being a logarithmic scale. I am using the following code:

pylab.figure(num=None,figsize=(8,6))  
pylab.plot(x_loc,var1,x_loc,var2)  
\#pylab.yscale('log')  
pylab.xlabel('$y/L_{1/2}$',fontsize=18)  
pylab.ylabel('$n/n_{max}$',fontsize=18)  
pylab.title('Particle Concentration vs. Position',fontsize=18)  
pylab.show() 

This gives me a thin line graph with the third line commented above, but when I uncomment this line and repeat, the data disappears from the graph. The chart window has the correct limits, but there is no more data.

Has anyone encountered this problem before?

Thank!
Peter

+3
source share
3 answers

set_yscale ('log'), yscale, . , . : http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.set%5Fyscale

. :

from matplotlib import use
use('TkAgg')
import pylab

( pylab use)

+1

, . , , , . matplotlib , symlog, linthreshy, , :

 pylab.yscale('symlog',linthreshy=1)

symlog log . .

+1

This seems to be a bug in the EPDLab package that I am using (from Enthought). If I run this command from IPython or terminal (python 'filename'), the graph is displayed correctly.

0
source

Source: https://habr.com/ru/post/1771575/


All Articles