linestyle problem while using plot.

David Bateman adb014 at gmail.com
Sat May 31 01:10:28 CDT 2008


Jinzhi Lei wrote:
> Hi, all,
> 
> I'm new to  Octave, and have a problem while I try to use plot. It seems
> that the
> 'linestyle' option doesn't work with plot at it does in matlab.
> 
> I use
> 
> plot(X,Y,'linestyle','--');
> print -deps test.eps;
> 
> to plot the curve and export to the file test.eps. However, when I open
> test.eps, the curve is not plot in dashed line, but a solid line.
> 
> When I plot two curves as follows:
> 
> hold on;
> plot(X,Y,'r-');
> plot(X,Y,'b-');
> print -deps test.eps;
> 
> the second curve always appear as dashed curve. 
> 
> It seems that I can't control the line style by myself. If any one an
> tell me how to resolve this problem? Thanks.
> 

There is the following comment in scripts/plot/__go_draw_axes__.m

    ## FIXME -- linetype is currently broken, since it disables the
    ## gnuplot default dashed and solid linestyles with the only
    ## benefit of being able to specify '--' and get a single sized
    ## dashed line of identical dash pattern for all called this way.
    ## All dash patterns are a subset of "with lines" and none of the
    ## lt specifications will correctly propagate into the x11 terminal
    ## or the print command.   Therefore, it is currently disabled in
    ## order to allow print (..., "-dashed") etc. to work correctly.

    ##    if (! isempty (lt))
    ##      fprintf (plot_stream, " linetype %s", lt);
    ##      found_style = true;
    ##    endif

so this feature is disabled and doesn't work in a x11 terminal in any
case. As suggested in the comment use the "-dashed' option to the print
command.

D.


More information about the Help-octave mailing list