I tried to save a plot as a jpeg-file: "plotwindow->SavePlot(wxT("jpeg"), filename);" but it fails (applicaton aborts). Using png-file format works fine: "plotwindow->SavePlot(wxT("png"), filename);". I've also tried to use wxT("jpg") but without success. Do I have to enable a jpeg-driver or something like this?
you're using the wxPLplotwindow class, do you? I just had a look at it, and this method is using the driver/devices provided by PLplot (the wxwidgets driver could also use the image output formats provided by wxWidgets, but this will be added in later releases). Anyway, the png and jpeg driver are provided by the gd driver (using libgd). Since png output works I assume, that the gd driver is compiled by cmake, but somehow not the jpeg device turned on. After you run cmake, there is some output (summary) of all important flags and there is also a list of all drivers enabled and devices provided. Could you have a look there, if jpeg (and gd) is one of them?
yes I'm using the wxPlplotwindow class. Here is a part of the cmake-output:
But I can not see why png-driver works and jpeg-driver not.
that's actually quite strange. You don't have even the gd driver included, so the png device shouldn't work as well. Anyway, the wxwidgets driver itself has already a better SavePlot function, the bindings could be enhanced accordingly. Copy the SavePlot() function from drivers/wxwidgets_app.cpp (line 353) to bindings/wxPlplotwindow.cpp and also change wxPlplotwindow.h accordingly. This function uses the available imagehandler provided by wxWidgets to save the plot. So you got a lot of options (btw, actually you shouldn't use jpeg for plots, since the quality sucks, png i lossless here and much better). You must recompile plplot then. I'll do the same for the latest svn, but this might take a while and it should work by just doing this small changes. It might error out if you use a wrong devicename (and close you application), this will be addressed in my changes.
I have done the changes you proposed and jpg-output basically works. But there remain some problems. For example in my plot I changed the backgroundcolor to white an the jpg-output still keeps the default color black. Perhaps I can solve those problems. Thank you very much.
You could add plclear() at the beginning of your plot. I'm not sure right now, if plreplot() also "remembers" plclear() calls, but you could try. Problem is, that the canvas is cleared in plbop() which is not called if you replot the buffer. Alternatively you could clear the background yourself in background color in Saveplot(). This is a hack, but I'm working on plplot buffer improvements. Needs some time.