Bug fix: Two-dimensional plots with coords

There are some bugs in changecoords in the plots package affecting two-dimensional plots that use the coords option: contourplot does not work with this option, and even plot fails with a coordinate system having parameters specified in functional style:

> with(plots):

Warning, the name changecoords has been redefined

> contourplot(x-y, x=0..1,y=0..1,coords=polar);

Error, (in plot/iplot2d) cannot convert to coordinate system polar

> plot(1, x=0..1, coords=logcosh(2));

Error, (in plot/adaptive) unknown optional argument coords = logcosh(2)

To remedy these bugs, I have written a replacement for changecoords for two-dimensional coordinate systems, called changecoords2d . This function is part of the Maple Advisor Database library . Instead of making a plot with the coords option, you can first produce the plot without the coords option and then call changecoords2d with the plot as first argument and the name of the coordinate system as second argument. All other options (e.g. scaling , colour or axes ) should be part of the first plotting command, not the changecoords2d .

Note that plot(f(x),x=a..b) plots the second variable in Cartesian coordinates, y , as a function of the first variable x . In polar coordinates it is more usual to plot the first variable, r , as a function of the second, theta (and this is what plot(f(theta), theta=a..b, coords=polar) does). However, that could not be accomplished by changecoords(plot(f(x),x=a..b), polar) : it would give you theta as a function of r . Instead of polar , you can use reverse(polar) , which interchanges the roles of the two variables and gives you r as a function of theta . You can also use reverse with any of the other coordinate systems.

> changecoords2d(plot(cos(x),x=-Pi/2 .. Pi/2, scaling=constrained), reverse(polar));

[Maple Plot]

> changecoords2d(pointplot([seq([1,7*Pi/10*i],i=0..20)], style=line, colour=blue,scaling=constrained), polar);

[Maple Plot]

> changecoords2d(implicitplot(x=y,x=0..1,y=0..1),logcosh);

[Maple Plot]

> changecoords2d(contourplot(x-y, x=0..1, y=0..1, axes=box), logcosh);

[Maple Plot]

> changecoords2d(plot(1, x=0..1), reverse(logcosh(2)));

[Maple Plot]

See also: addcoords , changecoords , changecoords2d , contourplot , coords , plot(coords) , transform

Maple Advisor Database, R. Israel 1999