4
$\begingroup$

I want to place a number on each atom (on a sphere) upon 3D plotting a molecule. For example, from:

mol = Molecule["h2co"]; MoleculePlot3D[m, {1, 2, 3, 4}, PlotLegends -> {"1", "2", "3", "4"}]

I get this:

enter image description here

But, this is not what I want. Instead of having this legend, I would like to have labels on the atoms themselves, like this:

enter image description here.

Any ideas on how to do this?

$\endgroup$
7
$\begingroup$
 mol = Molecule["Formaldehyde"];

 Show[ MoleculePlot3D[mol], 
  Graphics3D[MapThread[Text, 
    {Style[#, 16] & /@ Range[4], mol["AtomCoordinates"]["Magnitudes"]}]]] 

enter image description 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.