Table Of Contents

Previous topic

plot

Next topic

PlotGraphics

This Page

phoenix_title PlotCanvas

Subclass of a wx.Panel which holds two scrollbars and the actual plotting canvas (self.canvas). It allows for simple general plotting of data with zoom, labels, and automatic axis scaling.


class_hierarchy Inheritance Diagram

Inheritance diagram for class PlotCanvas

Inheritance diagram of PlotCanvas


super_classes Known Superclasses

Panel


method_summary Methods Summary

__init__ Constructs a panel, which can be a child of a frame or
Clear Erase the window.
Draw Wrapper around _Draw, which handles log axes
GetClosestPoint Returns list with
GetClosestPoints Returns list with
GetEnableAntiAliasing  
GetEnableCenterLines True if grid enabled.
GetEnableDiagonals True if grid enabled.
GetEnableDrag  
GetEnableGrid True if grid enabled.
GetEnableHiRes  
GetEnableLegend True if Legend enabled.
GetEnablePointLabel True if pointLabel enabled.
GetEnableTitle True if title enabled.
GetEnableZoom True if zooming enabled.
GetFontSizeAxis Get current tick and axis label font size in points
GetFontSizeLegend Get current Legend font size in points
GetFontSizeTitle Get current Title font size in points
GetGridColour  
getLogScale  
GetPointLabelFunc Returns pointLabel Drawing Function
GetShowScrollbars Set True to show scrollbars
GetUseScientificNotation  
GetXCurrentRange  
GetXMaxRange  
GetXSpec Returns current XSpec for axis
GetXY Wrapper around _getXY, which handles log scales
GetYCurrentRange  
GetYMaxRange  
GetYSpec Returns current YSpec for axis
OnLeave Used to erase pointLabel when mouse outside window
OnMotion  
OnMouseDoubleClick  
OnMouseLeftDown  
OnMouseLeftUp  
OnMouseRightDown  
OnPaint  
OnScroll  
OnSize  
PageSetup Brings up the page setup dialog
PositionScreenToUser Converts Screen position to User Coordinates
PositionUserToScreen Converts User position to Screen Coordinates
Printout Print current plot.
PrintPreview Print-preview current plot.
Redraw Redraw the existing plot.
Reset Unzoom the plot.
SaveFile Saves the file to the type specified in the extension. If no file
ScrollRight Move view right number of axis units.
ScrollUp Move view up number of axis units.
SetCursor  
SetEnableAntiAliasing Set True to enable anti-aliasing.
SetEnableCenterLines Set True, ‘Horizontal’ or ‘Vertical’ to enable center line(s).
SetEnableDiagonals Set True, ‘Bottomleft-Topright’ or ‘Bottomright-Topleft’ to enable
SetEnableDrag Set True to enable drag.
SetEnableGrid Set True, ‘Horizontal’ or ‘Vertical’ to enable grid.
SetEnableHiRes Set True to enable high-resolution mode when using anti-aliasing.
SetEnableLegend Set True to enable legend.
SetEnablePointLabel Set True to enable pointLabel.
SetEnableTitle Set True to enable title.
SetEnableZoom Set True to enable zooming.
SetFontSizeAxis Set the tick and axis label font size (default is 10 point)
SetFontSizeLegend Set Legend font size (default is 7 point)
SetFontSizeTitle Set Title font size (default is 15 point)
SetGridColour  
setLogScale  
SetPointLabelFunc Sets the function with custom code for pointLabel drawing
SetShowScrollbars Set True to show scrollbars
SetUseScientificNotation  
SetXSpec xSpec- defines x axis type. Can be ‘none’, ‘min’ or ‘auto’
SetYSpec ySpec- defines x axis type. Can be ‘none’, ‘min’ or ‘auto’
UpdatePointLabel Updates the pointLabel point on screen with data contained in
Zoom Zoom on the plot

property_summary Properties Summary

pageSetupData  
print_data  

api Class API



class PlotCanvas(Panel)

Subclass of a wx.Panel which holds two scrollbars and the actual plotting canvas (self.canvas). It allows for simple general plotting of data with zoom, labels, and automatic axis scaling.


Methods



__init__(self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=0, name="plotCanvas")

Constructs a panel, which can be a child of a frame or any other non-control window



Clear(self)

Erase the window.



Draw(self, graphics, xAxis = None, yAxis = None, dc = None)

Wrapper around _Draw, which handles log axes



GetClosestPoint(self, pntXY, pointScaled= True)

Returns list with [curveNumber, legend, index of closest point, pointXY, scaledXY, distance] list for only the closest curve. Returns [] if no curves are being plotted.

x, y in user coords if pointScaled == True based on screen coords if pointScaled == False based on user coords



GetClosestPoints(self, pntXY, pointScaled= True)

Returns list with [curveNumber, legend, index of closest point, pointXY, scaledXY, distance] list for each curve. Returns [] if no curves are being plotted.

x, y in user coords if pointScaled == True based on screen coords if pointScaled == False based on user coords



GetEnableAntiAliasing(self)


GetEnableCenterLines(self)

True if grid enabled.



