Update: NOT fixed in V10.0 - 12.0.0
While testing the examples from this recent post, i've noticed a problem in V.10 with PlotLegends
when it has to automatically generate more than 15 labels (i.e. when there are more then 15 functions to plot). There's no problem with V.9.
The problem concerns the option values : Automatic
and "Expressions"
. For example :
Plot[Evaluate[Range[20] + x], {x, -5, 5}, PlotLegends -> "Expressions"]
Plot[Evaluate[Range[20] + x], {x, -5, 5}, PlotLegends -> Automatic]
No problem however when you specify explicitly the labels in the legend :
Plot[Evaluate[Range[20] + x], {x, -5, 5}, PlotLegends -> Range[20]]
Answer
We may observe that the automatically generated legend limits the number of legend items to the number of available colors in the given color scheme. Using this utility function:
plot[scheme_] := Plot[Evaluate[Range[20] + x], {x, -5, 5},
PlotLegends -> "Expressions", PlotStyle -> scheme]
Observe the result for indexed color scheme #42 which has only four colors:
plot[42]
There are eight in #26:
plot[26]
As since there are 21 in #60 all your lines have a legend:
plot[60]
And if you specify a gradient color scheme:
Plot[Evaluate[Range[50] + x], {x, -5, 5}, PlotLegends -> "Expressions",
PlotStyle -> "Rainbow"]
Comments
Post a Comment