Bases: GraphicsWidget
Plot graphics item that can be added to any graphics scene. Implements axes, titles, and interactive viewbox. PlotItem also provides some basic analysis functionality that may be accessed from the context menu. Use plot() to create a new PlotDataItem and add it to the view. Use addItem() to add any QGraphicsItem to the view.
This class wraps several methods from its internal ViewBox: setXRange, setYRange, setRange, autoRange, setXLink, setYLink, setAutoPan, setAutoVisible, viewRect, viewRange, setMouseEnabled, enableAutoRange, disableAutoRange, setAspectLocked, invertY, register, unregister
The ViewBox itself can be accessed by calling getViewBox()
Signals | |
sigYRangeChanged | wrapped from ViewBox |
sigXRangeChanged | wrapped from ViewBox |
sigRangeChanged | wrapped from ViewBox |
Create a new PlotItem. All arguments are optional. Any extra keyword arguments are passed to PlotItem.plot().
Arguments | |
title | Title to display at the top of the item. Html is allowed. |
labels | A dictionary specifying the axis labels to display: {'left': (args), 'bottom': (args), ...}
The name of each axis and the corresponding arguments are passed to PlotItem.setLabel() Optionally, PlotItem my also be initialized with the keyword arguments left, right, top, or bottom to achieve the same effect. |
name | Registers a name for this view so that others may link to it |
viewBox | If specified, the PlotItem will be constructed with this as its ViewBox. |
axisItems | Optional dictionary instructing the PlotItem to use pre-constructed items for its axes. The dict keys must be axis names (‘left’, ‘bottom’, ‘right’, ‘top’) and the values must be instances of AxisItem (or at least compatible with AxisItem). |
Add a graphics item to the view box. If the item has plot data (PlotDataItem, PlotCurveItem, ScatterPlotItem), it may be included in analysis performed by the PlotItem.
Create a new LegendItem and anchor it over the internal ViewBox. Plots will be automatically displayed in the legend if they are created with the ‘name’ argument.
Remove all items from the ViewBox.
Enable auto-scaling. The plot will continuously scale to fit the boundaries of its data.
Return the specified AxisItem. name should be ‘left’, ‘bottom’, ‘top’, or ‘right’.
Hide one of the PlotItem’s axes. (‘left’, ‘bottom’, ‘right’, or ‘top’)
Causes auto-scale button (‘A’ in lower-left corner) to be hidden for this PlotItem
Add and return a new plot. See PlotDataItem.__init__ for data arguments
Remove an item from the internal ViewBox.
Set the label for an axis. Basic HTML formatting is allowed.
Arguments | |
axis | must be one of ‘left’, ‘bottom’, ‘right’, or ‘top’ |
text | text to display along the axis. HTML allowed. |
units | units to display after the title. If units are given, then an SI prefix will be automatically appended and the axis values will be scaled accordingly. (ie, use ‘V’ instead of ‘mV’; ‘m’ will be added automatically) |
Set log scaling for x and y axes. This informs PlotDataItems to transform logarithmically and switches the axes to use log ticking.
Note that no other items in the scene will be affected by this; there is no generic way to redisplay a GraphicsItem with log coordinates.
Enable or disable the context menu for this PlotItem. By default, the ViewBox’s context menu will also be affected. (use enableViewBoxMenu=None to leave the ViewBox unchanged)
Set the title of the plot. Basic HTML formatting is allowed. If title is None, then the title will be hidden.
Show or hide one of the plot’s axes. axis must be one of ‘left’, ‘bottom’, ‘right’, or ‘top’
Causes auto-scale button (‘A’ in lower-left corner) to be visible for this PlotItem
Show or hide the grid for either axis.
Arguments: | |
x | (bool) Whether to show the X grid |
y | (bool) Whether to show the Y grid |
alpha | (0.0-1.0) Opacity of the grid |
Show or hide one of the plot’s axis labels (the axis itself will be unaffected). axis must be one of ‘left’, ‘bottom’, ‘right’, or ‘top’
Return the screen geometry of the viewbox