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
(20) |
2
(21) |
3
(21) |
4
(14) |
5
(8) |
|
6
(12) |
7
(16) |
8
(27) |
9
(39) |
10
(19) |
11
(12) |
12
(3) |
|
13
(3) |
14
(18) |
15
(14) |
16
(6) |
17
(7) |
18
(19) |
19
(5) |
|
20
(8) |
21
(24) |
22
(42) |
23
(12) |
24
(11) |
25
(16) |
26
(2) |
|
27
(4) |
28
(10) |
|
|
|
|
|
|
From: Kris K. <kri...@gm...> - 2011-02-02 01:03:59
|
I am trying to plot a large number of locations that need to be labeled. Often the locations are quite clustered and the resulting text is unreadable. I have been looking through the API and examples on the matplotlib web page, and I don't see a straightforward way to plot text labels, preventing them from overlapping. There is no easy answer to the problem, since locating the labels so they are close to the point you want to label, and not overlapping is a sort of optimization problem, I guess. Using annotate(), the location and alignment of the text can be fixed, but you don't know the size of the resulting box until after draw() is called. Once draw is called, you can inquire what the bounding box for a label is, and then check to see if it overlaps with other labels, but this is an iterative process, and draw() can be quite slow to call repeatedly. I guess unless you use a fixed-width font (possible, but not optimal), you just don't know how big the labels will be, and therefore where they will extend to, and then how they should be avoided. This involves coming up with some sort of accounting system for the location and size of each text box, outside of the matplotlib API, and seems sub-optimal. Has anybody dealt with this problem and come up with an elegant or efficient solution? Kris |
|
From: Paul I. <piv...@gm...> - 2011-02-02 00:33:25
|
Jeremy Conlin, on 2011-02-01 16:48, wrote: > I'm trying to create a custom colormap used with pcolormesh, but the > results seem inconsistent to me. I want the following colors > > -3 < x <= -2 ----- Black > -2 < x <= -1 ----- Blue > -1 < x <= 0 ----- Yellow > 0 < x <= 1 ----- Green > 1 < x <= inf ----- Red > > A minimal example is copied below. I have a 2-D array that looks like: > > -1, 6, 2.5 > 1.3, -2, 4/3 > 2.5, 6, 0 > > I want to get a pcolormesh that looks like > > R R Y > R K R > B R R > > But instead I get: > > Y R B > Y K Y > K R Y > > I recognize that the pcolormesh is plotted "upside-down" from how the > matrix is printed. I apparently don't understand how to use a custom > colormap. I have tried to follow the example here: > > http://matplotlib.sourceforge.net/examples/api/colorbar_only.html > > but haven't been too successful. It seems like there is a > normalization going on that I can't seem to track down. Can anyone > see what is wrong? > > Thanks, > Jeremy > > > import numpy > import matplotlib.pyplot as pyplot > import matplotlib.colors > > C = numpy.array([[-1,6,2.5],[4/3., -2, 4/3.],[2.5,6,0.0]],dtype=float) > > cMap = matplotlib.colors.ListedColormap(['k', 'b', 'y', 'g', 'r']) > Bounds = [-3.0, -2.0, -1.0, 0.0, 1.0, numpy.inf] > > # Plot > Fig = pyplot.figure() > pyplot.pcolormesh(C, cmap=cMap) Hi Jeremy, you're right, matplotlib expects colors to be in the range 0-1. I've added the appropriate normalization below. I also had to subtract a small number from C to adjust for your specification of the desired intervals being closed on the upper bound, because the default makes lower bound closed. In other words, the default is to treat the bounds as -3 <= x < -2 for black, in your case, instead of -3 < x <= -2 as you wanted it. # R R Y # R K R # B R R n = mpl.colors.normalize(-3,2) pyplot.pcolormesh(C-(1e-15), cmap=cMap,norm=n) |
|
From: Benjamin R. <ben...@ou...> - 2011-02-02 00:19:28
|
On Tue, Feb 1, 2011 at 6:05 PM, Jeremy Conlin <jlc...@gm...> wrote: > On Tue, Feb 1, 2011 at 5:00 PM, Benjamin Root <ben...@ou...> wrote: > > > > > > On Tue, Feb 1, 2011 at 5:48 PM, Jeremy Conlin <jlc...@gm...> > wrote: > >> > >> I'm trying to create a custom colormap used with pcolormesh, but the > >> results seem inconsistent to me. I want the following colors > >> > >> -3 < x <= -2 ----- Black > >> -2 < x <= -1 ----- Blue > >> -1 < x <= 0 ----- Yellow > >> 0 < x <= 1 ----- Green > >> 1 < x <= inf ----- Red > >> > >> A minimal example is copied below. I have a 2-D array that looks like: > >> > >> -1, 6, 2.5 > >> 1.3, -2, 4/3 > >> 2.5, 6, 0 > >> > >> I want to get a pcolormesh that looks like > >> > >> R R Y > >> R K R > >> B R R > >> > >> But instead I get: > >> > >> Y R B > >> Y K Y > >> K R Y > >> > >> I recognize that the pcolormesh is plotted "upside-down" from how the > >> matrix is printed. I apparently don't understand how to use a custom > >> colormap. I have tried to follow the example here: > >> > >> http://matplotlib.sourceforge.net/examples/api/colorbar_only.html > >> > >> but haven't been too successful. It seems like there is a > >> normalization going on that I can't seem to track down. Can anyone > >> see what is wrong? > >> > >> Thanks, > >> Jeremy > >> > >> > >> import numpy > >> import matplotlib.pyplot as pyplot > >> import matplotlib.colors > >> > >> C = numpy.array([[-1,6,2.5],[4/3., -2, 4/3.],[2.5,6,0.0]],dtype=float) > >> > >> cMap = matplotlib.colors.ListedColormap(['k', 'b', 'y', 'g', > 'r']) > >> Bounds = [-3.0, -2.0, -1.0, 0.0, 1.0, numpy.inf] > >> > >> # Plot > >> Fig = pyplot.figure() > >> pyplot.pcolormesh(C, cmap=cMap) > >> > > > > Have you given imshow() a try? The pcolor() and family are really meant > for > > more general domain specifications. imshow() is about as basic as one > can > > get for producing an image that shows the colors for particular values. > > matshow() also does something similar and doesn't interpolate between > > points. > > > > I don't know if it would fix your problem, but it should be a good start. > > I just tried both imshow and matshow and they gave the same output, > but the plot was rotated -90º. I don't care so much about how it is > oriented, but I do care about consistency, i.e. -1 should be plotted > as blue, but is instead black. I could also accept -1 as yellow since > -1 is on the boundary. pcolor, imshow, and matshow all show the same > inconsistency. > > Jeremy > I think I just figured out what is wrong. In your code, you create a ListedColormap, but you don't assign a Norm object. So, when you call pcolor or whatever, it will use the default norm using the range of input values. I see you created a list of boundaries called Bounds, but you don't do anything with it. I believe you want to first make a BoundaryNorm object using Bounds and pass that object to the ListedColormap using the norm keyword. That should fix it. Ben Root |
|
From: Jeremy C. <jlc...@gm...> - 2011-02-02 00:05:37
|
On Tue, Feb 1, 2011 at 5:00 PM, Benjamin Root <ben...@ou...> wrote: > > > On Tue, Feb 1, 2011 at 5:48 PM, Jeremy Conlin <jlc...@gm...> wrote: >> >> I'm trying to create a custom colormap used with pcolormesh, but the >> results seem inconsistent to me. I want the following colors >> >> -3 < x <= -2 ----- Black >> -2 < x <= -1 ----- Blue >> -1 < x <= 0 ----- Yellow >> 0 < x <= 1 ----- Green >> 1 < x <= inf ----- Red >> >> A minimal example is copied below. I have a 2-D array that looks like: >> >> -1, 6, 2.5 >> 1.3, -2, 4/3 >> 2.5, 6, 0 >> >> I want to get a pcolormesh that looks like >> >> R R Y >> R K R >> B R R >> >> But instead I get: >> >> Y R B >> Y K Y >> K R Y >> >> I recognize that the pcolormesh is plotted "upside-down" from how the >> matrix is printed. I apparently don't understand how to use a custom >> colormap. I have tried to follow the example here: >> >> http://matplotlib.sourceforge.net/examples/api/colorbar_only.html >> >> but haven't been too successful. It seems like there is a >> normalization going on that I can't seem to track down. Can anyone >> see what is wrong? >> >> Thanks, >> Jeremy >> >> >> import numpy >> import matplotlib.pyplot as pyplot >> import matplotlib.colors >> >> C = numpy.array([[-1,6,2.5],[4/3., -2, 4/3.],[2.5,6,0.0]],dtype=float) >> >> cMap = matplotlib.colors.ListedColormap(['k', 'b', 'y', 'g', 'r']) >> Bounds = [-3.0, -2.0, -1.0, 0.0, 1.0, numpy.inf] >> >> # Plot >> Fig = pyplot.figure() >> pyplot.pcolormesh(C, cmap=cMap) >> > > Have you given imshow() a try? The pcolor() and family are really meant for > more general domain specifications. imshow() is about as basic as one can > get for producing an image that shows the colors for particular values. > matshow() also does something similar and doesn't interpolate between > points. > > I don't know if it would fix your problem, but it should be a good start. I just tried both imshow and matshow and they gave the same output, but the plot was rotated -90º. I don't care so much about how it is oriented, but I do care about consistency, i.e. -1 should be plotted as blue, but is instead black. I could also accept -1 as yellow since -1 is on the boundary. pcolor, imshow, and matshow all show the same inconsistency. Jeremy |
|
From: Benjamin R. <ben...@ou...> - 2011-02-02 00:01:14
|
On Tue, Feb 1, 2011 at 5:48 PM, Jeremy Conlin <jlc...@gm...> wrote: > I'm trying to create a custom colormap used with pcolormesh, but the > results seem inconsistent to me. I want the following colors > > -3 < x <= -2 ----- Black > -2 < x <= -1 ----- Blue > -1 < x <= 0 ----- Yellow > 0 < x <= 1 ----- Green > 1 < x <= inf ----- Red > > A minimal example is copied below. I have a 2-D array that looks like: > > -1, 6, 2.5 > 1.3, -2, 4/3 > 2.5, 6, 0 > > I want to get a pcolormesh that looks like > > R R Y > R K R > B R R > > But instead I get: > > Y R B > Y K Y > K R Y > > I recognize that the pcolormesh is plotted "upside-down" from how the > matrix is printed. I apparently don't understand how to use a custom > colormap. I have tried to follow the example here: > > http://matplotlib.sourceforge.net/examples/api/colorbar_only.html > > but haven't been too successful. It seems like there is a > normalization going on that I can't seem to track down. Can anyone > see what is wrong? > > Thanks, > Jeremy > > > import numpy > import matplotlib.pyplot as pyplot > import matplotlib.colors > > C = numpy.array([[-1,6,2.5],[4/3., -2, 4/3.],[2.5,6,0.0]],dtype=float) > > cMap = matplotlib.colors.ListedColormap(['k', 'b', 'y', 'g', 'r']) > Bounds = [-3.0, -2.0, -1.0, 0.0, 1.0, numpy.inf] > > # Plot > Fig = pyplot.figure() > pyplot.pcolormesh(C, cmap=cMap) > > Have you given imshow() a try? The pcolor() and family are really meant for more general domain specifications. imshow() is about as basic as one can get for producing an image that shows the colors for particular values. matshow() also does something similar and doesn't interpolate between points. I don't know if it would fix your problem, but it should be a good start. Ben Root |
|
From: Jeremy C. <jlc...@gm...> - 2011-02-01 23:48:42
|
I'm trying to create a custom colormap used with pcolormesh, but the results seem inconsistent to me. I want the following colors -3 < x <= -2 ----- Black -2 < x <= -1 ----- Blue -1 < x <= 0 ----- Yellow 0 < x <= 1 ----- Green 1 < x <= inf ----- Red A minimal example is copied below. I have a 2-D array that looks like: -1, 6, 2.5 1.3, -2, 4/3 2.5, 6, 0 I want to get a pcolormesh that looks like R R Y R K R B R R But instead I get: Y R B Y K Y K R Y I recognize that the pcolormesh is plotted "upside-down" from how the matrix is printed. I apparently don't understand how to use a custom colormap. I have tried to follow the example here: http://matplotlib.sourceforge.net/examples/api/colorbar_only.html but haven't been too successful. It seems like there is a normalization going on that I can't seem to track down. Can anyone see what is wrong? Thanks, Jeremy import numpy import matplotlib.pyplot as pyplot import matplotlib.colors C = numpy.array([[-1,6,2.5],[4/3., -2, 4/3.],[2.5,6,0.0]],dtype=float) cMap = matplotlib.colors.ListedColormap(['k', 'b', 'y', 'g', 'r']) Bounds = [-3.0, -2.0, -1.0, 0.0, 1.0, numpy.inf] # Plot Fig = pyplot.figure() pyplot.pcolormesh(C, cmap=cMap) |
|
From: Paul I. <piv...@gm...> - 2011-02-01 21:42:30
|
Denzel Li, on 2011-02-01 15:34, wrote:
> I had this problem but could not find the answer online. I will be highly
> appreciating if anyone can point me some direction on this problem.
> I installed pythonxy and used matplotlib through ipython. I used matshow to
> draw a matrix and then set ticklables. This lead to the shown rows having
> uneven height. The following shows my problem:
> ----------------------
> import numpy
> M=randn(4,6)
> matshow(M)
> -----------------------
> This works fine and is shown in fig1.png. However, after I set the yticks:
> ------------------------
> yticks(arange(4), ('1','2','3','4'))
> ---------------------------
> The rows of the matrix drawn have uneven height. Please see fig2.png.
Hi Denzel,
what version of matplotlib are you using? I am unable to
reproduce on fairly recent checkout of svn trunk, so it may be an
issue that was recently fixed.
one workaround would be to set the ylim after the call to yticks,
like this:
plt.ylim(3.5, -0.5)
best,
--
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7
|
|
From: Jeremy C. <jlc...@gm...> - 2011-02-01 20:23:40
|
On Tue, Feb 1, 2011 at 1:11 PM, Benjamin Root <ben...@ou...> wrote: > > > On Tue, Feb 1, 2011 at 1:48 PM, Jeremy Conlin <jlc...@gm...> wrote: >> >> On Tue, Feb 1, 2011 at 11:22 AM, Benjamin Root <ben...@ou...> wrote: >> > >> > >> > On Tue, Feb 1, 2011 at 11:58 AM, Jeremy Conlin <jlc...@gm...> >> > wrote: >> >> >> >> I have two arrays and I want to plot the ratio of A/B when A>=B or B/A >> >> when A<B. I can create numpy masked arrays to find the result in >> >> these two instances, but I'm having trouble plotting them. Below I >> >> have a minimal example. I get a plot, but only from the second time I >> >> issue the pcolormesh command. Is there a way to combine the two >> >> arrays for plotting or to plot without overlapping? >> >> >> >> Thanks, >> >> Jeremy >> >> >> >> >> > >> > Try this: >> > >> > ratio = numpy.where(A >= B, A/B, B/A) >> > Figure = pyplot.figure() >> > pyplot.pcolormesh(ratio) >> > >> > I hope that helps! >> >> numpy.where helps a lot. To further complicate things, some elements >> of A or B are zero which causes A/B or B/A to be infinite in some >> places. I can use numpy.where or create a masked array to elimnate >> those elements that are infinite, but then my plotted values are >> either 0 or 1 (False or True); I lose all the interesting data. The >> documents of pcolormesh show that I can pass a masked_array, but I'm >> successful in doing that. Do you have another trick you can show to >> help me get around this problem? >> >> Thanks again, >> Jeremy > > > I think you are using the masked array and/or the np.where incorrectly. > > ratio = np.where(A >= B, A/B, B/A) > ratio = np.ma.masked_array(ratio, mask=(~np.isfinite(ratio))) > > And then do a contourf on ratio. Yeah, that seems to work. Thanks for the help. Jeremy |
|
From: Benjamin R. <ben...@ou...> - 2011-02-01 20:11:39
|
On Tue, Feb 1, 2011 at 1:48 PM, Jeremy Conlin <jlc...@gm...> wrote: > On Tue, Feb 1, 2011 at 11:22 AM, Benjamin Root <ben...@ou...> wrote: > > > > > > On Tue, Feb 1, 2011 at 11:58 AM, Jeremy Conlin <jlc...@gm...> > wrote: > >> > >> I have two arrays and I want to plot the ratio of A/B when A>=B or B/A > >> when A<B. I can create numpy masked arrays to find the result in > >> these two instances, but I'm having trouble plotting them. Below I > >> have a minimal example. I get a plot, but only from the second time I > >> issue the pcolormesh command. Is there a way to combine the two > >> arrays for plotting or to plot without overlapping? > >> > >> Thanks, > >> Jeremy > >> > >> > > > > Try this: > > > > ratio = numpy.where(A >= B, A/B, B/A) > > Figure = pyplot.figure() > > pyplot.pcolormesh(ratio) > > > > I hope that helps! > > numpy.where helps a lot. To further complicate things, some elements > of A or B are zero which causes A/B or B/A to be infinite in some > places. I can use numpy.where or create a masked array to elimnate > those elements that are infinite, but then my plotted values are > either 0 or 1 (False or True); I lose all the interesting data. The > documents of pcolormesh show that I can pass a masked_array, but I'm > successful in doing that. Do you have another trick you can show to > help me get around this problem? > > Thanks again, > Jeremy > I think you are using the masked array and/or the np.where incorrectly. ratio = np.where(A >= B, A/B, B/A) ratio = np.ma.masked_array(ratio, mask=(~np.isfinite(ratio))) And then do a contourf on ratio. Ben Root |
|
From: Darren D. <dsd...@gm...> - 2011-02-01 18:29:50
|
On Tue, Feb 1, 2011 at 12:50 PM, Andraz Omahen <zaz...@gm...> wrote: > I just want you to stop sending massages to me form matplotlib. Unsubscribe here: https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Michael D. <md...@st...> - 2011-02-01 18:27:48
|
You can unsubscribe here: https://sourceforge.net/mail/?group_id=80706 On 02/01/2011 12:50 PM, Andraz Omahen wrote: > I just want you to stop sending massages to me form matplotlib. > > Thank you > > > ------------------------------------------------------------------------------ > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! > Finally, a world-class log management solution at an even better price-free! > Download using promo code Free_Logger_4_Dev2Dev. Offer expires > February 28th, so secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsight-sfd2d > > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Benjamin R. <ben...@ou...> - 2011-02-01 18:23:27
|
On Tue, Feb 1, 2011 at 11:58 AM, Jeremy Conlin <jlc...@gm...> wrote: > I have two arrays and I want to plot the ratio of A/B when A>=B or B/A > when A<B. I can create numpy masked arrays to find the result in > these two instances, but I'm having trouble plotting them. Below I > have a minimal example. I get a plot, but only from the second time I > issue the pcolormesh command. Is there a way to combine the two > arrays for plotting or to plot without overlapping? > > Thanks, > Jeremy > > > Try this: ratio = numpy.where(A >= B, A/B, B/A) Figure = pyplot.figure() pyplot.pcolormesh(ratio) I hope that helps! Ben Root |
|
From: Benjamin R. <ben...@ou...> - 2011-02-01 18:18:51
|
On Tue, Feb 1, 2011 at 11:09 AM, Francesco Benincasa < fra...@bs...> wrote: > Hi all, > > I'm using pygrads for plotting maps from netcdf files. > > I use the contourf method, but I'm not able to fill the region where there > are > no value (there is the missing value -999) with a color. It seems to ignore > the set_bad method that I used to make the colormap. > > Any suggestions? > > Thank you very much in advance. > > -- > | Francesco Benincasa > > Most likely, the issue is that set_bad is more for setting the color when encountering masked values (through masked arrays). As a quick and dirty way to deal with it, try setting that color through the set_under() method. The correct way to do this is to use set_bad, but convert your numpy array that you are displaying into a masked array like so: z_ma = np.ma.masked_array(z, mask=(z == -999)) and use contourf on z_ma. Let us know how that works for you. Ben Root |
|
From: Jeremy C. <jlc...@gm...> - 2011-02-01 17:58:53
|
I have two arrays and I want to plot the ratio of A/B when A>=B or B/A when A<B. I can create numpy masked arrays to find the result in these two instances, but I'm having trouble plotting them. Below I have a minimal example. I get a plot, but only from the second time I issue the pcolormesh command. Is there a way to combine the two arrays for plotting or to plot without overlapping? Thanks, Jeremy import numpy import matplotlib.pyplot as pyplot N = 5 A = numpy.array(numpy.random.randint(0, 10, (N,N)), dtype='float64') B = numpy.array(numpy.random.randint(0, 10, (N,N)), dtype='float64') ab = numpy.ma.masked_array(A/B, mask=A>=B, fill_value=0.0) ba = numpy.ma.masked_array(B/A, mask=A<B) Figure = pyplot.figure() pyplot.pcolormesh(ab) pyplot.pcolormesh(ba) |
|
From: Andraz O. <zaz...@gm...> - 2011-02-01 17:50:32
|
I just want you to stop sending massages to me form matplotlib. Thank you |
|
From: Jason G. <jas...@cr...> - 2011-02-01 17:47:58
|
On 2/1/11 11:40 AM, Darren Dale wrote:
> On Tue, Feb 1, 2011 at 12:29 PM, Jason Grout
> <jas...@cr...> wrote:
>> Observe the following image:
>>
>> import pylab
>> pylab.plot([0,1],[1,2],label="$\sigma'_0$")
>> pylab.legend()
>> pylab.savefig('test.png')
>>
>>
>> Notice that the \prime introduced by the single quote in the legend is
>> not raised above the \sigma, like it would be in TeX (i.e., in TeX,
>> $\sigma'_0$ is equivalent to $\sigma^\prime_0$, IIRC). Is this a design
>> decision, or is it easy to fix?
>
> Did you try:
>
> pylab.plot([0,1],[1,2],label="$\sigma^\prime_0$")
Yes, both that and
pylab.plot([0,1],[1,2],label="$\sigma^'_0$")
work fine. So we know a (somewhat clumsy) workaround.
Jason
|
|
From: Darren D. <dsd...@gm...> - 2011-02-01 17:40:09
|
On Tue, Feb 1, 2011 at 12:29 PM, Jason Grout
<jas...@cr...> wrote:
> Observe the following image:
>
> import pylab
> pylab.plot([0,1],[1,2],label="$\sigma'_0$")
> pylab.legend()
> pylab.savefig('test.png')
>
>
> Notice that the \prime introduced by the single quote in the legend is
> not raised above the \sigma, like it would be in TeX (i.e., in TeX,
> $\sigma'_0$ is equivalent to $\sigma^\prime_0$, IIRC). Is this a design
> decision, or is it easy to fix?
Did you try:
pylab.plot([0,1],[1,2],label="$\sigma^\prime_0$")
?
|
|
From: Paul I. <piv...@gm...> - 2011-02-01 17:30:16
|
Francesco Montesano, on 2011-02-01 12:07, wrote: > I attach a sample code which does not work. > > import numpy as np > > import matplotlib.pyplot as plt > > > > #create function to plot plus random error > > x = np.linspace(0,3,100) > > y = np.sin(x) > > err = np.random.random(100) > > > > plt.errorbar(x,y, yerr=err, color='g',linestyle='None',xuplims=True) > > plt.show() Hi Francesco, > > plt.errorbar(x,y, yerr=err, color='g',linestyle='None',xuplims=True) I'm not sure what you're hoping to see, but you should either use xerr with xuplims, or yerr with uplims. best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 |
|
From: Jason G. <jas...@cr...> - 2011-02-01 17:29:52
|
Observe the following image:
import pylab
pylab.plot([0,1],[1,2],label="$\sigma'_0$")
pylab.legend()
pylab.savefig('test.png')
Notice that the \prime introduced by the single quote in the legend is
not raised above the \sigma, like it would be in TeX (i.e., in TeX,
$\sigma'_0$ is equivalent to $\sigma^\prime_0$, IIRC). Is this a design
decision, or is it easy to fix? This is with matplotlib 1.0.0.
Thanks,
Jason
|
|
From: Francesco B. <fra...@bs...> - 2011-02-01 17:11:51
|
Hi all, I'm using pygrads for plotting maps from netcdf files. I use the contourf method, but I'm not able to fill the region where there are no value (there is the missing value -999) with a color. It seems to ignore the set_bad method that I used to make the colormap. Any suggestions? Thank you very much in advance. -- | Francesco Benincasa |
|
From: Francesco M. <fra...@go...> - 2011-02-01 16:58:39
|
Dear all, I'm producing a single figure with subplots arrange in a single columns. They all share the same x range but the y variable change from subplot to subplot In order have a nicer figure I hide the first and the last y label of each subplot in the following way > ytl = subpl.get_ymajorticklabels() > ytl[0].set_visible(False) > ytl[-1].set_visible(False) > It was well in most cases. But I've noticed that in some plot the first and/or the last label remains. In this cases, if I "print ytl", it writes "<a list of n Text yticklabel objects>", where "n" is larger by 1 or 2 than the number of labels shown before I make them invisible. So I end up having some label (nearly) exactly on the upper and/or bottom range of the plot. Is there a way to force the axis to return exactly the number of labels shown in the plot? Thanks in advance, Francesco |
|
From: Jason G. <ja...@gr...> - 2011-02-01 16:20:18
|
Observe the following image:
import pylab
pylab.plot([0,1],[1,2],label="$\sigma'_0$")
pylab.legend()
pylab.savefig('test.png')
Notice that the \prime introduced by the single quote in the legend is
not raised above the \sigma, like it would be in TeX (i.e., in TeX,
$\sigma'_0$ is equivalent to $\sigma^\prime_0$, IIRC). Is this a design
decision, or is it easy to fix? This is with matplotlib 1.0.0.
Thanks,
Jason
|
|
From: Paul A. L. <pau...@gm...> - 2011-02-01 12:06:21
|
On 10. juni 2009, at 14.53, John Hunter wrote:
> On Wed, Jun 10, 2009 at 1:58 AM, Paul Anton
> Letnes<pau...@gm...> wrote:
>
>>> This _must_ be a bug. Consider the following:
>>> ##############
>>> import matplotlib
>
> No it is not a bug -- mpl is doing what you tell it to do. Consider
>
>>>> figure()
>>>> subplot(111)
>>>> plot([1,2,3])
>>>> xlabel('hi mom', fontsize=100)
>
> Each command has precise meaning -- the fig creates a figure using the
> default size, the subplot occupies a fraction of that figure according
> to the default ratios in the subplots_adjust parameters, and the
> xlabel makes a label at an indicated physical size. You may not be
> explicitly setting those sizes, but they are all defined via defaults
> in the matplotlibrc. We try and make mpl do what you tell it to do,
> not to try and out-smart you and do what we think you are telling it
> to do.
>
> Now I definitely support the idea that we should have a *feature* to
> auto-adjust the subplots_adjust params and fontsizes so that it "just
> works" more often. But this should be an optional feature so the user
> who wants to express their intent clearly will not constantly be
> stymied by mpl adjusting the sizes. Michael Droettboom has worked on
> it and it is a difficult problem to get right.
>
> JDH
I don't mean to bother people with this question again, but has anyone implemented this auto-adjust feature that John was talking about? It would be nice not having to adjust matplotlib.rcParams['figure.subplot.left'] (and friends) in every plot script, or alternatively, through a clever hierarchy of matplotlibrc files.
By the way: kudos to matplotlib in every other respect!
Cheers
Paul
|
|
From: Francesco M. <fra...@go...> - 2011-02-01 11:08:01
|
Dear all, I am trying to make a plot with errorbars and upperlimits. I've found the following pylab example http://matplotlib.sourceforge.net/examples/pylab_examples/errorbar_limits.htmland it works fine both on a Mac OSX10.6 with python 2.6.1 and on Kubuntu 10.04 with python 2.6.5. I've tried the to reproduce the example using matplotlib.pyplot but the limits do not show up, regardless of syntax or system (matplotlib 1.0.0 on Mac and 1.0.1 on Kubuntu) I attach a sample code which does not work. import numpy as np > import matplotlib.pyplot as plt > > #create function to plot plus random error > x = np.linspace(0,3,100) > y = np.sin(x) > err = np.random.random(100) > > plt.errorbar(x,y, yerr=err, color='g',linestyle='None',xuplims=True) > plt.show() > Does anyone know how to solve this problem? Thanks in advance, Francesco |