首先,这个问题与Matplotlib semi-log plot: minor tick marks are gone when range is large直接相关。
我试图在y轴上得到相同的结果,范围为1E-15到1E-4。
我还没有足够的声誉来评论引用的问题 - 抱歉加倍!
Testsetup:我使用Jupyter 4.3.0和matplotlib 2.0.2以及numpy 1.13.1
以下代码(来自引用的问题)在我的Jupyter安装上的 x轴上没有显示小刻度。我需要y轴,但应该是相同的程序。
感谢任何投入让我朝着正确的方向前进。
import matplotlib.pyplot as plt
import matplotlib.ticker
import numpy as np
#Used this to reset any changes to the rc params
#plt.rcParams.update(plt.rcParamsDefault)
x = np.arange(10) # np.arange(9) is working as expected - well documented issue with >10 range for ticker.LocLocator
y = 10.0**x
fig, ax=plt.subplots()
ax.plot(y,x)
ax.set_xscale("log")
locmaj = matplotlib.ticker.LogLocator(base=10.0, subs=(0.1,1.0, ))
ax.xaxis.set_major_locator(locmaj)
locmin = matplotlib.ticker.LogLocator(base=10.0, subs=(0.1,0.2,0.4,0.6,0.8,1,2,4,6,8,10 ))
ax.xaxis.set_minor_locator(locmin)
ax.xaxis.set_minor_formatter(matplotlib.ticker.NullFormatter())
plt.show()
结果剧情 -
答案 0 :(得分:1)
需要更改的参数ind Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button1.Click
Microsoft.Win32.Registry.SetValue("HKEY_CURRENT_USER\Software\TextRetriever", "SavedText", TextBox1.Text, Microsoft.Win32.RegistryValueKind.String)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button2.Click
MessageBox.Show(Microsoft.Win32.Registry.GetValue("HKEY_CURRENT_USER\Software\TextRetriever", "SavedText", ""))
End Sub
,它限制了将要发出的滴答数。
numticks
一旦定位器决定开始跳过几十年,如果import matplotlib.pyplot as plt
import matplotlib.ticker
import numpy as np
#Used this to reset any changes to the rc params
#plt.rcParams.update(plt.rcParamsDefault)
x = np.arange(10)
y = 10.0**x
fig, ax=plt.subplots()
ax.plot(y,x)
ax.set_xscale("log")
locmaj = matplotlib.ticker.LogLocator(base=10.0, subs=(1.0, ), numticks=100)
ax.xaxis.set_major_locator(locmaj)
locmin = matplotlib.ticker.LogLocator(base=10.0, subs=np.arange(2, 10) * .1,
numticks=100)
ax.xaxis.set_minor_locator(locmin)
ax.xaxis.set_minor_formatter(matplotlib.ticker.NullFormatter())
plt.show()
不是subs
,则所有滴答都会被抑制,以防止一些非常混乱的刻度标签。
同样不是时间刻度线位于(1,)
,因此仅将[s * base ** i for s in subs for i in range(min_decade, max_decade, decade_stride]
中base
的倍数相加的值只重新勾选相同的点。