TGraph2D Drawing Very Slow

Hi, I’ve got a TGraph2D with 1000 data points, which doesn’t seem excessive to me, but Drawing the object takes a very long time, even with the default drawing options.

Is 1000 points too much to draw the graph reasonably quickly? Are there some drawing options that could be recommended for large graphs? My graph can be recreated by doing “.x graph2d.C” using the attached macro, then you can draw it using whatever option you wish for testing.

The points are in a regular grid. Is there a better 3D container for non-histogrammed grid data? It seems common enough that there could be a special class for grid data that wouldn’t need to do triangulation and such.

graph2d.C (476 KB)

  1. graph2d has 10000 points
  2. there are 100 NaN points in it -> get rid of them
  3. draw it using “P”, “P0”, “PCOL” or “LINE” options (i.e. avoid Delaunay triangulation)

Just an additional note.
In cases like yours, when one has data on a simple regular grid, I would say that one should create a simple TH2[FD] with appropriate numbers of Y and Y bins (equal to the corresponding numbers of grid points) and Fill it (or SetBinContent) with these data.
Note that the grid points do not need to be equally spaced. One can simply create a TH2[FD] with “variable size bins” (along X or Y or both).

Some test have been done to replace the current Delaunay triangulation code by some external package. It looks promising. Speed is not an issue anymore. I let the author of this work comment about it.

As mentioned before, TGraphDelaunay is currently undergoing major renovation.
10k points will be no problem for the new implementation.

Stay tuned for updates.