You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
(12) |
Sep
(12) |
Oct
(56) |
Nov
(65) |
Dec
(37) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(59) |
Feb
(78) |
Mar
(153) |
Apr
(205) |
May
(184) |
Jun
(123) |
Jul
(171) |
Aug
(156) |
Sep
(190) |
Oct
(120) |
Nov
(154) |
Dec
(223) |
2005 |
Jan
(184) |
Feb
(267) |
Mar
(214) |
Apr
(286) |
May
(320) |
Jun
(299) |
Jul
(348) |
Aug
(283) |
Sep
(355) |
Oct
(293) |
Nov
(232) |
Dec
(203) |
2006 |
Jan
(352) |
Feb
(358) |
Mar
(403) |
Apr
(313) |
May
(165) |
Jun
(281) |
Jul
(316) |
Aug
(228) |
Sep
(279) |
Oct
(243) |
Nov
(315) |
Dec
(345) |
2007 |
Jan
(260) |
Feb
(323) |
Mar
(340) |
Apr
(319) |
May
(290) |
Jun
(296) |
Jul
(221) |
Aug
(292) |
Sep
(242) |
Oct
(248) |
Nov
(242) |
Dec
(332) |
2008 |
Jan
(312) |
Feb
(359) |
Mar
(454) |
Apr
(287) |
May
(340) |
Jun
(450) |
Jul
(403) |
Aug
(324) |
Sep
(349) |
Oct
(385) |
Nov
(363) |
Dec
(437) |
2009 |
Jan
(500) |
Feb
(301) |
Mar
(409) |
Apr
(486) |
May
(545) |
Jun
(391) |
Jul
(518) |
Aug
(497) |
Sep
(492) |
Oct
(429) |
Nov
(357) |
Dec
(310) |
2010 |
Jan
(371) |
Feb
(657) |
Mar
(519) |
Apr
(432) |
May
(312) |
Jun
(416) |
Jul
(477) |
Aug
(386) |
Sep
(419) |
Oct
(435) |
Nov
(320) |
Dec
(202) |
2011 |
Jan
(321) |
Feb
(413) |
Mar
(299) |
Apr
(215) |
May
(284) |
Jun
(203) |
Jul
(207) |
Aug
(314) |
Sep
(321) |
Oct
(259) |
Nov
(347) |
Dec
(209) |
2012 |
Jan
(322) |
Feb
(414) |
Mar
(377) |
Apr
(179) |
May
(173) |
Jun
(234) |
Jul
(295) |
Aug
(239) |
Sep
(276) |
Oct
(355) |
Nov
(144) |
Dec
(108) |
2013 |
Jan
(170) |
Feb
(89) |
Mar
(204) |
Apr
(133) |
May
(142) |
Jun
(89) |
Jul
(160) |
Aug
(180) |
Sep
(69) |
Oct
(136) |
Nov
(83) |
Dec
(32) |
2014 |
Jan
(71) |
Feb
(90) |
Mar
(161) |
Apr
(117) |
May
(78) |
Jun
(94) |
Jul
(60) |
Aug
(83) |
Sep
(102) |
Oct
(132) |
Nov
(154) |
Dec
(96) |
2015 |
Jan
(45) |
Feb
(138) |
Mar
(176) |
Apr
(132) |
May
(119) |
Jun
(124) |
Jul
(77) |
Aug
(31) |
Sep
(34) |
Oct
(22) |
Nov
(23) |
Dec
(9) |
2016 |
Jan
(26) |
Feb
(17) |
Mar
(10) |
Apr
(8) |
May
(4) |
Jun
(8) |
Jul
(6) |
Aug
(5) |
Sep
(9) |
Oct
(4) |
Nov
|
Dec
|
2017 |
Jan
(5) |
Feb
(7) |
Mar
(1) |
Apr
(5) |
May
|
Jun
(3) |
Jul
(6) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
2018 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
1
(9) |
2
(8) |
3
(6) |
4
(5) |
5
(10) |
6
(1) |
7
|
8
(5) |
9
(3) |
10
(12) |
11
(24) |
12
(28) |
13
(16) |
14
(3) |
15
(10) |
16
(17) |
17
(19) |
18
(10) |
19
(20) |
20
(7) |
21
(11) |
22
(7) |
23
(5) |
24
(4) |
25
(11) |
26
(19) |
27
(1) |
28
(1) |
29
(13) |
30
(7) |
31
(22) |
|
|
|
From: Fernando P. <fpe...@gm...> - 2011-08-19 01:41:24
|
On Wed, Aug 17, 2011 at 5:53 AM, Jonathan Slavin <js...@cf...> wrote: > Attached are examples of the problem -- a PostScript file and the pdf > that is created using ps2pdf. The y-axis is properly labeled in the ps > file, but the part of the label using mathtext becomes invisible in the > pdf. > What happens if you generate the pdf file directly from matplotlib, and not via ps2pdf? That should work fine... Cheers, f |
From: bhargav v. <coo...@gm...> - 2011-08-18 21:26:03
|
Hello all Can any one explain me how can I use griddata in matplotlib for 2-d interpolation of polar to cartesian co-ordinates. I have two 1D arrays r and theta of 128 and 64 cells respectively I have a 2D array temperature T(r,theta) with (128, 64) cells. I would like to have Tnew(200,200) cells in cartesian coordinates x = r*cos(th) and y = r*sin(th) for the same I use Tnew = griddata(x,y,T,xi,yi) .... and x = outer(r,cos(th)) and y=outer(r,sin(th)) where xi,yi = mgrid[x.min():x.max():200j,y.min():y.max():200j] I get a ValueError suggesting that griddata does not like to have 2D arrays of x and y How can I get this to work? Regards Bhargav Vaidya |
From: Jonathan S. <js...@cf...> - 2011-08-18 17:20:33
|
Hi all, After trying several ways around this problem, I've found a solution that is pretty straightforward and produces nice results. The problem I'm referring to is that when I saved my figures as encapsulated PostScript for inclusion in a LaTeX document, the figures came out missing certain text when the document is converted to pdf (e.g. using dvipdf on the dvi file or ps2pdf on the ps file created using dvips). One solution is to set the rcParams['text.usetex'] = True, but that leads to a different font (serif) used for the numbers and for the axis labels (there are ways around that also...) But the best way that I've found is to save the figures as pdf and then convert them to eps by using pdftops with the -eps flag. You do lose transparency that way, but the figure, including text, looks good. You can also use the convert command from the ImageMagick package to do the pdf to eps conversion, which maintains the transparency at the cost of a worse looking figure (bitmapped) overall. It'd be nice to know exactly why this problem occurs in the first place. I assume it has to do with the interaction of pdf with some fonts used in mathtext. Jon -- ______________________________________________________________ Jonathan D. Slavin Harvard-Smithsonian CfA js...@cf... 60 Garden Street, MS 83 phone: (617) 496-7981 Cambridge, MA 02138-1516 cell: (781) 363-0035 USA ______________________________________________________________ |
From: mogliii <mo...@gm...> - 2011-08-18 16:30:01
|
I could already answer one question by myself about the top margin in gridspec. '''1) I would like to reduce the top margin. For that I though I can do something like this: gs = gridspec.GridSpec(2, 1, width_ratios=[2,1]) - gs.update(bottom=0.2, left=0.2, hspace=0.05) + gs.update(bottom=0.2, left=0.2, hspace=0.05, top=0.1) But I get an error ""ValueError: bottom cannot be >= top"". This limitation is not clear to me, why is this so?''' So if I want a top margin of 0.1*figure height I would have to specify >>> top = 0.9 So "top" is the absolute distance of the top plot edge from the lower figure edge. 1.0 would make the plot extend to the top edge. Looking back I must say that http://matplotlib.sourceforge.net/api/gridspec_api.html#matplotlib.gridspec.GridSpecBase is not very helpful. And it is very counter-intuitive to the Axes dimension specification with location lower left and width/height >>> plt.axes([0.1, 0.1, 0.8, 0.8]) To clarify I created a small illustration. |
From: Benjamin R. <ben...@ou...> - 2011-08-18 15:09:07
|
On Tue, Aug 16, 2011 at 7:12 PM, Andre' Walker-Loud <wal...@gm...>wrote: > Hi All, > > A question for a possible new feature for Matplotlib. > > First, in case there is a way to do it currently: > > I often find myself plotting data with errorbars, and I would like to be > able to modify the marker, or marker size of each individual point > separately. A (seemingly to me) natural way to do this would allow > > marker > markersize > markerfacecolor > markeredgecolor > > etc accept arrays, as well as a single kwarg. As far as I can tell, if I > have a set of data, and I want to make the markers with different sizes, the > only way to do this is have a loop that calls each data point individually > and assigns the marker features. > That's how I would do it right now. > > 1 - am I mistaken? and if so, could someone instruct me how to achieve my > goal > > 2 - does anyone else find this feature desirable? If so, could this be > added to Matplotlib? I have not the coding experience to attempt this > myself - but I imagine the simplest thing to do would be check if the > marker, ms, etc are given single kwargs, or arrays. If single, everything > happens as now. If array, then check the len of the array against the len > of the data, and if the same, match the entries. > > I personally would love to see more consistent support for features like this across all plotting and collection types. However, there are some issues that prevent making this an easy fix. The primary issue is distinguishing user intent with respect to colors. Right now, a user could specify color as a string or a rgb tuple. Now, if we accept an array of those things, it becomes harder to determine the user's intent. The way forward, I think, is some sort of decorator library (dbook.py?) that provides a common set of methods that all plotting and collection functions could use to consistently prepare input data. I encourage you to file a feature request on github, but for now, the best way seems to be looping the errorbar call. Cheers, Ben Root |
From: mogliii <mo...@gm...> - 2011-08-18 08:53:42
|
Hi, I want to have two plots above each other with shared y-axis. For this I am using gridspec to adjust the vertical distance between the graphs. Attached is a .pdf with the current results. Two problems: 1) I would like to reduce the top margin. For that I though I can do something like this: gs = gridspec.GridSpec(2, 1, width_ratios=[2,1]) - gs.update(bottom=0.2, left=0.2, hspace=0.05) + gs.update(bottom=0.2, left=0.2, hspace=0.05, top=0.1) But I get an error ""ValueError: bottom cannot be >= top"". This limitation is not clear to me, why is this so? 2) I want to make a shared y-axis label. I found this page: http://www.scipy.org/Cookbook/Matplotlib/Multiple_Subplots_with_One_Axis_Label But any additional axis I put before the gridspec axis is not shown in the end. Is there a special procedure that can be used together with gridspec? Below the code I use for the figure: ################################ import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec # Import data into numpy ndarray tung = np.loadtxt('tungsten_profiles_leveled.txt') insu = np.loadtxt('insulator_profiles_leveled.txt') fig_width_pt = 270 fig_height_pt = 220 inches_per_pt = 1.0/72.27 # Convert pt to inches fig_width = fig_width_pt*inches_per_pt # width in inches fig_height =fig_height_pt*inches_per_pt # height in inches fig_size = [fig_width,fig_height] # Settings for fitting LaTeX style plt.rc('font',**{'family':'serif','serif':['Computer Modern Roman']}) params = {'backend': 'ps', 'text.latex.preamble': [r"\usepackage{upgreek}"], 'axes.labelsize': 10, 'text.fontsize': 10, 'legend.fontsize': 8, 'xtick.labelsize': 8, 'ytick.labelsize': 8, 'text.usetex': True, 'figure.figsize': fig_size, 'axes.unicode_minus': True} plt.rcParams.update(params) ####### plt.figure(1) plt.clf() gs = gridspec.GridSpec(2, 1, width_ratios=[2,1]) gs.update(bottom=0.2, left=0.2, hspace=0.05, top=0.1) ax1 = plt.subplot(gs[0]) plt.ylabel(r'Height (nm)', labelpad = 12) for i in range(len(tung[:][0])/2): ax1.plot(tung[:,i*2]*1e6-0.3, tung[:,1+i*2]*1e9,linewidth=1) plt.ylim(-1,11) plt.yticks([0, 2, 4, 6, 8, 10]) leg = ax1.legend(('Profile 1', 'Profile 2', 'Profile 3', 'Profile 4', 'Profile 5', 'Profile 6', 'Profile 7'), shadow=True, loc = (1.1,-0.5)) plt.setp(ax1.get_xticklabels(), visible=False) ax1.annotate(r'\bf Tungsten', xy=(0,10), xycoords='data', # <-- check webpage for different coordinate systems horizontalalignment='left', verticalalignment='top', fontsize=10) ax2 = plt.subplot(gs[1], sharex = ax1) for i in range(len(insu[:][0])/2): ax2.plot(insu[:,i*2]*1e6-0.3, insu[:,1+i*2]*1e9,linewidth=1) plt.xlim(-0.1,2.1) plt.ylim(-1,11) plt.yticks([0, 2, 4, 6, 8, 10]) plt.xlabel(r'Position ($\upmu$m)', labelpad = 12) plt.ylabel(r'Height (nm)', labelpad = 12) # r for raw ax2.annotate(r'\bf Insulator', xy=(0,10), xycoords='data', # <-- check webpage for different coordinate systems horizontalalignment='left', verticalalignment='top', fontsize=10) #plt.show() plt.savefig('line_profiles.pdf') |
From: R. O'G. <ron...@ya...> - 2011-08-18 04:10:45
|
Hey guys, I was hoping someone could provide a hint for how I should go about correcting this. As you can see, locations for the inline labels for contours in this image are unfortunately chosen, and they overlap with one another. If I set manual to 'True' then I get this weird behavior where I can only choose labels in the top left grid and nothing is shownin any of the other grids. I am using a 2x2 Image Grid (I get the same problem when using gridspec instead of image grid), and loadingcontour data (2x2 array) from a file. Thanks for your help, Ron |
From: hari j. <ha...@gm...> - 2011-08-18 01:26:25
|
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 <jd...@gm...> wrote: > On Wed, Aug 17, 2011 at 5:30 PM, hari jayaram <ha...@gm...> 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 > |
From: Mathew Y. <mat...@gm...> - 2011-08-18 00:28:05
|
cool, On Wed, Aug 17, 2011 at 5:15 PM, Benjamin Root <ben...@ou...> wrote: > On Wed, Aug 17, 2011 at 7:01 PM, Mathew Yeates <mat...@gm...> 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/mat...@li.../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 > > |
From: Benjamin R. <ben...@ou...> - 2011-08-18 00:15:27
|
On Wed, Aug 17, 2011 at 7:01 PM, Mathew Yeates <mat...@gm...> 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/mat...@li.../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 |
From: Mathew Y. <mat...@gm...> - 2011-08-18 00:01:36
|
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...@gm...> 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...@ou...> wrote: >> >> >> On Wednesday, August 17, 2011, Mathew Yeates <mat...@gm...> 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 > |
From: Mathew Y. <mat...@gm...> - 2011-08-17 23:53:23
|
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...@ou...> wrote: > > > On Wednesday, August 17, 2011, Mathew Yeates <mat...@gm...> 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 |
From: Benjamin R. <ben...@ou...> - 2011-08-17 23:52:19
|
On Wednesday, August 17, 2011, Mathew Yeates <mat...@gm...> 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 |
From: John H. <jd...@gm...> - 2011-08-17 23:23:27
|
On Wed, Aug 17, 2011 at 5:30 PM, hari jayaram <ha...@gm...> 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 |
From: Mathew Y. <mat...@gm...> - 2011-08-17 22:53:31
|
Does anyone have an example showing how to change the cursor position using the key pad instead of the mouse? -Mathew |
From: hari j. <ha...@gm...> - 2011-08-17 22:31:03
|
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...@ou...> wrote: > On Wed, Aug 17, 2011 at 3:29 PM, hari jayaram <ha...@gm...> 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 > > |
From: Benjamin R. <ben...@ou...> - 2011-08-17 21:36:12
|
On Wed, Aug 17, 2011 at 3:29 PM, hari jayaram <ha...@gm...> 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 |
From: hari j. <ha...@gm...> - 2011-08-17 20:29:42
|
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() |
From: Tom D. <tdi...@ph...> - 2011-08-17 20:29:14
|
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 |
From: Benjamin R. <ben...@ou...> - 2011-08-17 19:30:40
|
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 |
From: Tom D. <tdi...@ph...> - 2011-08-17 19:18:26
|
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 <Jus...@ma... > <mailto:Jus...@ma...>> 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 > Mat...@li... > <mailto:Mat...@li...> > 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Keith H. <kei...@gm...> - 2011-08-17 17:26:58
|
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 <Jus...@ma...> 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
From: Damon M. <D.M...@wa...> - 2011-08-17 13:44:28
|
>> 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.m...@wa... http://damon.is-a-geek.com B2.39 Mathematics Institute Coventry West Midlands CV4 7AL |
From: Jeff K. <kl...@wi...> - 2011-08-17 13:28:24
|
On Tue, Aug 16, 2011 at 4:22 AM, Damon McDougall <D.M...@wa...> 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 |
From: Jonathan S. <js...@cf...> - 2011-08-17 13:16:23
|
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 > <js...@cf...> 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 > > Mat...@li... > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- ______________________________________________________________ Jonathan D. Slavin Harvard-Smithsonian CfA js...@cf... 60 Garden Street, MS 83 phone: (617) 496-7981 Cambridge, MA 02138-1516 cell: (781) 363-0035 USA ______________________________________________________________ |