Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
rqt_plot.data_plot.DataPlot Class Reference
Inheritance diagram for rqt_plot.data_plot.DataPlot:
Inheritance graph
[legend]

Public Member Functions

def __init__ (self, parent=None)
 
def add_curve (self, curve_id, curve_name, data_x, data_y)
 
def autoscroll (self, enabled=True)
 
def clear_values (self, curve_id=None)
 
def doSettingsDialog (self)
 
def get_xlim (self)
 
def get_ylim (self)
 
def getTitle (self)
 
def redraw (self)
 
def remove_curve (self, curve_id)
 
def restore_settings (self, plugin_settings, instance_settings)
 
def save_settings (self, plugin_settings, instance_settings)
 
def set_autoscale (self, x=None, y=None)
 
def set_xlim (self, limits)
 
def set_ylim (self, limits)
 
def update_values (self, curve_id, values_x, values_y, sort_data=True)
 
def vline (self, x, color=RED)
 

Static Public Attributes

tuple BLUE = (0, 0, 255)
 
tuple GREEN = (0, 255, 0)
 
 limits_changed = Signal()
 
list plot_types
 
tuple RED = (255, 0, 0)
 
int SCALE_ALL = 1
 
int SCALE_EXTEND = 4
 
int SCALE_VISIBLE = 2
 

Private Member Functions

def _do_redraw (self)
 
def _get_curve (self, curve_id)
 
def _merged_autoscale (self)
 
def _switch_data_plot_widget (self, plot_index, markers_on=False)
 
def _switch_plot_markers (self, markers_on)
 

Private Attributes

 _autoscale_x
 
 _autoscale_y
 
 _autoscroll
 
 _color_index
 
 _curves
 
 _data_plot_widget
 
 _layout
 
 _markers_on
 
 _plot_index
 
 _vline
 

Static Private Attributes

 _add_curve = Signal(str, str, 'QColor', bool)
 
list _colors
 
 _redraw = Signal()
 

Detailed Description

A widget for displaying a plot of data

The DataPlot widget displays a plot, on one of several plotting backends,
depending on which backend(s) are available at runtime. It currently
supports PyQtGraph, MatPlot and QwtPlot backends.

The DataPlot widget manages the plot backend internally, and can save
and restore the internal state using `save_settings` and `restore_settings`
functions.

Currently, the user MUST call `restore_settings` before using the widget,
to cause the creation of the enclosed plotting widget.

Definition at line 67 of file data_plot/__init__.py.

Constructor & Destructor Documentation

◆ __init__()

def rqt_plot.data_plot.DataPlot.__init__ (   self,
  parent = None 
)
Create a new, empty DataPlot

This will raise a RuntimeError if none of the supported plotting
backends can be found

Definition at line 125 of file data_plot/__init__.py.

Member Function Documentation

◆ _do_redraw()

def rqt_plot.data_plot.DataPlot._do_redraw (   self)
private
Redraw the underlying plot

This causes the underlying plot to be redrawn. This is usually used
after adding or updating the plot data

Definition at line 308 of file data_plot/__init__.py.

◆ _get_curve()

def rqt_plot.data_plot.DataPlot._get_curve (   self,
  curve_id 
)
private

Definition at line 324 of file data_plot/__init__.py.

◆ _merged_autoscale()

def rqt_plot.data_plot.DataPlot._merged_autoscale (   self)
private

Definition at line 445 of file data_plot/__init__.py.

◆ _switch_data_plot_widget()

def rqt_plot.data_plot.DataPlot._switch_data_plot_widget (   self,
  plot_index,
  markers_on = False 
)
private
Internal method for activating a plotting backend by index

Definition at line 167 of file data_plot/__init__.py.

◆ _switch_plot_markers()

def rqt_plot.data_plot.DataPlot._switch_plot_markers (   self,
  markers_on 
)
private

Definition at line 209 of file data_plot/__init__.py.

◆ add_curve()

def rqt_plot.data_plot.DataPlot.add_curve (   self,
  curve_id,
  curve_name,
  data_x,
  data_y 
)
Add a new, named curve to this plot

Add a curve named `curve_name` to the plot, with initial data series
`data_x` and `data_y`.

Future references to this curve should use the provided `curve_id`

Note that the plot is not redraw automatically; call `redraw()` to make
any changes visible to the user.

