I'm trying to make use of the function DensityPlot3D with the following specific example

DensityPlot3D[14.48 2.718^(2 Im[ArcTan[x,y]]) Abs[(Sqrt[x^2+y^2] SphericalBesselJ[1,7.72 Sqrt[x^2+y^2+z^2]])/Sqrt[x^2+y^2+z^2]]^2,{x,-1,1}, {y,-1,1},{z,-1,1},PlotLegends->Automatic,PlotRange->Automatic,PlotPoints->200]

from which I obtain (in the Mathematica notebook) a very opaque plot in gray as in this image:

enter image description here

Is this normal? If not, what am I missing? How could I obtain a plot like the one in the first answer of this question?

I also tried copying and pasting exactly the same code in that first answer, and I get a plot with the same problem: "completely gray".

However, if a save the plot as .pdf (right click -> Save Graphic As...) the plot reappears "magically" much better:

enter image description here

I'm using Mathematica 12.0 Student Edition.

  • $\begingroup$ The OpacityFunction is assigning too much opacity I think. Try making that have a stronger cutoff. Admittedly, though, I don't see your base issue generally. One worth trying might be like: OpacityFunction -> (Which[# > .25, #/2, # > .1, .1, True, 0] &) $\endgroup$
    – b3m2a1
    May 3 '19 at 6:24
  • $\begingroup$ @b3m2a1 Thanks, I'll try other things. Your last command it didn't work either; I've tried even with a simpler function, namely Sqrt[x^2 + y^2 + z^2] and the plot is still awful. $\endgroup$
    – SNC92
    May 3 '19 at 17:32
  • $\begingroup$ this is an apparent bug in 12.0. I am using mmka on MacOSX and getting grey boxes even for the examples in mmka help for DensityPlot3D. $\endgroup$
    – bronxy
    Jul 27 '19 at 22:37
  • $\begingroup$ @bronxy Which example? The ones I tried work fine in 12.0 on MacOS. $\endgroup$ Jul 27 '19 at 23:25
  • 1
    $\begingroup$ Please report this to support@wolfram.com, including the results of SystemInformation[] and details about your computer's OS version and hardware specs. $\endgroup$ Jul 29 '19 at 4:34

I had a similar problem (and a bunch of others) on mmka 12.0. Reseting the Mathematica subsystem, i.e., deleting all the mmka created folders in ~/Library, has solved this problem. Apparently something went wrong when upgrading from the previous version.


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.