2
$\begingroup$

I want to plot several functions in one plot and have different shades of the same colour for each of the plots. Doing with different colours is easy

a1 = Plot[{x^2}, {x, 0, 10}, PlotRange -> All, 
   PlotStyle -> {Thick, Red}, 
   BaseStyle -> {18, FontFamily -> "Times New Roman"}, 
   AxesLabel -> {"x", "f(X)"}];
a2 = Plot[2 x^2, {x, 0, 10}, PlotRange -> All, 
   PlotStyle -> {Thick, Green}, 
   BaseStyle -> {18, FontFamily -> "Times New Roman"}, 
   AxesLabel -> {"x", "f(X)"}];
a3 = Plot[3 x^2, {x, 0, 10}, PlotRange -> All, 
   PlotStyle -> {Thick, Blue}, 
   BaseStyle -> {18, FontFamily -> "Times New Roman"}, 
   AxesLabel -> {"x", "f(X)"}];
a4 = Plot[4 x^2, {x, 0, 10}, PlotRange -> All, 
   PlotStyle -> {Thick, Yellow}, 
   BaseStyle -> {18, FontFamily -> "Times New Roman"}, 
   AxesLabel -> {"x", "f(X)"}];
a5 = Plot[4 x^2, {x, 0, 10}, PlotRange -> All, 
   PlotStyle -> {Thick, Pink}, 
   BaseStyle -> {18, FontFamily -> "Times New Roman"}, 
   AxesLabel -> {"x", "f(X)"}];
Show[a1, a2, a3, a4, a5] 

But how can I get 5 different shades of red for example?

I tried to use

r1 = LightRed;
r2 = Red;
r3 = Darker[Red];
a1 = Plot[{x^2}, {x, 0, 10}, PlotRange -> All, 
   PlotStyle -> {Thick, r1}, 
   BaseStyle -> {18, FontFamily -> "Times New Roman"}, 
   AxesLabel -> {"x", "f(X)"}];
a2 = Plot[2 x^2, {x, 0, 10}, PlotRange -> All, 
   PlotStyle -> {Thick, r2}, 
   BaseStyle -> {18, FontFamily -> "Times New Roman"}, 
   AxesLabel -> {"x", "f(X)"}];
a3 = Plot[3 x^2, {x, 0, 10}, PlotRange -> All, 
   PlotStyle -> {Thick, r3}, 
   BaseStyle -> {18, FontFamily -> "Times New Roman"}, 
   AxesLabel -> {"x", "f(X)"}];
Show[a1, a2, a3]

which I found in an answer here, but this only gives three choices.

$\endgroup$
1
$\begingroup$

You can Blend Red with White and Black:

ClearAll[lightToDark]
lightToDark[n_, c_:Red] := Blend[{{0, White}, {n/2, c}, {n + 3, Black}}, #] & /@ Range[n]

Graphics[Table[{lightToDark[10][[x]], Disk[{x, 0}]}, {x, Range[10]}]]

enter image description here

functions = # x^2 & /@ Range[5];
Plot[functions, {x, 0, 10}, PlotRange -> All, 
 PlotStyle -> lightToDark[Length@functions], 
 BaseStyle -> {18, Thick, FontFamily -> "Times New Roman"}, 
 AxesLabel -> {"x", "f(X)"}, PlotLegends -> "Expressions"]

enter image description here

$\endgroup$
2
$\begingroup$

What about

col=Table[RGBColor[i, 0, 0], {i, 0.5, 1, .1}]
GraphicsRow[Map[Graphics[{#, Rectangle[]}] &,col]]

enter image description here

or the lighter version

col = Table[RGBColor[1, i, i], {i, 0. , .8, .2}] GraphicsRow[Map[Graphics[{#, Rectangle[]}] &, col]]

enter image description here

$\endgroup$
1
$\begingroup$

How about this..

   color = Take[Darker[Red, #] & /@ Subdivide[30], {1, -10, 5}];
Plot[Evaluate@Table[n x^2, {n, 5}], {x, 0, 10}, 
 PlotLegends -> "Expressions", PlotRange -> All, PlotStyle -> color, 
 BaseStyle -> {18, FontFamily -> "Times New Roman"}, 
 AxesLabel -> {"x", "f(x)"}]

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.