|
open_iA 2025.6
|
A scatter plot matrix (SPLOM) widget. More...
#include <iAQSplom.h>
Classes | |
| struct | Settings |
| All settings of the plot in one struct. More... | |
Public Types | |
| enum | ColorMode { cmAllPointsSame , cmByParameter , cmCustom } |
| < in what way the the dots should be colored. Order must match labels in m_settingsDlg->cbColorMode! More... | |
| enum | ColorParameterMode { pmContinuous , pmQualitative } |
| < How parameter colors should be applied. More... | |
| enum | ColorRangeMode { rmAutomatic , rmManual } |
| < How parameter range is determined if points are colored by parameter. Order must match labels in m_settingsDlg->cbColorRangeMode! More... | |
| enum | SPMMode { smUpperHalf , smAllPlots } |
| < two possible states of SPLOM: upper triangle with maximized plot or all possible combinations of scatter plots More... | |
Public Slots | |
| void | rangeFromParameter () |
| Call when color range should be determined from parameter. | |
| void | setColorTheme (QString const &themeName) |
| Call to adapt color theme used for coloring by a continuous parameter. | |
| void | setFlipAxes (bool flip) |
| set whether to flip parameters in large scatterplot | |
| void | setHistogramBins (int bins) |
| set the number of histogram bins | |
| void | setHistogramVisible (bool visible) |
| set visibility of histograms | |
| void | setSelectionMode (int mode) |
| set selection mode to either rectangle or polygon mode | |
| void | showSettings () |
| Show the settings dialog. | |
Signals | |
| void | chartClick (size_t paramX, size_t paramY, double x, double y, Qt::KeyboardModifiers modifiers) |
| Emitted when a point in the chart is clicked (and no selection or fixed point selection happened) | |
| void | currentPointModified (size_t index) |
| Emitted when hovered over a new point. | |
| void | lookupTableChanged () |
| Emitted when the lookup table has changed. | |
| void | parameterVisibilityChanged (size_t paramIndex, bool visible) |
| Emitted when the visibility of a parameter has changed (from within SPLOM, not triggered if it was set from the outside via setParameterVisibility). | |
| void | selectionModified (iAScatterPlotViewData::SelectionType const &selInds) |
| Emitted when new data points are selected. Contains a list of selected data points. | |
Public Member Functions | |
| iAQSplom (QWidget *parent=nullptr) | |
| ~iAQSplom () | |
| void | addContextMenuAction (QAction *action) |
| add an additional option to the context menu | |
| size_t | colorLookupParam () const |
| parameter currently used for color lookup | |
| ColorMode | colorMode () const |
| get current coloring mode | |
| std::shared_ptr< iASPLOMData > | data () |
| retrieve SPLOM data | |
| void | enableSelection (bool enable) |
| set whether selections are allowed or not | |
| void | getActivePlotIndices (int *inds_out) |
| Get X and Y parameter indices of currently active scatter plot. | |
| iAColorTheme const * | getBackgroundColorTheme () |
| retrieve the theme for background colors for the separated regions | |
| void | loadSettings (QVariantMap const &iniFile) |
| load settings from given object | |
| std::shared_ptr< iALookupTable > | lookupTable () const |
| get lookup table | |
| void | saveSettings (QSettings &iniFile) const |
| store current settings into given object | |
| void | setBackgroundColorTheme (iAColorTheme const *theme) |
| define the color theme to use for coloring the different separated regions | |
| void | setColorParam (const QString ¶mName) |
| Set the parameter to color code, lookup table will be auto-determined (By Parameter) | |
| void | setColorParam (size_t colorLookupParam) |
| Set the parameter to color code, lookup table will be auto-determined (By Parameter) | |
| void | setColorParameterMode (ColorParameterMode paramMode) |
| Set mode how colors are applied from parameter. | |
| void | setColorThemeQual (QString const &themeName) |
| Call to adapt color theme used for coloring by a qualitative parameter. | |
| void | setData (std::shared_ptr< iASPLOMData > data, std::vector< char > const &visibility) |
| set SPLOM data directly. | |
| void | setLookupTable (iALookupTable &lut, size_t paramIndex) |
| Set lookup table given the index of a parameter to color-code. | |
| void | setLookupTable (vtkLookupTable *lut, const QString ¶mName) |
| Set lookup table from VTK (vtkLookupTable) given the name of a parameter to color-code. | |
| void | setParameterInverted (size_t paramIndex, bool isInverted) |
| whether to invert the axis for a given parameter's index. | |
| void | setParameterVisibility (const QString ¶mName, bool isVisible) |
| Show/hide scatter plots of a parameter given parameter's name. | |
| void | setParameterVisibility (size_t paramIndex, bool isVisible) |
| Show/hide scatter plots of a parameter given parameter's index. | |
| void | setParameterVisibility (std::vector< char > const &visibility) |
| Adapt visibility of all parameters at once. | |
| void | setPointColor (QColor const &color) |
| set the color for all data points | |
| void | setPointOpacity (double opacity) |
| set the opaci ty for all data points | |
| void | setPointRadius (double radius) |
| set the radius for scatter plot points | |
| void | setSelectionColor (QColor color) |
| set the color for selected points | |
| void | setSeparation (int idx) |
| define an index at which a separation margin is inserted | |
| void | showAllPlots (const bool enableAllPlotsVisible) |
| switch between showing all plots or only upper half | |
| void | showDefaultMaxizimedPlot () |
| maximize plot in upper left corner | |
| std::shared_ptr< iAScatterPlotViewData > | viewData () |
| int | visibleParametersCount () const |
| Get the number of parameters currently displayed. | |
Public Attributes | |
| Settings | settings |
Protected Slots | |
| virtual void | currentPointUpdated (size_t index) |
| When hovered over a new point. | |
Protected Member Functions | |
| void | changeActivePlot (iAScatterPlot *s) |
| void | clear () |
| Clear all scatter plots in the SPLOM. | |
| void | drawPlotLabels (QPainter &painter, bool switchXY) |
| virtual bool | drawPopup (QPainter &painter) |
| Draws popup on the splom. | |
| void | drawTicks (QPainter &painter, QList< double > const &ticksX, QList< double > const &ticksY, QList< QString > const &textX, QList< QString > const &textY) |
| Draw ticks for X and Y axes of all plots in the SPLOM. | |
| void | drawVisibleParameters (QPainter &painter) |
| draws label for the whole scatter plot matrix | |
| QRect | getMaxRect () |
| int | getMaxTickLabelWidth (QList< QString > const &textX, QFontMetrics &fm) const |
| Get the width of the longest tick label width. | |
| QRect | getPlotRectByIndex (int x, int y) |
| Get a rectangle of a plot by its indices. | |
| iAScatterPlot * | getScatterplotAt (QPoint pos) |
| Get a scatter plot at mouse position. | |
| int | invert (int val) const |
| Inverts parameter index. Used for inverting SPLOM Y indexing order. | |
| void | maximizeSelectedPlot (iAScatterPlot *selectedPlot) |
| shows a maximized preview of the selected plot | |
| void | paintEvent (QPaintEvent *event) override |
| void | removeMaximizedPlot () |
| Removes maximized plot. | |
| void | removeMaxPlotIfHidden () |
| Removes maximized plot if any of his parameters is hidden. | |
| void | resetTransform () |
| Resets transform in all plots of the matrix. | |
| void | updateMaxPlotRect () |
| Updates the rectangle of the maximized scatter plot. | |
| void | updatePlotGridParams () |
| Updates some parameters used for the matrix grid layout calculations. | |
| void | updateSPLOMLayout () |
| Updates SPLOM layout: every plot in the matrix + maximized plot (if exists). | |
| void | updateVisiblePlots () |
| Updates matrix using only plots that are currently visible. | |
| void | wheelEvent (QWheelEvent *event) override |
| Overrides of Qt event handlers. | |
| void | resizeEvent (QResizeEvent *event) override |
| void | mousePressEvent (QMouseEvent *event) override |
| void | mouseReleaseEvent (QMouseEvent *event) override |
| void | mouseMoveEvent (QMouseEvent *event) override |
| void | keyPressEvent (QKeyEvent *event) override |
| void | mouseDoubleClickEvent (QMouseEvent *event) override |
| void | contextMenuEvent (QContextMenuEvent *event) override |
Protected Attributes | |
| iAScatterPlot * | m_activePlot |
| scatter plot that user currently interacts with | |
| iAColorTheme const * | m_bgColorTheme |
| background colors for regions in the scatterplot | |
| size_t | m_colorLookupParam |
| index of the column to use for color lookup (TODO: Move to settings?) | |
| QMenu * | m_columnPickMenu |
| sub-menu of the context menu for picking which columns are visible | |
| QMenu * | m_contextMenu |
| the context menu (can be extended via addContextMenuAction) | |
| std::shared_ptr< iALookupTable > | m_lut |
| lookup table, shared with individual scatter plots | |
| std::vector< std::vector< iAScatterPlot * > > | m_matrix |
| cache for all scatter plots | |
| iAScatterPlot * | m_maximizedPlot |
| pointer to the maximized plot | |
| SPMMode | m_mode |
| SPLOM current state: all plots or upper triangle with maximized plot (TODO: Move to settings?) | |
| std::vector< char > | m_paramVisibility |
| array of individual parameter visibility | |
| double | m_popupHeight |
| height of the last drawn popup | |
| iAScatterPlot * | m_previewPlot |
| plot currently being previewed (shown in maximized plot) | |
| QPoint | m_scatPlotSize |
| size of one scatter plot in the layout | |
| int | m_separationIdx |
| index at which to separate scatterplots spatially (e.g. into in- and output parameters) | |
| std::shared_ptr< iASPLOMData > | m_splomData |
| contains raw data points used in SPLOM | |
| std::shared_ptr< iAScatterPlotViewData > | m_viewData |
| std::vector< size_t > | m_visibleIndices |
| stores mapping from visible plot index to parameter index | |
| std::vector< std::vector< iAScatterPlot * > > | m_visiblePlots |
| matrix of visible scatter plots | |
A scatter plot matrix (SPLOM) widget.
Multidimensional data points are shown using a grid of 2D scatter plots for each pair of dimensions. Each plot is interactive and user-transformations such as scaling and translating are possible using mouse wheel and right-button dragging correspondingly. When 'R' key is pressed all the transformations are reset to default. The user can also hover over points of any plot, to see a popup with detailed information about the point. When hovering over a point, it will be highlighted in all plots to allow interactive exploration. Any parameter of the data can be color-coded using a lookup table. Any scatter plot from an upper matrix triangle can be maximized by clicking a button in the upper-right corner. The maximized plot can be minimized by using a button in upper-right corner. Inherits Q[Open]GLWidget,manages scatter plots internally. Some customization options are available via the public settings member.
Usage:
Example (visibleWidget is some widget, currently shown, with a layout):
iAQSplom* splom = new iAQSplom(); visibleWidget->layout()->addWidget(splom); // ... you might want enable Qt to process a paint event here, to make sure the OpenGL context is created QSharedPoiner<iASPLOMData> splomData = createSPLOMDataSomehow(); splom->setData(splomData); iALookupTable lut; // we assume here you want all points colored in a middle gray; we set up a color lookoup table // over all values of column 0, and set the same color for the whole range // if you want to color the dots by an actual column value, adapt this to your own needs! lut.setRange( splomData->paramRange(0) ); lut.allocate(2); QColor CustomDotColor(128, 128, 128) lut.setColor( 0, CustomDotColor ); lut.setColor( 1, CustomDotColor ); splom->setLookupTable( lut, 0 );
| enum iAQSplom::ColorMode |
| enum iAQSplom::SPMMode |
| iAQSplom::iAQSplom | ( | QWidget * | parent = nullptr | ) |
| iAQSplom::~iAQSplom | ( | ) |
| void iAQSplom::addContextMenuAction | ( | QAction * | action | ) |
add an additional option to the context menu
|
protected |
|
signal |
Emitted when a point in the chart is clicked (and no selection or fixed point selection happened)
|
protected |
Clear all scatter plots in the SPLOM.
| size_t iAQSplom::colorLookupParam | ( | ) | const |
parameter currently used for color lookup
| iAQSplom::ColorMode iAQSplom::colorMode | ( | ) | const |
get current coloring mode
|
overrideprotected |
|
signal |
Emitted when hovered over a new point.
|
protectedvirtualslot |
When hovered over a new point.
| std::shared_ptr< iASPLOMData > iAQSplom::data | ( | ) |
retrieve SPLOM data
|
protected |
|
protectedvirtual |
Draws popup on the splom.
|
protected |
Draw ticks for X and Y axes of all plots in the SPLOM.
|
protected |
draws label for the whole scatter plot matrix
| void iAQSplom::enableSelection | ( | bool | enable | ) |
set whether selections are allowed or not
| void iAQSplom::getActivePlotIndices | ( | int * | inds_out | ) |
Get X and Y parameter indices of currently active scatter plot.
| iAColorTheme const * iAQSplom::getBackgroundColorTheme | ( | ) |
retrieve the theme for background colors for the separated regions
|
protected |
|
protected |
Get the width of the longest tick label width.
|
protected |
Get a rectangle of a plot by its indices.
|
protected |
Get a scatter plot at mouse position.
|
protected |
Inverts parameter index. Used for inverting SPLOM Y indexing order.
|
overrideprotected |
| void iAQSplom::loadSettings | ( | QVariantMap const & | iniFile | ) |
load settings from given object
| std::shared_ptr< iALookupTable > iAQSplom::lookupTable | ( | ) | const |
get lookup table
|
signal |
Emitted when the lookup table has changed.
|
protected |
shows a maximized preview of the selected plot
|
overrideprotected |
|
overrideprotected |
|
overrideprotected |
|
overrideprotected |
|
overrideprotected |
|
signal |
Emitted when the visibility of a parameter has changed (from within SPLOM, not triggered if it was set from the outside via setParameterVisibility).
|
slot |
Call when color range should be determined from parameter.
|
protected |
Removes maximized plot.
|
protected |
Removes maximized plot if any of his parameters is hidden.
|
protected |
Resets transform in all plots of the matrix.
|
overrideprotected |
| void iAQSplom::saveSettings | ( | QSettings & | iniFile | ) | const |
store current settings into given object
|
signal |
Emitted when new data points are selected. Contains a list of selected data points.
| void iAQSplom::setBackgroundColorTheme | ( | iAColorTheme const * | theme | ) |
define the color theme to use for coloring the different separated regions
| void iAQSplom::setColorParam | ( | const QString & | paramName | ) |
Set the parameter to color code, lookup table will be auto-determined (By Parameter)
| void iAQSplom::setColorParam | ( | size_t | colorLookupParam | ) |
Set the parameter to color code, lookup table will be auto-determined (By Parameter)
| void iAQSplom::setColorParameterMode | ( | ColorParameterMode | paramMode | ) |
Set mode how colors are applied from parameter.
|
slot |
Call to adapt color theme used for coloring by a continuous parameter.
| void iAQSplom::setColorThemeQual | ( | QString const & | themeName | ) |
Call to adapt color theme used for coloring by a qualitative parameter.
| void iAQSplom::setData | ( | std::shared_ptr< iASPLOMData > | data, |
| std::vector< char > const & | visibility ) |
set SPLOM data directly.
|
slot |
set whether to flip parameters in large scatterplot
|
slot |
set the number of histogram bins
|
slot |
set visibility of histograms
| void iAQSplom::setLookupTable | ( | iALookupTable & | lut, |
| size_t | paramIndex ) |
Set lookup table given the index of a parameter to color-code.
| void iAQSplom::setLookupTable | ( | vtkLookupTable * | lut, |
| const QString & | paramName ) |
Set lookup table from VTK (vtkLookupTable) given the name of a parameter to color-code.
| void iAQSplom::setParameterInverted | ( | size_t | paramIndex, |
| bool | isInverted ) |
whether to invert the axis for a given parameter's index.
| void iAQSplom::setParameterVisibility | ( | const QString & | paramName, |
| bool | isVisible ) |
Show/hide scatter plots of a parameter given parameter's name.
| void iAQSplom::setParameterVisibility | ( | size_t | paramIndex, |
| bool | isVisible ) |
Show/hide scatter plots of a parameter given parameter's index.
| void iAQSplom::setParameterVisibility | ( | std::vector< char > const & | visibility | ) |
Adapt visibility of all parameters at once.
| void iAQSplom::setPointColor | ( | QColor const & | color | ) |
set the color for all data points
| void iAQSplom::setPointOpacity | ( | double | opacity | ) |
set the opaci ty for all data points
| void iAQSplom::setPointRadius | ( | double | radius | ) |
set the radius for scatter plot points
| void iAQSplom::setSelectionColor | ( | QColor | color | ) |
set the color for selected points
|
slot |
set selection mode to either rectangle or polygon mode
| void iAQSplom::setSeparation | ( | int | idx | ) |
define an index at which a separation margin is inserted
| void iAQSplom::showAllPlots | ( | const bool | enableAllPlotsVisible | ) |
switch between showing all plots or only upper half
| void iAQSplom::showDefaultMaxizimedPlot | ( | ) |
maximize plot in upper left corner
|
slot |
Show the settings dialog.
|
protected |
Updates the rectangle of the maximized scatter plot.
|
protected |
Updates some parameters used for the matrix grid layout calculations.
|
protected |
Updates SPLOM layout: every plot in the matrix + maximized plot (if exists).
|
protected |
Updates matrix using only plots that are currently visible.
| std::shared_ptr< iAScatterPlotViewData > iAQSplom::viewData | ( | ) |
| int iAQSplom::visibleParametersCount | ( | ) | const |
Get the number of parameters currently displayed.
|
overrideprotected |
Overrides of Qt event handlers.
|
protected |
scatter plot that user currently interacts with
|
protected |
background colors for regions in the scatterplot
|
protected |
index of the column to use for color lookup (TODO: Move to settings?)
|
protected |
sub-menu of the context menu for picking which columns are visible
|
protected |
the context menu (can be extended via addContextMenuAction)
|
protected |
lookup table, shared with individual scatter plots
|
protected |
cache for all scatter plots
|
protected |
pointer to the maximized plot
|
protected |
SPLOM current state: all plots or upper triangle with maximized plot (TODO: Move to settings?)
|
protected |
array of individual parameter visibility
|
protected |
height of the last drawn popup
|
protected |
plot currently being previewed (shown in maximized plot)
|
protected |
size of one scatter plot in the layout
|
protected |
index at which to separate scatterplots spatially (e.g. into in- and output parameters)
|
protected |
contains raw data points used in SPLOM
|
protected |
|
protected |
stores mapping from visible plot index to parameter index
|
protected |
matrix of visible scatter plots
| Settings iAQSplom::settings |