3

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

kglr
  • 394,356
  • 18
  • 477
  • 896
Gae P
  • 637
  • 3
  • 11

1 Answers1

4
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

kglr
  • 394,356
  • 18
  • 477
  • 896
  • Thanks! how can I specify colors in "colors"? – Gae P Mar 14 '18 at 11:18
  • 1
    @GaeP, my pleasure. Thank you for the accept. You can set colors to your choice, e.g., colors = { Red, Red, Green, Blue, Orange}. – kglr Mar 14 '18 at 11:21
  • I would like to use the default color...how can i do this? – Gae P Mar 14 '18 at 12:02
  • 1
    @GaeP, for default color in versions 10+ use colors = ColorData[97, "ColorList"][[{1, 1, 2, 3, 4}]]; – kglr Mar 14 '18 at 12:06
  • Furthermore, I would like to complete Epilog section:
    Epilog -> {Directive[Black, Thick, Dashing[{0, Small, Large, 
    Small}]],
    linea, Inset[
    Framed[Style["\!\(\*SubscriptBox[\(V\), \(22\)]\)", 
    FontFamily -> "Times New Roman", FontSize -> 13], 
    FrameStyle -> Directive[Black, Thin, Dashed]], {.15, 6}], 
    Inset[Framed[
    Style["\!\(\*SubscriptBox[\(V\), \(nn\)]\)", 
    FontFamily -> "Times New Roman", FontSize -> 13], 
    FrameStyle -> Directive[Black, Thin, Dashed]], {.4, 
    25}]}]]
    
    

    but FrameStyle doesn't work...Mathematica 10.0

    – Gae P Mar 15 '18 at 18:05
  • 1
    @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. – kglr Mar 15 '18 at 19:53