From nomo17k at gmail.com Mon Jul 9 15:02:41 2007 From: nomo17k at gmail.com (Taro Sato) Date: Mon, 9 Jul 2007 19:02:41 +0000 Subject: [Tioga-users] formatting for numeric label Message-ID: Hi there!! I'm already doing this now... Is there any way to give more control over the format for the numeric labels? I see that using the attribute xaxis_numeric_label_tex you can specify which tex command to use to enclose the output text. (I'm not aware of "string formatting" command in LaTeX...let me know if I can actually do this at tex level...) I think it would be relatively easy to implement, to let a user specify the precise format, maybe using C string formatter, so "%+.1f" would give both control over the forcing sign to be present even for > 0 numbers. (this will then be processed by xaxis_numeric_label_tex). What do you guys think? Taro From fourmond at gmail.com Mon Jul 9 15:10:49 2007 From: fourmond at gmail.com (Vincent Fourmond) Date: Mon, 09 Jul 2007 21:10:49 +0200 Subject: [Tioga-users] formatting for numeric label In-Reply-To: References: Message-ID: <46928839.7050305@gmail.com> Taro Sato wrote: > I think it would be relatively easy to implement, to let a user > specify the precise format, maybe using C string formatter, so > > "%+.1f" > > would give both control over the forcing sign to be present even for > > 0 numbers. (this will then be processed by xaxis_numeric_label_tex). I also wanted to modify this at some point, but I think the format string is also way too restrictive (though, admittedly, more powerful than what we currently have). I'm fine with implementing that right now, but the best solution would be to be able to pass a 'block' to the function -- that is (at least in Ruby's terms) an anonymous Ruby/Python that would take the float as an argument and handle the formatting, returning a string. I'm sure this is doable in Python, I know it is in Ruby, but I'm not sure it will be easy to keep both interfaces matching... As for the rest, you can do anything with TeX, it just takes ten times more processing time and a good hundred times more programming time to make real string processing -- think about docstrip ! Cheers, Vincent PS: I did CC you as I was too lazy to check you are in tioga-users; if that's the case, just mention it next time ;-). Anyway, with gmail, you're unlikely to get double messages... From nomo17k at gmail.com Mon Jul 9 15:30:15 2007 From: nomo17k at gmail.com (Taro Sato) Date: Mon, 9 Jul 2007 19:30:15 +0000 Subject: [Tioga-users] formatting for numeric label In-Reply-To: <46928839.7050305@gmail.com> References: <46928839.7050305@gmail.com> Message-ID: On 7/9/07, Vincent Fourmond wrote: > Taro Sato wrote: > > I think it would be relatively easy to implement, to let a user > > specify the precise format, maybe using C string formatter, so > > > > "%+.1f" > > > > would give both control over the forcing sign to be present even for > > > 0 numbers. (this will then be processed by xaxis_numeric_label_tex). > > I also wanted to modify this at some point, but I think the format > string is also way too restrictive (though, admittedly, more powerful > than what we currently have). I'm fine with implementing that right now, > but the best solution would be to be able to pass a 'block' to the > function -- that is (at least in Ruby's terms) an anonymous Ruby/Python > that would take the float as an argument and handle the formatting, > returning a string. I'm sure this is doable in Python, I know it is in > Ruby, but I'm not sure it will be easy to keep both interfaces matching... > > As for the rest, you can do anything with TeX, it just takes ten times > more processing time and a good hundred times more programming time to > make real string processing -- think about docstrip ! > > Cheers, > > Vincent > > PS: I did CC you as I was too lazy to check you are in tioga-users; if > that's the case, just mention it next time ;-). Anyway, with gmail, > you're unlikely to get double messages... Vince -- I'm on the list already, so don't worry about cc'ing me! Yeah, I generally agree with your approach of allowing really finer control for those who want! However, I think it also make sense to allow a simpler alternative. Actually we could do both, right? We can check the input and if it's a function object, we do what you outlined. If that's a string, then we can do C-like formatting. I like C-like formating because it's rather standard and don't confuse those who are not a real programmer. I like finer controls, but to attract a large user base, we should have very simple alternatives as well. (I tend to think about trying to make your thesis advisor learn to use the program --- is it easy enough?? that sort of thing...) Taro From fourmond at gmail.com Mon Jul 9 15:41:28 2007 From: fourmond at gmail.com (Vincent Fourmond) Date: Mon, 09 Jul 2007 21:41:28 +0200 Subject: [Tioga-users] formatting for numeric label In-Reply-To: References: <46928839.7050305@gmail.com> Message-ID: <46928F68.2020608@gmail.com> Taro Sato wrote: > Actually we could do both, right? We can check the input and if it's > a function object, we do what you outlined. If that's a string, then > we can do C-like formatting. Yes. I think we still need to be backward-compatible, and do what was done before if the string doesn't contain any % sign. And, later on, when we have mastered cross-interpreter programming, we'll also make the lambda stuff. I'll have a look at it some time later on tonight (yes, for me now is already tonight). Cheers, Vincent From fourmond at gmail.com Mon Jul 9 15:55:13 2007 From: fourmond at gmail.com (Vincent Fourmond) Date: Mon, 09 Jul 2007 21:55:13 +0200 Subject: [Tioga-users] formatting for numeric label In-Reply-To: References: <46928839.7050305@gmail.com> Message-ID: <469292A1.3030502@gmail.com> Bill Paxton wrote: > Incidentally, this also has the benefit of letting the user decide what > to do about cases where a major tick falls at the corner of a plot. Tioga currently > makes an attempt to deal with this, but it would be great to have a > way to override it. > > Comments? Great ! Cheers, Vincent From paxton at kitp.ucsb.edu Mon Jul 9 15:36:48 2007 From: paxton at kitp.ucsb.edu (Bill Paxton) Date: Mon, 9 Jul 2007 12:36:48 -0700 Subject: [Tioga-users] formatting for numeric label In-Reply-To: <46928839.7050305@gmail.com> References: <46928839.7050305@gmail.com> Message-ID: On Jul 9, 2007, at 12:10 PM, Vincent Fourmond wrote: > the best solution would be to be able to pass a 'block' to the > function Hi, I like the idea of providing a call-back routine for this, but perhaps it would be even better to do it at the level of the entire set of labels for an axis rather than for individual labels. Currently, you get the choice of either doing the whole thing yourself (by supplying arrays of locations and labels) or attempting to get tioga to do what you want using a bunch of not-so-lovely controls (such as number of decimal digits, digits max, or tex formatting). I think we need an intermediate alternative: caller provides a call-back function that gets a list of proposed locations for major ticks and returns 2 lists: one the actual locations to be used for major ticks and the other the strings giving the corresponding labels (which can of course be null strings to leave a tick unlabeled). These arrays obviously correspond to the arrays of the current "do-it-yourself" option mentioned above, but now extended so that the system provides you with candidate locations based on its initial calculations of axis sizes. Incidentally, this also has the benefit of letting the user decide what to do about cases where a major tick falls at the corner of a plot. Tioga currently makes an attempt to deal with this, but it would be great to have a way to override it. Comments? --Bill -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/tioga-users/attachments/20070709/a7f6a6a5/attachment.html From nomo17k at gmail.com Mon Jul 9 18:01:53 2007 From: nomo17k at gmail.com (Taro Sato) Date: Mon, 9 Jul 2007 22:01:53 +0000 Subject: [Tioga-users] dealing with log axis Message-ID: Hi again. (I may continue like this for a while, so bear with me!) I hope there will be a more convenient scheme to deal with log axis. Currently, I think users must take log of data values themselves to plot things on log axis, which to me is too much of inconvenience. I often switch between linear and log axis to see which mode looks more useful on the eyes, so being able to do this via some sort of "switch" would be highly desirable! It should be able to automatically put data values on the log scale and place ticks appropriately as well, without touching the input data on the user end... Any thoughts on how to implement this? Taro From vincent.fourmond at 9online.fr Mon Jul 9 18:10:50 2007 From: vincent.fourmond at 9online.fr (Vincent Fourmond) Date: Tue, 10 Jul 2007 00:10:50 +0200 Subject: [Tioga-users] dealing with log axis In-Reply-To: References: Message-ID: <4692B26A.5010007@9online.fr> Hello ! Taro Sato wrote: > I hope there will be a more convenient scheme to deal with log axis. > Currently, I think users must take log of data values themselves to > plot things on log axis, which to me is too much of inconvenience. > > I often switch between linear and log axis to see which mode looks > more useful on the eyes, so being able to do this via some sort of > "switch" would be highly desirable! It should be able to > automatically put data values on the log scale and place ticks > appropriately as well, without touching the input data on the user > end... > > Any thoughts on how to implement this? I wouldn't wish too much to hardcode this into tioga - or rather, I don't want to modify the way the log... options currently behave : it would cause me quite some trouble in ctioga - and I think that would amount to quite some work (both in tioga and in ctioga). For a starter, you can create some thin wrappers around the functions you use for actually plotting your data to decide whether you should take the safe_log10 of it or not. From my point of view, it is much better to do coordinates conversion at the source (one place to modify in the code) rather than in tioga's functions (a small hundred of functions to modify ???). I find that the current scheme fits me really well. But of course, I don't know how you are using tioga, so I can't tell for you. Would you mind posting some example of your code where this feature is cruelly missing ?? BTW, I just realize that you might not know what is this safe_log10 I speak about, because it lives in Dvector, which as far as I understood is not used by PyTioga. It does what it says for a vector. What do you think ? Cheers, Vincent -- Vincent Fourmond, Doctor in Physics http://vincent.fourmond.neuf.fr/ From nomo17k at gmail.com Mon Jul 9 22:17:14 2007 From: nomo17k at gmail.com (Taro Sato) Date: Tue, 10 Jul 2007 02:17:14 +0000 Subject: [Tioga-users] dealing with log axis In-Reply-To: <4692B26A.5010007@9online.fr> References: <4692B26A.5010007@9online.fr> Message-ID: On 7/9/07, Vincent Fourmond wrote: > > > > I often switch between linear and log axis to see which mode looks > > more useful on the eyes, so being able to do this via some sort of > > "switch" would be highly desirable! It should be able to > > automatically put data values on the log scale and place ticks > > appropriately as well, without touching the input data on the user > > end... > > > > Any thoughts on how to implement this? > > I wouldn't wish too much to hardcode this into tioga - or rather, I > don't want to modify the way the log... options currently behave : it > would cause me quite some trouble in ctioga - and I think that would > amount to quite some work (both in tioga and in ctioga). > > For a starter, you can create some thin wrappers around the functions > you use for actually plotting your data to decide whether you should > take the safe_log10 of it or not. > > From my point of view, it is much better to do coordinates conversion > at the source (one place to modify in the code) rather than in tioga's > functions (a small hundred of functions to modify ???). > > I find that the current scheme fits me really well. But of course, I > don't know how you are using tioga, so I can't tell for you. Would you > mind posting some example of your code where this feature is cruelly > missing ?? > > BTW, I just realize that you might not know what is this safe_log10 I > speak about, because it lives in Dvector, which as far as I understood > is not used by PyTioga. It does what it says for a vector. > > What do you think ? Vincent -- I mean, none of my requests need to be implemented immediately, so plz don't think first about the amount of "rewrite" that might need to happen to accommodate my request...haha. Just meaning to bounce around opinions... I can live with just having a simple wrapper where needed to have what I want, so that's not really a problem (I think I can simply decorate all these methods which take data values). However, the current tioga behavior is rather confusing (to me) for a couple reasons (oh please don't think "rewrite" again! just bouncing around ideas...). First is that users usually want to put their data on log scale on a plot only when the distribution of values turn out to be more even or well spread out in log space, and *not* that it makes sense to take log10 of their data values. When it makes sense for users to take log10 values of their data, that usually happens when they *want* log10 values (to adjust to convention, e.g., energy flux to astronomical magnitudes) to appear on the axis, in which case they keep that axis in linear scale, with the log10(values). Having users specify the data values are in log10, as well as having them to explicitly do the conversion themselves, is rather redundant, I think. (I'm actually still learning the codes, so it may take a bit before I start being more explicit about how the current implementation can be improved without too much fuss...another indication that I'm not expecting things to happen immediately..) Taro From paxton at kitp.ucsb.edu Tue Jul 10 15:50:24 2007 From: paxton at kitp.ucsb.edu (Bill Paxton) Date: Tue, 10 Jul 2007 12:50:24 -0700 Subject: [Tioga-users] Multi Page plots in Tioga In-Reply-To: <4693DC02.5050300@physics.ucsb.edu> References: <4693DC02.5050300@physics.ucsb.edu> Message-ID: <9B21BDFB-C8A2-4612-9C69-695F6C564FE3@kitp.ucsb.edu> On Jul 10, 2007, at 12:20 PM, Justin D. R. Steinfadt wrote: > Hey Bill. I'm wondering if their is an easy way to make multi page > plots in Tioga without actually having to define them as separate > figures. > > Basically I have multiple versions of the same type of data and I > would like to plot them six to a page. I have all the conditionals > and loop flow structure worked out so that I can do this. I was > hoping that when I got to the end of a page, there would be a > simple Tioga command that would say "start new page" that I could > use and the loops would continue onward (right now it just takes > the extra "pages" and plots it right on top of the first page). I > need to be able to do this because I don't know a priori the number > of plots I will need to make. > > Does such a command exist? > > Thanks, > -Justin > Hi Justin, Tioga doesn't have the notion of multi-page plots. Could you perhaps call your loop routine with a starting value and have it do 1 page worth of plots starting from there? It might work like the attached example, multipage_batch.rb (try it by doing ruby < multipage_batch.rb). -------------- next part -------------- A non-text attachment was scrubbed... Name: multipage_batch.rb Type: text/x-ruby-script Size: 947 bytes Desc: not available Url : http://rubyforge.org/pipermail/tioga-users/attachments/20070710/615c7e50/attachment.bin -------------- next part -------------- Cheers, Bill P.S. I've cc'd this to tioga-users since it may be of wider interest.