ImplicitPlot_Curves.mws
Implicitplot for lists of curves
Author: Carl Devore <devore@math.udel.edu>
20 April 2002
It is a commonly reported annoyance that
implicitplot
does not work for lists of curves. The first argument can be a set of curves, but not a list. There is no real reason for this other than bad design. That makes it difficult to plot, for example, a list of curves each in a different color. The procedure presented below corrects that. There are nine options to
implicitplot
which are applicable to the individual curves rather than the plot as a whole:
color, coords, legend, linestyle, numpoints, style, symbol, symbolsize,
and
thickness
. If any of these options are present with a list on the right side, then my procedure applies the kth member of the list to a kth curve. If the option is present without a list, then that option is applied to all the curves. If the
color
option is not specified, then my procedure uses the same sequence of colors as used by
plot
.
> |
Implicitplot:= proc()
option `Copyright (c) 2002, Carl DeVore. All rights reserved.`;
local listable,others,i,F,C;
F:= args[1];
if not F::list then return plots[implicitplot](args) fi;
listable,others:=
selectremove
(a-> a::`=`
and member
(lhs(a)
,[color, coords, legend, linestyle, numpoints
,style, symbol, symbolsize, thickness
])
and rhs(a)::list
,{args[2..-1]}
);
if not member(color, map(lhs, listable union indets(others, `=`))) then
C:= [:-_COLORRGB];
listable:=
{listable[], color= [seq(COLOR(RGB, C[1+irem(i-1, nops(C))][]), i= 1..nops(F))]}
fi;
plots[display]
(seq(plots[implicitplot]
(F[i]
,others[]
,map(a-> lhs(a)=rhs(a)[i], listable)[]
)
,i= 1..nops(F)
)
)
end proc:
|
Example:
> |
Implicitplot([x^2+y^2=1, x^2+y^2=2], x= -2..2, y= -2..2, legend= ["small", "large"]);
|