2
$\begingroup$

LogLogPlot does not output legends correctly

When I give lists of functions to LogPlot or LogLogPlot with the option of PlotLegends, the output legends only have its first one, just like on the image below.

What should I do to get all legends in the plot?

$\endgroup$
  • $\begingroup$ Evaluate@pdata in the second plot, but you really should make pdata a function... and please, in the future, post code, not images. See the help for information on how. $\endgroup$ – ciao May 1 '14 at 9:08
2
$\begingroup$

Using Evaluate for your variable will allow PlotLegends to work. For example:

llist = {1, 2, 3};
pdata = {x, x^2, x^3};
LogLogPlot[Evaluate@pdata, {x, 1, 10}, PlotLegends -> llist]

gives:enter image description here

or

LogPlot[Evaluate@pdata, {x, 1, 10}, PlotLegends -> llist]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.