Multiple plots -- only legends on some

#1

I plot multiple time series in the same plot, one with nominal parameter value and the others a result of Monte Carlo runs. I only want label on the one with nominal value…

I tried to do:

``````plot(…, label="_nolabel_")
``````

for those plots where I don’t want a label (taken from syntax for `matplotlib`…), and this works with the `pyplot` backend of `Plots`: I get loads of error messages in `IJulia`, but the plot is ok. The error messages are typically

``````C:\Users\BLI\.julia\v0.6\Conda\deps\usr\lib\site-packages\matplotlib\legend.py:588: UserWarning: The handle <matplotlib.lines.Line2D object at 0x0000000052A27BE0> has a label of '_nolabel_' which cannot be automatically added to the legend.
'legend.'.format(handle, label))
``````

– one for each `"_nolabel_"` label, I guess…

I get a similar error message when I try to `savefig()` the plot.

Question:

• Is this the way to do it in general in `Plots`, or is there a better way?

[Backend `gr()` doesn’t support the `plot(…,label="_nolabel_")` syntax, and also doesn’t appear to support LaTeX syntax.]

#2

just `label = ""` . Latex syntax is provided by LaTeXStrings.

#3

Great! Much better syntax for avoiding label…

The `gr` backend doesn’t support LaTeX code, though…

I am `using LaTeXStrings`. Notice that `xlabel` and `ylabel` are not typeset correctly using `gr` backend. (The `label`, is, however, probalby typeset as it should – but doesn’t look particularly nice in `IJulia`… ). Using `pyplot`, however, the result is correct.

#4

hm that’s a bug then

#5

Maybe a bug, but should be easy to fix ? :-).

#6

I found that it only supports latexstrings on the entire string. I.e. what seems to not be working are the `\$` signs.