Mirrored tics and borders when box is off.

David Bateman adb014 at gmail.com
Sun Dec 16 14:23:09 CST 2007


Peter A. Gustafson wrote:
> Hi,
> 
> Consider the following:
> 
> fplot("sin",[0 2*pi]);
> set(gca(),"yaxislocation","right","box","off");
> set(gca(),"xaxislocation","top","box","off");
> 
> It creates improper tics and border in the current cvs 2.9.19+.
> 
> Please consider the attached patch which fixed the problem for me.  I don't 
> think it breaks anything... perhaps David could have a look since he has been 
> making a lot of these changes.  Thanks,
> 
> Pete Gustafson
> 
> 
> ------------------------------------------------------------------------
> 
> Index: scripts/plot/__go_draw_axes__.m
> ===================================================================
> RCS file: /cvs/octave/scripts/plot/__go_draw_axes__.m,v
> retrieving revision 1.95
> diff -u -r1.95 __go_draw_axes__.m
> --- scripts/plot/__go_draw_axes__.m	14 Dec 2007 17:42:55 -0000	1.95
> +++ scripts/plot/__go_draw_axes__.m	15 Dec 2007 05:18:25 -0000
> @@ -1055,8 +1055,25 @@
>        if (nd == 3)
>  	fputs (plot_stream, "set border 895;\n");
>        else
> -	fputs (plot_stream, "set border 3;\n");
> -	fputs (plot_stream, "set xtics nomirror; set ytics nomirror;\n");
> +	if (strcmpi (axis_obj.yaxislocation, "right"))
> +	  fputs (plot_stream, "unset ytics; set y2tics nomirror\n");
> +	  if (strcmpi (axis_obj.xaxislocation, "top"))
> +	    fputs (plot_stream, "unset xtics; set x2tics nomirror\n");
> +	    fputs (plot_stream, "set border 12;\n");
> +	  else
> +	    fputs (plot_stream, "unset x2tics; set xtics nomirror\n");
> +	    fputs (plot_stream, "set border 9;\n");
> +	  endif
> +	else
> +	  fputs (plot_stream, "unset y2tics; set ytics nomirror\n");
> +	  if (strcmpi (axis_obj.xaxislocation, "top"))
> +	    fputs (plot_stream, "unset xtics; set x2tics nomirror\n");
> +	    fputs (plot_stream, "set border 6;\n");
> +	  else
> +	    fputs (plot_stream, "unset x2tics; set xtics nomirror\n");
> +	    fputs (plot_stream, "set border 3;\n");
> +	  endif
> +	endif
>        endif
>      endif
>  
> 

Frankly, I'm not a real expert in the graphics. Just thought it was
stupid to have most of the graphic handle code in place and then not
have the high level functions on top of it. So I wrote a few high level
functions and found a couple of bugs along the way. Probably Kai, Petr
or Michael know more about this stuff than I do.

That being said, it seems that you are right that the axis positions/box
are not being respected and that your patch correctly addresses this..

D.




More information about the Bug-octave mailing list