I want visualize a imported xyz-file and a graphic object at same time.
g = Import["H2O.xyz", "XYZ"];
Show[g, Graphics3D[{Opacity[0.5], Sphere[]}]]
But this shows only the xyz-file. Please, can someone help me?
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityThis could be because the result of Show
inherits graphics options from the first argument, this case the imported graphics. One of the important graphics options is PlotRange
. Very likely this is explicitly set for the imported object, and the sphere might fall outside of these bounds (and thus may not visible).
If this is the case, explicitly set
Show[..., PlotRange -> Automatic]
to show everything.
Another possibility is that the sphere is so much smaller than the XYZ object that it is not visible. Also set Axes -> True
in Show
to get an idea about the size of the object.
Example:
Show[
Import["ExampleData/caffeine.xyz"],
Graphics3D[{Yellow, Opacity[0.5], Sphere[{0, 0, 0}, 200]}],
PlotRange -> All,
Axes -> True
]
I set Axes -> True
to get a sense of the scale of the imported object. based on this, I set the sphere radius to 200. A sphere of radius 1 would be invisibly tiny.
MinMax[Graphics`MoleculePlotDump`elementVanDerWaalRadii]
yields {120, 300}
. So, a radius 1 sphere would definitely be hard to spot.
$\endgroup$
Sep 25, 2018 at 14:24