2
$\begingroup$

I'm trying to reproduce a figure like the following:

example

I had the analytical expression for each curve, and the color bar indicates the value of some parameter. My problem is that I don't figure out how to program a bar like that.

For instance, let me assume that my parameter is A in

Plot[Table[A Sin[3 x], {A, 1, 10, 0.5}], {x, 0, 6}

How can I get a bar with the intensity of A?

I appreciate any comment.

Thanks.

$\endgroup$

1 Answer 1

6
$\begingroup$
Plot[Evaluate @ Table[A Sin[3 x], {A, 1, 10, 0.5}], {x, 0, 6}, 
 PlotStyle -> (ColorData["BlueGreenYellow"] /@ Rescale[Range[1, 10, .5]]), 
 PlotLegends -> BarLegend[{"BlueGreenYellow", {1, 10}}]]

enter image description here

$\endgroup$
2
  • $\begingroup$ Thanks @kglr. Just another question: Do you know how to manange the Thickess and Dashing togheter with the instructions in your response? $\endgroup$ Feb 10, 2022 at 21:25
  • 1
    $\begingroup$ Maybe you can do something like PlotStyle -> (Directive[ColorData["BlueGreenYellow"]@#, AbsoluteDashing[{5 - 3 #, 3 #}], AbsoluteThickness[4 - 2 #]] & /@ Rescale[Range[1, 10, .5]])? $\endgroup$
    – kglr
    Feb 10, 2022 at 21:35

Your Answer

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

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