2
$\begingroup$

This question already has an answer here:

So I'm basically trying to plot a table that has multiple versions of (x^4)+(cx^2)+x, with c being an integer.

I've gotten the expressions to all be graphed, however I can't seem to have the legend show all the expressions and their matching linestyle. It's currently only showing 8 out of the 13. Here's what I have

f[x_] := x^4 + x
g[x_] := x^2
Plot[y = f[x], {x, -2, 2}, PlotStyle -> Black]
tSet = Table[f[x] + c*g[x], {c, -4, 8}]
Plot[Evaluate@tSet, {x, -2, 2}, PlotTheme -> "Monochrome", 
 PlotLegends -> "Expressions"]

Here is the table

{x - 4 x^2 + x^4, x - 3 x^2 + x^4, x - 2 x^2 + x^4, x - x^2 + x^4, 
 x + x^4, x + x^2 + x^4, x + 2 x^2 + x^4, x + 3 x^2 + x^4, 
 x + 4 x^2 + x^4, x + 5 x^2 + x^4, x + 6 x^2 + x^4, x + 7 x^2 + x^4, 
 x + 8 x^2 + x^4}

By the way, I'm using PlotTheme -> "Monochrome" because I need to print in black and white!

Any help would be lovely :)

$\endgroup$

marked as duplicate by Mr.Wizard plotting Sep 25 '17 at 23:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ It seems you are limited by the plot theme - "Monochrome" doesn't have 13 distinct styles. $\endgroup$ – Jason B. Sep 25 '17 at 21:43
  • $\begingroup$ i was thinking the same thing, but when i used a normal styling (with colors) it looked like the colors used were repeated well (although that might just be my eyes) Would you happen to now a way to distinguish all 13 without color? $\endgroup$ – DrunkOnHotCoco Sep 25 '17 at 21:55
  • $\begingroup$ @DrunkOnHotCoco-I had the same issue with making out the different colors. But just try this: Plot[{x, x + 1, x + 2}, {x, -3, 3}, PlotStyle -> {Red, Blue, Red}, PlotLegends -> "Expressions"] $\endgroup$ – Jason B. Sep 25 '17 at 21:56
  • $\begingroup$ ah, I understand. Thanks! $\endgroup$ – DrunkOnHotCoco Sep 25 '17 at 21:59
  • $\begingroup$ If your publication can distinguish between gray and black lines, you could do something like this. (I answered there as that question came first) $\endgroup$ – Jason B. Sep 25 '17 at 22:08
1
$\begingroup$

The issue is that you only have 8 different plot styles, but 13 different functions. The "Expressions" option will only show as many legend items as there are distinct styles,

Plot[{x, x + 1, x + 2}, {x, -3, 3}, PlotStyle -> {Red, Blue, Red}, 
 PlotLegends -> "Expressions"]

Mathematica graphics

$\endgroup$

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