Drawing limit markers on graphs (like those in the plot above) instead of normal points has always been a somewhat involved process in ROOT (Drawing TArrows at each point, then struggling to make their lengths consistent - ever tried it with a logarithmic scale?). To help solve this problem I attach a gzipped archive (limit_files.tar.gz) containing modified versions of the TGX11.cxx and TPostScript.cxx files. Under ROOT 5.33, using these files is as simple as copying the archive to your $ROOTSYS, extracting it (which should place the modified files in the correct locations - you may want to make some backups first - just in case) and running make. Once you have done this you should now have access to two new marker styles. Upper limits can be drawn using marker style 35 and lower limits can be drawn using marker style 36. I have also attached some example macros together with their output in another archive file (limit_examples.tar.gz).
Hopefully someone will find this useful (and who knows, it might make it into the next ROOT version as a patch).
limit_examples.tar.gz (2.45 KB)
limit_files.tar.gz (40.3 KB)
This should not be done by modifying TGX11 and TPostScript.
That’s far too low levels.
I think I have somewhere some code doing that. I will search it.
I understand your concerns and indeed, I also have numerous codes that do it in different ways, but (to the user at least) this is much more simple. After all, I could also draw triangular markers as zero length arrows, but why should I?
Moreover, I’m not forcing anyone to use this code. I’m just offering it as an option.
The way you did it will imply mods every where. You did TPostScript, but what about TPDF ? TSVG ? etc …
Anyway this option already exists.
Look for “Arrow” in root.cern.ch/root/html/TGraphPainter.html
Having had a closer look at the arrow option for TGraphPainter, I’ve found that actually it’s not useful for this particular purpose. For a start, it places arrows on the end of all the error bars, which is not what is required. Secondly one still has to programatically determine the appropriate length for the error bar, and I know from bitter experience that this is tricky when logarithmic scales are involved. Moreover, even if one does calculate the appropriate transformation to get all the arrows/errorbars the same length, it is very difficult to make them be a definite absolute length because the pad automatically resizes itself on drawing/painting to accommodate the various primitives within. Therefore, the only way I found to get consistently sized upper limit arrows (apart from modifying TGX11 and TPostScript) was to apply an iterative procedure whereby the pad is repeatedly re-drawn, re-calculating the arrow lengths at each iteration until convergence occurs. Not at all straightforward - perhaps there’s a much simpler way, but I never found it.
You are of course correct that there are many other classes which are required to draw in various other formats and for those, the upper limit markers will not be available. Perhaps I should have stated categorically: [quote]If you want to draw upper or lower limit markers on systems which use X11 to render graphics (i.e. not Win32) or to output postscript or encapsulated postscript files, then you might want to consider using this code.[/quote] However, I should also note they do work for png and jpg formats. Are you suggesting that the modifications I’ve made will break existing codes? If so, (although I’ve seen no evidence that this is the case) I recommend that nobody else use them.
I repeat, nobody is forced to use this code.
I see, you want always the same arrow size.
An other simple way to do it is to use the marker 23: root.cern.ch/root/html/TAttMarker.html
I agree it will not look exactly like your arrows.
Unfortunately, the convention for “upper limit” (or “lower limit”) markers is to have an appropriately directed arrow (not just a triangle). I realise that the popular approach in particle physics is to present limits using allowed or excluded bands and regions, and therefore such markers might not be useful for the vast majority of ROOT users. However, for astronomers like myself, discrete upper limits still have some utility and it would be nice if I could draw them easily in native ROOT.
I also note from your website on the ROOT graphics program of work is to increase the number of available markers. Even if you don’t end up using any of the modifications I’ve made, I would suggest adding upper and lower limit markers to the list.
Yes we would use exclusion zone for that. ROOT has it natively implemented.
What would be the convention for the size ?
The marker size as it is define now might not be appropriate ?
Is there a standard size for the arrow markers when you produce a graph ?
In terms of sizing the way I implemented it seems to produce aesthetically pleasant results. One can control the size using the marker size attribute. I admit that one cannot customise the ratio of arrow length to arrowhead width, but perhaps the convenience of being able to plot limit points simply would outweigh the lack of precision control? Otherwise, some additional methods (e.g. SetLimitLength(), SetLimitWidth()) would need to be added to TAttMarker specifically for limit markers.