相关疑难解决方法(0)

在matplotlib中,如何绘制从轴向外指向的R样式轴刻度?

由于它们是在绘图区域内绘制的,因此许多matplotlib图中的数据会使轴刻度变得模糊.更好的方法是绘制从轴向延伸的刻度线,如ggplotR的绘图系统中的默认值.

从理论上讲,这可以通过重新绘制与所述刻度线来完成TICKDOWNTICKLEFT线样式的x轴和y轴分别蜱:

import matplotlib.pyplot as plt
import matplotlib.ticker as mplticker
import matplotlib.lines as mpllines

# Create everything, plot some data stored in `x` and `y`
fig = plt.figure()
ax = fig.gca()
plt.plot(x, y)

# Set position and labels of major and minor ticks on the y-axis
# Ignore the details: the point is that there are both major and minor ticks
ax.yaxis.set_major_locator(mplticker.MultipleLocator(1.0))
ax.yaxis.set_minor_locator(mplticker.MultipleLocator(0.5))

ax.xaxis.set_major_locator(mplticker.MultipleLocator(1.0))
ax.xaxis.set_minor_locator(mplticker.MultipleLocator(0.5))

# Try to set the tick markers …
Run Code Online (Sandbox Code Playgroud)

python plot matplotlib

20
推荐指数
1
解决办法
6873
查看次数

matplotlib中的R样式数据轴缓冲区

R曲线自动设置x和y限制,以在数据和轴之间放置一些空间.我想知道matplotlib是否有办法自动完成相同的操作.如果没有,是否有一个良好的公式或"经验法则"R如何设置其轴限制?

python plot r matplotlib

7
推荐指数
2
解决办法
752
查看次数

在matplotlibrc中设置spines

出于一个奇怪的原因,我找不到在Python的matplotlibrc文件中指定spines配置的方法.有关如何使matplotlib默认不绘制上右刺的任何想法? 刺http://matplotlib.sourceforge.net/_images/whats_new_99_spines.png

有关matplotlib中刺的信息的更多信息,请点击此处

谢谢

python matplotlib

6
推荐指数
2
解决办法
3478
查看次数

标签 统计

matplotlib ×3

python ×3

plot ×2

r ×1