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: Benjamin R. <ben...@ou...> - 2011-08-30 03:33:10
|
On Mon, Aug 29, 2011 at 10:26 PM, Trevor J Christensen < tr...@jc...> wrote: > I have a number of questions, but I'll start with one. Consider the > following code: > > import matplotlib as mpl > import matplotlib.pyplot as plt > import numpy as np > x = np.arange(1, 6) > plt.plot(x, x*1.5) > plt.show() > s = raw_input('Enter anything to continue:') > plt.show() > print 'The end' > > Question: The first plt.show() launches an interactive window. Control > returns to the script upon its close. The second plt.show() does nothing > that I can see. Why? > > Ubuntu 11.04, Python 2.7.1, Matplotlib 0.99.3 > That is because closing the figure destroys that object. If you want full interactive mode, I suggest updating to v1.0.1 (or the upcoming v1.1.0 release) and use plt.ion(). The show() will trigger the figures to appear, but control immediately returns to the script. Interactivity in earlier versions of mpl is a bit more hit-or-miss, so you can try it out first before updating. Also note that multiple calls to plt.show() in earlier versions are not recommended, but are allowed in v1.0 and up. I hope this helps, Ben Root |
From: Trevor J C. <tr...@jc...> - 2011-08-30 03:26:41
|
I have a number of questions, but I'll start with one. Consider the following code: import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np x = np.arange(1, 6) plt.plot(x, x*1.5) plt.show() s = raw_input('Enter anything to continue:') plt.show() print 'The end' Question: The first plt.show() launches an interactive window. Control returns to the script upon its close. The second plt.show() does nothing that I can see. Why? Ubuntu 11.04, Python 2.7.1, Matplotlib 0.99.3 |
From: Benjamin R. <ben...@ou...> - 2011-08-30 02:12:21
|
How about Numpy's loadtxt()? Genfromtext is more of a specialty function. Ben Root On Monday, August 29, 2011, Alexa Villaume <ale...@gm...> wrote: > Hi there, > I have a 2d array that I'd like to contour. The plot isn't turning out right and I think it's because the array isn't be read in correctly. > It's a 25x41 array that is in a text file. I have tried using genfromtxt and the asciitable module to read the data in and neither gives the correct output. > Does anyone know of any command either specific for reading in 2d arrays or is able to handle 2d arrays? > Thanks, > Alexa |
From: Alexa V. <ale...@gm...> - 2011-08-30 01:31:42
|
Hi there, I have a 2d array that I'd like to contour. The plot isn't turning out right and I think it's because the array isn't be read in correctly. It's a 25x41 array that is in a text file. I have tried using genfromtxt and the asciitable module to read the data in and neither gives the correct output. Does anyone know of any command either specific for reading in 2d arrays or is able to handle 2d arrays? Thanks, Alexa |
From: Benjamin R. <ben...@ou...> - 2011-08-29 21:30:10
|
On Sun, Aug 28, 2011 at 3:03 PM, Bruce Ford <br...@cl...>wrote: > Getting a strange result trying to divide two 3d arrays. I am getting > a matrix of NaNs regardless of how I divide and I can't determine why. > > #opened a NetCDF file using python-netcdf4 > > var1 = nc_file.variables['var1'] ###shape = [31,181,360] with a > values ranging from 0 - 243 and NO NaNs in the array, dtype float32 > var2 = nc_file.variables['var2'] ###shape = [31,181,360] with a > values ranging from 0 - 4 (mostly zeros) and NO NaNs in the array, > dtype float32 > > np.seterr(all='ignore') #in case problem has something do to with > dividing by zero > > var1/var2 ###gives array of NaNs with shape of 31,181,360 > > #doing the division one slice at a time doesn't help... > for x in range(1,var1.shape[0]): > var[x,:,:] = var1[x,:,:]/var2[x,:,:] ###gives array of > NaNs with shape of 31,181,360 > > var = np.divide(var1,var2) ###gives array of NaNs with shape of 31,181,360 > > > print "<p>where max: " + np.where(var1 == np.max(var1)) #prints > (array([28]), array([79]), array([182])) > print var1[28,79,182] #print 545 > print var2[28,79,182] ##prints 6 > > #so there are values in this location that should not result in an > NaN. Instead I get an entire array of NaNs > > What am I missing? > > Bruce > > Just to be sure, what might appear to be all NaNs is not really. To find out for sure, do this: print np.any(np.isfinite(var1/var2)) If it is True, then the array is not full of NaNs and Infs, if False, then that would be odd. When you print an array to the screen, it will often only print part of the array. Furthermore, the author of the post that you link to in your other email misses some important facts about representation of numbers in computers. The reason 0 / 0 (integers) did not return a NaN or 2 / 0 return an Inf is that integers can not represent those values. Only floating point numbers can. Furthermore, there is an important difference between Inf and NaN. It is merely out of convenience that nan_to_num() would convert the Infs into the largest (or smallest for -Inf) floating point number. Other functions designed for NaN (such as nansum(), nanmax(), etc) do not treat Infs in this manner. Ben Root |
From: John H. <jd...@gm...> - 2011-08-29 20:13:04
|
On Mon, Aug 29, 2011 at 2:56 PM, Mark Bakker <ma...@gm...> wrote: > Hello List, > > Does anybody know of any plans to include support for the new datetime64 > data type in numpy? If this is the new numpy standard for doing dates and > times, it would be great if it would work with plot_date, for example. > > Just wondering (but boy, would I do a little dance when all this datetime > stuff is fully operational and integrated), Should be fairly straightforward to write a converter. Just follow the example of DateConverter in matplotlib.dates :https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/dates.py: class DateConverter(units.ConversionInterface): """ Converter for datetime.date and datetime.datetime data, or for date/time data represented as it would be converted by :func:`date2num`. The 'unit' tag for such data is None or a tzinfo instance. """ @staticmethod def axisinfo(unit, axis): """ Return the :class:`~matplotlib.units.AxisInfo` for *unit*. *unit* is a tzinfo instance or None. The *axis* argument is required but not used. """ tz = unit majloc = AutoDateLocator(tz=tz) majfmt = AutoDateFormatter(majloc, tz=tz) datemin = datetime.date(2000, 1, 1) datemax = datetime.date(2010, 1, 1) return units.AxisInfo( majloc=majloc, majfmt=majfmt, label='', default_limits=(datemin, datemax)) @staticmethod def convert(value, unit, axis): """ If *value* is not already a number or sequence of numbers, convert it with :func:`date2num`. The *unit* and *axis* arguments are not used. """ if units.ConversionInterface.is_numlike(value): return value return date2num(value) @staticmethod def default_units(x, axis): 'Return the tzinfo instance of *x* or of its first element, or None' try: x = x[0] except (TypeError, IndexError): pass try: return x.tzinfo except AttributeError: pass return None units.registry[datetime.date] = DateConverter() units.registry[datetime.datetime] = DateConverter() |
From: Mark B. <ma...@gm...> - 2011-08-29 19:56:12
|
Hello List, Does anybody know of any plans to include support for the new datetime64 data type in numpy? If this is the new numpy standard for doing dates and times, it would be great if it would work with plot_date, for example. Just wondering (but boy, would I do a little dance when all this datetime stuff is fully operational and integrated), Mark |
From: Eric F. <ef...@ha...> - 2011-08-29 18:04:14
|
On 08/29/2011 07:40 AM, Benjamin Root wrote: > > > On Mon, Aug 29, 2011 at 12:30 PM, Eric Firing <ef...@ha... > <mailto:ef...@ha...>> wrote: > > On 08/29/2011 05:44 AM, Benjamin Root wrote: > > On Mon, Aug 29, 2011 at 9:59 AM, James McMurray > <jam...@gm... <mailto:jam...@gm...> > > <mailto:jam...@gm... <mailto:jam...@gm...>>> wrote: > > > > Okay, so using cm.set_over() and set_under works, but is > there any > > way of adding the set colors to the edges of the colorbar? > > > > > > > > This example should do what you want: > > > > http://matplotlib.sourceforge.net/examples/api/colorbar_only.html > > Also > http://matplotlib.sourceforge.net/examples/pylab_examples/contourf_demo.html. > > Note that "extend=both" is the relevant kwarg. With contourf, the kwarg > goes in the contourf call, and colorbar automatically gets it from the > ContourSet. With other types of color mappable plot, the kwarg needs to > be given directly to the colorbar call. > > Eric > > > Crap! Is that why my colorbars from my pcolors (or was it pcolormesh?) > never worked right? I have been making colorbars directly for a while > now because I couldn't figure out why those colorbars didn't work right. > > I think I will file a feature request to fix this inconsistency. > Probably will be a bit involved to fix it, though. It's not entirely an inconsistency. The logic is this: extend='both' (or whatever) directly affects the levels used in contourf; there is nothing similar in imshow or pcolor*. Adding the extend kwarg to them would simply be putting it in place for later use by colorbar. Eric > > Ben Root > > > > ------------------------------------------------------------------------------ > EMC VNX: the world's simplest storage, starting under $10K > The only unified storage solution that offers unified management > Up to 160% more powerful than alternatives and 25% more efficient. > Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev > > > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Benjamin R. <ben...@ou...> - 2011-08-29 17:41:04
|
On Mon, Aug 29, 2011 at 12:30 PM, Eric Firing <ef...@ha...> wrote: > On 08/29/2011 05:44 AM, Benjamin Root wrote: > > On Mon, Aug 29, 2011 at 9:59 AM, James McMurray <jam...@gm... > > <mailto:jam...@gm...>> wrote: > > > > Okay, so using cm.set_over() and set_under works, but is there any > > way of adding the set colors to the edges of the colorbar? > > > > > > > > This example should do what you want: > > > > http://matplotlib.sourceforge.net/examples/api/colorbar_only.html > > Also > > http://matplotlib.sourceforge.net/examples/pylab_examples/contourf_demo.html > . > > Note that "extend=both" is the relevant kwarg. With contourf, the kwarg > goes in the contourf call, and colorbar automatically gets it from the > ContourSet. With other types of color mappable plot, the kwarg needs to > be given directly to the colorbar call. > > Eric > > Crap! Is that why my colorbars from my pcolors (or was it pcolormesh?) never worked right? I have been making colorbars directly for a while now because I couldn't figure out why those colorbars didn't work right. I think I will file a feature request to fix this inconsistency. Probably will be a bit involved to fix it, though. Ben Root |
From: Eric F. <ef...@ha...> - 2011-08-29 17:30:46
|
On 08/29/2011 05:44 AM, Benjamin Root wrote: > On Mon, Aug 29, 2011 at 9:59 AM, James McMurray <jam...@gm... > <mailto:jam...@gm...>> wrote: > > Okay, so using cm.set_over() and set_under works, but is there any > way of adding the set colors to the edges of the colorbar? > > > > This example should do what you want: > > http://matplotlib.sourceforge.net/examples/api/colorbar_only.html Also http://matplotlib.sourceforge.net/examples/pylab_examples/contourf_demo.html. Note that "extend=both" is the relevant kwarg. With contourf, the kwarg goes in the contourf call, and colorbar automatically gets it from the ContourSet. With other types of color mappable plot, the kwarg needs to be given directly to the colorbar call. Eric > > I hope that helps! > Ben Root > > > > ------------------------------------------------------------------------------ > EMC VNX: the world's simplest storage, starting under $10K > The only unified storage solution that offers unified management > Up to 160% more powerful than alternatives and 25% more efficient. > Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev > > > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Bruce F. <br...@cl...> - 2011-08-29 16:10:41
|
Closing the loop...I found the difficulty and applied this: var = np.nan_to_num(np.divide(var1,var2)) See this page: http://psaffrey.wordpress.com/2010/07/30/numpy-and-nan-again/ --------------------------------------- Bruce W. Ford Clear Science, Inc. br...@cl... On Sun, Aug 28, 2011 at 4:03 PM, Bruce Ford <br...@cl...> wrote: > Getting a strange result trying to divide two 3d arrays. I am getting > a matrix of NaNs regardless of how I divide and I can't determine why. > > #opened a NetCDF file using python-netcdf4 > > var1 = nc_file.variables['var1'] ###shape = [31,181,360] with a > values ranging from 0 - 243 and NO NaNs in the array, dtype float32 > var2 = nc_file.variables['var2'] ###shape = [31,181,360] with a > values ranging from 0 - 4 (mostly zeros) and NO NaNs in the array, > dtype float32 > > np.seterr(all='ignore') #in case problem has something do to with > dividing by zero > > var1/var2 ###gives array of NaNs with shape of 31,181,360 > > #doing the division one slice at a time doesn't help... > for x in range(1,var1.shape[0]): > var[x,:,:] = var1[x,:,:]/var2[x,:,:] ###gives array of > NaNs with shape of 31,181,360 > > var = np.divide(var1,var2) ###gives array of NaNs with shape of 31,181,360 > > > print "<p>where max: " + np.where(var1 == np.max(var1)) #prints > (array([28]), array([79]), array([182])) > print var1[28,79,182] #print 545 > print var2[28,79,182] ##prints 6 > > #so there are values in this location that should not result in an > NaN. Instead I get an entire array of NaNs > > What am I missing? > > Bruce > > --------------------------------------- > Bruce W. Ford > Clear Science, Inc. > br...@cl... > |
From: Benjamin R. <ben...@ou...> - 2011-08-29 15:44:58
|
On Mon, Aug 29, 2011 at 9:59 AM, James McMurray <jam...@gm...>wrote: > Okay, so using cm.set_over() and set_under works, but is there any way of > adding the set colors to the edges of the colorbar? > > > This example should do what you want: http://matplotlib.sourceforge.net/examples/api/colorbar_only.html I hope that helps! Ben Root |
From: James M. <jam...@gm...> - 2011-08-29 14:59:24
|
Okay, so using cm.set_over() and set_under works, but is there any way of adding the set colors to the edges of the colorbar? On 29 August 2011 15:47, James McMurray <jam...@gm...> wrote: > Hi, > > Is it possible to color values outside the colorbar limits in a different > color than the colorbar itself. So for example, an otherwise greyscale plot > could have the values outside the upperlimit in blue and those below the > lower limit in red, so that these points are not confused with the > legitimate data points (as they can be when they are just more black and > white points as default). > > Thanks, > James McMurray > |
From: mdekauwe <mde...@gm...> - 2011-08-29 13:59:34
|
Can you describe what you want to do? So you now want a histogram? surfcast23 wrote: > > Sorry everyone I totally missed something very important. What I need to > do is first bin the masses(which I don't know how to do). > > Chelonian wrote: >> >> On Thu, Aug 25, 2011 at 10:01 PM, surfcast23 <sur...@gm...> >> wrote: >>> >>> Hi, >>> >>> there is only one column. so I want a plot of y and x. With y taking >>> values running from 0 to n or 7 in my example and x as the average of >>> the >>> values that are contained in the rows in my example it was 5.57. >> >> It seems to me that, as described, you want a plot that in which all >> the bars are the same height (or width if it is a sideways bar chart), >> in this case, 5.57. That makes no sense. >> >> What information is this plot is intended to provide the viewer? >> >> ------------------------------------------------------------------------------ >> EMC VNX: the world's simplest storage, starting under $10K >> The only unified storage solution that offers unified management >> Up to 160% more powerful than alternatives and 25% more efficient. >> Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> > > -- View this message in context: http://old.nabble.com/How-do-you-Plot-data-generated-by-a-python-script--tp32328822p32357095.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: James M. <jam...@gm...> - 2011-08-29 13:47:49
|
Hi, Is it possible to color values outside the colorbar limits in a different color than the colorbar itself. So for example, an otherwise greyscale plot could have the values outside the upperlimit in blue and those below the lower limit in red, so that these points are not confused with the legitimate data points (as they can be when they are just more black and white points as default). Thanks, James McMurray |
From: Samuel T. S. <arc...@gm...> - 2011-08-29 12:28:10
|
Eu gostaria de adicioná-lo à minha rede profissional no LinkedIn. -Samuel Teixeira Samuel Teixeira Santos Analista B na Embrapa Cerrados Brasília e redondezas, Brasil Confirme que você conhece Samuel Teixeira Santos: https://www.linkedin.com/e/-b7qixr-grxfc2g9-4q/isd/4010246358/ylaRjg6e/ -- Você está recebendo convites de conexão por e-mail. Clique aqui para parar de recebê-los: http://www.linkedin.com/e/-b7qixr-grxfc2g9-4q/_dML4GcZf3-2F5VO_wzm4ASVf0JrnPVO-ObO4eeHsZV8OPkmQwLeZN8i/goo/matplotlib-users%40lists%2Esourceforge%2Enet/20061/I1381245525_1/ (c) 2011 LinkedIn Corporation. 2029 Stierlin Ct, Mountain View, CA 94043 - EUA. |
From: galorencom <gal...@gm...> - 2011-08-29 11:29:43
|
Hello I have an animation which shows 3D diffusion I added color bar at the side during the animation the colors changing but the scale at the colorbar of the graph stay asame. please help with that soon as you can! Thanks! Gal:working: -- View this message in context: http://old.nabble.com/Refresh-colorbar-in-3D-graph-animation-tp32356118p32356118.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: Bruce F. <br...@cl...> - 2011-08-28 20:04:09
|
Getting a strange result trying to divide two 3d arrays. I am getting a matrix of NaNs regardless of how I divide and I can't determine why. #opened a NetCDF file using python-netcdf4 var1 = nc_file.variables['var1'] ###shape = [31,181,360] with a values ranging from 0 - 243 and NO NaNs in the array, dtype float32 var2 = nc_file.variables['var2'] ###shape = [31,181,360] with a values ranging from 0 - 4 (mostly zeros) and NO NaNs in the array, dtype float32 np.seterr(all='ignore') #in case problem has something do to with dividing by zero var1/var2 ###gives array of NaNs with shape of 31,181,360 #doing the division one slice at a time doesn't help... for x in range(1,var1.shape[0]): var[x,:,:] = var1[x,:,:]/var2[x,:,:] ###gives array of NaNs with shape of 31,181,360 var = np.divide(var1,var2) ###gives array of NaNs with shape of 31,181,360 print "<p>where max: " + np.where(var1 == np.max(var1)) #prints (array([28]), array([79]), array([182])) print var1[28,79,182] #print 545 print var2[28,79,182] ##prints 6 #so there are values in this location that should not result in an NaN. Instead I get an entire array of NaNs What am I missing? Bruce --------------------------------------- Bruce W. Ford Clear Science, Inc. br...@cl... |
From: Niels L. E. <nie...@gm...> - 2011-08-27 12:19:17
|
Dear matplotlib Gurus If I run the script below then I end up creating a graph where some of the grid lines are missing. The problem disappear if I remove the call to ax.axis("equal") or the calls to set_smart_bounds(True). I already found a different way to solve my problem, but I thought that this bugreport might be useful to you. Kind regards Niels #!/usr/bin/env python import numpy as np imporot matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator fig = plt.figure(1, frameon=False,) ax = fig.add_subplot(1,1,1) #If you remove these two line the problem disappears ax.spines['left'].set_smart_bounds(True) ax.spines['bottom'].set_smart_bounds(True) #Grid ax.xaxis.set_major_locator(MultipleLocator(0.2)) ax.xaxis.set_minor_locator(MultipleLocator(0.1)) ax.yaxis.set_major_locator(MultipleLocator(0.2)) ax.yaxis.set_minor_locator(MultipleLocator(0.1)) ax.xaxis.grid(True,'minor') ax.yaxis.grid(True,'minor') ax.xaxis.grid(True,'major',linewidth=2) ax.yaxis.grid(True,'major',linewidth=2) #If you remove this line the problem disappears ax.axis("equal") #The graph phi=np.arange(0,np.pi,0.1) ax.plot(np.cos(phi),np.sin(phi)) #Save fig.savefig('unit_circle.png', dpi=200) |
From: Stan W. <sta...@nr...> - 2011-08-26 21:14:09
|
From: ben...@gm... [mailto:ben...@gm...] On Behalf Of Benjamin Root Sent: Friday, August 26, 2011 13:11 Actually, that might be useful. The current solution I have is to use the core contouring function in mpl to generate paths, but they doesn't seem to guarantee either clockwise or counter-clockwise traversals. Does graham scan guarantee something like that? I need to calculate outward-facing normal vectors. The points would be traversed in radial order from P's vantage, as if a radar sweep numbered each point as it passed by. I suppose that if the points form a convex polygon, then that traversal order is the same one that would result from anywhere in the interior, and it would be unambiguously clockwise or counter-clockwise depending on the sort order. (You might have to handle the case in which P and two or more other points are colinear by breaking the tie in the sort appropriately.) If the points form a concave polygon-that is, if one or more points lie inside the convex hull of the points-then I suppose you would need additional constraints or information to choose where those points should fall in the traversal order. I'm glad the method might help. |
From: Benjamin R. <ben...@ou...> - 2011-08-26 17:11:01
|
On Friday, August 26, 2011, Stan West <sta...@nr...> wrote: > From: Benjamin Root [mailto:ben...@ou...] > Sent: Friday, August 19, 2011 13:43 > > I have an arbitrary list of coordinates that I know represent the boundary of a polygon. Is there some sort of function from the contouring or path codes that would allow me to pass in that list and get back the resorted list with the path codes with it? > > Hi, Ben. Is it the order of the points around the polygon that is unknown, and is it unambiguous because the polygon is known to be convex? If so, I believe you could use part of the Graham scan [1] convex hull algorithm. The function you need would find the point P with the lowest Y coordinate, then sort the remaining points by the cosine of the angle they and P make with the X axis. After that, the list comprising P and the sorted points would need the path codes. > > If the polygon is concave but the order is somehow clear (e.g., a radial progression about the average coordinate), you might be able to adapt the method. I hope I understood your problem correctly and that this helps. > > [1] http://en.wikipedia.org/wiki/Graham_scan Actually, that might be useful. The current solution I have is to use the core contouring function in mpl to generate paths, but they doesn't seem to guarantee either clockwise or counter-clockwise traversals. Does graham scan guarantee something like that? I need to calculate outward-facing normal vectors. Ben Root |
From: Stan W. <sta...@nr...> - 2011-08-26 17:00:19
|
From: Benjamin Root [mailto:ben...@ou...] Sent: Friday, August 19, 2011 13:43 I have an arbitrary list of coordinates that I know represent the boundary of a polygon. Is there some sort of function from the contouring or path codes that would allow me to pass in that list and get back the resorted list with the path codes with it? Hi, Ben. Is it the order of the points around the polygon that is unknown, and is it unambiguous because the polygon is known to be convex? If so, I believe you could use part of the Graham scan [1] convex hull algorithm. The function you need would find the point P with the lowest Y coordinate, then sort the remaining points by the cosine of the angle they and P make with the X axis. After that, the list comprising P and the sorted points would need the path codes. If the polygon is concave but the order is somehow clear (e.g., a radial progression about the average coordinate), you might be able to adapt the method. I hope I understood your problem correctly and that this helps. [1] http://en.wikipedia.org/wiki/Graham_scan |
From: Jouni K. S. <jk...@ik...> - 2011-08-26 16:37:34
|
Michael Droettboom <md...@st...> writes: > The other approach is used when "text.usetex" is True. It calls out > to a real "tex" interpreter and then interprets the DVI it produces to > convert it into a form the matplotlib backends can use. Since I > didn't write this code, I'm not as familiar with the details. There are actually at least three mechanisms used by text.usetex: (1) The Postscript backend uses psfrag. The Postscript file has placeholders for LaTeX text, and the file is processed with LaTeX and dvips to replace these placeholders with typeset text. (2) The Agg backend puts each piece of TeX text into a separate file (which you can find in ~/.matplotlib/tex.cache), processes it with LaTeX into dvi and with dvipng into png, reads in the png files and overlays them onto the image. (That's at least what I imagine it does; I have not looked at the code.) (3) The pdf backend uses the dviread module (written originally by me). The various pieces of text are written into different tex files, just as with the Agg backend, then processed with LaTeX into dvi files, which in turn are translated by dviread into sequences of (x, y, font, character) tuples. The dviread module reads the pdftex.map configuration file, which maps the TeX font names into Postscript fonts, which are embedded in the output PDF file, and the characters are placed at the coordinates specified in the dvi file. The dvipng approach avoids dealing with fonts, but the output is a bitmap. With psfrag you can only get Postscript output (which is nontrivial to parse), but it includes scalable fonts. The dviread approach gets you both scalable fonts and the information of where each character is, but you will have to deal with the fonts yourself. In PDF output this is relatively easy, since we can piggyback on the pdftex.map configuration file, which conveniently points to font files that can be embedded in PDF. -- Jouni K. Seppänen http://www.iki.fi/jks |
From: Sebastian B. <seb...@si...> - 2011-08-26 16:36:35
|
Hi, On Fri, 2011-08-26 at 06:09 -0700, a.sam wrote: > I have a problem with changing the ticklabels text. In fact I am aware of the > method which is explained by the matplotlib help center. But I need more > flexibility with ticklabels text. You could set the formatter yourself instead of manipulating strings or setting the ticklabels by hand. IE: my_formatter = matplotlib.ticker.FormatStrFormatter('a%s') #etc... see http://matplotlib.sourceforge.net/api/ticker_api.html a = plt.gca() a.xaxis.set_major_formatter(my_formatter) plt.draw() Regards, Sebastian > For example, I want to add an "a" before every tick label of the xaxis. So I > wrote the following sample code: > #---------------------------------------------------------------- > from pylab import * > # > t = arange(0.0, 100.0, 0.1) > s = sin(0.1*pi*t)*exp(-t*0.01) > # > ax = subplot(111) > plot(t,s) > # > for label1 in ax.xaxis.get_majorticklabels(): > label1.set_weight('bold') > label1._text="a"+label1._text > # > show() > #---------------------------------------------------------------- > It seems to me that `` label1._text="a"+label1._text ' ' should do this > job, but it does nothing. The only way I found was using something like > this: > > ax.xaxis.set_ticklabels(('a0','a20','a40','a60','a80','a100')) > > which I would rather not to use, because there are lots of graphs in my > project and I do not want to this process manually. So, my question is which > property or method would set (and also get) the ticklabel text? > > Thanks is advance |
From: Benjamin R. <ben...@ou...> - 2011-08-26 16:13:58
|
On Friday, August 26, 2011, a.sam <a....@gm...> wrote: > > I have a problem with changing the ticklabels text. In fact I am aware of the > method which is explained by the matplotlib help center. But I need more > flexibility with ticklabels text. > For example, I want to add an "a" before every tick label of the xaxis. So I > wrote the following sample code: > #---------------------------------------------------------------- > from pylab import * > # > t = arange(0.0, 100.0, 0.1) > s = sin(0.1*pi*t)*exp(-t*0.01) > # > ax = subplot(111) > plot(t,s) > # > for label1 in ax.xaxis.get_majorticklabels(): > label1.set_weight('bold') > label1._text="a"+label1._text > # > show() > #---------------------------------------------------------------- > It seems to me that `` label1._text="a"+label1._text ' ' should do this > job, but it does nothing. The only way I found was using something like > this: > > ax.xaxis.set_ticklabels(('a0','a20','a40','a60','a80','a100')) > > which I would rather not to use, because there are lots of graphs in my > project and I do not want to this process manually. So, my question is which > property or method would set (and also get) the ticklabel text? > > Thanks is advance Why not use get_ticklabels() to get the list of strings, modify that, and call set_ticklabels() with the modified list? Ben Root |