This class handles 1D plots of data using Qwt. More...
#include <DGVPlot.h>
Public Slots | |
void | save () |
Saves the plot. | |
void | xLabel () |
Ask for x-label. | |
void | yLabel () |
Ask for y-label. | |
void | titleLabel () |
Ask for title label. | |
void | rescaleAxis (const int axis) |
Rescale axis. | |
void | rescaleXAxis () |
Rescale x-axis. | |
void | rescaleYAxis () |
Rescale y-axis. | |
void | toggleLinePlot () |
Toggles whether plot is a line or points plot. | |
void | renameData () |
Renames the plot data. | |
Public Member Functions | |
DGVPlot (QWidget *parent=0) | |
virtual | ~DGVPlot () |
The standard destructor. | |
void | setName (QString filename) |
Sets the name of the plot. | |
void | setToLinePlot (bool lines) |
Sets the style of the plot to lines (true) or points/dots (false). | |
void | setData (Array< imageType, 1 > &xData, Array< imageType, 1 > &yData) |
Sets the data for the plot. Call generatePlot() after this to create the plot. | |
void | setData (Array< Array< imageType, 1 >, 1 > &xData, Array< Array< imageType, 1 >, 1 > &yData) |
Sets the data for the plot. Call generatePlot() after this to create the plot. | |
virtual void | createCurvePlots (Array< Array< imageType, 1 >, 1 > &xData, Array< Array< imageType, 1 >, 1 > &yData, QString plotTitle) |
Creates curve plots of the rows of data provided. | |
virtual void | createCurvePlot (Array< imageType, 1 > xData, Array< imageType, 1 > yData, QString plotTitle) |
void | generatePlot () |
Generates the plot from the stored data. | |
bool | loadGNU (QString filename) |
Loads a 2D GNU Plot data file. | |
bool | saveGNU (QString filename) |
Saves the data as a 2D GNU Plot data file. | |
void | setRenderAntialiased () |
QString | strippedName () |
Returns the stripped (path removed) name of the plot. | |
QString | strippedNamePrefix () |
Returns the stripped (path removed) name of the plot with "Plot" prefix. | |
Protected Member Functions | |
virtual void | contextMenuEvent (QContextMenuEvent *event) |
Protected Attributes | |
QString | name |
Name of the plot. | |
bool | loaded |
Data loaded into arrays. | |
bool | linePlot |
Is plot shown a line plot? | |
QAction * | saveAct |
Saves window. | |
QAction * | xLabelAct |
x label | |
QAction * | yLabelAct |
y label | |
QAction * | titleAct |
Title. | |
QAction * | xScaleAct |
x rescale | |
QAction * | yScaleAct |
y rescale | |
QAction * | linePlotAct |
toggle line plot to point plot? | |
QAction * | renameAct |
Renames window. | |
QAction * | refreshAct |
Renames window. | |
QAction * | closeAct |
Closes window. | |
bool | antialiased |
Array< Array< imageType, 1 >, 1 > | xArray |
Array< Array< imageType, 1 >, 1 > | yArray |
int | plotSize |
Array< QwtPlotCurve *, 1 > | curves |
This class handles 1D plots of data using Qwt.
It handles multiple 1D plots on the same plot and uses a generated scale and legend.
Usage Example 1:
DGVPlot *rowPlot = new DGVPlot; Array<double,1> uniqueRow(prime), op(prime); firstIndex x; int prime = 13; uniqueRow = sin(4.0*x/prime); op = x; rowPlot->setName("Nth Ghost"); rowPlot->createCurvePlot(op,uniqueRow,"Nth Ghost"); rowPlot->show();
Usage Example 2:
DGVPlot *rowPlot = new DGVPlot; Array<double,1> uniqueRow(prime), op(prime); firstIndex x; int prime = 13; uniqueRow = sin(4.0*x/prime); op = x; rowPlot->setName("Nth Ghost"); rowPlot->setData(op,uniqueRow); rowPlot->generatePlot(); rowPlot->show();
If memory conscious, use example 1 instead of example 2.
Definition at line 70 of file DGVPlot.h.
DGVPlot::DGVPlot | ( | QWidget * | parent = 0 |
) |
Definition at line 37 of file DGVPlot.cpp.
DGVPlot::~DGVPlot | ( | ) | [virtual] |
The standard destructor.
Definition at line 52 of file DGVPlot.cpp.
void DGVPlot::contextMenuEvent | ( | QContextMenuEvent * | event | ) | [protected, virtual] |
void DGVPlot::createCurvePlot | ( | Array< imageType, 1 > | xData, | |
Array< imageType, 1 > | yData, | |||
QString | plotTitle | |||
) | [virtual] |
Definition at line 127 of file DGVPlot.cpp.
void DGVPlot::createCurvePlots | ( | Array< Array< imageType, 1 >, 1 > & | xData, | |
Array< Array< imageType, 1 >, 1 > & | yData, | |||
QString | plotTitle | |||
) | [virtual] |
Creates curve plots of the rows of data provided.
Definition at line 97 of file DGVPlot.cpp.
void DGVPlot::generatePlot | ( | ) |
Generates the plot from the stored data.
Definition at line 153 of file DGVPlot.cpp.
bool DGVPlot::loadGNU | ( | QString | filename | ) |
Loads a 2D GNU Plot data file.
Definition at line 161 of file DGVPlot.cpp.
void DGVPlot::renameData | ( | ) | [slot] |
Renames the plot data.
Definition at line 357 of file DGVPlot.cpp.
void DGVPlot::rescaleAxis | ( | const int | axis | ) | [slot] |
Rescale axis.
Definition at line 367 of file DGVPlot.cpp.
void DGVPlot::rescaleXAxis | ( | ) | [slot] |
Rescale x-axis.
Definition at line 391 of file DGVPlot.cpp.
void DGVPlot::rescaleYAxis | ( | ) | [slot] |
Rescale y-axis.
Definition at line 396 of file DGVPlot.cpp.
void DGVPlot::save | ( | ) | [slot] |
Saves the plot.
Definition at line 266 of file DGVPlot.cpp.
bool DGVPlot::saveGNU | ( | QString | filename | ) |
Saves the data as a 2D GNU Plot data file.
Definition at line 224 of file DGVPlot.cpp.
Sets the data for the plot. Call generatePlot() after this to create the plot.
Definition at line 68 of file DGVPlot.cpp.
void DGVPlot::setData | ( | Array< Array< imageType, 1 >, 1 > & | xData, | |
Array< Array< imageType, 1 >, 1 > & | yData | |||
) |
Sets the data for the plot. Call generatePlot() after this to create the plot.
Definition at line 81 of file DGVPlot.cpp.
void DGVPlot::setName | ( | QString | filename | ) |
Sets the name of the plot.
Definition at line 57 of file DGVPlot.cpp.
void DGVPlot::setToLinePlot | ( | bool | lines | ) | [inline] |
Sets the style of the plot to lines (true) or points/dots (false).
Definition at line 63 of file DGVPlot.cpp.
QString DGVPlot::strippedName | ( | ) |
Returns the stripped (path removed) name of the plot.
Definition at line 420 of file DGVPlot.cpp.
QString DGVPlot::strippedNamePrefix | ( | ) |
Returns the stripped (path removed) name of the plot with "Plot" prefix.
Definition at line 425 of file DGVPlot.cpp.
void DGVPlot::titleLabel | ( | ) | [slot] |
Ask for title label.
Definition at line 347 of file DGVPlot.cpp.
void DGVPlot::toggleLinePlot | ( | ) | [slot] |
Toggles whether plot is a line or points plot.
Definition at line 401 of file DGVPlot.cpp.
void DGVPlot::xLabel | ( | ) | [slot] |
Ask for x-label.
Definition at line 327 of file DGVPlot.cpp.
void DGVPlot::yLabel | ( | ) | [slot] |
Ask for y-label.
Definition at line 337 of file DGVPlot.cpp.
bool DGVPlot::antialiased [protected] |
QAction* DGVPlot::closeAct [protected] |
Array<QwtPlotCurve*, 1> DGVPlot::curves [protected] |
bool DGVPlot::linePlot [protected] |
QAction* DGVPlot::linePlotAct [protected] |
bool DGVPlot::loaded [protected] |
QString DGVPlot::name [protected] |
int DGVPlot::plotSize [protected] |
QAction* DGVPlot::refreshAct [protected] |
QAction* DGVPlot::renameAct [protected] |
QAction* DGVPlot::saveAct [protected] |
QAction* DGVPlot::titleAct [protected] |
Array< Array<imageType,1>, 1 > DGVPlot::xArray [protected] |
QAction* DGVPlot::xLabelAct [protected] |
QAction* DGVPlot::xScaleAct [protected] |
Array< Array<imageType,1>, 1 > DGVPlot::yArray [protected] |
QAction* DGVPlot::yLabelAct [protected] |
QAction* DGVPlot::yScaleAct [protected] |