Octave 3.1.55: printing to pdf

Ben Abbott bpabbott at mac.com
Sun Apr 5 12:12:42 CDT 2009


On Apr 5, 2009, at 3:47 AM, Petr Mikulik wrote:

> Printing to pdf (via gnuplot backend) is broken in Octave 3.1.55  
> even though
> gnuplot accepts "set term pdf" via "pdfcairo" terminal.
>
>
>> plot(1:100); print a.pdf -dpdf
>
> error: gnuplot_drawnow: the gnuplot terminal, "pdf", is not available.
> error: called from:
> error:
> /opt/octave/octave-3.1.55/share/octave/3.1.55/m/plot/ 
> gnuplot_drawnow.m at
> line 72, column 7
>
>
> It seems that gnuplot_drawnow.m requires exact match of terminal  
> names in
> 3.1.55. However, gnuplot names the pdf terminal "pdf" or "pdfcairo"
> according to the library it was compiled against. In both cases "set  
> term
> pdf" works.
>
> I think gnuplot_drawnow.m should test presence of "pdfcairo" if  
> "pdf" has
> not been found.
>
> If I try
> 	print zz.png -dpngcairo
> 	print zz.pdf -dpdfcairo
> it produces these two files:
> 	pngcairo:zz.png
> 	pdfcairo:zz.pdf
> Why the prefix there?
>
> ---
> PM

Petr,

For "set term png" if there is no "png" present does gnuplot  
substitute "pngcairo" as well?

I notice the cairo terminals default options are different from the  
non-cairo terminals. Specifically, there is no default font-name  
specified, in GPVAL_TERMOPTIONS, for the cairo terminals. This will  
interfere with the rendering of different font-sizes when the  
anonymous font-name "*" is associated to an Octave text object.

The prefixes "pngcairo" and "pdfcairo" prefixes are due to how print.m  
has been implemented.

When the specified device does not match an explicit list, Octave  
assumes that "convert" is to be used to convert the image to the  
specified format. Octave uses eps as the basis for converting to other  
formats.

As "pdfcairo" and "pngcairo" are not presently among the devices  
supported by Ocave, the current implementation relies upon  
"convert" ... which is obviously not what you intend, and does not  
produce a sensible result.

In any event, I'm planning to add support the Lua/TikZ terminal soon.  
It would make sense for me to include the cairo terminals as well.

Ben



More information about the Bug-octave mailing list