I would like to plot a 1D graph with two curves that identically overlap. For example, trivially consider

Plot[Sin[x], {x, 0, 3}]

What are the best options to use to plot two overlapping $\sin$ cuves (in the same domain) such that the graphs are (to some extent) visually distinguishable so that the reader can say: "yes, these two plots are the same" -- for more interesting cases, though.


  • 4
    $\begingroup$ Why not plot the difference of the two functions? $\endgroup$ – march Aug 22 '16 at 1:10

For any curves that might overlap even just a little:

Plot[{Sin[x], Sin[x]}, {x, 0, 3}, 
 PlotStyle -> {{Thickness[0.03], LightGray}, Red},
 PlotLegends -> {"Curve 1", "Curve 2"}]

Two identical curves


Use a combination of Show with MeshStyle and/or PlotStyle

 Plot[Sin[x], {x, 0, Pi}, Mesh -> 20, 
  MeshStyle -> Directive[PointSize[0.02], Red], 
  PlotStyle -> Directive[Thickness[0.01], Red], MaxRecursion -> 0],
 Plot[Cos[x - Pi/2], {x, 0, Pi}, Mesh -> 20, 
  MeshStyle -> Directive[PointSize[0.01], Blue], 
  PlotStyle -> Directive[Thickness[0.0025], Blue], MaxRecursion -> 0]

enter image description here

  • $\begingroup$ 兄弟reputation涨得好猛 :) $\endgroup$ – yode Aug 22 '16 at 9:34

Using Epilog directly.

Plot[Sin[x], {x, 0, 3}, 
     PlotStyle -> {Blue, Opacity[0.5]}, 
     Epilog -> {Dashed, Red, Line[Table[{t, Sin[t]}, {t, 0, 3, 0.1}]]}]

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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