I have this line in maple 11:
polygonplot([[0,0],[1,1],[1,0],[0,0]],legend="stuff");
and the legend doesn't appear, is there a way to force maple to produce the legend (other than horribly right clicking and manually writing the legend in every time - I'm trying to make lots of polygon plots...)
thanks
Steve
A bug?
Seems like a bug to me.
Not that my opinion means anything...
Alec
legends
Although I don't see it documented in the help, it seems to me that legends in plots are for CURVES or POINTS objects and not for POLYGONS. To fix it, you could make an outline of the polygon at the same time as the polygon itself.
> outlinedpolygon := proc(L::list) uses plots; display(polygonplot(args), pointplot([op(L),L[1]], args[2..-1], style=line)) end proc; > outlinedpolygon([[0,0],[1,1],[1,0],[0,0]], colour=blue,legend="stuff");_rest
That looks very nice!
One possible (very slight) improvement (that I learned from Joe Riel) is that in Maple 12 _rest can be used instead of args[2..-1].
Alec
Workaround for plotting polygons
This looks like a bug in plots[polygonplot] which I'll record in our database. Until this is fixed, you can use the plottools[polygon] command as a workaround. This command takes similar arguments, but it creates a single POLYGONS structure rather than a plot. You'll have to call plots[display] to create the plot itself, but you can display several polygons at once. Here's an example:
> with(plottools);
> p1 := polygon([[1, 0], [2, 2], [1, 1]], color = "Blue", legend = "a triangle");
> p2 := polygon([[3, 3], [3, 2], [2, 3]], color = "Green", legend = "another triangle");
> plots[display](p1, p2);
Paulina Chin
Maplesoft