Definition at line 331 of file data_plot/__init__.py.

◆ autoscroll()

def rqt_plot.data_plot.DataPlot.autoscroll (   self,
  enabled = True 
)
Enable or disable autoscrolling of the plot

Definition at line 301 of file data_plot/__init__.py.

◆ clear_values()

def rqt_plot.data_plot.DataPlot.clear_values (   self,
  curve_id = None 
)
Clear the values for the specified curve, or all curves

This will erase the data series associaed with `curve_id`, or all
curves if `curve_id` is not present or is None

Note that the plot is not redraw automatically; call `redraw()` to make
any changes visible to the user.

Definition at line 382 of file data_plot/__init__.py.

◆ doSettingsDialog()

def rqt_plot.data_plot.DataPlot.doSettingsDialog (   self)
Present the user with a dialog for choosing the plot backend

This displays a SimpleSettingsDialog asking the user to choose a
plot type, gets the result, and updates the plot type as necessary

This method is blocking

Definition at line 263 of file data_plot/__init__.py.

◆ get_xlim()

def rqt_plot.data_plot.DataPlot.get_xlim (   self)
get X limits

Definition at line 529 of file data_plot/__init__.py.

◆ get_ylim()

def rqt_plot.data_plot.DataPlot.get_ylim (   self)
get Y limits

Definition at line 544 of file data_plot/__init__.py.

◆ getTitle()

def rqt_plot.data_plot.DataPlot.getTitle (   self)
get the title of the current plotting backend

Definition at line 222 of file data_plot/__init__.py.

◆ redraw()

def rqt_plot.data_plot.DataPlot.redraw (   self)

Definition at line 305 of file data_plot/__init__.py.

◆ remove_curve()

def rqt_plot.data_plot.DataPlot.remove_curve (   self,
  curve_id 
)
Remove the specified curve from this plot

Definition at line 352 of file data_plot/__init__.py.

◆ restore_settings()

def rqt_plot.data_plot.DataPlot.restore_settings (   self,
  plugin_settings,
  instance_settings 
)
Restore the settings for this widget

Currently, this just restores the plot type.

Definition at line 241 of file data_plot/__init__.py.

◆ save_settings()

def rqt_plot.data_plot.DataPlot.save_settings (   self,
  plugin_settings,
  instance_settings 
)
Save the settings associated with this widget

Currently, this is just the plot type, but may include more useful
data in the future

Definition at line 226 of file data_plot/__init__.py.

◆ set_autoscale()

def rqt_plot.data_plot.DataPlot.set_autoscale (   self,
  x = None,
  y = None 
)
Change autoscaling of plot axes

if a parameter is not passed, the autoscaling setting for that axis is
not changed

@param x: enable or disable autoscaling for X
@param y: set autoscaling mode for Y

Definition at line 415 of file data_plot/__init__.py.

◆ set_xlim()

def rqt_plot.data_plot.DataPlot.set_xlim (   self,
  limits 
)
set X limits

Definition at line 537 of file data_plot/__init__.py.

◆ set_ylim()

def rqt_plot.data_plot.DataPlot.set_ylim (   self,
  limits 
)
set Y limits

Definition at line 552 of file data_plot/__init__.py.

◆ update_values()

def rqt_plot.data_plot.DataPlot.update_values (   self,
  curve_id,
  values_x,
  values_y,
  sort_data = True 
)
Append new data to an existing curve

`values_x` and `values_y` will be appended to the existing data for
`curve_id`

Note that the plot is not redraw automatically; call `redraw()` to make
any changes visible to the user.

If `sort_data` is set to False, values won't be sorted by `values_x`
order.

Definition at line 360 of file data_plot/__init__.py.

◆ vline()

def rqt_plot.data_plot.DataPlot.vline (   self,
  x,
  color = RED 
)
Draw a vertical line on the plot

Draw a line a position X, with the given color

@param x: position of the vertical line to draw
@param color: optional parameter specifying the color, as tuple of
      RGB values from 0 to 255

Definition at line 401 of file data_plot/__init__.py.

Member Data Documentation

◆ _add_curve

rqt_plot.data_plot.DataPlot._add_curve = Signal(str, str, 'QColor', bool)
staticprivate

Definition at line 123 of file data_plot/__init__.py.

