本文整理汇总了Python中chaco.api.HPlotContainer.spacing方法的典型用法代码示例。如果您正苦于以下问题:Python HPlotContainer.spacing方法的具体用法?Python HPlotContainer.spacing怎么用?Python HPlotContainer.spacing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chaco.api.HPlotContainer
的用法示例。
在下文中一共展示了HPlotContainer.spacing方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _plot_default
# 需要导入模块: from chaco.api import HPlotContainer [as 别名]
# 或者: from chaco.api.HPlotContainer import spacing [as 别名]
def _plot_default(self):
data = self.data < self.limit
pd = self.pd = ArrayPlotData(imagedata=data,orig=self.data)
plot1 = Plot(pd, default_origin='top left')
plot2 = Plot(pd, default_origin='top left')
img_plot1 = plot1.img_plot("imagedata",colormap=gray,padding=0)[0]
img_plot2 = plot2.img_plot("orig",colormap=gray,padding=0)[0]
container = HPlotContainer(plot1,plot2)
container.spacing=0
plot1.padding_right=0
plot2.padding_left=0
plot2.y_axis.orientation= 'right'
return container
示例2: _plot_default
# 需要导入模块: from chaco.api import HPlotContainer [as 别名]
# 或者: from chaco.api.HPlotContainer import spacing [as 别名]
def _plot_default(self):
# Create the data and the PlotData object
x = linspace(-14, 14, 100)
y = sin(x) * x**3
plotdata = ArrayPlotData(x = x, y = y)
# Create the scatter plot
scatter = Plot(plotdata)
scatter.plot(("x", "y"), type="scatter", color="blue")
# Create the line plot
line = Plot(plotdata)
line.plot(("x", "y"), type="line", color="blue")
# Create a horizontal container and put the two plots inside it
container = HPlotContainer(scatter, line)
container.spacing = 0
scatter.padding_right = 0
line.padding_left = 0
line.y_axis.orientation = "right"
return container
示例3: __init__
# 需要导入模块: from chaco.api import HPlotContainer [as 别名]
# 或者: from chaco.api.HPlotContainer import spacing [as 别名]
def __init__(self):
super(ContainerExample, self).__init__()
x = linspace(-14, 14, 100)
y = sin(x) * x ** 3
plotdata = ArrayPlotData(x=x, y=y)
scatter = Plot(plotdata)
scatter.plot(("x", "y"), type="scatter", color="blue")
line = Plot(plotdata)
line.plot(("x", "y"), type="line", color="blue")
container = HPlotContainer(scatter, line)
#Making the plots touch in the middle
container.spacing = 0
scatter.padding_right = 0
line.padding_left = 0
line.y_axis.orientation = "right"
self.plot = container
示例4: create_SourcePlot
# 需要导入模块: from chaco.api import HPlotContainer [as 别名]
# 或者: from chaco.api.HPlotContainer import spacing [as 别名]
#.........这里部分代码省略.........
self.SourceFuncPlot.range2d.x_range.set_bounds(self.new_vaxis[0], self.new_vaxis[-1])
self.SourceFuncPlot.range2d.y_range.set_bounds(self.new_height[0], self.new_height[-1])
#---------------------Create Tau * Exp(-tau) plot---------------------
tauCalcTE = (tau*N.exp(-tau))
tauCalcTE = tauCalcTE[:, ::-1]
new_tauCalcTE = lineformInterpolate2D(vaxis, height, tauCalcTE, self.new_vaxis, self.new_height)
self._image_indexTE = GridDataSource(xdata = self.new_vaxis, ydata = self.new_height)
index_mapperTE = GridMapper(range = DataRange2D(self._image_indexTE))
self._image_valueTE = ImageData(data = new_tauCalcTE, value_depth = 1)
color_mapperTE = jet(DataRange1D(self._image_valueTE))
self.TauExpPlotData = ArrayPlotData(imagedata = new_tauCalcTE, colormap = color_mapperTE, index = vaxis, TauOne = tau_one, Velocity = vz, Height = height, VelocityZeroXPoints = VelocityZeroXPoints, VelocityZeroYPoints = VelocityZeroYPoints)
self.TauExpPlot = Plot(self.TauExpPlotData)
self.TauExpPlot.img_plot1 = self.TauExpPlot.img_plot("imagedata", colormap = color_mapperTE, xbounds = (self.new_vaxis[0], self.new_vaxis[-1]), ybounds = (self.new_height[0], self.new_height[-1]))[0]
self.TauExpPlot.overlays.append(ZoomTool(self.TauExpPlot.img_plot1))
self.TauExpPlot.tools.append(PanTool(self.TauExpPlot.img_plot1, drag_button="right"))
self.TauExpPlot.TauOnePlot = self.TauExpPlot.plot(("index","TauOne"), type = "line", color = "red", resizeable = True)
self.TauExpPlot.VelocityPlot = self.TauExpPlot.plot(("Velocity","Height"), type = "line", color = "green", resizeable = True)
self.TauExpPlot.VelocityZeroPlot = self.TauExpPlot.plot(("VelocityZeroXPoints","VelocityZeroYPoints"), type = "line", color = "yellow", resizeable = True)
self.TauExpPlot.title = "Tau * Exp Plot"
self.TauExpPlot.x_axis.title = "Velocity (km/s)"
self.TauExpPlot.y_axis.title = "Height (Mm)"
self.TauExpPlot.range2d.x_range.set_bounds(self.new_vaxis[0], self.new_vaxis[-1])
self.TauExpPlot.range2d.y_range.set_bounds(self.new_height[0], self.new_height[-1])
self.TauExpPlotC = OverlayPlotContainer()
self.TauExpPlotC.add(self.TauExpPlot)
#--------------------Create Contribution Function Plot------------------------
new_tau_oneCF = lineformInterpolate1D(vaxis, tau_one, self.new_vaxis)
new_vzCF = lineformInterpolate1D(height, vz, self.new_height)
new_bint = lineformInterpolate1D(vaxis, bint, self.new_vaxis)
ContributionFuncCF = (chi*N.exp(-tau)*S)[:,::-1]
ContributionFuncCF /= N.max(ContributionFuncCF, axis=0)
new_ContributionPlotCF = lineformInterpolate2D(vaxis, height, ContributionFuncCF, self.new_vaxis , self.new_height)
self._image_indexCF = GridDataSource(xdata = self.new_vaxis, ydata = self.new_height)
index_mapperCF = GridMapper(range = DataRange2D(self._image_indexCF))
self._image_valueCF = ImageData(data = new_ContributionPlotCF, value_depth = 1)
color_mapperCF = jet(DataRange1D(self._image_valueCF))
self.ContributionFuncPlotData = ArrayPlotData(imagedata = new_ContributionPlotCF, colormap = color_mapperCF, index = vaxis, TauOne = tau_one, Velocity = vz, Height = height, VelocityZeroXPoints = VelocityZeroXPoints, VelocityZeroYPoints = VelocityZeroYPoints)
self.ContributionFuncPlot = Plot(self.ContributionFuncPlotData)
self.ContributionFuncPlot.img_plot1 = self.ContributionFuncPlot.img_plot("imagedata", colormap = color_mapperCF, xbounds = (self.new_vaxis[0], self.new_vaxis[-1]), ybounds = (self.new_height[0], self.new_height[-1]))[0]
self.ContributionFuncPlot.overlays.append(ZoomTool(self.ContributionFuncPlot.img_plot1))
self.ContributionFuncPlot.tools.append(PanTool(self.ContributionFuncPlot.img_plot1, drag_button="right"))
self.ContributionFuncPlot.TauOnePlot = self.ContributionFuncPlot.plot(("index","TauOne"), type = "line", color = "red", resizeable = True)
self.ContributionFuncPlot.VelocityPlot = self.ContributionFuncPlot.plot(("Velocity","Height"), type = "line", color = "green", resizeable = True)
self.ContributionFuncPlot.VelocityZeroPlot = self.ContributionFuncPlot.plot(("VelocityZeroXPoints","VelocityZeroYPoints"), type = "line", color = "yellow", resizeable = True)
self.IntensityPlotData = ArrayPlotData(index = self.new_vaxis, bint = new_bint)
self.IntensityPlot = Plot(self.IntensityPlotData)
self.IntensityPlot.intensity = self.IntensityPlot.plot(("index","bint"), color = 'white', line_width = 2.0)
self.IntensityPlot.y_axis.orientation = 'right'
self.IntensityPlot.y_axis.title = "I_v (kK)"
self.IntensityPlot.default_origin = 'bottom right'
self.IntensityPlot.x_grid.visible = False
self.IntensityPlot.y_grid.visible = False
self.IntensityPlot.x_axis.visible = False
self.IntensityPlot.x_axis = self.ContributionFuncPlot.x_axis
self.IntensityPlot.range2d.y_range.set_bounds(3,7)
#right_axis = LabelAxis(IntensityPlot, orientation = 'right')
#IntensityPlot.underlays.append(right_axis)
self.ContributionFuncPlot.title = "Contribution Function Plot"
self.ContributionFuncPlot.x_axis.title = "Velocity (km/s)"
self.ContributionFuncPlot.y_axis.title = "Height (Mm)"
self.ContributionFuncPlot.range2d.x_range.set_bounds(self.new_vaxis[0], self.new_vaxis[-1])
self.ContributionFuncPlot.range2d.y_range.set_bounds(self.new_height[0], self.new_height[-1])
self.ContributionFuncPlotC = OverlayPlotContainer()
self.ContributionFuncPlotC.add(self.ContributionFuncPlot)
self.ContributionFuncPlotC.add(self.IntensityPlot)
#-------------------------------Final Container Construction-------------------------------
self.TauExpPlot.range2d = self.ChiTauPlot.range2d
self.ContributionFuncPlot.range2d = self.ChiTauPlot.range2d
self.SourceFuncPlot.range2d = self.ChiTauPlot.range2d
self.LeftPlots = VPlotContainer(self.TauExpPlotC, self.ChiTauPlotC, background = "lightgray", use_back_buffer = True)
self.LeftPlots.spacing = 0
self.RightPlots = VPlotContainer(self.ContributionFuncPlotC, self.SourceFuncPlotC, background = "lightgray", use_back_buffer = True)
self.RightPlots.spacing = 0
MainContainer = HPlotContainer(self.LeftPlots, self.RightPlots, background = "lightgray", use_back_buffer = True)
MainContainer.spacing = 0
self.PrimaryPlotC = MainContainer
示例5: create_PrimaryPlotC
# 需要导入模块: from chaco.api import HPlotContainer [as 别名]
# 或者: from chaco.api.HPlotContainer import spacing [as 别名]
def create_PrimaryPlotC(self):
#Extracts the data for the main plot
self.MainPlotData = self.IntensityData[:,:,self.intensityindex]
self.markerplotdatax = []
self.markerplotdatay = []
self.SpectraMultiple = 1.0e+8
WavelengthXPoints = [self.Wavelength, self.Wavelength]
WavelengthYPoints = [N.min(self.IntensityData[:,:])*self.SpectraMultiple, N.max(self.IntensityData[:,:])*self.SpectraMultiple]
WavelengthXPointsStatic = WavelengthXPoints
WavelengthYPointsStatic = WavelengthYPoints
AvgIntensity = N.mean(N.mean(self.IntensityData, axis = 0), axis = 0)
print "mean computed-------------------"
#Create main Plot (intensity plot)
self.Mainplotdata = ArrayPlotData(Mainimagedata = self.MainPlotData, markerplotdatax = self.markerplotdatax, markerplotdatay = self.markerplotdatay)
self.Mainplot = Plot(self.Mainplotdata)
self.Main_img_plot = self.Mainplot.img_plot("Mainimagedata", colormap = jet)[0]
#Create marker wneh x is pressed
self.Mainplot.MarkerPlot = self.Mainplot.plot(("markerplotdatax","markerplotdatay"),type = 'line', color = 'white')
#Create overlaid crosshairs for Main plot
LineInspector1 = LineInspector(component = self.Main_img_plot,axis = 'index_x', write_metadata=True,is_listener = False,inspect_mode="indexed")
self.Main_img_plot.overlays.append(LineInspector1)
LineInspector2 = LineInspector(component = self.Main_img_plot,axis = 'index_y', write_metadata=True,is_listener = False,inspect_mode="indexed")
self.Main_img_plot.overlays.append(LineInspector2)
#Create overlay tools and add them to main plot
Main_imgtool = ImageInspectorTool(self.Main_img_plot)
self.Main_img_plot.tools.append(Main_imgtool)
Main_overlay = ImageInspectorOverlay(component = self.Main_img_plot, image_inspector = Main_imgtool, bgcolor = "white", border_visible = True)
self.Main_img_plot.overlays.append(Main_overlay)
#Sync up inspector position so it can be passed to the spectra plot
Main_overlay.sync_trait('InspectorPosition', self, 'InspectorPosition', mutual = True)
Main_imgtool.sync_trait('ImageLock', self, 'ImageLock')
Main_imgtool.sync_trait('SaveFlag', self, 'SaveFlag')
#Sync up max and min colormap value
self.Main_img_plot.value_range.sync_trait('low', self, 'colormapmin', mutual = True)
self.Main_img_plot.value_range.sync_trait('high', self, 'colormapmax', mutual = True)
#Create spectra plot for a single column
self.Spectraplotdata = ArrayPlotData(x = self.WavelengthData[:], y = (self.IntensityData[2,2] * self.SpectraMultiple), WavelengthXPointsStatic = WavelengthXPointsStatic, WavelengthYPointsStatic = WavelengthYPointsStatic, WavelengthXPoints = WavelengthXPoints, WavelengthYPoints = WavelengthYPoints, AvgIntensity = AvgIntensity * self.SpectraMultiple, is_listener = True)
self.Spectraplot1 = Plot(self.Spectraplotdata)
self.Spectraplot1.plot(("x","y"), type = "line", color = "blue")
self.Spectraplot1.plot( ("WavelengthXPointsStatic","WavelengthYPointsStatic"), type = 'line', line_style = 'dash', color = 'green')
self.Spectraplot1.plot( ("WavelengthXPoints","WavelengthYPoints"), type = 'line', line_style = 'dash', color = 'red')
self.Spectraplot1.plot( ("x","AvgIntensity"), type = 'line', color = 'black')
#Change Plot characteristics
#Sets width around waveref to examine
self.xlowspread = 1.
self.xhighspread = 1.
self.Spectraplot1.range2d.x_range.set_bounds(self.wave_ref - self.xlowspread, self.wave_ref + self.xhighspread)
self.Spectraplot1.x_axis.title = "Wavelength (A)"
self.Spectraplot1.y_axis.title = "Intensity (J s^-1 m^-2 Hz^-1 sr^-1)"
self.rangearray = self.IntensityData[:,:]
self.rangearray = self.rangearray[:,:,N.argmin(N.abs(self.WavelengthData[:]-(self.wave_ref-self.xlowspread))):N.argmin(N.abs(self.WavelengthData[:]-(self.wave_ref+self.xhighspread)))]
self.Spectraplot1.range2d.y_range.set_bounds(N.min(self.rangearray[:,:])*self.SpectraMultiple, N.max(self.rangearray[:,:]) * self.SpectraMultiple)
#self.Spectraplot1.range2d.y_range.set_bounds(N.min(self.rangearray[:,:])*self.SpectraMultiple, Scaling * (N.max(self.rangearray[:,:]) - N.min(self.rangearray[:,:])) + N.min(self.rangearray[:,:]) * self.SpectraMultiple)
#add some standard tools. Note, I'm assigning the PanTool to the
#right mouse-button to avoid conflicting with the cursors
self.Mainplot.tools.append(PanTool(self.Main_img_plot, drag_button="right"))
self.Spectraplot1.tools.append(PanTool(self.Spectraplot1, drag_button="right"))
self.Mainplot.overlays.append(ZoomTool(self.Main_img_plot))
self.Spectraplot1.overlays.append(ZoomTool(self.Spectraplot1))
#Changing interactive options
zoom = ZoomTool(component=self.Mainplot, tool_mode="box", always_on=False)
#Create Container for main plot
MainContainer = HPlotContainer(self.Mainplot, self.Spectraplot1, background = "lightgray", use_back_buffer = True)
MainContainer.spacing = 25
self.PrimaryPlotC = MainContainer