From: Russell E. O. <ro...@ce...> - 2005-03-22 22:22:53
|
We'd like to set up a set of plots that look something like: PPPP PPPP PPPP PPPP PPPP PPPP PPPP PPPP PPPP PPPP PPPP PPPP hhh s... hhhhh s... hhh s... hhhhhh s..... where - each set of Ps is a 4x4 pcolor plot representing signal on a 4x4 detector at a particular time. I.e. a 4x4 array of solid blocks of gray. - h is a histogram - s is the left edge of a scatter plot/strip chart We have the basic layout, but are missing a few subtleties... If possible, when the window is resized we'd like to: - Resize the histogram and scatterplots but not the pcolor plots. (After all, there's no detail to zoom into in a 4x4 pcolor plot!) - Keep the pcolor plots (Ps) square. My first thought was to set up multiple FigureCanvas objects and use tk's layout options. But the updating then looked funny (and seemed to go slower, though that may be my imagination). We're updating the displays at 2 Hz (for data coming in at 20Hz) and all the plots are related, so it's important to update them all at the same time. Any hints would be appreciated. -- Russell P.S. when using the TkAgg API, is this the usual idiom for turning off axis labels?: yls = self.axScatter.get_yticklabels() for yl in yls: yl.set_visible(False) I did not find any equivalent to the pylab.set command that automatically iterates over collections of ticks or labels. No big deal, but I'd simplify the code if I could. |
From: John H. <jdh...@ac...> - 2005-03-27 21:57:11
|
>>>>> "Russell" == Russell E Owen <ro...@ce...> writes: Russell> We'd like to set up a set of plots that look something Russell> like: PPPP PPPP PPPP PPPP PPPP PPPP PPPP PPPP PPPP PPPP Russell> PPPP PPPP Russell> hhh s... hhhhh s... hhh s... hhhhhh s..... Russell> where - each set of Ps is a 4x4 pcolor plot representing Russell> signal on a 4x4 detector at a particular time. I.e. a 4x4 Russell> array of solid blocks of gray. - h is a histogram - s is Russell> the left edge of a scatter plot/strip chart Russell> We have the basic layout, but are missing a few Russell> subtleties... Russell> If possible, when the window is resized we'd like to: - Russell> Resize the histogram and scatterplots but not the pcolor Russell> plots. (After all, there's no detail to zoom into in a Russell> 4x4 pcolor plot!) - Keep the pcolor plots (Ps) square. Perry and I have been actively discussing the need for a physical size Axes, rather than a relative size. This doesn't exist currently, but might help enable something like what you want -- some axes that resize dynamically with the figure window and some that don't. The problem of creating axes where the aspect ratio is preserved even under figure resizes is important to many people, so hopefully we can get a working implementation sooner rather than later. Russell> My first thought was to set up multiple FigureCanvas Russell> objects and use tk's layout options. But the updating Russell> then looked funny (and seemed to go slower, though that Russell> may be my imagination). We're updating the displays at 2 Russell> Hz (for data coming in at 20Hz) and all the plots are Russell> related, so it's important to update them all at the same Russell> time. Russell> Any hints would be appreciated. If you wanted to turn your 4x4 pcolors into images using one means or another, you could hack something out. The matplotlib.figure.Figure.figimage command does a raw pixel dump to the Figure window, which is not resized. You would have to use it carefully but it should be doable. Eg, create Numerix arrays that were right pixel dimensions you wanted and set the scalar values of the various regions using array indexing. Not very elegant, but might be usable. The tk canvas solution you tried is another good idea, but I'm not sure how to best handle the synchronous updates problem. Russell> P.S. when using the TkAgg API, is this the usual idiom Russell> for turning off axis labels?: yls = Russell> self.axScatter.get_yticklabels() for yl in yls: Russell> yl.set_visible(False) I did not find any equivalent to Russell> the pylab.set command that automatically iterates over Russell> collections of ticks or labels. No big deal, but I'd Russell> simplify the code if I could. I just moved the set/get stuff into the Artist class so you can use it at the API level. This is not yet in CVS, but will be soon. For now, the way you do it will work fine, even though it may not be as pithy. JDH |
From: Russell E. O. <ro...@ce...> - 2005-03-28 17:18:27
|
In article <m3r...@pe...>, John Hunter <jdh...@ac...> wrote: > >>>>> "Russell" == Russell E Owen > >>>>> <ro...@ce...> writes: > > Russell> We'd like to set up a set of plots that look something > Russell> like: PPPP PPPP PPPP PPPP PPPP PPPP PPPP PPPP PPPP PPPP > Russell> PPPP PPPP > > Russell> hhh s... hhhhh s... hhh s... hhhhhh s..... > > Russell> where - each set of Ps is a 4x4 pcolor plot representing > Russell> signal on a 4x4 detector at a particular time. I.e. a 4x4 > Russell> array of solid blocks of gray. - h is a histogram - s is > Russell> the left edge of a scatter plot/strip chart > > Russell> We have the basic layout, but are missing a few > Russell> subtleties... > > Russell> If possible, when the window is resized we'd like to: - > Russell> Resize the histogram and scatterplots but not the pcolor > Russell> plots. (After all, there's no detail to zoom into in a > Russell> 4x4 pcolor plot!) - Keep the pcolor plots (Ps) square. > > Perry and I have been actively discussing the need for a physical size > Axes, rather than a relative size. This doesn't exist currently, but > might help enable something like what you want -- some axes that > resize dynamically with the figure window and some that don't.... It certainly would be very useful in our case, and for many users I'm sure. Another useful thing for wx API, Tk API, etc. users would be a simple and time-efficient way to say "update all these FigureCanvas objects now". Then one could use all the power of wx, Tk, etc.'s built in layout support, more easily mix standard GUI controls with graphs, and the whole bit. (By "time-efficient" I mean: not much worse than if all those same graphs were on one FigureCanvas object. I have no idea if a reasonable thing to attempt.) > Russell> P.S. when using the TkAgg API, is this the usual idiom > Russell> for turning off axis labels?: yls = > Russell> self.axScatter.get_yticklabels() for yl in yls: > Russell> yl.set_visible(False)... > > I just moved the set/get stuff into the Artist class so you can use it > at the API level. This is not yet in CVS, but will be soon. For now, > the way you do it will work fine, even though it may not be as pithy. Thanks! I suspect pylab users will benefit as well! Thank you very much for the improvements and the helpful answer. Regards, -- Russell |