Octave, how to save the graph schedule?

I need to keep the plot. This is my code, which I do not know why it does not work.

hold on; plot(x1, y2) plot(x1, y2) print -djpg image.jpg 

The line in the output on the screen is correct, but the result in the file is different: it only stores an empty image of the image without my dots.

This is my output in the file: enter image description here

+7
image save plot octave
source share
1 answer

I had the same problem with the latest Octave (3.8.1). This issue comes from GhostScript, not from Octave. There is a font management error.

To make sure, check your console after you try to print if this error is output (along with a lot more information):

 GPL Ghostscript 8.63: Unrecoverable error, exit code 1 

If this is the case, try this:

 set (0, "defaultaxesfontname", "Helvetica") % this is the line to add BEFORE plotting hold on; plot(x1, y2) plot(x1, y2) print -djpg image.jpg 

This will fix the problem by installing a font that GhostScript can handle without any problems. Please note: if you have already built the drawing, you will have to close it and execute it after setting defaultaxesfontname.

Source: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=710272

+8
source share

All Articles