⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dashpointlabel.py

📁 非原创。很好的python例子
💻 PY
字号:
from matplotlib import pylabDATA = ((1, 3),        (2, 4),        (3, 1),        (4, 2))# dash_style =#     direction, length, (text)rotation, dashrotation, push# (The parameters are varied to show their effects,# not for visual appeal).dash_style = (    (0, 20, -15, 30, 10),    (1, 30, 0, 15, 10),    (0, 40, 15, 15, 10),    (1, 20, 30, 60, 10),    )def test_dashpointlabel(save=False):    pylab.clf()    (x,y) = zip(*DATA)    pylab.plot(x, y, marker='o')    for i in xrange(len(DATA)):        (x,y) = DATA[i]        (dd, dl, r, dr, dp) = dash_style[i]        pylab.text(x, y, str((x,y)), withdash=True,                   dashdirection=dd,                   dashlength=dl,                   rotation=r,                   dashrotation=dr,                   dashpush=dp,                   )    axis = pylab.gca()    axis.set_xlim((0.0, 5.0))    axis.set_ylim((0.0, 5.0))    if save:        pylab.savefig('dashpointlabel')    pylab.show()if __name__ == '__main__':    test_dashpointlabel()

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -