3
$\begingroup$

I have the following curves:

linea = Line[{{0.1, 0}, {0.1, 50}}]; Show[
Plot[{2/Abs[a], 3/Abs[a], 4/Abs[a], 6/Abs[a]}, {a, 0, 1}, 
Mesh -> {{0.1, 1}}, MeshShading -> {Dashed, Automatic, Dotted}, 
MeshStyle -> None, Filling -> {1 -> Axis}, 
PlotStyle -> {Thickness[0.005]}, 
Ticks -> {{0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1}, 
Automatic}, AxesOrigin -> {0, 0}, 
Epilog -> {Directive[Black, DotDashed], PointSize[.015], linea}]]

I would like to plot filling option with two different styles: for 0 < a < 1 light grey, for a>1 grey. How can I obtain this option? Moreover, how can I grow up the size of dash in DotDashed style of linea? Thank you

$\endgroup$
  • 1
    $\begingroup$ try Dashing[{0, Small, Large, Small}] in place of DotDashed. $\endgroup$ – kglr Mar 14 '18 at 10:34
  • 1
    $\begingroup$ you probably meant "for 0 < a < 0.1 light grey,..."? $\endgroup$ – kglr Mar 14 '18 at 11:05
4
$\begingroup$
colors = ColorData[1, "ColorList"][[{1, 1, 2, 3, 4}]];
linea = Line[{{0.1, 0}, {0.1, 50}}]; 
Plot[{ConditionalExpression[2/Abs[a], a <= .1], 
  ConditionalExpression[2/Abs[a], a >= .1], 3/Abs[a], 4/Abs[a], 6/Abs[a]}, {a, 0, 1}, 
 Mesh -> {{0.1, 1}}, MeshShading -> {Dashed, Automatic, Dotted}, MeshStyle -> None, 
 Filling -> {1 -> {Axis, LightGray}, 2 -> {Axis, LightBlue}}, 
 PlotStyle -> Thread[Directive[colors, Thickness[.005]]], 
 Ticks -> {{0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1},  Automatic}, 
 AxesOrigin -> {0, 0}, 
 Epilog -> {Directive[Black, Dashing[{0, Small, Large, Small}]], PointSize[.015], linea}]

enter image description here

$\endgroup$
  • $\begingroup$ Thanks! how can I specify colors in "colors"? $\endgroup$ – Gae P Mar 14 '18 at 11:18
  • 1
    $\begingroup$ @GaeP, my pleasure. Thank you for the accept. You can set colors to your choice, e.g., colors = { Red, Red, Green, Blue, Orange}. $\endgroup$ – kglr Mar 14 '18 at 11:21
  • $\begingroup$ I would like to use the default color...how can i do this? $\endgroup$ – Gae P Mar 14 '18 at 12:02
  • 1
    $\begingroup$ @GaeP, for default color in versions 10+ use colors = ColorData[97, "ColorList"][[{1, 1, 2, 3, 4}]]; $\endgroup$ – kglr Mar 14 '18 at 12:06
  • 1
    $\begingroup$ @GaeP, looks like it works in version 11. But in version 9 (it seems in version 10 too) FrameStyle option in Framed does not handle dashing and thickness. You might want to post this as a new question. $\endgroup$ – kglr Mar 15 '18 at 19:53

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.