plot
->setAxisScale
(QwtPlot::yRight,
0.0,
(double) largestBin
);
plot->setAxisScale(QwtPlot::yRight, 0.0, (double) largestBin);
To copy to clipboard, switch view to plain text mode
grid->enableXMin(true);
grid
->setMajPen
(QPen(Qt
::gray,
0, Qt
::DotLine));
grid
->setMinPen
(QPen(Qt
::lightGray,
0 , Qt
::DotLine));
grid->attach(plot);
grid->setZ(5);
spectrogram->setRenderThreadCount( 0 );
spectrogram->setColorMap( new ColorMap() );
spectrogram
->setYAxis
(QwtPlot::yLeft);
spectrogram
->setRenderHint
(QwtPlotItem::RenderAntialiased);
plot
->setAxisMaxMajor
(QwtPlot::xBottom,
8);
plot
->setAxisMaxMinor
(QwtPlot::xBottom,
10);
plot
->setAxisScale
(QwtPlot::xBottom, 1e
-16, 1e
-8
);
plot
->setAxisAutoScale
( QwtPlot::yLeft );
// Y bins... (X bins handled by histogram class)
double minSize = 0.300;
double maxSize = 10.0;
double sizeGranularity = 0.100;
double sizeBin = sizeGranularity/2.0;
int nSizes = qCeil((maxSize - minSize) / sizeBin);
double largestBin = 0.0;
QVector<Histogram *> *hists = new QVector<Histogram *>();
for(int i=0;i < nSizes; i++ ) {
hists->append(new Histogram() );
}
/* [ load data in hists, find largest bin, clipped for brevity ...] */
layout->addWidget(plot);
m_rightAxis->setEnabled(true);
HistData *data = new HistData();
data->setData(hists);
spectrogram->setData( data );
spectrogram->attach( plot );
QList<double> contourLevels;
for ( double level = 0.5; level < 110.0; level += 15.0 )
contourLevels += level;
spectrogram->setContourLevels( contourLevels );
spectrogram
->setDefaultContourPen
( QPen() );
const QwtInterval zInterval = spectrogram->data()->interval(Qt::ZAxis);
m_rightAxis->setColorMap(zInterval, new ColorMap());
plot
->setAxisScale
(QwtPlot::yRight,
0.0,
(double) largestBin
);
plot->plotLayout()->setAlignCanvasToScales( true );
plot->replot();
dlg.show();
dlg.exec();
QDialog dlg;
QVBoxLayout *layout = new QVBoxLayout(&dlg);
QwtPlot *plot = new QwtPlot();
QwtPlotGrid *grid = new QwtPlotGrid();
grid->enableXMin(true);
grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine));
grid->setMinPen(QPen(Qt::lightGray, 0 , Qt::DotLine));
grid->attach(plot);
grid->setZ(5);
QwtPlotSpectrogram *spectrogram = new QwtPlotSpectrogram();
spectrogram->setRenderThreadCount( 0 );
spectrogram->setColorMap( new ColorMap() );
spectrogram->setYAxis(QwtPlot::yLeft);
spectrogram->setRenderHint(QwtPlotItem::RenderAntialiased);
plot->setAxisMaxMajor(QwtPlot::xBottom, 8);
plot->setAxisMaxMinor(QwtPlot::xBottom, 10);
plot->setAxisScaleEngine(QwtPlot::xBottom, new QwtLog10ScaleEngine());
plot->setAxisScale(QwtPlot::xBottom, 1e-16, 1e-8);
plot->setAxisAutoScale( QwtPlot::yLeft );
// Y bins... (X bins handled by histogram class)
double minSize = 0.300;
double maxSize = 10.0;
double sizeGranularity = 0.100;
double sizeBin = sizeGranularity/2.0;
int nSizes = qCeil((maxSize - minSize) / sizeBin);
double largestBin = 0.0;
QVector<Histogram *> *hists = new QVector<Histogram *>();
for(int i=0;i < nSizes; i++ ) {
hists->append(new Histogram() );
}
/* [ load data in hists, find largest bin, clipped for brevity ...] */
layout->addWidget(plot);
QwtScaleWidget * m_rightAxis = plot->axisWidget(QwtPlot::yRight);
m_rightAxis->setEnabled(true);
HistData *data = new HistData();
data->setData(hists);
spectrogram->setData( data );
spectrogram->attach( plot );
spectrogram->setDisplayMode(QwtPlotSpectrogram::ImageMode, true);
QList<double> contourLevels;
for ( double level = 0.5; level < 110.0; level += 15.0 )
contourLevels += level;
spectrogram->setContourLevels( contourLevels );
spectrogram->setDefaultContourPen( QPen() );
spectrogram->setDisplayMode(QwtPlotSpectrogram::ContourMode, true);
const QwtInterval zInterval = spectrogram->data()->interval(Qt::ZAxis);
m_rightAxis->setColorMap(zInterval, new ColorMap());
plot->setAxisScale(QwtPlot::yRight, 0.0, (double) largestBin);
plot->enableAxis(QwtPlot::yRight);
plot->plotLayout()->setAlignCanvasToScales( true );
plot->replot();
dlg.show();
dlg.exec();
To copy to clipboard, switch view to plain text mode
Bookmarks