2
$\begingroup$

How do I visualize plots containing lines that exactly overlap in certain regions such that it is clear what lines are underneath.

This question is inspired by Best way to plot nearly identically overlapping data? but with the difference that the plots exactly overlap. I thus don't want to highlight the difference I want to somehow visualize the multiple lines.

For example, for two lines the following solutions would still work

ListPlot[{{{1, 1}, {2, 2}, {3, 3}}, {{1, 1}, {2, 2}, {3, 4}}}, 
 Joined -> True, PlotLegends -> {"a", "b"}, 
 PlotStyle -> {Dashed, Opacity[0.5]}]

But what do I do if I have more overlapping lines? Any good ideas?

$\endgroup$

1 Answer 1

4
$\begingroup$

Use Thickness in descending order. I'm exaggerating here, but you see the idea:

Plot[{0, x, x^2, x^3}, {x, -1, 1}, Frame -> True, Axes -> False, 
  PlotStyle -> Thickness /@ {0.04, 0.03, 0.02, 0.01}]

enter image description here

$\endgroup$
2
  • $\begingroup$ I like the idea, but in practice it doesn't seem to work so well. You either need a huge difference in thickness, meaning the difference between the thinnest and the thickest line looks ridiculous, or take the difference smaller but then we can't tell them apart again. $\endgroup$
    – Kvothe
    May 3, 2019 at 12:01
  • $\begingroup$ I agree, and would suggest combining this technique with others like Opacity, Dashed, etc. It's not a stand-alone solution. $\endgroup$
    – Roman
    May 3, 2019 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.