Re: [Matplotlib-users] plot() not using alpha value from RGBA tuple
On 08/16/2011 12:42 AM, Vlastimil Brom wrote: 2011/8/16 Eric Firingefir...@hawaii.edu: On 07/25/2011 08:21 AM, Ben Breslauer wrote: I think that I have found the problem here. Line2D.draw() (and I presume other Artist subclasses) calls gc.set_foreground(self._color) ... gc.set_alpha(self._alpha) self._color is defined by the color kwarg, whether it be a hex value, 3-tuple, 4-tuple, or something else. self._alpha is defined by the alpha kwarg, but if the alpha kwarg is None, it is not overwritten with color[3]. Therefore, using color=(R,G,B,A) does not set alpha correctly. I'm not sure the best (i.e. most matplotlib-like) way to change this so that the A value gets used iff alpha is None, but I've attached a patch that does it one way (diff'ed against the github master, commit 67b1cd650f574f9c53ce). I know the patch is less than ideal, as it adds kwarg-specific handling into a place where none had previously been done, and it's also in a for loop. Maybe it would be better to do the checking along with the scalex and scaley pops? Alpha handling is a real can of worms; it has gotten better, but as you note, there are still problems. Unfortunately, I don't think your proposed solution will work in general, because self._color could be a 4-letter string, like gray, in which case alpha would be set to y, and that would not be good at all. I suspect the right place to solve the problem is down in the GraphicsContext--although I thought I had already straightened that out some time ago. ... Eric Separately, I noticed that backend_bases.GraphicsContextBase.set_foreground claims to only expect an RGB definition, and not an RGBA definition. As such, I think that it should call self._rgb = colors.colorConverter.to_rgb(fg) instead of self._rgb = colors.colorConverter.to_rgba(fg) since that will make self._rgb a 3-tuple instead of a 4-tuple. Ben ... Just a remark for this recent proposed patch, as I unfortunately don't know the implications for the whole codebase. I believe, that the condition added in the patch if len(line._color) == 4 and line._alpha == None: could be adjusted to e.g.: if isinstance(line._color, tuple) and len(line._color) == 4 and line._alpha == None If the alpha value can be set in the color-tuple (for #RRGGBBAA some parsing would be needed, if it is accepted). Possibly the _alpha should be replace with tha alpha value of the colour passed this way like http://matplotlib.sourceforge.net/api/colors_api.html#matplotlib.colors.ColorConverter.to_rgba If arg is an RGBA sequence and alpha is not None, alpha will replace the original A. But as has been suggested already, it might be better adressed in some more general way, than in this single function. See https://github.com/matplotlib/matplotlib/pull/423 Eric regards, vbr -- uberSVN's rich system and user administration capabilities and model configuration take the hassle out of deploying and managing Subversion and the tools developers use with it. Learn more about uberSVN and get a free download at: http://p.sf.net/sfu/wandisco-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] mathtext in eps figures doesn't come out in pdf
Setting test.usetex to True solved this problem. The only drawback is that the font used for numbers and that used for axis labels is different and looks a bit odd. I'm sure the fix for that is not too difficult, however. Jon On Wed, 2011-08-17 at 14:09 +0900, Jae-Joon Lee wrote: Can you post an output eps file so that we can take a look? Regards, -JJ On Wed, Aug 17, 2011 at 5:52 AM, Jonathan Slavin jsla...@cfa.harvard.edu wrote: Hi all, I've been making figures for a paper I'm writing (to be submitted to the ApJ). I'm using LaTeX and so need to use encapsulated PostScript for the figures. The problem is that when the paper is translated to pdf from PostScript, the mathtext in the figures disappears. The reason that I think this is a matplotlib issue is that it's never happened to me with eps figures created in different ways. It's clear that this must be related to fonts, but I'm not sure how to get around it. Should I set text.usetex to True? I have a feeling this issue must have come up before, but I haven't found anything obviously pertinent in the mailing list archives. Jon -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- __ Jonathan D. Slavin Harvard-Smithsonian CfA jsla...@cfa.harvard.edu 60 Garden Street, MS 83 phone: (617) 496-7981 Cambridge, MA 02138-1516 cell: (781) 363-0035 USA __ -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Error with PDF output with usetex
On Tue, Aug 16, 2011 at 4:22 AM, Damon McDougall d.mcdoug...@warwick.ac.uk wrote: Hi Jeff, I am able to run the tex_demo.py with no problems and I can create output files using the Agg backend. When I try to use the PDF backend, however, I get an error which stems from dviread.py (pasted below). Any thoughts on what could be going wrong? Thanks! Jeff Hi Jeff, How did you install matplotlib? From source yourself? No, I'm using the Enthought Python Distribution (EPD64). And when you installed matplotlib, did it see that you had dvipng installed? FYI, you can do which dvipng to return the path where dvipng lives (if it is in your path already) or you can do locate dvipng to do a search for the binary if it isn't already in your path. P.S. You forgot to reply-all so everyone can see your response. $ which dvipng /usr/texbin/dvipng I don't remember any complaints while running the EPD installer. Would there be a way to check this? Is the problem definitely related to an inability to find dvipng, or could there be other possibilities? Thanks, Jeff I had a similar problem. I don't think it's an inability to find dvipng, I think it's that it couldn't find dvipng when matplotlib was built. When matplotlib builds there'll be a section of text sent to stdout under the heading of 'OPTIONAL DEPENDENCIES', there it will tell you whether it found dvipng when it was building. Are you able to find this? If not, are there install logs saved somewhere after you installed matplotlib? I'm not able to find this. The EPD installer comes as a Mac .pkg application which seems to hide everything that's going on. It saves Receipts, but these don't contain the kind of logs we're looking for, as far as I can tell. On my previous laptop, I was using OS X Snow Leopard with python and matplotlib from an older EPD version, and I had no troubles. Perhaps I need to ask the Enthought folks. Thanks, Jeff -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Error with PDF output with usetex
Hi Jeff, I am able to run the tex_demo.py with no problems and I can create output files using the Agg backend. When I try to use the PDF backend, however, I get an error which stems from dviread.py (pasted below). Any thoughts on what could be going wrong? Thanks! Jeff Hi Jeff, How did you install matplotlib? From source yourself? No, I'm using the Enthought Python Distribution (EPD64). And when you installed matplotlib, did it see that you had dvipng installed? FYI, you can do which dvipng to return the path where dvipng lives (if it is in your path already) or you can do locate dvipng to do a search for the binary if it isn't already in your path. P.S. You forgot to reply-all so everyone can see your response. $ which dvipng /usr/texbin/dvipng I don't remember any complaints while running the EPD installer. Would there be a way to check this? Is the problem definitely related to an inability to find dvipng, or could there be other possibilities? Thanks, Jeff I had a similar problem. I don't think it's an inability to find dvipng, I think it's that it couldn't find dvipng when matplotlib was built. When matplotlib builds there'll be a section of text sent to stdout under the heading of 'OPTIONAL DEPENDENCIES', there it will tell you whether it found dvipng when it was building. Are you able to find this? If not, are there install logs saved somewhere after you installed matplotlib? I'm not able to find this. The EPD installer comes as a Mac .pkg application which seems to hide everything that's going on. It saves Receipts, but these don't contain the kind of logs we're looking for, as far as I can tell. On my previous laptop, I was using OS X Snow Leopard with python and matplotlib from an older EPD version, and I had no troubles. Perhaps I need to ask the Enthought folks. Thanks, Jeff Hmm. You could try installing from source as per http://matplotlib.sourceforge.net/faq/installing_faq.html#building-and-installing-from-source-on-osx-with-epd and at least that way you can see what's going on. Damon McDougall d.mcdoug...@warwick.ac.uk http://damon.is-a-geek.com B2.39 Mathematics Institute Coventry West Midlands CV4 7AL -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Best way to cycle through numpy images using scroll?
I'm also looking into a similar issue, and would be interested to see what approaches others have taken. Has anyone found a good framework-independent solution? Keith On Wed, Aug 10, 2011 at 5:15 PM, David Just just.da...@mayo.edu wrote: I have an array of images stored as an array of numpy arrays. I need to be able to efficiently scroll through that set of images. My first attempt at doing this goes something like this: --init-- self.ax = pyplot.imshow(imgdta[0], interpolation='spline36', cmap=cm.gray, picker=True) # draw the plot @UndefinedVariable pyplot.axes().set_axis_off() self.fig = self.ax.get_figure() self.canvas = FigureCanvasGTKAgg(self.fig) --onscroll-- self.ax.set_array(imdta[n]) # 0 n num_images self.canvas.draw() This method of changing the image data does not seem to be very preferment. It takes ~.25 seconds to go from one image to the next. Can anybody suggest a faster way? This also ends up in a canvas that’s much larger than I need, is there a better way to define my view area? Thank you, Dave. -- uberSVN's rich system and user administration capabilities and model configuration take the hassle out of deploying and managing Subversion and the tools developers use with it. Learn more about uberSVN and get a free download at: http://p.sf.net/sfu/wandisco-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Best way to cycle through numpy images using scroll?
Here is how am solving this problem. It isn't terribly fast either, but it works for me. I wrote something with pygame that was faster, but it had its own set of problems. Tom --- import numpy as np import pylab class plotter: def __init__(self, im, i=0): self.im = im self.i = i self.vmin = im.min() self.vmax = im.max() self.fig = pylab.figure() pylab.gray() self.ax = self.fig.add_subplot(111) self.draw() self.fig.canvas.mpl_connect('key_press_event',self.key) def draw(self): if self.im.ndim is 2: im = self.im if self.im.ndim is 3: im = self.im[...,self.i] self.ax.set_title('image {0}'.format(self.i)) pylab.show() self.ax.imshow(im, vmin=self.vmin, vmax=self.vmax, interpolation=None) def key(self, event): old_i = self.i if event.key=='right': self.i = min(self.im.shape[2]-1, self.i+1) elif event.key == 'left': self.i = max(0, self.i-1) if old_i != self.i or old_j != self.j: self.draw() self.fig.canvas.draw() def show(im, i=0): plotter(im, i) On 08/17/2011 01:26 PM, Keith Hughitt wrote: I'm also looking into a similar issue, and would be interested to see what approaches others have taken. Has anyone found a good framework-independent solution? Keith On Wed, Aug 10, 2011 at 5:15 PM, David Just just.da...@mayo.edu mailto:just.da...@mayo.edu wrote: I have an array of images stored as an array of numpy arrays. I need to be able to efficiently scroll through that set of images. My first attempt at doing this goes something like this: --init-- self.ax http://self.ax = pyplot.imshow(imgdta[0], interpolation='spline36', cmap=cm.gray, picker=True) # draw the plot @UndefinedVariable pyplot.axes().set_axis_off() self.fig = self.ax.get_figure() self.canvas = FigureCanvasGTKAgg(self.fig) --onscroll-- self.ax.set_array(imdta[n]) # 0 n num_images self.canvas.draw() This method of changing the image data does not seem to be very preferment. It takes ~.25 seconds to go from one image to the next. Can anybody suggest a faster way? This also ends up in a canvas that’s much larger than I need, is there a better way to define my view area? Thank you, Dave. -- uberSVN's rich system and user administration capabilities and model configuration take the hassle out of deploying and managing Subversion and the tools developers use with it. Learn more about uberSVN and get a free download at: http://p.sf.net/sfu/wandisco-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Best way to cycle through numpy images using scroll?
Two issues with your code that should significantly speed things up. First, by calling imshow() each time for the draw, there is significant overhead caused by this. Instead -- (and this is a huge speedup) -- save the object returned by the first call to imshow(). That object has a method .set_array() that will allow you to just change the data contained within the AxesImage object. This is *much* faster than calling imshow() repeatedly. Note that the array going into set_array() will have to be of the same shape as the original image. Second, by setting the interpolation kwarg to *None*, you are merely telling imshow() to use the default interpolation specified in your rcParams file. Instead, you probably want nearest. Actually, supposedly, the upcoming release is supposed to support a new value none for absolutely no interpolation at all. The idea would be that one would pre-interpolate the image data before sending it to imshow() and have imshow set to do no interpolations at all. Therefore, the images display much faster. I hope this helps! Ben Root -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Best way to cycle through numpy images using scroll?
Excellent! That sped things up quite a bit. I can now flip through my small images with no perceivable delay. I will look forward to trying out the new interpolation setting when it gets here, since I have some larger images that still lag slightly. If others want, I can repost my code with Ben's changes. Thanks a bunch! Tom On 08/17/2011 03:30 PM, Benjamin Root wrote: Two issues with your code that should significantly speed things up. First, by calling imshow() each time for the draw, there is significant overhead caused by this. Instead -- (and this is a huge speedup) -- save the object returned by the first call to imshow(). That object has a method .set_array() that will allow you to just change the data contained within the AxesImage object. This is *much* faster than calling imshow() repeatedly. Note that the array going into set_array() will have to be of the same shape as the original image. Second, by setting the interpolation kwarg to *None*, you are merely telling imshow() to use the default interpolation specified in your rcParams file. Instead, you probably want nearest. Actually, supposedly, the upcoming release is supposed to support a new value none for absolutely no interpolation at all. The idea would be that one would pre-interpolate the image data before sending it to imshow() and have imshow set to do no interpolations at all. Therefore, the images display much faster. I hope this helps! Ben Root -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Newbie : How to add a Colored legend with Text for 3d plot
Hi everyone, I have successfully plotted a set of 372 (x,y,z ) scattered values in 7 series. Each point is a circle colored according to a color based on a simple lookup table. # Lookup table for color col_lut = dict(Bistris7p2 = burlywood, Cit7p2 = c,APhosph8p0 = m, Acetate5p5 = k,Borate8p5 = y,Mes6p7 = c,Hep8p2 = g,ATris9p0 = r) I was wondering how can I have a legend for this color code positioned somewhere alongside or within the interactive 3D figure. The legend text would be the col_lut keys and the colored values would be a box or circle filled with color alongside. I am sorry I couldnt find an appropriate example to help with the legend creation and am asking to be spoon fed. Do I use a matplotlib widget or some other utility to programmatically do this. Thanks for your help Hari My code is as follows: #!/usr/bin/python # import csv file with pH ,salt_conc , temp and do a 3d plot import csv from mpl_toolkits.mplot3d.axes3d import Axes3D import matplotlib.pyplot as plt from matplotlib import cm from matplotlib.colors import ListedColormap ph = [] salt_conc = [] tm = [] buffcomp = [] # Get the raw data f = open(stability_buffer_matrix_lookup_table_temp.csv) csvfile = csv.reader(f) #color lookup table col_lut = dict(Bistris7p2 = burlywood, Cit7p2 = c,APhosph8p0 = m, Acetate5p5 = k,Borate8p5 = y,Mes6p7 = c,Hep8p2 = g,ATris9p0 = r) for i in csvfile: # weed out incomplete data points if not in i: ph.append(float(i[4])) salt_conc.append(float(i[5])) tm.append(float(i[-1])) #gets a color from the lookup table based on the buffer component entry buffcomp.append(col_lut[i[3]]) print set(buffcomp) , col_lut fig = plt.figure(figsize=plt.figaspect(0.5)) ax = fig.add_subplot(1, 1, 1, projection='3d') surf = ax.scatter(ph,salt_conc,tm, c=buffcomp) ax.set_xlabel('pH') ax.set_ylabel('Salt Conc') ax.set_zlabel('Tm') #Tried this does not show up #colmap = ListedColormap(col_lut.values()) #colmap.Bounds = range(len(col_lut.keys()) +1 ) plt.show() -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Newbie : How to add a Colored legend with Text for 3d plot
On Wed, Aug 17, 2011 at 3:29 PM, hari jayaram hari...@gmail.com wrote: Hi everyone, I have successfully plotted a set of 372 (x,y,z ) scattered values in 7 series. Each point is a circle colored according to a color based on a simple lookup table. # Lookup table for color col_lut = dict(Bistris7p2 = burlywood, Cit7p2 = c,APhosph8p0 = m, Acetate5p5 = k,Borate8p5 = y,Mes6p7 = c,Hep8p2 = g,ATris9p0 = r) I was wondering how can I have a legend for this color code positioned somewhere alongside or within the interactive 3D figure. The legend text would be the col_lut keys and the colored values would be a box or circle filled with color alongside. I am sorry I couldnt find an appropriate example to help with the legend creation and am asking to be spoon fed. Do I use a matplotlib widget or some other utility to programmatically do this. Thanks for your help Hari Legend-handling in mplot3d is no different from how it is done for 2D plots. I don't know exactly how to do your particular example, but it would likely involve passing legend() a list of Patch objects that represent the markers you made, along with names. Maybe these examples might be useful? http://matplotlib.sourceforge.net/examples/pylab_examples/legend_demo.html http://matplotlib.sourceforge.net/examples/pylab_examples/legend_demo2.html http://matplotlib.sourceforge.net/examples/pylab_examples/legend_demo3.html This one in particular might be very relevant: http://matplotlib.sourceforge.net/examples/pylab_examples/legend_scatter.html I hope that helps! Ben Root -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Newbie : How to add a Colored legend with Text for 3d plot
Thanks for your email Ben. Sorry I am still lost. I dont understand what the handles type is . In my example I guess the handles are an array of circles representing each x,y,z point.I am still a little lost since the plot autmatically plots my 3 arrays The color of each circle is arbitrary and stored a the color array. Even after looking at the examples I dont know how to construct my plt.legend() call. Hari On Wed, Aug 17, 2011 at 5:35 PM, Benjamin Root ben.r...@ou.edu wrote: On Wed, Aug 17, 2011 at 3:29 PM, hari jayaram hari...@gmail.com wrote: Hi everyone, I have successfully plotted a set of 372 (x,y,z ) scattered values in 7 series. Each point is a circle colored according to a color based on a simple lookup table. # Lookup table for color col_lut = dict(Bistris7p2 = burlywood, Cit7p2 = c,APhosph8p0 = m, Acetate5p5 = k,Borate8p5 = y,Mes6p7 = c,Hep8p2 = g,ATris9p0 = r) I was wondering how can I have a legend for this color code positioned somewhere alongside or within the interactive 3D figure. The legend text would be the col_lut keys and the colored values would be a box or circle filled with color alongside. I am sorry I couldnt find an appropriate example to help with the legend creation and am asking to be spoon fed. Do I use a matplotlib widget or some other utility to programmatically do this. Thanks for your help Hari Legend-handling in mplot3d is no different from how it is done for 2D plots. I don't know exactly how to do your particular example, but it would likely involve passing legend() a list of Patch objects that represent the markers you made, along with names. Maybe these examples might be useful? http://matplotlib.sourceforge.net/examples/pylab_examples/legend_demo.html http://matplotlib.sourceforge.net/examples/pylab_examples/legend_demo2.html http://matplotlib.sourceforge.net/examples/pylab_examples/legend_demo3.html This one in particular might be very relevant: http://matplotlib.sourceforge.net/examples/pylab_examples/legend_scatter.html I hope that helps! Ben Root -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] changing the cursor position with a key press
Does anyone have an example showing how to change the cursor position using the key pad instead of the mouse? -Mathew -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Newbie : How to add a Colored legend with Text for 3d plot
On Wed, Aug 17, 2011 at 5:30 PM, hari jayaram hari...@gmail.com wrote: Thanks for your email Ben. Sorry I am still lost. I dont understand what the handles type is . In my example I guess the handles are an array of circles representing each x,y,z point.I am still a little lost since the plot autmatically plots my 3 arrays The color of each circle is arbitrary and stored a the color array. Even after looking at the examples I dont know how to construct my plt.legend() call. Take a look at the proxy artist section of the legend guide and see if that helps http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist JDH -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] changing the cursor position with a key press
On Wednesday, August 17, 2011, Mathew Yeates mat.yea...@gmail.com wrote: Does anyone have an example showing how to change the cursor position using the key pad instead of the mouse? -Mathew Are you talking about externally to mpl or within mpl? I have some code from a couple of months ago that automated graph interaction that allowed me to exactly reproduce various actions so I could profile the execution. It uses the Gtk accessibility framework to control the mouse. Ben Root -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] changing the cursor position with a key press
I'm looking for something like - display = gdk_display_get_default (); screen = gdk_display_get_default_screen (display); /* get cursor position */ gdk_display_get_pointer (display, NULL, x, y, NULL); /* set new cusor position */ x += xadd; y += yadd; gdk_display_warp_pointer (display, screen, x, y); On Wed, Aug 17, 2011 at 11:52 PM, Benjamin Root ben.r...@ou.edu wrote: On Wednesday, August 17, 2011, Mathew Yeates mat.yea...@gmail.com wrote: Does anyone have an example showing how to change the cursor position using the key pad instead of the mouse? -Mathew Are you talking about externally to mpl or within mpl? I have some code from a couple of months ago that automated graph interaction that allowed me to exactly reproduce various actions so I could profile the execution. It uses the Gtk accessibility framework to control the mouse. Ben Root -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] changing the cursor position with a key press
Here is how to do it display=mainwindow.get_display() screen = gtk.gdk.Display.get_default_screen(display) x,y=mainwindow.get_pointer() s,x,y,m = display.get_pointer() gtk.gdk.Display.warp_pointer(display, screen,x+1,y) On Wed, Aug 17, 2011 at 11:53 PM, Mathew Yeates mat.yea...@gmail.com wrote: I'm looking for something like - display = gdk_display_get_default (); screen = gdk_display_get_default_screen (display); /* get cursor position */ gdk_display_get_pointer (display, NULL, x, y, NULL); /* set new cusor position */ x += xadd; y += yadd; gdk_display_warp_pointer (display, screen, x, y); On Wed, Aug 17, 2011 at 11:52 PM, Benjamin Root ben.r...@ou.edu wrote: On Wednesday, August 17, 2011, Mathew Yeates mat.yea...@gmail.com wrote: Does anyone have an example showing how to change the cursor position using the key pad instead of the mouse? -Mathew Are you talking about externally to mpl or within mpl? I have some code from a couple of months ago that automated graph interaction that allowed me to exactly reproduce various actions so I could profile the execution. It uses the Gtk accessibility framework to control the mouse. Ben Root -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] changing the cursor position with a key press
On Wed, Aug 17, 2011 at 7:01 PM, Mathew Yeates mat.yea...@gmail.com wrote: Here is how to do it display=mainwindow.get_display() screen = gtk.gdk.Display.get_default_screen(display) x,y=mainwindow.get_pointer() s,x,y,m = display.get_pointer() gtk.gdk.Display.warp_pointer(display, screen,x+1,y) Ok, glad that works for you. For reference, the email I was referring to is here: http://www.mail-archive.com/matplotlib-devel@lists.sourceforge.net/msg08321.html The toolkit offers a bunch of other tools for scripting out interaction, in case anybody cares about that sort of thing. (actually, might be a good idea to consider adding stuff like that to the testing suite...) Ben Root -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] changing the cursor position with a key press
cool, On Wed, Aug 17, 2011 at 5:15 PM, Benjamin Root ben.r...@ou.edu wrote: On Wed, Aug 17, 2011 at 7:01 PM, Mathew Yeates mat.yea...@gmail.com wrote: Here is how to do it display=mainwindow.get_display() screen = gtk.gdk.Display.get_default_screen(display) x,y=mainwindow.get_pointer() s,x,y,m = display.get_pointer() gtk.gdk.Display.warp_pointer(display, screen,x+1,y) Ok, glad that works for you. For reference, the email I was referring to is here: http://www.mail-archive.com/matplotlib-devel@lists.sourceforge.net/msg08321.html The toolkit offers a bunch of other tools for scripting out interaction, in case anybody cares about that sort of thing. (actually, might be a good idea to consider adding stuff like that to the testing suite...) Ben Root -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Newbie : How to add a Colored legend with Text for 3d plot
Thanks a lot John and Benjamin for your help. The Proxy Artist approach fits the bill perfectly. I used the following code to make a legend from my color_lut lookup table. # Lookup table for color col_lut = dict(Bistris7p2 = burlywood, Cit7p2 = c,APhosph8p0 = m, Acetate5p5 = k,Borate8p5 = y,Mes6p7 = c,Hep8p2 = g,ATris9p0 = r) for key,value in col_lut.items(): legend_box.append(Rectangle((0,0),1,1,fc=%s % value)) legend_text.append(key) ax.legend(legend_box, legend_text) Hari On Wed, Aug 17, 2011 at 7:23 PM, John Hunter jdh2...@gmail.com wrote: On Wed, Aug 17, 2011 at 5:30 PM, hari jayaram hari...@gmail.com wrote: Thanks for your email Ben. Sorry I am still lost. I dont understand what the handles type is . In my example I guess the handles are an array of circles representing each x,y,z point.I am still a little lost since the plot autmatically plots my 3 arrays The color of each circle is arbitrary and stored a the color array. Even after looking at the examples I dont know how to construct my plt.legend() call. Take a look at the proxy artist section of the legend guide and see if that helps http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist JDH -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users