From: Lorenzo M. <lor...@ya...> - 2011-11-19 14:10:33
|
Hallo Michael, even if it is not frequently maintained, I find gnuploy.py still very useful, and, I think, it's clear and well written. So, thank you for this project! About set_tics method, I think your way is far more general than mine, and agree with your approach. lorenzo --- Sab 19/11/11, Michael Haggerty <mh...@al...> ha scritto: > Da: Michael Haggerty <mh...@al...> > Oggetto: Re: [Gnuplot-py-users] tics labels > A: "Lorenzo Mentaschi" <lor...@ya...> > Cc: gnu...@li... > Data: Sabato 19 novembre 2011, 14:36 > On 10/09/2011 12:03 PM, Lorenzo > Mentaschi wrote: > > in order to make gnuplot-py deal with xtics labels of > string type > > (without building the gnuplot command in user code), I > added this method > > to Gnuplot class: > > > > > > ###### > > def set_tics_labels(self, > labels, axis = 'x'): > > cmd = 'set > %stics (' % (axis,) > > for indx, label > in zip(range(len(labels)), labels): > > cmd += > '"%s" %i,' % (label, indx,) > > cmd = > cmd.strip(',') + ")" > > self(cmd) > > > ###### > > > > > > This seems to work for me. Is there any smarter way to > do this? > > Thanks for your submission. > > If I understand correctly, your function takes a list of > label strings > as argument and places the 0th label in the list at axis > position 0.0, > the 1st label at axis position 1.0, etc. Is that > correct? > > Because this seems quite special-purpose. The gnuplot > "set *tics" > commands are much more flexible. They allow labels to > be placed at > arbitrary positions and allow the user to specify which tic > marks are > major vs. minor. If we are going to build a > set_tics_labels() command > into Gnuplot, then I think it should provide access to more > of gnuplot's > functionality. > > What do you think of the attached patch? > > Michael > > -- > Michael Haggerty > mh...@al... > http://softwareswirl.blogspot.com/ > |