◆ _autoscale_x

rqt_plot.data_plot.DataPlot._autoscale_x
private

Definition at line 137 of file data_plot/__init__.py.

◆ _autoscale_y

rqt_plot.data_plot.DataPlot._autoscale_y
private

Definition at line 138 of file data_plot/__init__.py.

◆ _autoscroll

rqt_plot.data_plot.DataPlot._autoscroll
private

Definition at line 135 of file data_plot/__init__.py.

◆ _color_index

rqt_plot.data_plot.DataPlot._color_index
private

Definition at line 133 of file data_plot/__init__.py.

◆ _colors

list rqt_plot.data_plot.DataPlot._colors
staticprivate
Initial value:
= [Qt.blue, Qt.red, Qt.cyan, Qt.magenta, Qt.green,
Qt.darkYellow, Qt.black, Qt.darkCyan, Qt.darkRed, Qt.gray]

Definition at line 118 of file data_plot/__init__.py.

◆ _curves

rqt_plot.data_plot.DataPlot._curves
private

Definition at line 142 of file data_plot/__init__.py.

◆ _data_plot_widget

rqt_plot.data_plot.DataPlot._data_plot_widget
private

Definition at line 141 of file data_plot/__init__.py.

◆ _layout

rqt_plot.data_plot.DataPlot._layout
private

Definition at line 146 of file data_plot/__init__.py.

◆ _markers_on

rqt_plot.data_plot.DataPlot._markers_on
private

Definition at line 134 of file data_plot/__init__.py.

◆ _plot_index

rqt_plot.data_plot.DataPlot._plot_index
private

Definition at line 132 of file data_plot/__init__.py.

◆ _redraw

rqt_plot.data_plot.DataPlot._redraw = Signal()
staticprivate

Definition at line 122 of file data_plot/__init__.py.

◆ _vline

rqt_plot.data_plot.DataPlot._vline
private

Definition at line 143 of file data_plot/__init__.py.

◆ BLUE

tuple rqt_plot.data_plot.DataPlot.BLUE = (0, 0, 255)
static

Definition at line 112 of file data_plot/__init__.py.

◆ GREEN

tuple rqt_plot.data_plot.DataPlot.GREEN = (0, 255, 0)
static

Definition at line 111 of file data_plot/__init__.py.

◆ limits_changed

rqt_plot.data_plot.DataPlot.limits_changed = Signal()
static

Definition at line 121 of file data_plot/__init__.py.

◆ plot_types

list rqt_plot.data_plot.DataPlot.plot_types
static
Initial value:
= [
{
'title': 'PyQtGraph',
'widget_class': PyQtGraphDataPlot,
'description':
'Based on PyQtGraph\n- installer: http://luke.campagnola.me/code/pyqtgraph\n',
'enabled': PyQtGraphDataPlot is not None,
},
{
'title': 'MatPlot',
'widget_class': MatDataPlot,
'description':
'Based on MatPlotLib\n- needs most CPU\n- needs matplotlib >= 1.1.0\n- if using '
'PySide: PySide > 1.1.0\n',
'enabled': MatDataPlot is not None,
},
{
'title': 'QwtPlot',
'widget_class': QwtDataPlot,
'description':
'Based on QwtPlot\n- does not use timestamps\n- uses least CPU\n- needs Python '
'Qwt bindings\n',
'enabled': QwtDataPlot is not None,
},
]

Definition at line 83 of file data_plot/__init__.py.

◆ RED

tuple rqt_plot.data_plot.DataPlot.RED = (255, 0, 0)
static

Definition at line 110 of file data_plot/__init__.py.

◆ SCALE_ALL

int rqt_plot.data_plot.DataPlot.SCALE_ALL = 1
static

Definition at line 114 of file data_plot/__init__.py.

◆ SCALE_EXTEND

int rqt_plot.data_plot.DataPlot.SCALE_EXTEND = 4
static

Definition at line 116 of file data_plot/__init__.py.

◆ SCALE_VISIBLE

int rqt_plot.data_plot.DataPlot.SCALE_VISIBLE = 2
static

Definition at line 115 of file data_plot/__init__.py.


The documentation for this class was generated from the following file:


rqt_plot
Author(s): Dorian Scholz, Dirk Thomas
autogenerated on Wed Mar 2 2022 00:58:35