I've got a strange issue using pyroot. I am trying to color the dots of a TGraph using a loop and TMarker, however, with the attached code, I never see the TGraph, and the TMarker show up individually on the canvas. Ie, the dots are painted sequentially, but only the last tmarker in the loop is saved in the output png. The translated code works great in a C macro, however, I can't get it to work in python. Any ideas? Thanks,
Yeah, I know it works just fine in C. It’s just that I have a project in python which I need to execute basically the exact same code but even the simple example I posted first in python doesn’t reproduce the plot like the C code example. Any ideas?
the TMarker in the loop gets deleted, as its reference gets overwritten in each subsequent iteration, so you only see the last. To keep all markers around, store them in a list fo the duration necessary. Easiest is to add a data member to the TGraph (to bind their life times):[code]view._markers = []
there is no (explicit) deletion of the markers in the C++ code. As per the script, markers are allocated on the heap and ownership is assumed to be taken by the current pad (which will indeed delete them on its destruction). This is the case for virtually all graphics objects.