View Full Version : Problem saving a plot

9th July 2008, 17:41

I'm saving a plot to an image file using the QwtPlot print function.
The problem is that the saved image has a bad black margin (see the image attached).

This is the code I'm using to save the plot image. I'm using Qt 3.3.7 on Windows

void MyPlot::savePlot(const QString &sOutputFilename, int w, int h)
// get the plot pixmap
QPixmap plotPxm(w, h);

plotPxm.save(sOutputFilename, "PNG");

How can I solve the problem?

Thank you in advance for your help.

9th July 2008, 19:03
a) I recommend to export into better formats like PDF or SVG ( without using a pixmap in between).
b) Your pixmap is not initialized. Add plotPxm.fill(...) before you print on it.


10th July 2008, 08:31
Uwe, Thank you very much for your hint, it works!

I tried to save the plot is SVG and it looks better, but unfortunatly I need to save it as a JPEG/PNG image, so I have to leave it the way it is now.

Thanks again!