本文整理匯總了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]