thickening 2D plot axes

December 12 2011 acer 10668
Maple 15
7
This post in reply to the Post, publisher rejects Maple graphs

It is possible to thicken the axes of 2D plots by adjusting the underlying data structure, since the appropriately placed THICKNESS() call within the PLOT() data structure is recognized by the Standard GUI. This does not seem to be recognized for PLOT3D structures, however.

The issue of obtaining thicker axes for 2D plots can then be resolved by first creating a plot, and then subsequently modifying the PLOT structure.

The same techniques could be used to thin the axes of a 2D plot whose axes were thicker than 1, as well.

If the thickness of the tickmarks have not been specifically set in the original plot creation, then the THICKNESS of the _AXIS[n] subcall will also get used for the tickmarks. But if the tickmark thickness is set (even to "1", the default value!) then the THICKNESS of the _AXIS[n] subcall will not override the THICKNESS of the TICKMARKS subcall. Confused? You won't be, hopefully, after these examples.

thicken:=proc(P::specfunc(anything,{PLOT,PLOT3D}),
              {axes::list(identical(1,2,3)):=[1,2]},
              {thickness::posint:=2})
   local temp1,temp2,newAXES;
   if type(P,specfunc(anything,PLOT)) and member(3,axes) then
      error "expecting PLOT3D structure in order to thicken third axis";
   end if;
   temp1,temp2:=selectremove(type,{op(P)},
                             {seq(specfunc(anything,_AXIS[i]), i in axes)});
   newAXES:=seq( `if`(select(type,temp1,specfunc(anything,_AXIS[t]))={},
                      _AXIS[t]('THICKNESS'(thickness)),
                      _AXIS[t](op(remove(type,
                                      select(type,temp1,
                                             specfunc(anything,_AXIS[t]))[1],
                                      specfunc(anything,':-THICKNESS'))),
                               'THICKNESS'(thickness))), t in axes);
   op(0,P)(op(temp2),newAXES);
end proc:


Q:=plot(x^2,x=-6..6):
Q;

thicken(Q); # xtickmarks and ytickmarks are also thickened

Q:=plot(x^2,x=-6..6,axis[1]=[tickmarks=[default,thickness=1]]):
Q;

thicken(Q); # xtickmarks are not thickened, because inherited

Q:=plot(x^2,x=-6..6,axis=[tickmarks=[default,thickness=1]]):
Q;

thicken(Q); # x and y tickmarks are both not thickened, because inherited

thicken(%,axes=[1],thickness=1); # thinning x axis from previous plot

Of course, it should be easy to adjust this routine. It could easily be made more aggressive, for example, and deliberately set the tickmarks' thicknesses to 1 if they were not specified in the incoming plot. It could also be augmented with another option, ticks=[identical(1,2,3)], which would separately specify the thickness of the ticks on each named axes.

This kind of command could be put into a user-authored (ie. customized) context-menu entry.

full worksheet

acer


Please Wait...