2
$\begingroup$

I'm plotting a list of data (v) where some of the points are very close together. No problem if AbsoluteThickness[x] is set to x=0.5, but the trace begins to look fuzzy if x>2.5. This is mainly an issue at the beginning of each stair step, where there are a ton of data points. Is there anything I can do to fix this?

Voltage[x_] :=
 ListLinePlot[
  v,
  PlotStyle -> {Red, AbsoluteThickness[x]},
  PlotRange -> Automatic,
  ImageSize -> 600,
  LabelStyle -> {FontSize -> 20, FontFamily -> "Helvetica", Black, 
    Bold},
  Frame -> {True, True, False, False},
  FrameLabel -> {{"Potential (V)", ""}, {"Time (h)", "" }}
  ]

Voltage[0.5]
Voltage[2.5]
Voltage[5]

enter image description here

And no, I cannot weed out data points so my graph looks better.

Thanks for taking the time to read this.

$\endgroup$
5
  • $\begingroup$ Can you provide some datapoints, at least around the beginning of the step? $\endgroup$
    – Domen
    Commented Jul 23, 2021 at 20:24
  • $\begingroup$ docs.google.com/document/d/… This is the full list. $\endgroup$
    – Mike Baird
    Commented Jul 23, 2021 at 20:37
  • 2
    $\begingroup$ Adding InterpolationOrder -> 0 as an option to Plot cleans it up a bit. Is that good enough? $\endgroup$
    – march
    Commented Jul 23, 2021 at 20:57
  • $\begingroup$ @march that is perfect! Thanks for the tip. $\endgroup$
    – Mike Baird
    Commented Jul 23, 2021 at 21:05
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    Commented Jul 23, 2021 at 22:43

1 Answer 1

3
$\begingroup$

Adding InterpolationOrder -> 0 prevents this issue.

Voltage[x_] :=
 ListLinePlot[
  v,
  PlotStyle -> {Red, AbsoluteThickness[x]},
  PlotRange -> Automatic,
  ImageSize -> 600,
  LabelStyle -> {FontSize -> 20, FontFamily -> "Helvetica", Black, 
    Bold},
  Frame -> {True, True, False, False},
  FrameLabel -> {{"Potential (V)", ""}, {"Time (h)", ""}},
  InterpolationOrder -> 0
  ]

enter image description here

$\endgroup$

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.