本文整理汇总了Python中mpl_toolkits.axes_grid.parasite_axes.SubplotHost.set_xbound方法的典型用法代码示例。如果您正苦于以下问题:Python SubplotHost.set_xbound方法的具体用法?Python SubplotHost.set_xbound怎么用?Python SubplotHost.set_xbound使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpl_toolkits.axes_grid.parasite_axes.SubplotHost
的用法示例。
在下文中一共展示了SubplotHost.set_xbound方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MatplotlibTimelines
# 需要导入模块: from mpl_toolkits.axes_grid.parasite_axes import SubplotHost [as 别名]
# 或者: from mpl_toolkits.axes_grid.parasite_axes.SubplotHost import set_xbound [as 别名]
#.........这里部分代码省略.........
data=data[:-1]
plotIt=True
try:
if self.spec.logscale and min(data)<=0:
plotIt=False
except AttributeError:
pass
drawstyle='default'
marker=''
linestyle='-'
if self.with_=='lines':
pass
elif self.with_=='steps':
drawstyle='steps'
elif self.with_=='points':
linestyle=''
marker='*'
elif self.with_=='dots':
linestyle=''
marker='.'
elif self.with_=='linespoints':
marker='*'
else:
warning("'with'-style",self.with_,"not implemented, using 'lines'")
if plotIt:
a.plot(tm,
data,
label=title,
drawstyle=drawstyle,
marker=marker,
linestyle=linestyle)
def preparePlot(self):
"""Prepare the plotting window"""
plt.hot()
self.figure=plt.figure(self.figNr)
self.figure.clear()
# this is black magic that makes the legend work with two axes
if self.hasSubplotHost:
self.axis1=SubplotHost(self.figure,111)
self.figure.add_subplot(self.axis1)
else:
self.axis1=self.figure.add_subplot(111)
self.axis1.set_xlabel("Time")
self.axis1.set_ylabel(self.ylabel)
if self.spec.start or self.spec.end:
self.axis1.set_xbound(lower=self.spec.start,upper=self.spec.end)
if len(self.alternate)>0:
self.axis2=self.axis1.twinx()
self.axis2.set_ylabel(self.ylabel2)
try:
if self.spec.logscale:
self.axis1.set_yscale("log")
if self.axis2:
self.axis2.set_yscale("log")
except AttributeError:
pass
def doReplot(self):
"""Replot the whole data"""
if self.hasSubplotHost:
l=self.axis1.legend(fancybox=True)
else:
l=plt.legend(fancybox=True)
# l.get_frame().set_fill(False)
if l:
l.get_frame().set_alpha(0.7)
l.get_texts()[0].set_size(10)
plt.suptitle(self.title)
plt.grid(True)
plt.draw()
# plt.show()
def actualSetTitle(self,title):
"""Sets the title"""
self.title=title
def setYLabel(self,title):
"""Sets the label on the first Y-Axis"""
self.ylabel=title
def setYLabel2(self,title):
"""Sets the label on the second Y-Axis"""
self.ylabel2=title
def doHardcopy(self,filename,form):
"""Write the contents of the plot to disk
@param filename: Name of the file without type extension
@param form: String describing the format"""
self.figure.savefig(filename+"."+form,format=form)