GetEnableDiagonals(self)

True if grid enabled.



GetEnableDrag(self)


GetEnableGrid(self)

True if grid enabled.



GetEnableHiRes(self)


GetEnableLegend(self)

True if Legend enabled.



GetEnablePointLabel(self)

True if pointLabel enabled.



GetEnableTitle(self)

True if title enabled.



GetEnableZoom(self)

True if zooming enabled.



GetFontSizeAxis(self)

Get current tick and axis label font size in points



GetFontSizeLegend(self)

Get current Legend font size in points



GetFontSizeTitle(self)

Get current Title font size in points



GetGridColour(self)


getLogScale(self)


GetPointLabelFunc(self)

Returns pointLabel Drawing Function



GetShowScrollbars(self)

Set True to show scrollbars



GetUseScientificNotation(self)


GetXCurrentRange(self)


GetXMaxRange(self)


GetXSpec(self)

Returns current XSpec for axis



GetXY(self, event)

Wrapper around _getXY, which handles log scales



GetYCurrentRange(self)


GetYMaxRange(self)


GetYSpec(self)

Returns current YSpec for axis



OnLeave(self, event)

Used to erase pointLabel when mouse outside window



OnMotion(self, event)


OnMouseDoubleClick(self, event)


OnMouseLeftDown(self, event)


OnMouseLeftUp(self, event)


OnMouseRightDown(self, event)


OnPaint(self, event)


OnScroll(self, evt)


OnSize(self, event)


PageSetup(self)

Brings up the page setup dialog



PositionScreenToUser(self, pntXY)

Converts Screen position to User Coordinates



PositionUserToScreen(self, pntXY)

Converts User position to Screen Coordinates



Printout(self, paper=None)

Print current plot.



PrintPreview(self)

Print-preview current plot.



Redraw(self, dc=None)

Redraw the existing plot.



Reset(self)

Unzoom the plot.



SaveFile(self, fileName= '')

Saves the file to the type specified in the extension. If no file name is specified a dialog box is provided. Returns True if sucessful, otherwise False.

.bmp Save a Windows bitmap file. .xbm Save an X bitmap file. .xpm Save an XPM bitmap file. .png Save a Portable Network Graphics file. .jpg Save a Joint Photographic Experts Group file.



ScrollRight(self, units)

Move view right number of axis units.



ScrollUp(self, units)

Move view up number of axis units.



SetCursor(self, cursor)


SetEnableAntiAliasing(self, enableAntiAliasing)

Set True to enable anti-aliasing.



SetEnableCenterLines(self, value)

Set True, ‘Horizontal’ or ‘Vertical’ to enable center line(s).



SetEnableDiagonals(self, value)

Set True, ‘Bottomleft-Topright’ or ‘Bottomright-Topleft’ to enable center line(s).



SetEnableDrag(self, value)

Set True to enable drag.



SetEnableGrid(self, value)

Set True, ‘Horizontal’ or ‘Vertical’ to enable grid.



SetEnableHiRes(self, enableHiRes)

Set True to enable high-resolution mode when using anti-aliasing.



SetEnableLegend(self, value)

Set True to enable legend.



SetEnablePointLabel(self, value)

Set True to enable pointLabel.



SetEnableTitle(self, value)

Set True to enable title.



SetEnableZoom(self, value)

Set True to enable zooming.



SetFontSizeAxis(self, point= 10)

Set the tick and axis label font size (default is 10 point)



SetFontSizeLegend(self, point= 7)

Set Legend font size (default is 7 point)



SetFontSizeTitle(self, point= 15)

Set Title font size (default is 15 point)



SetGridColour(self, colour)


setLogScale(self, logscale)


SetPointLabelFunc(self, func)

Sets the function with custom code for pointLabel drawing **** more info needed ***********



SetShowScrollbars(self, value)

Set True to show scrollbars



SetUseScientificNotation(self, useScientificNotation)


SetXSpec(self, type= 'auto')

xSpec- defines x axis type. Can be ‘none’, ‘min’ or ‘auto’ where:

  • ‘none’ - shows no axis or tick mark values
  • ‘min’ - shows min bounding box values
  • ‘auto’ - rounds axis range to sensible values
  • <number> - like ‘min’, but with <number> tick marks


SetYSpec(self, type= 'auto')

ySpec- defines x axis type. Can be ‘none’, ‘min’ or ‘auto’ where:

  • ‘none’ - shows no axis or tick mark values
  • ‘min’ - shows min bounding box values
  • ‘auto’ - rounds axis range to sensible values
  • <number> - like ‘min’, but with <number> tick marks


UpdatePointLabel(self, mDataDict)

Updates the pointLabel point on screen with data contained in mDataDict.

mDataDict will be passed to your function set by SetPointLabelFunc. It can contain anything you want to display on the screen at the scaledXY point you specify.

This function can be called from parent window with onClick, onMotion events etc.



Zoom(self, Center, Ratio)

Zoom on the plot Centers on the X,Y coords given in Center Zooms by the Ratio = (Xratio, Yratio) given


Properties



pageSetupData

See pageSetupData



print_data

See print_data