【发布时间】:2015-09-07 04:33:58
【问题描述】:
我正在尝试在等边三角形的两侧绘制看起来像刻度线的尖齿。我在 Python 中使用 Matplotlib 进行此操作。
这是等边三角形***:
import matplotlib.pyplot as plt
from pylab import *
fig = figure()
ax = fig.add_subplot(111)
ax.axis('equal')
ax.plot([1, 0.5], [0, 0.866], 'k-')
ax.plot([0, 0.5], [0, 0.866], 'k-')
ax.plot([0, 1], [0, 0], 'k-')
ax.plot([0.5, 1.01, 0.1], [-0.01, 0.5, 0.88], 'w.') #base boundary
plt.show()
生成的图像显示在这里。。
现在,我想添加看起来像刻度线的线条。线条会像看到的here from 1:07-1:29 and from 2:19-2:32 一样绘制。
我希望输出看起来像这张图片。
有没有办法用 Matplotlib 绘制这些线?
编辑:***三角码根据here
【问题讨论】:
-
你有什么理由不把它们像画三角形那样简单地画成线?
-
是的,我可以这样做。但是,我不确定如何将线条放在适当的间距。这就是我遇到的问题,这就是为什么我不能将刻度添加为线条。
标签: python python-2.7 matplotlib