changing line style from solid to dashed after an intersection

I used this link: Plot that draws a dashed/solid curve depending on the y-value of the curve to help me start this. I have two lines. I want to change from solid to dashed after an intersection. The line with higher slope will have dashed line AFTER the intersection and the line with lower slope will have dashed line BEFORE the intersection. These two lines should be red and blue.

Here is what I have done so far…

In[289]:= y1 = 1.44; y2 = 27.9 - 16000 x;
intercept = x /. Solve[y1 == y2, x][[1]]

Out[290]= 0.00165375

The plot…

Plot[{y1, y2}, {x, .0014, .0019}, PlotRange -> All, 
 MeshFunctions -> {#1 &}, 
 Mesh -> {{0.0014, intercept}, {intercept, 0.0019}}, 
 MeshShading -> {Blue, Directive[Blue, Dashed]}, MeshStyle -> None]

Here was the result…

7Pl5h changing line style from solid to dashed after an intersection

Not sure how to fix this. Please help me.

3 Answers

Let’s block ads! (Why?)

Recent Questions – Mathematica Stack Exchange