help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Print Plot Results in all Black plot in file


From: Ben Abbott
Subject: Re: Print Plot Results in all Black plot in file
Date: Tue, 04 Aug 2015 15:36:23 -0400

> On Aug 4, 2015, at 3:56 AM, Thomas D. Dean <address@hidden> wrote:
> 
> On 08/04/15 00:16, Dmitri A. Sergatskov wrote:
>> On Tue, Aug 4, 2015 at 12:41 AM, Thomas D. Dean <address@hidden
>> <mailto:address@hidden>> wrote:
>> 
>> 
>>    I am struggling thru the code for print.
>> 
>>    Is there a global value that can be set to control the output of print.
>> 
>>    octave:> z=1:.1:pi;
>>    octave:> plot(z,sin(z));
>>    octave:> print("sin.png","-dpngcairo");
>> 
>>    works.
>> 
>>    Without -dpngcairo opts.devopt gets set to "-dpng" and print
>>    produces a black square.
>> 
>>    It looks like the opts structure is passed to gnuplot in
>>    __gnuplot_print__.m.  As a work-around, I patched this file to force
>>    pngcairo.  Not a solution, just makes lots of scripts work, again.
>> 
>>    I don't see any global mechanism to set a default print device.
>> 
>>    True?
>> 
>> 
>> 
>> ​A quick and dirty hack is to add a line
>> 
>> ​ if (strfind (opts.devopt, "png")) opts.devopt = "pngcairo" ; endif
>> 
>> near the top of function print in "print.m"
>> 
>> (while you at it you can also similarly override pdf with pdfcairo
>>   (and postscript with epscairo, but that require some extra
>> modifications))
> 
> Thanks, that is a better temporary fix than mine.  I want to stay with 
> gnuplot 5.1 for other reasons.  So far, after making the patch, I have not 
> found any problems.
> 
> > hg diff
> diff -r 011a364b4d78 scripts/plot/util/print.m
> --- a/scripts/plot/util/print.m Fri Jun 05 15:51:04 2015 -0400
> +++ b/scripts/plot/util/print.m Tue Aug 04 00:50:01 2015 -0700
> @@ -287,6 +287,14 @@
> 
>   opts = __print_parse_opts__ (varargin{:});
> 
> +  if (strfind (opts.devopt, "png"))
> +    opts.devopt = "pngcairo" ;
> +  elseif (strfind (opts.devopt, "pdf"))
> +    opts.devopt = "pdfcairo" ;
> +  elseif (strfind (opts.devopt, "eps"))
> +    opts.devopt = "epscairo" ;
> +  endif
> +
>   opts.pstoedit_cmd = @pstoedit;
>   opts.fig2dev_cmd = @fig2dev;
>   opts.latex_standalone = @latex_standalone;
> 
> Tom Dean

Can a changeset be constructed that either …

(1) Favors the cairo terminals in favor of the others by using 
__gnuplot_has_terminal__() to check that the cairo terminal is available?

or

(2) Favors the cairo terminals in favor of the others by checking the version 
of gnuplot in __gnuplot_has_feature__ and adding a has_cairo_terminals feature.

Ben





reply via email to

[Prev in Thread] Current Thread [Next in Thread]