Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/355.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python matplotlib如何使用对数间隔的Y点和水平网格线绘制半对数图_Python_Logging_Matplotlib_Plot_Python 2.5 - Fatal编程技术网

Python matplotlib如何使用对数间隔的Y点和水平网格线绘制半对数图

Python matplotlib如何使用对数间隔的Y点和水平网格线绘制半对数图,python,logging,matplotlib,plot,python-2.5,Python,Logging,Matplotlib,Plot,Python 2.5,我想绘制一些20000到50000范围内的y数据 我希望y轴以5000的步长从10000到60000。 我希望y轴是一个对数图 我试过ax1.set_yscale'log'。这给出了一个对数图,但没有水平网格线和y记号 如何在两个方向上获得网格线,y记号以对数间距上升10000、15000等 我正在试着得到一个像这样的雅克斯音阶 我在Python 2.5.2中使用以下代码: fig = pl.figure() rcParams['figure.figsize'] = 14, 10 # set g

我想绘制一些20000到50000范围内的y数据

我希望y轴以5000的步长从10000到60000。 我希望y轴是一个对数图

我试过ax1.set_yscale'log'。这给出了一个对数图,但没有水平网格线和y记号

如何在两个方向上获得网格线,y记号以对数间距上升10000、15000等

我正在试着得到一个像这样的雅克斯音阶

我在Python 2.5.2中使用以下代码:

fig = pl.figure()
rcParams['figure.figsize'] = 14, 10 # set graph size
ax1 = fig.add_subplot(1, 1, 1)
ax1.plot(do,line,'r-', do,ind,'g-')  
ax1.grid(True)
pl.xticks(do,rotation=45)
ax1.set_xlim( [date1, date2] )
ax1.set_yscale('log')
pl.show()

我可以计算logline和logind,并做一个线性图,但该图不会提供太多信息

您可能需要打开副栅格。但是也要注意,对于对数图来说,10到60的范围非常小,这就是为什么主网格没有出现的原因

import pylab as pl
fig = pl.figure()
# rcParams['figure.figsize'] = 14, 10 # set graph size
ax1 = fig.add_subplot(1, 1, 1)
#ax1.plot(line,'r-', ind,'g-')
ax1.grid(True)
# pl.xticks(do,rotation=45)
ax1.set_xlim([10, 20])
ax1.set_yscale('log')
ax1.set_ylim([10000, 60000])
ax1.grid(which='minor')
pl.show()

谢谢大家的关注。在阅读了您的建议和Beachcombers链接以及一些实验后,我提出了以下解决方案

import pylab as pl
fig = pl.figure()
rcParams['figure.figsize'] = 14, 10 # set graph size
ax1 = fig.add_subplot(1, 1, 1)
ax1.plot(do,line,'r-', do, ind,'g-')
ax1.grid(True)
pl.xticks(do,rotation=45)
ax1.set_xlim( [date1, date2] )
ax1.set_yscale('log')
ax1.grid(which='minor')
from matplotlib.ticker import FormatStrFormatter
ax1.yaxis.set_minor_formatter(FormatStrFormatter("%.0f"))
pl.show()

单击链接时,图像不可见。你能直接把它放在这里而不是链接上吗?看看hmmm中的例子。。。。。。。。。。。是的,链接不可点击!我不得不复制并粘贴它——对不起,我已经看过了图库,示例使用的数字是10的幂,例如10到10000。他们不使用较小范围的数字,如10到60,这是一个类似的图表;希望可以根据您的评论点击,这可能就是您想要的: