3
$\begingroup$

Bug introduced in 12.0 or earlier and fixed in 12.3.


Simply do this

ListPlot[Range[1500], PlotRange -> All, 
 PlotStyle -> {{Thickness[0.02], Opacity[0.5, Black]}}, 
 Joined -> True, Frame -> True]

we obtain

enter image description here

What's wrong with this darker segments each 500 point?

$\endgroup$
4
  • 1
    $\begingroup$ I do not see this problem on macOS with Mathematica 12.3.1. It may be a platform-specific rendering issue. Please indicate your OS and Mathematica version. You might try using fewer plot points and see if it helps. It looks like there are more points than the width of the image in pixels. Try MaxPlotPoints. $\endgroup$
    – Szabolcs
    Jul 12 '21 at 12:03
  • $\begingroup$ If you assign the graphics to the variable g, what does Count[g, _Line, Infinity] return? For me it returns 1. If for you it returns a greater number, it may be the (correctable) root cause of the issue. $\endgroup$
    – Szabolcs
    Jul 12 '21 at 12:06
  • 1
    $\begingroup$ No such problem on Linux or Windows 11 with Mathematica 12.3.1. $\endgroup$
    – cvgmt
    Jul 12 '21 at 12:10
  • $\begingroup$ Indeed, this bug is fixed after ver. 12.3 $\endgroup$ Jul 12 '21 at 13:37
3
$\begingroup$

I can reproduce this using Mathematica 12.2 on macOS, but not using Mathematica 12.3.1. I believe it is a rendering bug.

enter image description here

Simply copying the graphics expression between a 12.3 and a 12.2 notebook makes the problem appear/disappear, which shows that the issue is specific to graphics rendering.


It seems that the problem appears whenever there is a Line with a large number of points, and Opacity of less than 1. Perhaps the line is broken to smaller pieces internally and what we see if the overlap between these pieces?

A simpler example to reproduce the problem is:

Graphics[{Thickness[0.02], GrayLevel[0, 0.5], 
  Line[Table[{k, k}, {k, 1000}]]}]

One possible workaround is to reduce the number of points. Unfortunately, there is a risk that the plot quality will be reduces as well. I suggest that you experiment with MaxPlotPoints settings. I need to use MaxPlotPoints -> 100 or less on my machine to make the problem go away, showing that the Line is broken to pieces with 100 points each. It looks like on your machine this value may be closed to 500 (as I see three overlaps for 1500 points). 500 should be sufficient for most plots.


I expect someone might be able to produce a workaround using undocumented Graphics rendering options. I suggest you contact Wolfram Support and if they give you a better workaround, post it here.

$\endgroup$

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.