本文整理汇总了Python中matplotlib.markers方法的典型用法代码示例。如果您正苦于以下问题:Python matplotlib.markers方法的具体用法?Python matplotlib.markers怎么用?Python matplotlib.markers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib
的用法示例。
在下文中一共展示了matplotlib.markers方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import markers [as 别名]
def __init__(self, lines):
import gtk.glade
datadir = matplotlib.get_data_path()
gladefile = os.path.join(datadir, 'lineprops.glade')
if not os.path.exists(gladefile):
raise IOError('Could not find gladefile lineprops.glade in %s'%datadir)
self._inited = False
self._updateson = True # suppress updates when setting widgets manually
self.wtree = gtk.glade.XML(gladefile, 'dialog_lineprops')
self.wtree.signal_autoconnect(dict([(s, getattr(self, s)) for s in self.signals]))
self.dlg = self.wtree.get_widget('dialog_lineprops')
self.lines = lines
cbox = self.wtree.get_widget('combobox_lineprops')
cbox.set_active(0)
self.cbox_lineprops = cbox
cbox = self.wtree.get_widget('combobox_linestyles')
for ls in self.linestyles:
cbox.append_text(ls)
cbox.set_active(0)
self.cbox_linestyles = cbox
cbox = self.wtree.get_widget('combobox_markers')
for m in self.markers:
cbox.append_text(m)
cbox.set_active(0)
self.cbox_markers = cbox
self._lastcnt = 0
self._inited = True
示例2: get_active_marker
# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import markers [as 别名]
def get_active_marker(self):
'get the active lineinestyle'
ind = self.cbox_markers.get_active()
m = self.markers[ind]
return m
示例3: test_alpha
# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import markers [as 别名]
def test_alpha():
np.random.seed(0)
data = np.random.random(50)
fig = plt.figure()
ax = fig.add_subplot(111)
# alpha=.5 markers, solid line
ax.plot(data, '-D', color=[1, 0, 0], mfc=[1, 0, 0, .5],
markersize=20, lw=10)
# everything solid by kwarg
ax.plot(data + 2, '-D', color=[1, 0, 0, .5], mfc=[1, 0, 0, .5],
markersize=20, lw=10,
alpha=1)
# everything alpha=.5 by kwarg
ax.plot(data + 4, '-D', color=[1, 0, 0], mfc=[1, 0, 0],
markersize=20, lw=10,
alpha=.5)
# everything alpha=.5 by colors
ax.plot(data + 6, '-D', color=[1, 0, 0, .5], mfc=[1, 0, 0, .5],
markersize=20, lw=10)
# alpha=.5 line, solid markers
ax.plot(data + 8, '-D', color=[1, 0, 0, .5], mfc=[1, 0, 0],
markersize=20, lw=10)
示例4: test_marker_styles
# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import markers [as 别名]
def test_marker_styles():
fig = plt.figure()
ax = fig.add_subplot(111)
for y, marker in enumerate(sorted(matplotlib.markers.MarkerStyle.markers,
key=lambda x: str(type(x))+str(x))):
ax.plot((y % 2)*5 + np.arange(10)*10, np.ones(10)*10*y, linestyle='',
marker=marker, markersize=10+y/5, label=marker)
示例5: test_markers_fillstyle_rcparams
# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import markers [as 别名]
def test_markers_fillstyle_rcparams():
fig, ax = plt.subplots()
x = np.arange(7)
for idx, (style, marker) in enumerate(
[('top', 's'), ('bottom', 'o'), ('none', '^')]):
matplotlib.rcParams['markers.fillstyle'] = style
ax.plot(x+idx, marker=marker)
示例6: random_marker
# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import markers [as 别名]
def random_marker():
markers = mks.MarkerStyle.markers
num = len(markers.keys())
idx = random.randint(0, num - 1)
return markers.keys()[idx]