2
$\begingroup$

I have a Table of Sin[nx] functions where n is an integer. Now my issue is that I have been searching a way to make the plots look like a gradient of a color because if I just use the available options for PlotStyle it is hard to distinguish each plot.

Plot[Evaluate[Table[Sin[n x], {n, 1, 3, 1}]], {x, -1, 10}, AxesStyle -> {Thick, 18}, PlotStyle -> {Thick, "BlueGreenYellow"}, PlotRange -> Full]

Image

An example is shown above where I just plotted three Sin[nx]. The colors shown there are very random, I would like say a dark color red is the first plot, a lighter red is the second plot, and so on.

Another option I would like is say a gradient from red to blue, so that the evolution of the plots can be seen through the gradient of the color.

$\endgroup$

2 Answers 2

4
$\begingroup$

Your question addresses PlotTheme.

This is how default PlotTheme looks:

Plot[Evaluate[Table[BesselJ[n, x], {n, 5}]], {x, 0, 10}]

default plottheme

It is "PastelColor". No Plot without PlotTheme.

Very much contrasting is:

Plot[Evaluate[Table[BesselJ[n, x], {n, 5}]], {x, 0, 10}, 
 PlotTheme -> "GrayColor"]

GrayColor

Plot[Evaluate[Table[BesselJ[n, x], {n, 5}]], {x, 0, 10}, 
 PlotTheme -> "CoolColor"]

"CoolColor"

Like in the question the options can be overwritten and replace in putting them explicit in the options list and give them the desired value.

Your question addresses too PlotStyle. Then a solution will be

Plot[Evaluate@Table[BesselJ[n, x], {n, 3}], {x, 0, 15}, 
 PlotStyle -> {Darker@Orange, Orange, Lighter@Orange}]

PlotStyle with Orange But that there only three lightnesses built in.

Plot[Evaluate@Table[BesselJ[n, x], {n, 5}], {x, 0, 15}, 
 PlotStyle -> Table[Darker[Blue, i/5], {i, 1, 5}]]

enter image description here This in not so high in contrast but step in Darker of the color Blue. Same with Lighter:

Plot[Evaluate@Table[BesselJ[n, x], {n, 5}], {x, 0, 15}, 
 PlotStyle -> Table[Lighter[Blue, i/7.5], {i, 1, 5}]]

Lighter Mathematica knows since 12 a lot of important colors: Color.

Plot[Evaluate@Table[BesselJ[n, x], {n, 5}], {x, 0, 15}, 
 PlotStyle -> 
  Table[Lighter[Interpreter["Color"]["HTML green"], i/7.5], {i, 1, 
    5}], AxesStyle -> {Thick, 18}, PlotRange -> Full]

Interpreter["Color"]["HTML green"] You may use Blend:

Plot[Evaluate@Table[BesselJ[n, x], {n, 5}], {x, 0, 15}, 
 PlotStyle -> Table[Blend[{Red, Blue}, x], {x, 0, 1, 1/5}], 
 AxesStyle -> {Thick, 18}, PlotRange -> Full, AxesLabel -> Automatic]

Blend between Red and Blue References on Blend spend ideas for many more possibilities.

$\endgroup$
1
  • $\begingroup$ The default theme is not "PastelColor". It is ColorData[97] applied to the PlotStyle. $\endgroup$
    – b3m2a1
    Commented Mar 16, 2021 at 23:05
3
$\begingroup$

This?

Plot[Evaluate[Table[Sin[n x], {n, 1, 3, 1}]], {x, -1, 10}, 
 AxesStyle -> {Thick, 18}, 
 PlotStyle -> (Blend[{Red, White}, #] & /@ Subdivide[0, 1, 3]), 
 PlotRange -> Full]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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