I've got this code
Plot[{(V^2/360)/0.4, ConditionalExpression[(V^2/860)/0.4, V < 12],
ConditionalExpression[(V^2/860)/0.4, V > 12]}, {V, 8, 18},
PlotRange -> {0, 1.5},
PlotStyle -> {{AbsoluteThickness[3]}, {AbsoluteThickness[3],
Dashed}, { AbsoluteThickness[3], ColorData[1, 2]}},
GridLines -> Automatic,
Epilog -> {{Thick, Dashed, Black, Line[{{12, 0}, {12, 2}}]}, {Thick,
Dashed, Black, Line[{{8, 1}, {18, 1}}]}}]
to plot a function in two pieces, each in a different style:
This works OK for me, though I didn't like it that I had to use ColorData[1, 2]
to get the second part in the same color. Are there better ways to do this (possibly something with Piecewise
)?