# Plotting issue — possible bug?

Issue: a plot that previously worked in version 10.1 (see first figure below) produced an odd looking graph when re-evaluated in version 10.2 (see second graph). I have downloaded the latest version, (10.3) but the issue persists. I am working on a Mac.

Picture of graph from before:

Same graph now looks like this:

Any suggestions on what might be the issue?

I have also tried changing the Antialiasing setting (See: Preferences -> Appearance -> Graphics), but that did not help resolve the issue.

Code: The code below is similar to that used to generate the graph above. I just removed some non-essential elements of the code so that it would be faster/easier to reproduce. This code still yields the same issue; the only difference is that the resulting function looks more like a step-function now.

z = RandomVariate[BetaDistribution[2, 2], 100];

f[x_, y_] :=
Sum[(
Boole[(z[[i]] - (Min[z[[i]], x]) - y) > Max[z[[i]] - x, 0]] +
Boole[(z[[i]] - x) > Max[(z[[i]] - (Min[z[[i]], x]) - y), 0]]),
{i, 1, 100}
];

Plot3D[f[x, y], {x, 0, 1}, {y, 0, 1}, PlotTheme -> "Detailed"]

• I have no idea. Can you post how you generated the plot? – rcollyer Nov 1 '15 at 3:07
• Using your code, I was able to reproduce the issue with V10.3 running on OS X. – m_goldberg Nov 1 '15 at 5:40
• What if you add Exclusions -> None? – J. M.'s technical difficulties Nov 1 '15 at 5:49
• Replicated on 10.3 on Linux (Mint 17.2 xfce x64). – Eric Towers Nov 1 '15 at 6:38
• @J.M. using the "Exclusions -> None" option does appear to fix the problem. Thanks for the suggestion. – Seb Nov 1 '15 at 14:32

I do not see a difference between the versions you reported, at least not for the function you use in your question. The result I get for 10.1 is the same as 10.3 and all other versions I tried (8, 9, 10.0, 10.2).

The main problem is that your function has discrete steps at highly irregular positions. Plot3D is not really suiuted for these types of functions, but you can improve your result by increasing the PlotPoints option value:

Plot3D[f[x, y], {x, 0, 1}, {y, 0, 1}, PlotTheme -> "Detailed",
PlotRange -> All, PlotPoints -> 100, MaxRecursion -> 1]


DiscretePlot3D may be better suited for plots like this one:

DiscretePlot3D[f[x, y], {x, 0, 1, 1/60}, {y, 0, 1, 1/60},
PlotTheme -> "Detailed", ExtentSize -> Full, Filling -> None,
Joined -> True]


This was with a regular grid. In the case of this function, function state is particular dependent on the relation between x and y and the values of z (all of which lie between 0 and 1). Making use of this, lets sample x and y using the z list itself:

DiscretePlot3D[f[x, y], {x, Union[z ]}, {y, Union[z]},
PlotTheme -> "Detailed", ExtentSize -> Full, Filling -> None,
Joined -> False]