Package Scientific :: Package QtWidgets :: Module QtPlotCanvas :: Class PlotCanvas
[frames] | no frames]

Class PlotCanvas

qt_fake.QWidget --+
                  |
                 PlotCanvas

Qt plot widget

PlotCanvas objects support all operations of Qt widgets.

Instance Methods
 
__init__(self, parent=None, background='white', font=None, zoom=False, select=None)
 
clear(self)
Clear the canvas
 
draw(self, graphics, xaxis=None, yaxis=None)
Draw something on the canvas
 
mouseMoveEvent(self, event)
 
mousePressEvent(self, event)
 
mouseReleaseEvent(self, event)
 
paintEvent(self, event)
 
redraw(self)
Redraw the most recent canvas contents
 
resizeEvent(self, event)
 
select(self, range)
Highlight a range on the x-axis
Method Details

__init__(self, parent=None, background='white', font=None, zoom=False, select=None)
(Constructor)

 
Parameters:
  • parent - the parent widget
  • background (str) - the background color
  • font (QFont) - the font for axis labels, default: 10 point Helevetica
  • zoom (bool) - a flag that indicates whether interactive zooming (using the left mouse button) is enabled; the default is False (no zoom)
  • select - enables the user to select a range along the x axis by dragging the mouse (with the left button pressed) in the area under the x axis. If select is 0, no selection is possible. Otherwise the value of select must be a callable object that is called whenever the selection changes, with a single argument that can be None (no selection) or a tuple containing two x values.

draw(self, graphics, xaxis=None, yaxis=None)

 

Draw something on the canvas

Parameters:
  • graphics - the graphics object (PolyLine, PolyMarker, or PlotGraphics) to be drawn
  • xaxis - None (no x-axis), "automatic" (automatic scaling), or a pair (x1, x2) defining the range of the x-axis
  • yaxis - None (no y-axis), "automatic" (automatic scaling), or a pair (y1, y2) defining the range of the y-axis

select(self, range)

 

Highlight a range on the x-axis

Parameters:
  • range - the range on the x-axis to be highlighted. It can be None (no selection) or a sequence of two values on the x-axis.