Bug introduced in 9.0.1 -- fixed in 10.0.0?
I noted that only part of the legend shows up in ParametricPlot
using v9's PlotLegends
:
ParametricPlot[{{t, t}, {t, 2 t}}, {t, 0, 1}, PlotLegends -> LineLegend[{1, 2}]]
Inspecting the figure's FullForm
gets me (among other things)
LineLegend[
List[
Directive[EdgeForm[GrayLevel[0.5`]], Hue[0.9060679774997897`, 0.6`, 0.6`]]
], List[1, 2],
Rule[LegendLayout, "Column"]]
It looks like Mathematica forgot to add the second color. Adding the color manually gets me the full legend. This looks like a bug, but perhaps I'm missing something?
I also noticed that virtually all examples in the "Options/PlotLegends" section of the ParametricPlot
doc page yield a result differing from the pre-rendered image. Again, this looks like a bug, perhaps introduced by a last-minute addition. I'm using v9.0.1. Anyone with v9.0.0 care to check whether it exists there as well?
Answer
The work-around posted by rcollyer can readily be generalized to work for an arbitrary number of parametric functions.
With[{funcList = {{t, t}, {t, 2 t}, {t, t/2}}},
With[{n = Length@funcList},
Legended[ParametricPlot[funcList, {t, 0, 1}],
LineLegend[(ColorData[1][#])& /@ #, #]& @ Range @ n]]]
Comments
Post a Comment