Hi,
I have an application which displays a stack of QwtPlotSpectrograms that I’d like to export as PNG or other image formats. Since the underlying data is really raster based, I’d be fine with going through the data array myself and setting each and every pixel directly to a PNG QImage. There should not be any stretching or resizing be necessary.
The problem is, that it is getting more and more complicated the more (semi-transparent) spectrograms I use, just because then I will have to recalculate the colour and all the stuff that has already been done by the QwtPlot.
I’ve read through “Saving qwt plot as image†and adapted one of the solutions
pixmap.fill(Qt::white);
filter.setOptions(options);
qwt_plot->print(pixmap, image);
QImage image(600, 600, QImage::Format_ARGB32);
pixmap.fill(Qt::white);
QwtPlotPrintFilter filter;
int options = QwtPlotPrintFilter::PrintAll;
options &= ~QwtPlotPrintFilter::PrintBackground;
options &= ~QwtPlotPrintFilter::PrintFrameWithScales;
options &= ~QwtPlotPrintFilter::PrintMargin;
options &= ~QwtPlotPrintFilter::PrintTitle;
options &= ~QwtPlotPrintFilter::PrintLegend ;
options &= ~QwtPlotPrintFilter::PrintGrid;
filter.setOptions(options);
qwt_plot->print(pixmap, image);
To copy to clipboard, switch view to plain text mode
However, I find no way to disable the axes or the colour bar. What do I need to do in order to have the plain plot without any surrounding extras? (See the attached file.)
In the documentation it says that QwtPlotPrintFilter is outdated, so I guess there should be a better way to do this.
Another thing that you can see in the attached image is, that the x and y axes go from 0 to 70, so there is some unfilled space between 64 an 70 on each coordinate. How can I tell QwtPlot that these axes should really only go to 64? (Edit note: I think, I’ve been able to fix this subproblem with a simple setAxisScale)
(And, while I’m at it: Can one have two colour bars next to each other? Looking at the documentation, I feel this is not possible but maybe it is…?)
Many thanks.
Bookmarks