17

私はこれまで、Pythonとmatplotlibでプロットを作成していますが、これは巨大で柔軟性があります。

方法がわからなかったのは、プロットに複数のグリッドを作成することだけです。ドキュメントを調べましたが、それは線のスタイルのためだけです...

それぞれが異なるグリッドを持つ2つのプロットのように、それらが重なるように考えています。

したがって、たとえば、このグラフを作成したいと思います。

代替テキストhttp://img137.imageshack.us/img137/2017/waittimeprobability.png

これと同様のグリッドマークがあります。

代替テキストhttp://img137.imageshack.us/img137/6122/saucelabssauceloadday.png

つまり、重要なポイント間の色が薄い、より頻繁なグリッドです。

4

1 に答える 1

32

このようなものはどうですか(ここから適応):

from pylab import *
from matplotlib.ticker import MultipleLocator, FormatStrFormatter

t = arange(0.0, 100.0, 0.1)
s = sin(0.1*pi*t)*exp(-t*0.01)

ax = subplot(111)
plot(t,s)

ax.xaxis.set_major_locator(MultipleLocator(20))
ax.xaxis.set_major_formatter(FormatStrFormatter('%d'))
ax.xaxis.set_minor_locator(MultipleLocator(5))

ax.yaxis.set_major_locator(MultipleLocator(0.5))
ax.yaxis.set_minor_locator(MultipleLocator(0.1))

ax.xaxis.grid(True,'minor')
ax.yaxis.grid(True,'minor')
ax.xaxis.grid(True,'major',linewidth=2)
ax.yaxis.grid(True,'major',linewidth=2)

show()

ここに画像の説明を入力

于 2009-11-13T16:44:44.110 に答える