本文整理汇总了Python中matplotlib.axes.subplot_class_factory函数的典型用法代码示例。如果您正苦于以下问题:Python subplot_class_factory函数的具体用法?Python subplot_class_factory怎么用?Python subplot_class_factory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了subplot_class_factory函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: draw
maxes.Axes.__init__(self, *kl, **kw)
def draw(self, renderer):
usetex = plt.rcParams["text.usetex"]
preview = plt.rcParams["text.latex.preview"]
plt.rcParams["text.usetex"] = self.usetex
plt.rcParams["text.latex.preview"] = self.preview
maxes.Axes.draw(self, renderer)
plt.rcParams["text.usetex"] = usetex
plt.rcParams["text.latex.preview"] = preview
subplot = maxes.subplot_class_factory(Axes)
def test_window_extent(ax, usetex, preview):
va = "baseline"
ax.xaxis.set_visible(False)
ax.yaxis.set_visible(False)
text_kw = dict(va=va,
size=50,
bbox=dict(pad=0., ec="k", fc="none"))
test_strings = ["lg", r"$\frac{1}{2}\pi$",
r"$p^{3^A}$", r"$p_{3_2}$"]
开发者ID:DanHickstein,项目名称:matplotlib,代码行数:29,代码来源:usetex_baseline_test.py
示例2: _get_base_axes
def _get_base_axes(self):
return axes_class
return type("%sHostAxes" % axes_class.__name__,
(HostAxesBase, axes_class),
{'_get_base_axes': _get_base_axes})
def host_subplot_class_factory(axes_class):
host_axes_class = host_axes_class_factory(axes_class=axes_class)
subplot_host_class = subplot_class_factory(host_axes_class)
return subplot_host_class
HostAxes = host_axes_class_factory(axes_class=Axes)
SubplotHost = subplot_class_factory(HostAxes)
def host_axes(*args, axes_class=None, figure=None, **kwargs):
"""
Create axes that can act as a hosts to parasitic axes.
Parameters
----------
figure : `matplotlib.figure.Figure`
Figure to which the axes will be added. Defaults to the current figure
`pyplot.gcf()`.
*args, **kwargs
Will be passed on to the underlying ``Axes`` object creation.
"""
开发者ID:mattip,项目名称:matplotlib,代码行数:31,代码来源:parasite_axes.py
示例3: host_subplot_class_factory
def host_subplot_class_factory(axes_class):
host_axes_class = host_axes_class_factory(axes_class=axes_class)
subplot_host_class = subplot_class_factory(host_axes_class)
return subplot_host_class
开发者ID:mattip,项目名称:matplotlib,代码行数:4,代码来源:parasite_axes.py
示例4: set
self.name2plot = {}
self.highlighted = set()
self.divs = []
self.figure.clf()
def picked(self, e):
try:
if e.mouseevent.button==1:
print e.artist.get_text()
sys.stdout.flush()
except:
pass
def getplot(self, x):
p = None
try:
i = self.root.index(x)
return self.plot[i]
except ValueError:
return self.name2plot.get(x)
class UpdatingRect(Rectangle): # Used in overview plot
def __call__(self, p):
self.set_bounds(*p.viewLim.bounds)
p.draw_labels()
p.figure.canvas.draw_idle()
TreePlot = subplot_class_factory(Tree)
RadialTreePlot = subplot_class_factory(RadialTree)
OverviewTreePlot = subplot_class_factory(OverviewTree)
开发者ID:ChriZiegler,项目名称:ivy,代码行数:30,代码来源:treevis.py
示例5: new_floating_axis
nth_coord=None,
axis_direction=None,
offset=offset,
axes=self,
)
return axis
def new_floating_axis(self, nth_coord, value, axis_direction="bottom"):
gh = self.get_grid_helper()
axis = gh.new_floating_axis(nth_coord, value,
axis_direction=axis_direction,
axes=self)
return axis
Subplot = maxes.subplot_class_factory(Axes)
class AxesZero(Axes):
def _init_axis_artists(self):
super()._init_axis_artists()
new_floating_axis = self._grid_helper.new_floating_axis
xaxis_zero = new_floating_axis(nth_coord=0,
value=0.,
axis_direction="bottom",
axes=self)
xaxis_zero.line.set_clip_path(self.patch)
xaxis_zero.set_visible(False)
开发者ID:phobson,项目名称:matplotlib,代码行数:31,代码来源:axislines.py
示例6: headeradd
headeradd("CRVAL1 = %10.5f / Galactic longitude of reference pixel" \
% (lon_center,))
cards = pyfits.CardList()
for l in header_list:
card = pyfits.Card()
card.fromstring(l.strip())
cards.append(card)
h = pyfits.Header(cards)
return h
FloatingAxes = floatingaxes_class_factory(AxesWcs)
FloatingSubplot = maxes.subplot_class_factory(FloatingAxes)
_proj_pseudo_cyl_list = ["SFL", "PAR", "MOL"]
_proj_lat_limits = dict(MER= 75)
def make_allsky_axes_from_header(fig, rect, header, lon_center,
lat_minmax=None, pseudo_cyl=None):
proj = header["CTYPE1"].split("-")[-1]
if pseudo_cyl is None:
if proj in _proj_pseudo_cyl_list:
pseudo_cyl = True
if lat_minmax is None:
开发者ID:dreadtoad,项目名称:pywcsgrid2,代码行数:30,代码来源:allsky_axes.py
示例7: center_y
x0, x1 = points[:,0]; y0, y1 = points[:,1]
deltax = x0 - xlim[0]; deltay = y0 - ylim[0]
self.set_xlim(xlim[0]+deltax, xlim[1]-deltax)
self.set_ylim(ylim[0]+deltay, ylim[1]-deltay)
def center_y(self, y):
ymin, ymax = self.get_ylim()
yoff = (ymax - ymin) * 0.5
self.set_ylim(y-yoff, y+yoff)
def center_x(self, x, offset=0.3):
xmin, xmax = self.get_xlim()
xspan = xmax - xmin
xoff = xspan*0.5 + xspan*offset
self.set_xlim(x-xoff, x+xoff)
def scroll(self, x, y):
x0, x1 = self.get_xlim()
y0, y1 = self.get_ylim()
xd = (x1-x0)*x
yd = (y1-y0)*y
self.set_xlim(x0+xd, x1+xd)
self.set_ylim(y0+yd, y1+yd)
def home(self):
self.set_xlim(0, self.nchar)
self.set_ylim(self.ntax, 0)
AlignmentPlot = subplot_class_factory(Alignment)
开发者ID:ChriZiegler,项目名称:ivy,代码行数:29,代码来源:alignment.py
示例8: range
param = []
for j in range(len(params)):
param.append([p[id] for p in params[j]])
params = param[:]
# at this point, we should have:
#bounds = [(60,105),(0,30),(2.1,2.8)] or [(None,None),(None,None),(None,None)]
#xyz = [(2,3),(6,7),(10,11)] for any length tuple
#wxyz = [(0,1),(4,5),(8,9)] for any length tuple (should match up with xyz)
#select = ['-1'] or ['1','2','3','-1'] or similar
#id = 0 or None
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib.axes import subplot_class_factory
Subplot3D = subplot_class_factory(Axes3D)
plots = len(select)
if not flatten:
dim1,dim2 = best_dimensions(plots)
else: dim1,dim2 = 1,1
# use the default bounds where not specified
bounds = [list(i) for i in bounds]
for i in range(len(bounds)):
if bounds[i][0] is None: bounds[i][0] = 0
if bounds[i][1] is None: bounds[i][1] = 1
# correctly bound the first plot. there must be at least one plot
fig = plt.figure()
ax1 = Subplot3D(fig, dim1,dim2,1)
开发者ID:jcfr,项目名称:mystic,代码行数:31,代码来源:support_hypercube_measures.py
示例9: get_tightbbox
def get_tightbbox(self, renderer):
if not self.get_visible():
return
bb = [b for b in self._bboxes if b and (b.width != 0 or b.height != 0)]
if bb:
_bbox = Bbox.union(bb)
return _bbox
else:
return self.get_window_extent(renderer)
def grid(self, draw_grid=True, **kwargs):
"""
Plot gridlines for both coordinates.
Standard matplotlib appearance options (color, alpha, etc.) can be
passed as keyword arguments.
Parameters
----------
draw_grid : bool
Whether to show the gridlines
"""
if draw_grid:
self.coords.grid(draw_grid=draw_grid, **kwargs)
WCSAxesSubplot = subplot_class_factory(WCSAxes)
开发者ID:ChrisBeaumont,项目名称:wcsaxes,代码行数:30,代码来源:wcsaxes.py
示例10: add_subplot
def add_subplot(self, *args, **kwargs):
"""
Add a subplot. Examples::
fig.add_subplot(111)
# equivalent but more general
fig.add_subplot(1,1,1)
# add subplot with red background
fig.add_subplot(212, axisbg='r')
# add a polar subplot
fig.add_subplot(111, projection='polar')
# add Subplot instance sub
fig.add_subplot(sub)
*kwargs* are legal :class:`~matplotlib.axes.Axes` kwargs plus
*projection*, which chooses a projection type for the axes.
(For backward compatibility, *polar=True* may also be
provided, which is equivalent to *projection='polar'*). Valid
values for *projection* are: %(projection_names)s. Some of
these projections
support additional *kwargs*, which may be provided to
:meth:`add_axes`.
The :class:`~matplotlib.axes.Axes` instance will be returned.
If the figure already has a subplot with key (*args*,
*kwargs*) then it will simply make that subplot current and
return it.
The following kwargs are supported:
%(Axes)s
"""
if not len(args): return
if len(args) == 1 and isinstance(args[0], int):
args = tuple([int(c) for c in str(args[0])])
if isinstance(args[0], SubplotBase):
a = args[0]
assert(a.get_figure() is self)
# make a key for the subplot (which includes the axes object id
# in the hash)
key = self._make_key(*args, **kwargs)
else:
projection_class, kwargs, key = \
process_projection_requirements(self, *args, **kwargs)
# try to find the axes with this key in the stack
ax = self._axstack.get(key)
if ax is not None:
if isinstance(ax, projection_class):
# the axes already existed, so set it as active & return
self.sca(ax)
return ax
else:
# Undocumented convenience behavior:
# subplot(111); subplot(111, projection='polar')
# will replace the first with the second.
# Without this, add_subplot would be simpler and
# more similar to add_axes.
self._axstack.remove(ax)
a = subplot_class_factory(projection_class)(self, *args, **kwargs)
self._axstack.add(key, a)
self.sca(a)
return a
开发者ID:jesper-friis,项目名称:matplotlib,代码行数:74,代码来源:figure.py
注:本文中的matplotlib.axes.subplot_class_factory函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论