6
$\begingroup$

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:

before

Same graph now looks like this:

after

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"]
$\endgroup$
7
  • 4
    $\begingroup$ I have no idea. Can you post how you generated the plot? $\endgroup$
    – rcollyer
    Nov 1, 2015 at 3:07
  • $\begingroup$ Using your code, I was able to reproduce the issue with V10.3 running on OS X. $\endgroup$
    – m_goldberg
    Nov 1, 2015 at 5:40
  • 4
    $\begingroup$ What if you add Exclusions -> None? $\endgroup$ Nov 1, 2015 at 5:49
  • $\begingroup$ Replicated on 10.3 on Linux (Mint 17.2 xfce x64). $\endgroup$ Nov 1, 2015 at 6:38
  • $\begingroup$ @J.M. using the "Exclusions -> None" option does appear to fix the problem. Thanks for the suggestion. $\endgroup$
    – Seb
    Nov 1, 2015 at 14:32

1 Answer 1

5
$\begingroup$

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]

Mathematica graphics

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]

Mathematica graphics

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]

Mathematica graphics

$\endgroup$

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.