PDA

View Full Version : Problem saving a plot



kalos80
9th July 2008, 18:41
Hi,

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);
print(plotPxm);

plotPxm.save(sOutputFilename, "PNG");
}



How can I solve the problem?

Thank you in advance for your help.

Uwe
9th July 2008, 20: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.

HTH,
Uwe

kalos80
10th July 2008, 09: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!