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
(24) |
2
(35) |
3
(21) |
4
(15) |
5
(1) |
|
6
(2) |
7
(30) |
8
(16) |
9
(11) |
10
(10) |
11
(10) |
12
(4) |
|
13
(2) |
14
(14) |
15
(21) |
16
(7) |
17
(5) |
18
(2) |
19
(5) |
|
20
|
21
(4) |
22
(8) |
23
(4) |
24
(6) |
25
(2) |
26
(2) |
|
27
(5) |
28
(9) |
29
(16) |
30
(14) |
31
(5) |
|
|
|
From: Gael V. <gae...@no...> - 2009-12-13 23:48:03
|
========================== Announcing EuroScipy 2010 ========================== --------------------------------------------------- The 3rd European meeting on Python in Science --------------------------------------------------- **Paris, Ecole Normale Supérieure, July 8-11 2010** We are happy to announce the 3rd EuroScipy meeting, in Paris, July 2010. The EuroSciPy meeting is a cross-disciplinary gathering focused on the use and development of the Python language in scientific research. This event strives to bring together both users and developers of scientific tools, as well as academic research and state of the art industry. Important dates ================== ====================================== =================================== **Registration opens** Sunday March 29 **Paper submission deadline** Sunday May 9 **Program announced** Sunday May 22 **Tutorials tracks** Thursday July 8 - Friday July 9 **Conference track** Saturday July 10 - Sunday July 11 ====================================== =================================== Tutorial ========= There will be two tutorial tracks at the conference, an introductory one, to bring up to speed with the Python language as a scientific tool, and an advanced track, during which experts of the field will lecture on specific advanced topics such as advanced use of numpy, scientific visualization, software engineering... Main conference topics ======================== We will be soliciting talks on the follow topics: - Presentations of scientific tools and libraries using the Python language, including but not limited to: - Vector and array manipulation - Parallel computing - Scientific visualization - Scientific data flow and persistence - Algorithms implemented or exposed in Python - Web applications and portals for science and engineering - Reports on the use of Python in scientific achievements or ongoing projects. - General-purpose Python tools that can be of special interest to the scientific community. Keynote Speaker: Hans Petter Langtangen ========================================== We are excited to welcome Hans Petter Langtangen as our keynote speaker. - Director of scientific computing and bio-medical research at Simula labs, Oslo - Author of the famous book Python scripting for computational science http://www.springer.com/math/cse/book/978-3-540-73915-9 -- Gaël Varoquaux, conference co-chair Nicolas Chauvat, conference co-chair Program committee ................. Romain Brette (ENS Paris, DEC) Mike Müller (Python Academy) Christophe Pradal (CIRAD/INRIA, DigiPlantes team) Pierre Raybault (CEA, DAM) Jarrod Millman (UC Berkeley, Helen Wills NeuroScience institute) |
|
From: Reinier H. <re...@he...> - 2009-12-13 23:23:07
|
Hi,
You'll have to use ax.w_yaxis.set_yscale('log'), which should work fine.
Hope this helps,
Reinier
On Tue, Dec 8, 2009 at 5:11 PM, Trevor Irons <tre...@gm...> wrote:
> Hi:
>
> I'm trying to get a semilog 3D plot. I want to plot several 2D time series
> lines, with the third axis being on a log scale. I am trying to set an axis
> to log using ax.set_yscale('log'), but am getting errors. Is this possible?
>
> I keep getting numpy errors when I try:
> raise MaskError, 'Cannot convert masked element to a Python int.'
> numpy.ma.core.MaskError: Cannot convert masked element to a Python int.
>
> My attempt:
>
> from mpl_toolkits.mplot3d import Axes3D
> import matplotlib.pyplot as plt
> import numpy as np
>
> fig = plt.figure()
> #ax = fig.gca()
> ax = Axes3D(fig)
>
> colors = ('r', 'g', 'b', 'k')
> zd = (0., 1., 2., 3.)
> T2 = (0.9, .8, .7, .6)
> ic = 1
>
> for ic in xrange(len(colors)):
> x = np.arange(0.05,1,.005)
> z = np.exp(-x/T2[ic]) + np.random.normal(0, .05, len(x))
> y = np.exp(zd[ic])*np.ones(len(x))
> ax.plot(x,y,z)
>
> # Error if uncommented
> #ax.set_yscale('log')
> plt.show()
>
> Thanks for any insight.
--
Reinier Heeres
Tel: +31 6 10852639
|
|
From: Nicolas B. <nbi...@gm...> - 2009-12-12 16:58:11
|
Wonderful! Thanx a lot ;) 2009/12/11 <PH...@ge...> > Reinier, > > This in incredible. Wow. Thanks for all of your hard work. > > Cheers, > -paul > > > -----Original Message----- > > From: Reinier Heeres [mailto:re...@he...] > > Sent: Thursday, December 10, 2009 3:37 PM > > To: Matthias Michler > > Cc: mat...@li... > > Subject: Re: [Matplotlib-users] mplot3d: plot_surface() and contour on > > grid? > > > > Hi, > > > > I just committed a patch to do this in svn, also allowing for contour > > lines along other directions. > > > > See the attached image for an example. > > > > ------------------------------------------------------------------------------ > Return on Information: > Google Enterprise Search pays you back > Get the facts. > http://p.sf.net/sfu/google-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: Jae-Joon L. <lee...@gm...> - 2009-12-12 06:04:05
|
On Fri, Dec 11, 2009 at 2:34 PM, Ryan Neve <rya...@gm...> wrote:
> Thank you for your help. I found the problem. It was caused by using
> pyplot.title(). It is working better now.
> I next have to figure out how to do the following within AxesGrid:
>
> 1. How to convert the x axis labels from an integer value representing
> epoch seconds to a nicely formatted date. I think this has something to do
> with matplotlib.dates.DateFormatter. I hope that this will remove the
> 1.25325e9 from the plot.
>
> 2. How to minimize or eliminate the white bands on the right and bottom
> of each axes caused by the axis scale exceeding the data values.
>
> 3. How to eliminate (or hide) the first major tic label on the y axis
> (always 0) so it doesn't overlap with the last tick from the previous y
> axis.
>
> It seems like there may be a different way to approach this than with
> subplot()
>
While there are certain differences, most of the usual matplotlib command
supposed to work. So, I recommend you to read the matplotlib documentation
first.
1. There are lots of examples in the gallery. Please take a look.
2. see the code below.
3. this kind of thing is difficult to do with axes_grid toolkit. but see
below.
First, you need to change the x-values to date (not seconds).
Then, add the code below inside your for loop.
Other than ax.axis["bottom"].. thing, these are just normal matplotlib
command.
Also, I should have mentioned it earlier, but I don't see any need of
axes_grid toolkit in your code. You'd better simply use subplot, which is
recommended if you're not familiar with matplotlib.
Regards,
-JJ
ax = my_grid[i]
ax.autoscale_view(tight=True) # adjust xlim and ylim
# you can manually call ax.set_xlim and ax.set_ylim.
ax.xaxis_date() # tick format as date and time
ax.axis["bottom"].major_ticklabels.set_rotation(30)
ax.axis["bottom"].major_ticklabels.set_ha("right")
ax.axis["bottom"].major_ticklabels.set_va("top")
# with axes_grid toolkit, it is difficult to make a certain
# ticklabel invisible (without disabling the tick line). The
# below line of code slightly adjust the ylim so that y=0 ticks
# are not shown
ax.set_ylim(ymax=-0.001)
|
|
From: Eric F. <ef...@ha...> - 2009-12-12 03:58:57
|
David Arnold wrote: > All, > > In Matlab, if I want to clear my working space of variables, I type: > > >> clear all > > How do I do the same thing in Ipython? I think the magic "%reset" is the closest. Eric |
|
From: David A. <dwa...@su...> - 2009-12-12 03:55:05
|
All, In Matlab, if I want to clear my working space of variables, I type: >> clear all How do I do the same thing in Ipython? D. |
|
From: Ryan N. <rya...@gm...> - 2009-12-11 19:34:51
|
(sorry if this is a duplicate post)
Jae,
Thank you for your help. I found the problem. It was caused by using
pyplot.title(). It is working better now.
I next have to figure out how to do the following within AxesGrid:
1. How to convert the x axis labels from an integer value representing
epoch seconds to a nicely formatted date. I think this has something to do
with matplotlib.dates.DateFormatter. I hope that this will remove the
1.25325e9 from the plot.
2. How to minimize or eliminate the white bands on the right and bottom
of each axes caused by the axis scale exceeding the data values.
3. How to eliminate (or hide) the first major tic label on the y axis
(always 0) so it doesn't overlap with the last tick from the previous y
axis.
It seems like there may be a different way to approach this than with
subplot()
Regards,
-Ryan
*
Here's a complete example:*
from matplotlib import pyplot
from mpl_toolkits.axes_grid import AxesGrid
from numpy import arange, linspace, meshgrid, random, transpose
# Generate some data
x_dim = linspace(1253250000,1253250000 + 60*60*24,47) # This is epoch
seconds
y_dim = arange(0,-2.7,-0.1)
z_dim = {}
z_dim['chl'] = random.rand(len(x_dim),len(y_dim)) +
linspace(5,26,len(y_dim))
z_dim['do'] = random.rand(len(x_dim),len(y_dim)) +
linspace(5,10,len(y_dim))
z_dim['turb'] = random.rand(len(x_dim),len(y_dim)) +
linspace(4.5,12.5,len(y_dim))
x_grid,y_grid = meshgrid(x_dim,y_dim)
x_grid = transpose(x_grid)
y_grid = transpose(y_grid)
# Start the plotting routines
DAP_figure = pyplot.figure(1,(8,8))
#pyplot.title('Title goes here') # *THIS IS THE LINE THAT CAUSES THE EARLIER
PROBLEM*
pyplot.figtext(0.05,.5,"Depth
(m)",rotation='vertical',verticalalignment='center')
# Create a grid of axes with the AxesGrid helper class
my_grid = AxesGrid(DAP_figure, 111, # Only one grid in DAP_figure
nrows_ncols = (3,1),
axes_pad = 0.0, #pad between axes in inches
aspect=False, #By default (False), widths and heigths of
axes in the grid are scaled independently. If True, they are scaled
according to their data limits
add_all=True, # Add axes to figures if True (default True)
share_all=False, # xaxis & yaxis of all axes are shared if
True (default False)
label_mode = "L", # location of tick labels thaw will be
displayed. "1" (only the lower left axes), "L" (left most and bottom most
axes), or "all"
cbar_location="right", # "right" or "top"
cbar_mode="each", # "None","single", or "each"
cbar_size="2%",
cbar_pad="1%",
)
for i,parameter in enumerate(z_dim):
ax = my_grid[i].pcolor(x_grid,y_grid,z_dim[parameter])
my_grid[i].set_ylabel(parameter) # Puts a y label on every graph.
Eventually we want this labeled only once.
my_grid.cbar_axes[i].colorbar(ax)
my_grid.cbar_axes[i].axis["right"].toggle(ticklabels=True,label=True)
my_grid.cbar_axes[i].set_ylabel("units")
my_grid[i].axis["bottom"].major_ticklabels.set_rotation(45) #
pyplot.show()
[image: p5R5J.png]
On Tue, Dec 8, 2009 at 7:39 PM, Jae-Joon Lee <lee...@gm...> wrote:
>
> Did you test the code in my previous post?
>
> If you want to get some help, you need to take your time to create a simple
> and complete example (which reproduces the problem) that others can easily
> test.
>
> Since I believe the problem is due to the existence of an extra axes, your
> example don't need to show any images. Please post a simple script that
> draws a blank AxesGrid and shows extra ticklabels as your current code does.
>
> Regards,
>
> -JJ
>
>
|
|
From: Alan G I. <ala...@gm...> - 2009-12-11 18:11:22
|
On 12/11/2009 12:07 PM, Brian Larsen wrote: > talking about cool > science and visualizations done can be really useful You probably saw the thumbnail gallery, but if not, it is helpful: http://matplotlib.sourceforge.net/gallery.html (Click a chart for its code.) Alan Isaac |
|
From: <PH...@Ge...> - 2009-12-11 17:30:26
|
Reinier, This in incredible. Wow. Thanks for all of your hard work. Cheers, -paul > -----Original Message----- > From: Reinier Heeres [mailto:re...@he...] > Sent: Thursday, December 10, 2009 3:37 PM > To: Matthias Michler > Cc: mat...@li... > Subject: Re: [Matplotlib-users] mplot3d: plot_surface() and contour on > grid? > > Hi, > > I just committed a patch to do this in svn, also allowing for contour > lines along other directions. > > See the attached image for an example. |
|
From: Gökhan S. <gok...@gm...> - 2009-12-11 17:21:57
|
On Fri, Dec 11, 2009 at 11:06 AM, Manuel Wittchen <man...@gm... > wrote: > Hi, > > When I plot very tiny datavalues (biggest value is 8e-7) the yticks > are also very small numbers with lots of digits (e.g. 0.000002). So > the ylabel isn't visible any more. > To make the ylabel visible again I would like to change the yticks > from 0.000002 to 2.0e-6 for example. How do I do that? > > Regards, > Manuel > Hi Manuel, This thread should answer your question: http://old.nabble.com/scientific-notation-%5Ctimes-symbol-td26688149.html > > > ------------------------------------------------------------------------------ > Return on Information: > Google Enterprise Search pays you back > Get the facts. > http://p.sf.net/sfu/google-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Gökhan |
|
From: Brian L. <bal...@bu...> - 2009-12-11 17:07:57
|
Hello all, I am new to matplotlib and loving it (No more IDL for me, woohoo). Are any experts attending the meeting that have done things in python/ matplotlib that I need to be sure and see? Still wrapping my mind around the python way instead of the IDL way and talking about cool science and visualizations done can be really useful. I'm in SM11A poster session Monday morning if anyone wants to stop by and say hello. SM11A-1562 Poster Hall (Moscone South) Cheers, Brian -- ----------------------------------------------------------- Brian A Larsen, PhD RBSP-ECT Instrument Suite Scientist Boston University Center for Space Physics 725 Commonwealth Ave, Rm 506 Boston, MA 02215-1401 T: 617-358-4945 F: 617-353-6463 bal...@bu... |
|
From: Manuel W. <man...@gm...> - 2009-12-11 17:06:18
|
Hi, When I plot very tiny datavalues (biggest value is 8e-7) the yticks are also very small numbers with lots of digits (e.g. 0.000002). So the ylabel isn't visible any more. To make the ylabel visible again I would like to change the yticks from 0.000002 to 2.0e-6 for example. How do I do that? Regards, Manuel |
|
From: Neal B. <ndb...@gm...> - 2009-12-11 14:34:21
|
How should I put some text marking a position on the x-axis? |
|
From: Manuel W. <man...@gm...> - 2009-12-11 09:39:55
|
Hi, I want to plot data from two different datafiles. To do so I use numpy.loadtxt two times in the script (see below). The problem is, that I don't get any output: no resulting plot, no errormessages or something in the terminal. Even if I comment-out one loadtxt-row nothing happens. Even if I try to plot something simple without using the loaded datafiles, nothing happens. Other files with simple plots without using a datafile work fine. Can't find my mistake. Manuel #!/usr/bin/env python from pylab import * import numpy as np datafile1 = '/path/to/datafile1.dat' datafile2 = '/path/to/datafile2.dat' TIME_F, STIRRER, O2, CO2 = np.loadtxt(datafile1, dtype='float', comments='#', delimiter='\t', usecols=(0,1,2,3), unpack=True) TIME_H, OD, FLUOR, BTM, GLY = np.loadtxt(datafile2, dtype='float', comments='#', delimiter='\t', usecols=(0,1,2,3,4), unpack=True) plot(TIME_F, O2) |
|
From: Reinier H. <re...@he...> - 2009-12-10 23:37:13
|
Hi, I just committed a patch to do this in svn, also allowing for contour lines along other directions. See the attached image for an example. Cheers, Reinier On Thu, Dec 3, 2009 at 10:01 AM, Matthias Michler <Mat...@gm...> wrote: > Thanks a lot! > > Regards, > Matthias > > On Wednesday 02 December 2009 17:10:54 Reinier Heeres wrote: >> Hi Matthias, >> >> I have a similar patch lying around somewhere, and I will try to apply >> it soon. I've been terribly busy lately, but I expect some nice >> mplot3d enhancements in the very near future. >> >> Regards, >> Reinier >> >> On Wed, Dec 2, 2009 at 4:22 PM, Matthias Michler >> >> <Mat...@gm...> wrote: >> > Hi Andrew, >> > >> > do you have any idea if the patch (or a part of it) may get a part of >> > matplotlib-svn some day? >> > >> > Kind regards, >> > Matthias >> > >> > On Friday 09 October 2009 23:25:28 Andrew Straw wrote: >> >> Matthias Michler wrote: >> >> > Hello list, >> >> > >> >> > I'm not an expert in axes3d, but in case the feature which Nicolas >> >> > requested is not possible in an easy manner up to now, I propose an >> >> > additional kwarg for axes3d.Axes3D.contour. Something like *offset*. >> >> > If offset is None the z-values of the contour lines corresponds to >> >> > given Z and otherwise offset is used for the z-values of the contour >> >> > lines. I attached a changed axes3d.py and a patch against current svn. >> >> > The result is illustrated in the contour3d_demo.png. >> >> > >> >> > Could any of the experts have a look at it and tell me if this could >> >> > be useful, please? >> >> > >> >> > Thanks in advance for any comments. >> >> > >> >> > Kind regards >> >> > Matthias >> >> > >> >> > On Wednesday 30 September 2009 19:22:42 Nicolas Bigaouette wrote: >> >> >> Hi, >> >> >> I have a nice plot_surface() using mplot3d (see attachement). >> >> >> >> >> >> I'd like to project the surface on the axis xoy, xoz and yoz with a >> >> >> contour, similar to this figure: >> >> >> http://homepages.ulb.ac.be/~dgonze/INFO/matlab/fig19.jpg >> >> >> >> >> >> Is it possible using matplotlib and mplot3d? >> >> >> >> >> >> Thanx! >> >> >> >> Hi Matthias, >> >> >> >> I committed your patch to a github branch of MPL, but I'll let Reinier >> >> actually commit something based on this to MPL. >> >> http://github.com/astraw/matplotlib/tree/dev/michler-3d-contourf-offsets >> >> >> >> -Andrew > > > ------------------------------------------------------------------------------ > Join us December 9, 2009 for the Red Hat Virtual Experience, > a free event focused on virtualization and cloud computing. > Attend in-depth sessions from your desk. Your couch. Anywhere. > http://p.sf.net/sfu/redhat-sfdev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Reinier Heeres Tel: +31 6 10852639 |
|
From: Marius J. K. <mj...@ny...> - 2009-12-10 19:26:50
|
I use to save my plots as tiff. The color model of these plots is RGB. Can I change it to CMYK? |
|
From: Eric F. <ef...@ha...> - 2009-12-10 17:45:55
|
mar...@if... wrote: > > Hello, > > let's say I have given an image of distance values, which I display with > the jet colormap. Now if there are invalid pixels within the image they > have the value -1 or -2. Is there a way to display just the "valid" > image with the jet colorbar and the -1 pixels as white pixels and the -2 > pixels as black pixels? See http://matplotlib.sourceforge.net/examples/pylab_examples/image_masked.html. You might need to use a masked array and mask the -2 values. Eric > > Till now I scale the image with vmin, vmax: > > >>> vmin = img[(img != -1) & (img != -2)].min() > >>> vmax = img[(img != -1) & (img != -2)].max() > >>> imshow(img, vmin=vmin, vmax=vmax, interpolation = 'nearest') > > But how can I now paint the black and white pixels? > > Regards, > > Markus > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Return on Information: > Google Enterprise Search pays you back > Get the facts. > http://p.sf.net/sfu/google-dev2dev > > > ------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Pierre de B. <pd...@ul...> - 2009-12-10 14:55:37
|
Hello, According to http://matplotlib.sourceforge.net/api/ pyplot_api.html#matplotlib.pyplot.scatter , the keyword argument that takes an array to specify the colors of the individual markers is c. color is interpreted as a color to give to all markers at once. The following works on my computer (matplotlib 0.99.0) : import numpy as N from matplotlib import pyplot as P x = N.random.randn(100) y = N.random.randn(100) z = N.random.randn(100)**2 fig = P.figure() ax = fig.add_subplot(1,1,1) cmap = P.matplotlib.cm.jet norm = P.matplotlib.colors.Normalize(vmin=0, vmax=1) sc = ax.scatter(x,y, c=z, cmap=cmap, norm=norm, ) Le 10 déc. 09 à 14:44, Yannick Copin a écrit : > Hi, > > according to the documentation, scatter should accept a 1D float > array for > color kwarg. Therefore, I thought the following code would work > (and I think > it worked at some point in the past; I'm currently using matplotlib > 0.99.0): > > import numpy as N > from matplotlib import pyplot as P > > x = N.random.randn(100) > y = N.random.randn(100) > z = N.random.randn(100)**2 > > fig = P.figure() > ax = fig.add_subplot(1,1,1) > > cmap = P.matplotlib.cm.jet > norm = P.matplotlib.colors.Normalize(vmin=0, vmax=1) > > sc = ax.scatter(x,y, > color=z, > cmap=cmap, > norm=norm, > ) > > But this crashes with the following error: > > [...] |
|
From: Michael C. <mc...@ca...> - 2009-12-10 09:18:10
|
Thanks, the svn version is working nicely. Cheers Mike On 12/09/2009 01:21 PM, Michael Droettboom wrote: > I can confirm this bug on matplotlib-0.99.0, and 0.99.1.2, but not on > SVN head. I think this is related to a recently fixed bug involving the > renderer outputting single-point lines (which obviously doesn't make > sense, and Postscript has problems with). > > You can either install from SVN (I recommend using the 0.99.x branch > [1], rather than the trunk), or set the rcParam 'path.simplify' to > False. Unfortunately, the latter will result in some very large file sizes. > > [1] https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_99_maint > > Cheers, > Mike > > Michael Cohen wrote: >> Hi there, >> Does anyone know what might be the problem with this EPS write? >> Please see my email of Dec 6th for the attachments. >> >> Regards, >> Michael >> >> Michael Cohen wrote: >>> Hi, >>> >>> Sorry for taking a few days to reply. >>> Basic system information >>> >>> $ uname -a >>> Linux shc-b 2.6.18-128.1.10.el5 #1 SMP Wed Apr 29 13:53:08 EDT 2009 >>> x86_64 x86_64 x86_64 GNU/Linux >>> $ head -n1 /etc/issue >>> Red Hat Enterprise Linux Server release 5.3 (Tikanga) >>> $ >>> >>> matplotlibrc attached. >>> >>> plot_test.py attached also. >>> >>> $ python >>> Python 2.6.2 (r262:71600, Sep 16 2009, 13:37:23) >>> [GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2 >>> Type "help", "copyright", "credits" or "license" for more information. >>> >>> import matplotlib >>> >>> print matplotlib.__version__ >>> 0.99.0 >>> >>> >>> >>> finally, failed output eps also attached. >>> >>> The plot generates a set of horizontal and vertical lines to make a >>> grid, and then applies the Mollweide projection to give latitude and >>> longitude lines. >>> For some reason, not running the projection (i.e. lines 43-51 in the >>> python script) gives a file that outputs as a nice eps. If you do >>> keep the Mollweide projection in, you still generate a lovely plot, >>> but the savefig to .eps fails. >>> >>> Thanks, >>> Michael >>> >>> >>> John Hunter wrote: >>>> On Wed, Dec 2, 2009 at 3:20 PM, Michael Cohen <mc...@ca...> >>>> wrote: >>>>> Hi, >>>>> To add more information. I am trying this on two separate installs of >>>>> matplotlib 0.99, both using TkAgg as the backend. One produces an >>>>> unreadable file, the other does produce a readable EPS. However, even >>>>> in this case, zooming in on the image shows that what is being >>>>> saved is >>>>> bitmapped, not a vector graphic. >>>> Could you please post some sample code and the EPS it generates, as >>>> well as platform information and any specific rc settings you may >>>> have? >>>> >>>> Thanks, >>>> JDH >> >> ------------------------------------------------------------------------------ >> >> Return on Information: >> Google Enterprise Search pays you back >> Get the facts. >> http://p.sf.net/sfu/google-dev2dev >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: <mar...@if...> - 2009-12-10 08:21:49
|
Hello, let's say I have given an image of distance values, which I display with the jet colormap. Now if there are invalid pixels within the image they have the value -1 or -2. Is there a way to display just the "valid" image with the jet colorbar and the -1 pixels as white pixels and the -2 pixels as black pixels? Till now I scale the image with vmin, vmax: >>> vmin = img[(img != -1) & (img != -2)].min() >>> vmax = img[(img != -1) & (img != -2)].max() >>> imshow(img, vmin=vmin, vmax=vmax, interpolation = 'nearest') But how can I now paint the black and white pixels? Regards, Markus |
|
From: Mike A. <ma...@ry...> - 2009-12-10 01:17:00
|
Unfortunately i have not found such a function as of yet and the function that sound close to it (aspect) only controls the windows aspect ratio Fortunately there is a quick and dirty work around I have found the following to be useful Assuming you have X Y Z matrices made using meshgrid or some other means from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np fig = plt.figure() ax = Axes3D(fig) u = np.linspace(0, 2 * np.pi, 100) v = np.linspace(0, np.pi, 100) x = 10 * np.outer(np.cos(u), np.sin(v)) y = 10 * np.outer(np.sin(u), np.sin(v)) z = 50 * np.outer(np.ones(np.size(u)), np.cos(v)) ax.plot_surface(x, y, z, rstride=4, cstride=4, color='b') Xstart=(x.min()) Xend =(x.max()) Ystart=(y.min()) Zstart=(z.min()) Scalex=(Xend-Xstart) ax.set_xlim3d(Xstart,Xstart+Scale) ax.set_ylim3d(Ystart,Ystart+Scale) ax.set_zlim3d(Zstart,Zstart+Scale) plt.show() again I have made the assumption that the plot is "squarish" in the x and y direction, a more robust version would test to see which is the biggest scalex,scaley,scalez center the other axis value but again i just coded this in 5 min as an example -----Original Message----- From: David Arnold [mailto:dwa...@su...] Sent: December-07-09 12:30 PM To: mat...@li... Subject: [Matplotlib-users] axis equal All, Is there an "axis equal" command for mplot3d? D. ---------------------------------------------------------------------------- -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev _______________________________________________ Matplotlib-users mailing list Mat...@li... https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Reinier H. <re...@he...> - 2009-12-10 00:44:42
|
Hi Mike,
Sorry for the slow reply, but I put support for this in the
development version in SVN. It can also do a bit of shading to make
the surface look more structured.
Note that the fact that a 40x40 grid turns into 39x39 squares is
expected behavior: the code assumes the 40 points are the *edges* of
the patches. There are only 39 patches between 40 points.
Regards,
Reinier
On Tue, Dec 1, 2009 at 3:06 AM, Mike Alger <ma...@ry...> wrote:
> After a weekend of no replies I managed to figure a way out myself
>
> As this was “left to the reader as an exercise” I will leave the integration
> or improvement of this solution as an exercise to the next reader
>
> What I have done is basically cloned the plot surface function and replaced
> the avgz variable with a reference to the “colors” parameter i have added to
> the function call.
>
> This code doesn’t center things perfectly with respect to the grid (for
> some reason a 40x40 grid turns into 39x39 grid in the function) again this
> is something else that could be improved, however I am happy with it and a
> one pixel shift won’t be missed in my plots. I also have no real clue as to
> what the following comments was about
>
>
>
> # The construction leaves the array with duplicate points,
> which
>
> # are removed here.
>
>
>
> but it is probably related to my non centered plots.
>
>
>
>
>
>
>
>
>
> What follows is the modified function :
>
>
>
>
>
>
>
> def plot_surface2(self, X, Y, Z, colors, *args, **kwargs):
>
> '''
>
> Create a surface plot.
>
>
>
> By default it will be colored in shades of a solid color,
>
> but it also supports color mapping by supplying the *cmap*
>
> argument.
>
>
>
> ========== ================================================
>
> Argument Description
>
> ========== ================================================
>
> *X*, *Y*, Data values as numpy.arrays
>
> *Z*
>
> *colors* an array the same size as z that contains a separate
> color data
>
> *rstride* Array row stride (step size)
>
> *cstride* Array column stride (step size)
>
> *color* Color of the surface patches
>
> *cmap* A colormap for the surface patches.
>
> ========== ================================================
>
> '''
>
>
>
> had_data = self.has_data()
>
>
>
> rows, cols = Z.shape
>
> tX, tY, tZ = np.transpose(X), np.transpose(Y), np.transpose(Z)
>
> rstride = kwargs.pop('rstride', 10)
>
> cstride = kwargs.pop('cstride', 10)
>
>
>
> color = kwargs.pop('color', 'b')
>
> color = np.array(colorConverter.to_rgba(color))
>
> cmap = kwargs.get('cmap', None)
>
>
>
> polys = []
>
> normals = []
>
> avgz = []
>
> for rs in np.arange(0, rows-1, rstride):
>
> for cs in np.arange(0, cols-1, cstride):
>
> ps = []
>
> corners = []
>
> for a, ta in [(X, tX), (Y, tY), (Z, tZ)]:
>
> ztop = a[rs][cs:min(cols, cs+cstride+1)]
>
> zleft = ta[min(cols-1, cs+cstride)][rs:min(rows,
> rs+rstride+1)]
>
> zbase = a[min(rows-1, rs+rstride)][cs:min(cols,
> cs+cstride+1):]
>
> zbase = zbase[::-1]
>
> zright = ta[cs][rs:min(rows, rs+rstride+1):]
>
> zright = zright[::-1]
>
> corners.append([ztop[0], ztop[-1], zbase[0], zbase[-1]])
>
> z = np.concatenate((ztop, zleft, zbase, zright))
>
> ps.append(z)
>
>
>
> # The construction leaves the array with duplicate points,
> which
>
> # are removed here.
>
> ps = zip(*ps)
>
> lastp = np.array([])
>
> ps2 = []
>
> avgzsum = 0.0
>
> for p in ps:
>
> if p != lastp:
>
> ps2.append(p)
>
> lastp = p
>
> avgzsum += p[2]
>
> polys.append(ps2)
>
> ##################################
>
> Begin of changes
>
> ##################################
>
> #avgz.append(avgzsum / len(ps2))
>
> avgz.append(colors[rs][cs])
>
> ##################################
>
> end of changes
>
> ##################################
>
>
>
> v1 = np.array(ps2[0]) - np.array(ps2[1])
>
> v2 = np.array(ps2[2]) - np.array(ps2[0])
>
> normals.append(np.cross(v1, v2))
>
>
>
> polyc = art3d.Poly3DCollection(polys, *args, **kwargs)
>
> if cmap is not None:
>
> # polyc.set_array(np.array(colors))
>
> polyc.set_array(np.array(avgz))
>
> polyc.set_linewidth(0)
>
> else:
>
> colors = self._shade_colors(color, normals)
>
> polyc.set_facecolors(colors)
>
>
>
> self.add_collection(polyc)
>
> self.auto_scale_xyz(X, Y, Z, had_data)
>
>
>
> return polyc
>
>
>
>
>
> From: Mike Alger [mailto:ma...@ry...]
> Sent: November-25-09 8:42 PM
> To: mat...@li...
> Subject: Re: [Matplotlib-users] Color in 3d plots
>
>
>
> I have been looking at this for the past day and in am pretty sure I could
> replace the instance of polyc by the “cmap if statements” my colour array
> and I should be able to get close to what I want. However I am new to both
> python & mpl, and I am not entirely sure in how I would go about testing my
> hypothesis. Furthermore I am also relatively new to submitting fixes to
> open-source projects so I have lots of questions about how I would go about
> suggesting a modification.
>
>
>
> 1.) can I just modify the file in the
> C:\python26\Lib\site-packages\mpl-toolkits\mplot3d\axes3d.py file to do my
> tests?
>
> a. Also, where are these files usually kept in a linux environment ?
>
> b. What do I do with the. pyc files with the same name? are they
> re-complied automatically when I call the function externally?
>
> 2.) Is this capability already built in with the colour argument ? if so
> how do I properly call it?
>
> 3.) If I do make a modification should it be as a separate function with
> the additional variable or should I try to stuff the new capability into the
> old function
>
> 4.) is there a clean easy to follow tutorial for submitting changes via
> svn or can I rely on someone else to do the final commit?
>
>
>
> I have attached the function in question for reference to save others from
> digging down into their python directories
>
>
>
>
>
> Again thanks for taking your time to help me figure this out
>
>
>
> Mike Alger
>
>
>
> < Code>
>
> def plot_surface(self, X, Y, Z, *args, **kwargs):
>
> '''
>
> Create a surface plot.
>
>
>
> By default it will be colored in shades of a solid color,
>
> but it also supports color mapping by supplying the *cmap*
>
> argument.
>
>
>
> ========== ================================================
>
> Argument Description
>
> ========== ================================================
>
> *X*, *Y*, Data values as numpy.arrays
>
> *Z*
>
> *rstride* Array row stride (step size)
>
> *cstride* Array column stride (step size)
>
> *color* Color of the surface patches
>
> *cmap* A colormap for the surface patches.
>
> ========== ================================================
>
> '''
>
>
>
> had_data = self.has_data()
>
>
>
> rows, cols = Z.shape
>
> tX, tY, tZ = np.transpose(X), np.transpose(Y), np.transpose(Z)
>
> rstride = kwargs.pop('rstride', 10)
>
> cstride = kwargs.pop('cstride', 10)
>
>
>
> color = kwargs.pop('color', 'b')
>
> color = np.array(colorConverter.to_rgba(color))
>
> cmap = kwargs.get('cmap', None)
>
>
>
> polys = []
>
> normals = []
>
> avgz = []
>
> for rs in np.arange(0, rows-1, rstride):
>
> for cs in np.arange(0, cols-1, cstride):
>
> ps = []
>
> corners = []
>
> for a, ta in [(X, tX), (Y, tY), (Z, tZ)]:
>
> ztop = a[rs][cs:min(cols, cs+cstride+1)]
>
> zleft = ta[min(cols-1, cs+cstride)][rs:min(rows,
> rs+rstride+1)]
>
> zbase = a[min(rows-1, rs+rstride)][cs:min(cols,
> cs+cstride+1):]
>
> zbase = zbase[::-1]
>
> zright = ta[cs][rs:min(rows, rs+rstride+1):]
>
> zright = zright[::-1]
>
> corners.append([ztop[0], ztop[-1], zbase[0], zbase[-1]])
>
> z = np.concatenate((ztop, zleft, zbase, zright))
>
> ps.append(z)
>
>
>
> # The construction leaves the array with duplicate points,
> which
>
> # are removed here.
>
> ps = zip(*ps)
>
> lastp = np.array([])
>
> ps2 = []
>
> avgzsum = 0.0
>
> for p in ps:
>
> if p != lastp:
>
> ps2.append(p)
>
> lastp = p
>
> avgzsum += p[2]
>
> polys.append(ps2)
>
> avgz.append(avgzsum / len(ps2))
>
>
>
> v1 = np.array(ps2[0]) - np.array(ps2[1])
>
> v2 = np.array(ps2[2]) - np.array(ps2[0])
>
> normals.append(np.cross(v1, v2))
>
>
>
> polyc = art3d.Poly3DCollection(polys, *args, **kwargs) ## this is
> where a modification could be made to allow for a separate colour matrix
>
> if cmap is not None:
>
> polyc.set_array(np.array(avgz))
>
> polyc.set_linewidth(0)
>
> else:
>
> colors = self._shade_colors(color, normals)
>
> polyc.set_facecolors(colors)
>
>
>
> self.add_collection(polyc)
>
> self.auto_scale_xyz(X, Y, Z, had_data)
>
>
>
> return polyc
>
> </Code>
>
>
>
> From: Mike Alger [mailto:mik...@ng...]
> Sent: November-23-09 3:42 PM
> To: mat...@li...
> Subject: [Matplotlib-users] Color in 3d plots
>
>
>
> This may be a dumb question, however I have been scratching my head trying
> to figure out how to plot a 3 dimensional plot with with a colour map
> different from the elevation(Z) parameter.
>
>
>
> An example of this done in Matlab would be
>
>
>
> [X,Y,Z] = peaks(30);
>
> C=Z'% could be anything other than Z as long as it has the same dimensions
>
> surf(X,Y,Z,C)
>
>
>
> axis([-3 3 -3 3 -10 5])
>
>
>
>
>
> Is this possible with matplotlib '0.99.1'
>
>
>
> If so how do i go about doing this is there some sample code?
>
>
>
> Mike Alger, M.A.Sc
>
> ma...@ry...
>
>
>
> ------------------------------------------------------------------------------
> Join us December 9, 2009 for the Red Hat Virtual Experience,
> a free event focused on virtualization and cloud computing.
> Attend in-depth sessions from your desk. Your couch. Anywhere.
> http://p.sf.net/sfu/redhat-sfdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Reinier Heeres
Tel: +31 6 10852639
|
|
From: Mike A. <ma...@ry...> - 2009-12-10 00:39:19
|
I had a hunch that was the case but wasn`t entirely sure, and to be honest
3d plot functions have always been a black box for me and i have never
really thought about what exactly gets plotted in 3d plot until now
Thanks again
Reinier i will take a look at the SVN A.S.A.P.
Mike
-----Original Message-----
From: Reinier Heeres [mailto:re...@he...]
Sent: December-09-09 7:17 PM
To: Mike Alger
Cc: mat...@li...
Subject: Re: [Matplotlib-users] Color in 3d plots
Hi Mike,
Sorry for the slow reply, but I put support for this in the
development version in SVN. It can also do a bit of shading to make
the surface look more structured.
Note that the fact that a 40x40 grid turns into 39x39 squares is
expected behavior: the code assumes the 40 points are the *edges* of
the patches. There are only 39 patches between 40 points.
Regards,
Reinier
On Tue, Dec 1, 2009 at 3:06 AM, Mike Alger <ma...@ry...> wrote:
> After a weekend of no replies I managed to figure a way out myself
>
> As this was left to the reader as an exercise I will leave the
integration
> or improvement of this solution as an exercise to the next reader
>
> What I have done is basically cloned the plot surface function and
replaced
> the avgz variable with a reference to the colors parameter i have added
to
> the function call.
>
> This code doesnt center things perfectly with respect to the grid (for
> some reason a 40x40 grid turns into 39x39 grid in the function) again this
> is something else that could be improved, however I am happy with it and a
> one pixel shift wont be missed in my plots. I also have no real clue as
to
> what the following comments was about
>
>
>
> # The construction leaves the array with duplicate points,
> which
>
> # are removed here.
>
>
>
> but it is probably related to my non centered plots.
>
>
>
>
>
>
>
>
>
> What follows is the modified function :
>
>
>
>
>
>
>
> def plot_surface2(self, X, Y, Z, colors, *args, **kwargs):
>
> '''
>
> Create a surface plot.
>
>
>
> By default it will be colored in shades of a solid color,
>
> but it also supports color mapping by supplying the *cmap*
>
> argument.
>
>
>
> ========== ================================================
>
> Argument Description
>
> ========== ================================================
>
> *X*, *Y*, Data values as numpy.arrays
>
> *Z*
>
> *colors* an array the same size as z that contains a separate
> color data
>
> *rstride* Array row stride (step size)
>
> *cstride* Array column stride (step size)
>
> *color* Color of the surface patches
>
> *cmap* A colormap for the surface patches.
>
> ========== ================================================
>
> '''
>
>
>
> had_data = self.has_data()
>
>
>
> rows, cols = Z.shape
>
> tX, tY, tZ = np.transpose(X), np.transpose(Y), np.transpose(Z)
>
> rstride = kwargs.pop('rstride', 10)
>
> cstride = kwargs.pop('cstride', 10)
>
>
>
> color = kwargs.pop('color', 'b')
>
> color = np.array(colorConverter.to_rgba(color))
>
> cmap = kwargs.get('cmap', None)
>
>
>
> polys = []
>
> normals = []
>
> avgz = []
>
> for rs in np.arange(0, rows-1, rstride):
>
> for cs in np.arange(0, cols-1, cstride):
>
> ps = []
>
> corners = []
>
> for a, ta in [(X, tX), (Y, tY), (Z, tZ)]:
>
> ztop = a[rs][cs:min(cols, cs+cstride+1)]
>
> zleft = ta[min(cols-1, cs+cstride)][rs:min(rows,
> rs+rstride+1)]
>
> zbase = a[min(rows-1, rs+rstride)][cs:min(cols,
> cs+cstride+1):]
>
> zbase = zbase[::-1]
>
> zright = ta[cs][rs:min(rows, rs+rstride+1):]
>
> zright = zright[::-1]
>
> corners.append([ztop[0], ztop[-1], zbase[0],
zbase[-1]])
>
> z = np.concatenate((ztop, zleft, zbase, zright))
>
> ps.append(z)
>
>
>
> # The construction leaves the array with duplicate points,
> which
>
> # are removed here.
>
> ps = zip(*ps)
>
> lastp = np.array([])
>
> ps2 = []
>
> avgzsum = 0.0
>
> for p in ps:
>
> if p != lastp:
>
> ps2.append(p)
>
> lastp = p
>
> avgzsum += p[2]
>
> polys.append(ps2)
>
> ##################################
>
> Begin of changes
>
> ##################################
>
> #avgz.append(avgzsum / len(ps2))
>
> avgz.append(colors[rs][cs])
>
> ##################################
>
> end of changes
>
> ##################################
>
>
>
> v1 = np.array(ps2[0]) - np.array(ps2[1])
>
> v2 = np.array(ps2[2]) - np.array(ps2[0])
>
> normals.append(np.cross(v1, v2))
>
>
>
> polyc = art3d.Poly3DCollection(polys, *args, **kwargs)
>
> if cmap is not None:
>
> # polyc.set_array(np.array(colors))
>
> polyc.set_array(np.array(avgz))
>
> polyc.set_linewidth(0)
>
> else:
>
> colors = self._shade_colors(color, normals)
>
> polyc.set_facecolors(colors)
>
>
>
> self.add_collection(polyc)
>
> self.auto_scale_xyz(X, Y, Z, had_data)
>
>
>
> return polyc
>
>
>
>
>
> From: Mike Alger [mailto:ma...@ry...]
> Sent: November-25-09 8:42 PM
> To: mat...@li...
> Subject: Re: [Matplotlib-users] Color in 3d plots
>
>
>
> I have been looking at this for the past day and in am pretty sure I could
> replace the instance of polyc by the cmap if statements my colour array
> and I should be able to get close to what I want. However I am new to both
> python & mpl, and I am not entirely sure in how I would go about testing
my
> hypothesis. Furthermore I am also relatively new to submitting fixes to
> open-source projects so I have lots of questions about how I would go
about
> suggesting a modification.
>
>
>
> 1.) can I just modify the file in the
> C:\python26\Lib\site-packages\mpl-toolkits\mplot3d\axes3d.py file to do my
> tests?
>
> a. Also, where are these files usually kept in a linux environment ?
>
> b. What do I do with the. pyc files with the same name? are they
> re-complied automatically when I call the function externally?
>
> 2.) Is this capability already built in with the colour argument ? if
so
> how do I properly call it?
>
> 3.) If I do make a modification should it be as a separate function
with
> the additional variable or should I try to stuff the new capability into
the
> old function
>
> 4.) is there a clean easy to follow tutorial for submitting changes via
> svn or can I rely on someone else to do the final commit?
>
>
>
> I have attached the function in question for reference to save others from
> digging down into their python directories
>
>
>
>
>
> Again thanks for taking your time to help me figure this out
>
>
>
> Mike Alger
>
>
>
> < Code>
>
> def plot_surface(self, X, Y, Z, *args, **kwargs):
>
> '''
>
> Create a surface plot.
>
>
>
> By default it will be colored in shades of a solid color,
>
> but it also supports color mapping by supplying the *cmap*
>
> argument.
>
>
>
> ========== ================================================
>
> Argument Description
>
> ========== ================================================
>
> *X*, *Y*, Data values as numpy.arrays
>
> *Z*
>
> *rstride* Array row stride (step size)
>
> *cstride* Array column stride (step size)
>
> *color* Color of the surface patches
>
> *cmap* A colormap for the surface patches.
>
> ========== ================================================
>
> '''
>
>
>
> had_data = self.has_data()
>
>
>
> rows, cols = Z.shape
>
> tX, tY, tZ = np.transpose(X), np.transpose(Y), np.transpose(Z)
>
> rstride = kwargs.pop('rstride', 10)
>
> cstride = kwargs.pop('cstride', 10)
>
>
>
> color = kwargs.pop('color', 'b')
>
> color = np.array(colorConverter.to_rgba(color))
>
> cmap = kwargs.get('cmap', None)
>
>
>
> polys = []
>
> normals = []
>
> avgz = []
>
> for rs in np.arange(0, rows-1, rstride):
>
> for cs in np.arange(0, cols-1, cstride):
>
> ps = []
>
> corners = []
>
> for a, ta in [(X, tX), (Y, tY), (Z, tZ)]:
>
> ztop = a[rs][cs:min(cols, cs+cstride+1)]
>
> zleft = ta[min(cols-1, cs+cstride)][rs:min(rows,
> rs+rstride+1)]
>
> zbase = a[min(rows-1, rs+rstride)][cs:min(cols,
> cs+cstride+1):]
>
> zbase = zbase[::-1]
>
> zright = ta[cs][rs:min(rows, rs+rstride+1):]
>
> zright = zright[::-1]
>
> corners.append([ztop[0], ztop[-1], zbase[0],
zbase[-1]])
>
> z = np.concatenate((ztop, zleft, zbase, zright))
>
> ps.append(z)
>
>
>
> # The construction leaves the array with duplicate points,
> which
>
> # are removed here.
>
> ps = zip(*ps)
>
> lastp = np.array([])
>
> ps2 = []
>
> avgzsum = 0.0
>
> for p in ps:
>
> if p != lastp:
>
> ps2.append(p)
>
> lastp = p
>
> avgzsum += p[2]
>
> polys.append(ps2)
>
> avgz.append(avgzsum / len(ps2))
>
>
>
> v1 = np.array(ps2[0]) - np.array(ps2[1])
>
> v2 = np.array(ps2[2]) - np.array(ps2[0])
>
> normals.append(np.cross(v1, v2))
>
>
>
> polyc = art3d.Poly3DCollection(polys, *args, **kwargs) ## this is
> where a modification could be made to allow for a separate colour matrix
>
> if cmap is not None:
>
> polyc.set_array(np.array(avgz))
>
> polyc.set_linewidth(0)
>
> else:
>
> colors = self._shade_colors(color, normals)
>
> polyc.set_facecolors(colors)
>
>
>
> self.add_collection(polyc)
>
> self.auto_scale_xyz(X, Y, Z, had_data)
>
>
>
> return polyc
>
> </Code>
>
>
>
> From: Mike Alger [mailto:mik...@ng...]
> Sent: November-23-09 3:42 PM
> To: mat...@li...
> Subject: [Matplotlib-users] Color in 3d plots
>
>
>
> This may be a dumb question, however I have been scratching my head trying
> to figure out how to plot a 3 dimensional plot with with a colour map
> different from the elevation(Z) parameter.
>
>
>
> An example of this done in Matlab would be
>
>
>
> [X,Y,Z] = peaks(30);
>
> C=Z'% could be anything other than Z as long as it has the same dimensions
>
> surf(X,Y,Z,C)
>
>
>
> axis([-3 3 -3 3 -10 5])
>
>
>
>
>
> Is this possible with matplotlib '0.99.1'
>
>
>
> If so how do i go about doing this is there some sample code?
>
>
>
> Mike Alger, M.A.Sc
>
> ma...@ry...
>
>
>
>
----------------------------------------------------------------------------
--
> Join us December 9, 2009 for the Red Hat Virtual Experience,
> a free event focused on virtualization and cloud computing.
> Attend in-depth sessions from your desk. Your couch. Anywhere.
> http://p.sf.net/sfu/redhat-sfdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Reinier Heeres
Tel: +31 6 10852639
|
|
From: Michael D. <md...@st...> - 2009-12-09 21:21:20
|
I can confirm this bug on matplotlib-0.99.0, and 0.99.1.2, but not on SVN head. I think this is related to a recently fixed bug involving the renderer outputting single-point lines (which obviously doesn't make sense, and Postscript has problems with). You can either install from SVN (I recommend using the 0.99.x branch [1], rather than the trunk), or set the rcParam 'path.simplify' to False. Unfortunately, the latter will result in some very large file sizes. [1] https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_99_maint Cheers, Mike Michael Cohen wrote: > Hi there, > Does anyone know what might be the problem with this EPS write? > Please see my email of Dec 6th for the attachments. > > Regards, > Michael > > Michael Cohen wrote: > >> Hi, >> >> Sorry for taking a few days to reply. >> Basic system information >> >> $ uname -a >> Linux shc-b 2.6.18-128.1.10.el5 #1 SMP Wed Apr 29 13:53:08 EDT 2009 >> x86_64 x86_64 x86_64 GNU/Linux >> $ head -n1 /etc/issue >> Red Hat Enterprise Linux Server release 5.3 (Tikanga) >> $ >> >> matplotlibrc attached. >> >> plot_test.py attached also. >> >> $ python >> Python 2.6.2 (r262:71600, Sep 16 2009, 13:37:23) >> [GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. >> >>> import matplotlib >> >>> print matplotlib.__version__ >> 0.99.0 >> >>> >> >> finally, failed output eps also attached. >> >> The plot generates a set of horizontal and vertical lines to make a >> grid, and then applies the Mollweide projection to give latitude and >> longitude lines. >> For some reason, not running the projection (i.e. lines 43-51 in the >> python script) gives a file that outputs as a nice eps. If you do keep >> the Mollweide projection in, you still generate a lovely plot, but the >> savefig to .eps fails. >> >> Thanks, >> Michael >> >> >> John Hunter wrote: >> >>> On Wed, Dec 2, 2009 at 3:20 PM, Michael Cohen <mc...@ca...> wrote: >>> >>>> Hi, >>>> To add more information. I am trying this on two separate installs of >>>> matplotlib 0.99, both using TkAgg as the backend. One produces an >>>> unreadable file, the other does produce a readable EPS. However, even >>>> in this case, zooming in on the image shows that what is being saved is >>>> bitmapped, not a vector graphic. >>>> >>> Could you please post some sample code and the EPS it generates, as >>> well as platform information and any specific rc settings you may >>> have? >>> >>> Thanks, >>> JDH >>> > > ------------------------------------------------------------------------------ > Return on Information: > Google Enterprise Search pays you back > Get the facts. > http://p.sf.net/sfu/google-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA |
|
From: Michael C. <mc...@ca...> - 2009-12-09 20:51:29
|
Hi there, Does anyone know what might be the problem with this EPS write? Please see my email of Dec 6th for the attachments. Regards, Michael Michael Cohen wrote: > Hi, > > Sorry for taking a few days to reply. > Basic system information > > $ uname -a > Linux shc-b 2.6.18-128.1.10.el5 #1 SMP Wed Apr 29 13:53:08 EDT 2009 > x86_64 x86_64 x86_64 GNU/Linux > $ head -n1 /etc/issue > Red Hat Enterprise Linux Server release 5.3 (Tikanga) > $ > > matplotlibrc attached. > > plot_test.py attached also. > > $ python > Python 2.6.2 (r262:71600, Sep 16 2009, 13:37:23) > [GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import matplotlib > >>> print matplotlib.__version__ > 0.99.0 > >>> > > finally, failed output eps also attached. > > The plot generates a set of horizontal and vertical lines to make a > grid, and then applies the Mollweide projection to give latitude and > longitude lines. > For some reason, not running the projection (i.e. lines 43-51 in the > python script) gives a file that outputs as a nice eps. If you do keep > the Mollweide projection in, you still generate a lovely plot, but the > savefig to .eps fails. > > Thanks, > Michael > > > John Hunter wrote: >> On Wed, Dec 2, 2009 at 3:20 PM, Michael Cohen <mc...@ca...> wrote: >>> Hi, >>> To add more information. I am trying this on two separate installs of >>> matplotlib 0.99, both using TkAgg as the backend. One produces an >>> unreadable file, the other does produce a readable EPS. However, even >>> in this case, zooming in on the image shows that what is being saved is >>> bitmapped, not a vector graphic. >> >> Could you please post some sample code and the EPS it generates, as >> well as platform information and any specific rc settings you may >> have? >> >> Thanks, >> JDH |