|
[Rivet] PSTrick on ratio-only plotsAndy Buckley andy.buckley at cern.chMon Sep 5 22:15:11 BST 2016
Hi Simon, Most of that code is just implementing a hacky coordinates transform which (if I remember correctly) allows SPECIALs to place things via physics coordinates. Ok, I took another look... the issue is that the special drawing is done by the MainPlot object. If you disable drawing the main plot, then the special will not appear. Hopefully the fix is not too hard, but I hope you understand that it's not a priority... actually, you may be as fast as us at implementing it, since no-one is *really* familiar with this rendering code! Another maybe useful thing is that you can now give an argument like --format=tex,pdf to Rivet's make-plots command, to dump out the .tex file used to do the rendering. You can then hack special stuff into it by hand. Not wonderful, but maybe an ok fix for a one-off while we fix it more generally. To do this, run rivet-cmphistos instead of rivet-mkhtml (with the same args), then run make-plots on the .dat file(s) that results. Andy On 02/09/16 17:09, Simon Paul Berlendis wrote: > Hi Andy, > > Unfortunately, my knowledge on the code in too poor to fill this task... > However, I still tried to have a look at the code and I have the > impression that all happens in line 1077 of make-plots. > But I have no idea what to change in order to make the coordinate > proportional to the canvas... > > Cheers, Simon. > > / def draw(self,coors): > out = "" > out += ('\n%\n% Special\n%\n') > import re > regex = > re.compile(r'^(.*?)(\\physics[xy]?coor)\(\s?([0-9\.eE+-]+)\s?,\s?([0-9\.eE+-]+)\s?\)(.*)') > # TODO: More precise number string matching, something like > this: > > # num = > r"-?[0-9]*(?:\.[0-9]*)(?:[eE][+-]?\d+]" > > # regex = re.compile(r'^(.*?)(\\physics[xy]?coor)\(\s?(' + num + > ')\s?,\s?(' + num + > ')\s?\)(.*)') > for i in xrange(len(self.data)): > while regex.search(self.data[i]): > match = regex.search(self.data[i]) > xcoor, ycoor = float(match.group(3)), float(match.group(4)) > if match.group(2)[1:] in ["physicscoor", "physicsxcoor"]: > xcoor = coors.phys2frameX(xcoor) > if match.group(2)[1:] in ["physicscoor", "physicsycoor"]: > ycoor = coors.phys2frameY(ycoor) > line = "%s(%f, %f)%s" % (match.group(1), xcoor, ycoor, > match.group(5)) > self.data[i] = line > out += self.data[i]+'\n' > return out/ > > -- Dr Andy Buckley, Lecturer / Royal Society University Research Fellow Particle Physics Expt Group, University of Glasgow
More information about the Rivet mailing list |