cod3monk3y
cod3monk3y

Reputation: 9843

Axes but no lines when printing plot in Octave for windows

When attempting to print a plot to .png in Octave 3.8.1.1 on Windows 8 64-bit, the axes plot, but the line I'm plotting won't print. The plot I'm creating is:

> t = 0:0.1:6.28318;
> plot (t, sin(t));
> print figure.png

The resulting plot:

enter image description here

And the image saved to disk:

enter image description here

So the axes are showing up fine, but the line I've plotted is completely missing!

I have gs9.09 (win32) installed, with epstool win32 copied into gs's /bin directory, which is being set in my %HOMEPATH%\.octaverc as:

cmd_path = getenv ("path");
gs_path = 'C:\Programs\gs\gs9.09\bin';
if (isempty (strfind (cmd_path, gs_path)))
   setenv ('path', strcat (cmd_path, pathsep (), gs_path));
endif

I am running the windows GUI version via w8-octave-gui.bat.

EDIT On a fresh launch with the following commands to set gnuplot as the graphics toolkit before launching any plots (from @Andy's comments), I get a blank white image for all images without -dpngalpha (1, 2, 4, 5) and completely transparent images with no content for images with -dpngalpha (3, 6):

>> graphics_toolkit("gnuplot");
>> graphics_toolkit()
ans = gnuplot
>> t = 0:0.1:6.3;
>> plot(t,sin(t));
>> print ("1.png");
>> print ("-dpng", "2.png");
>> print ("-dpngalpha", "3.png");
>> axis("off");
>> print ("4.png");
>> print ("-dpng", "5.png");
>> print ("-dpngalpha", "6.png");

Halp!

Upvotes: 10

Views: 4684

Answers (2)

Matthias Zilk
Matthias Zilk

Reputation: 81

I encountered the same problem.

For me the solution was bypassing the system graphics driver and switching to OpenGL software rendering with Mesa. To achieve this I downloaded the windows binary of Mesa that is linked on http://qt-project.org/wiki/Cross-compiling-Mesa-for-Windows and copied the included opengl32.dll into octave's bin directory. Afterwards the print command worked fine.

The Mesa binary from the link above is built with LLVMpipe and seems to run reasonably fast.

Upvotes: 0

Andy
Andy

Reputation: 8091

Looks like you've hit this bug: https://savannah.gnu.org/bugs/?42534

I know you answered to juliohm's comment that switching to gnuplot doesn't has an effect but I can't believe this. You have to execute graphics_toolkit("gnuplot") before any command which creates a plot figure. To be sure you can run "close all" before.

The reason for your problem is possibly that the line is printed behind the white background due to some rounding errors in the z-depth. Can you please try EDIT: these command when graphics_toolkit fltk is enabled (should be the case with a default install and a fresh start):

t = 0:0.1:6.28318;
plot (t, sin(t));
axis ("off");
print ("-dpngalpha", "out.png")

to verify this? This doesn't solve your problem but helps the Octave maintainers to find the problem.

Upvotes: 2

Related Questions