Public Slots | Public Member Functions | Protected Member Functions | Protected Attributes

DGVPlot Class Reference

This class handles 1D plots of data using Qwt. More...

#include <DGVPlot.h>

List of all members.

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

Detailed Description

This class handles 1D plots of data using Qwt.

Author:
Shekhar S. Chandra, 2008-2009

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.


Constructor & Destructor Documentation

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.


Member Function Documentation

void DGVPlot::contextMenuEvent ( QContextMenuEvent *  event  )  [protected, virtual]

Setup Save action

Labels

Setup Close action

Definition at line 430 of file DGVPlot.cpp.

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.

Todo:
Bug: Saves plots in monochrome only. Works ok in Linux though.

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.

void DGVPlot::setData ( Array< imageType, 1 > &  xData,
Array< imageType, 1 > &  yData 
)

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::setRenderAntialiased (  )  [inline]

Definition at line 129 of file DGVPlot.h.

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.


Member Data Documentation

bool DGVPlot::antialiased [protected]

Definition at line 208 of file DGVPlot.h.

QAction* DGVPlot::closeAct [protected]

Closes window.

Definition at line 206 of file DGVPlot.h.

Array<QwtPlotCurve*, 1> DGVPlot::curves [protected]

Definition at line 214 of file DGVPlot.h.

bool DGVPlot::linePlot [protected]

Is plot shown a line plot?

Definition at line 192 of file DGVPlot.h.

QAction* DGVPlot::linePlotAct [protected]

toggle line plot to point plot?

Definition at line 202 of file DGVPlot.h.

bool DGVPlot::loaded [protected]

Data loaded into arrays.

Definition at line 191 of file DGVPlot.h.

QString DGVPlot::name [protected]

Name of the plot.

Definition at line 190 of file DGVPlot.h.

int DGVPlot::plotSize [protected]

Definition at line 212 of file DGVPlot.h.

QAction* DGVPlot::refreshAct [protected]

Renames window.

Definition at line 205 of file DGVPlot.h.

QAction* DGVPlot::renameAct [protected]

Renames window.

Definition at line 204 of file DGVPlot.h.

QAction* DGVPlot::saveAct [protected]

Saves window.

Definition at line 195 of file DGVPlot.h.

QAction* DGVPlot::titleAct [protected]

Title.

Definition at line 199 of file DGVPlot.h.

Array< Array<imageType,1>, 1 > DGVPlot::xArray [protected]

Definition at line 210 of file DGVPlot.h.

QAction* DGVPlot::xLabelAct [protected]

x label

Definition at line 197 of file DGVPlot.h.

QAction* DGVPlot::xScaleAct [protected]

x rescale

Definition at line 200 of file DGVPlot.h.

Array< Array<imageType,1>, 1 > DGVPlot::yArray [protected]

Definition at line 211 of file DGVPlot.h.

QAction* DGVPlot::yLabelAct [protected]

y label

Definition at line 198 of file DGVPlot.h.

QAction* DGVPlot::yScaleAct [protected]

y rescale

Definition at line 201 of file DGVPlot.h.


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