4
$\begingroup$

I want to fill the area between the second gridline (blue and count from the left) and the yellow curve as shown in the figure. I used a simple code to illustrate the figure but I have no idea how to fill and represent the specific area. If you have some good suggestions, please share them with me, and thank you in advance. Schematic diagram

The code is as follows and I simplify the code of the plot theme part:

Plot[{V = 6*0.3 t^2, V = 3 t - 12*0.3 t^2, V = -3 t + 12*0.3 t^2, V = 3 t}, 
 {t, 0, 5/3}, PlotRange -> {0, Automatic},
 GridLines -> {{5/9, 5/6, 5/3}, {0}}, 
 GridLinesStyle -> {{Dashed, Blue}, {Dotted, Blue}},
 Filling -> {2 -> Axis}]
$\endgroup$
1
  • $\begingroup$ I typed the wrong value for the first gridline which is supposed to be 5/9 but this does not affect the region that needs to be filled. $\endgroup$
    – Jay Zhang
    Nov 28, 2020 at 8:03

2 Answers 2

7
$\begingroup$
Plot[{6*0.3 t^2, 3 t - 12*0.3 t^2, -3 t + 12*0.3 t^2, 3 t, 
  ConditionalExpression[3 t, 8/9 <= t <= 5/3]}, {t, 0, 5/3}, 
 PlotStyle -> {Automatic, Automatic, Automatic, Automatic, None}, 
 PlotRange -> {0, Automatic}, GridLines -> {{8/9, 5/6, 5/3}, {0}}, 
 GridLinesStyle -> {{Dashed, Blue}, {Dotted, Blue}}, 
 Filling -> {2 -> Axis, 5 -> {3}}]

enter image description here

$\endgroup$
6
$\begingroup$

Add a region.

a = Plot[{V = 6*0.3 t^2, V = 3 t - 12*0.3 t^2, V = -3 t + 12*0.3 t^2, 
    V = 3 t}, {t, 0, 5/3}, PlotRange -> {0, Automatic}, 
   GridLines -> {{8/9, 5/6, 5/3}, {0}}, 
   GridLinesStyle -> {{Dashed, Blue}, {Dotted, Blue}}, 
   Filling -> {2 -> Axis}];
b = RegionPlot[-3 t + 12*0.3 t^2 <= V <= 3 t && t >= 8/9, {t, 0, 
    2}, {V, 0, 5}, BoundaryStyle -> None, 
   PlotStyle -> HatchFilling[75 Degree]];
Show[a, b]

enter image description here

$\endgroup$
1
  • $\begingroup$ I filled the target area in the figure with lines just want to emphasize the region and the initial filling style is fine. Thanks for considering more to meet the given figure :) $\endgroup$
    – Jay Zhang
    Nov 28, 2020 at 8:10

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.