Depict evolving 3D structure (molecule) with TGraph2D()


I’m trying to plot a structure in 3D (a molecule), which consists of a few balls (atoms) of different color.

I’m using TGraph2D()s with typically a single point for each of the atom types and plot them all on top of each other in the same TPad(). I use SetMarkerStyle(20) (balls).

In fact, I plot how this structure evolves and string all the images together in a movie (an animated trajectory of the molecular dynamics).

The problem is: The molecule is rotating and the balls start overlapping. However, as usual for different TGraphs, the balls are always visible in the inverse order they were plotted. A red ball, which is behind a black ball in the 3D space will nonetheless be plotted on top.

Is there a way to prevent this overplotting issue and still have balls of different color? How do you depict a red and black ball rotating around each other in 3D?


ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

Hi Jochen,
how about using TGeo.
see e.g.


Otherwise could you provide a simple example
using TGraph2D


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.