SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

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
(10)
2
(6)
3
(1)
4
(4)
5
(11)
6
(19)
7
(18)
8
(7)
9
(9)
10
(4)
11
(3)
12
(5)
13
(19)
14
(13)
15
(21)
16
(4)
17
18
(5)
19
(9)
20
(13)
21
(7)
22
23
(1)
24
(3)
25
26
(3)
27
(1)
28
(2)
29
(6)
30
(5)
31

Showing results of 208

1 2 3 .. 9 > >> (Page 1 of 9)
From: Paul I. <piv...@gm...> - 2011年12月30日 23:58:01
Attachments: signature.asc
Eric Firing, on 2011年12月27日 15:31, wrote:
> It looks like this is something I can fix by modifying ListedColormap. 
> It is discarding the alpha values, and I don't think there is any reason 
> it needs to do so.
One of my first attempts at a contribution to matplotlib three
years ago was related to this. It was in reply to a similar
question on list, and I wrote a patch, but never saw it through
to inclusion because it wasn't something I needed.
http://www.mail-archive.com/mat...@li.../msg09216.html
I think it's a helpful starting point, as I include a discussion
on the limitation of mpl colormaps there.
-- 
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 
From: Stephen W. <sw...@tx...> - 2011年12月30日 22:06:50
Hello all,
I have a python module that requires making about 24 different kinds of plots, and to keep things tidy I put them all in different modules, which I then import.
All the import calls are at the head of the top module. There is one plotting call inside a while loop, and it is returning blank plots saved in the proper location. Blank meaning no axes, so it is a totally empty .png file. After the loop, the first plot called is being saved, but all the subsequent plots are saving as blank. I begin every plotting module with matplotlib.pyplot.clf() and then write out the individual plotting commands.
This worked fine when everything was in one gigantic module, but I am at a loss for why it has stopped working once I put everything into submodules.
Thanks for your help,
Stephen D. Webb
Associate Research Scientist
Tech-X Corporation
http://www.txcorp.com
e: sw...@tx...
5621 Arapahoe Ave. Suite A
Boulder, CO 80303 USA
From: Benjamin R. <ben...@ou...> - 2011年12月30日 20:04:25
On Friday, December 30, 2011, klo uo <kl...@gm...> wrote:
>>>> from mpl_toolkits.basemap import Basemap
>
> /usr/local/lib/python2.7/dist-packages/mpl_toolkits/__init__.py:2:
UserWarning: Module dateutil was already imported from
/usr/local/lib/python2.7/dist-packages/dateutil/__init__.pyc, but
/usr/lib/pymodules/python2.7 is being added to sys.path
> __import__('pkg_resources').declare_namespace(__name__)
>
>
> I always get this warning, and IIRC when importing some MPL module
possibly too
>
> I removed MPL 1.0.1 and upgraded to 1.1.0 but nothing changed in regard
to this warning
>
> Also Google did not reveal much - it's listed on IPython mailing list,
and also in "pyroms" forum again when someone tried to import Basemap
package.
>
> So why is this and what can I do to avoid this warning when I import
Basemap
>
> Thanks
>
I just noticed this warning this week, so it is good to know others have
gotten it, too. The odd thing is that one of my scripts triggers it, but
another (nearly identical) script does not.
I will be investigating this further.
Ben Root
From: klo uo <kl...@gm...> - 2011年12月30日 19:05:25
>>> from mpl_toolkits.basemap import Basemap
/usr/local/lib/python2.7/dist-packages/mpl_toolkits/__init__.py:2:
UserWarning: Module dateutil was already imported from
/usr/local/lib/python2.7/dist-packages/dateutil/__init__.pyc, but
/usr/lib/pymodules/python2.7 is being added to sys.path
 __import__('pkg_resources').declare_namespace(__name__)
I always get this warning, and IIRC when importing some MPL module possibly
too
I removed MPL 1.0.1 and upgraded to 1.1.0 but nothing changed in regard to
this warning
Also Google did not reveal much - it's listed on IPython mailing list, and
also in "pyroms" forum again when someone tried to import Basemap package.
So why is this and what can I do to avoid this warning when I import Basemap
Thanks
From: <fdu...@gm...> - 2011年12月30日 16:23:38
Dear all,
I couldn't find a function to plot venn diagram with python, so I 
written one for my daily use (with a lot inspirations from the internet 
and R). Hope it could be of any help to someone else, so I put it on 
github. The path to it is 
https://github.com/icetime/pyinfor/blob/master/venn.py .
I'm wondering if there is any chance that the function be included in 
matplotlib. I think matplotlib need a function for venn diagram.
Also, could someone kindly help to review the code, so I can make it 
better?
Any suggestions or comments will be greatly appreciated. Thanks a lot.
Best Regards,
Jianfeng
From: Aryeh L. T. <vi...@ar...> - 2011年12月29日 20:50:09
Hello all. I use matplotlib occasionally but not often enough that I
remember the api, so when I use it, I refer frequently to the docs. I
appreciate that the docs are very complete in most areas, but I find
navigation very difficult. I have chm files for most of the platforms I
use and I appreciate the navigation pane they provide.
To make a long story short, I have created a small extension for Google
Chrome which pulls out the relevant information and creates a handy-dandy
treeview navigation pane for the matplotlib api docs. I threw in support
for the python docs as well.
Learn more and install the extension here:
https://bitbucket.org/altaurog/sphdoctoc
enjoy,
Aryeh Leib Taurog
From: elmar w. <el...@ne...> - 2011年12月29日 16:22:42
yeap, thanks a lot.
after installing ffmpeg everything is working smoothly.
On 29.12.2011 12:12, Fabrice Silva wrote:
> It seems that the Animation.save method assume that ffmpeg is installed,
> as there is no cmd_gen keyword argument for this method.
>
> As a quick and dirty fix, you may change the imposed commandline
> constructor overloading the ffmpeg_cmd method
>
> ani.ffmpeg_cmd = ani.mencoder_cmd
>
> or, if you prefer using gstreamer, something like that (not tested)
> def gst_cmd(fname, fps, codec, frame_prefix):
> cmd = 'gst-launch multifilesrc location="{prefix}%%04d.png" index={i0} num-buffers={nb} '\
> 	 'caps="image/png,framerate=\(fraction\){fps}/1" ! pngdec ! ffmpegcolorspace ! '\
> 	 '{codec_f} ! filesink location={fname} '
> nb_frames = len([tmp for tmp in os.listdir('./') if tmp.endswith('.png') and tmp.startswith(frame_prefix)])
> return cmd.format(prefix=frame_prefix, i0=0, nb=nb_frames, fps=fps, codec_f=codec+'mux', fname=fname)
>
> ani.ffmpeg_cmd = gst_cmd
From: Paul B. <pau...@gm...> - 2011年12月29日 15:21:09
Maybe this is worth reviewing and refining: seems like all the parts are there, as I suspected. 
http://telliott99.blogspot.com/2011/07/matplotlib-on-os-x-lion-revised.html 
> BTW, whatever you do, do not follow the instructions that the matplotlib developers provide. You do not need another Python, including MacPython or the Endthought distribution or anything else..
--
Paul Beard
Are you trying to win an argument or solve a problem? 
From: Paul B. <pau...@gm...> - 2011年12月29日 15:15:32
This is turning out to be complicated. Is there any easier way? 
It may be something as simple as a damaged archive, as this doesn't look right: 
[/home/paul/src/basemap-1.0.2]:: find . -name setup.py
(pa...@sh...)-(07:02 AM / Thu Dec 29)
It makes this step difficult: 
3) cd back to the top level basemap directory (basemap-X.Y.Z) and
run the usual 'python setup.py install'. Check your installation
by running "from mpl_toolkits.basemap import Basemap" at the python
prompt.
I have tried easy-install (it wasn't). I have tried pulling from git:
python setup.py build
Traceback (most recent call last):
 File "setup.py", line 42, in <module>
 from setupext import build_agg, build_gtkagg, build_tkagg,\
 File "/usr/home/paul/src/matplotlib/setupext.py", line 184, in <module>
 basedirlist = basedir[sys.platform]
KeyError: 'freebsd8'
I tried the packaged version on OS X Lion: 
Built for OS X 10.3? Really? 
I'm not installing fink or macports or homebrew: if it doesn't install from source without a duplicated file hierarchy I'm not interested.
Any hope here? 
--
Paul Beard
Are you trying to win an argument or solve a problem? 
From: Fabrice S. <si...@lm...> - 2011年12月29日 11:25:44
It seems that the Animation.save method assume that ffmpeg is installed,
as there is no cmd_gen keyword argument for this method.
As a quick and dirty fix, you may change the imposed commandline
constructor overloading the ffmpeg_cmd method
 ani.ffmpeg_cmd = ani.mencoder_cmd
or, if you prefer using gstreamer, something like that (not tested)
 def gst_cmd(fname, fps, codec, frame_prefix):
 cmd = 'gst-launch multifilesrc location="{prefix}%%04d.png" index={i0} num-buffers={nb} '\
 	 'caps="image/png,framerate=\(fraction\){fps}/1" ! pngdec ! ffmpegcolorspace ! '\
 	 '{codec_f} ! filesink location={fname} '
 nb_frames = len([tmp for tmp in os.listdir('./') if tmp.endswith('.png') and tmp.startswith(frame_prefix)])
 return cmd.format(prefix=frame_prefix, i0=0, nb=nb_frames, fps=fps, codec_f=codec+'mux', fname=fname)
 
 ani.ffmpeg_cmd = gst_cmd
-- 
Fabrice Silva
From: elmar w. <el...@ne...> - 2011年12月29日 10:24:16
Hi,
running the "AnimatedImage.py" I get the appended error message.
What's wrong?
Cheers
Elmar
In [5]: run AnimatedImage.py
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (23, 0))
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
/usr/local/lib/python2.7/dist-packages/IPython/utils/py3compat.pyc in 
execfile(fname, *where)
 173 else:
 174 filename = fname
--> 175 __builtin__.execfile(filename, *where)
/home/elmar/PyScripts/examples_mpl/AnimatedImage.py in <module>()
 27 repeat_delay=1000)
 28
---> 29 ani.save('dynamic_images.mp4')
 30
 31
/usr/local/lib/python2.7/dist-packages/matplotlib/animation.pyc in 
save(self, filename, fps, codec, clear_temp, frame_prefix)
 125 self._fig.savefig(fname)
 126
--> 127 self._make_movie(filename, fps, codec, frame_prefix)
 128
 129 #Delete temporary files
/usr/local/lib/python2.7/dist-packages/matplotlib/animation.pyc in 
_make_movie(self, fname, fps, codec, frame_prefix, cmd_gen)
 162 verbose.report('Animation._make_movie running command: 
%s'%' '.join(command))
 163 proc = Popen(command, shell=False,
--> 164 stdout=PIPE, stderr=PIPE)
 165 proc.wait()
 166
/usr/lib/python2.7/subprocess.pyc in __init__(self, args, bufsize, 
executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, 
env, universal_newlines, startupinfo, creationflags)
 677 p2cread, p2cwrite,
 678 c2pread, c2pwrite,
--> 679 errread, errwrite)
 680
 681 if mswindows:
/usr/lib/python2.7/subprocess.pyc in _execute_child(self, args, 
executable, preexec_fn, close_fds, cwd, env, universal_newlines, 
startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, 
errread, errwrite)
 1237 if fd is not None:
 1238 os.close(fd)
-> 1239 raise child_exception
 1240
 1241
From: Eric F. <ef...@ha...> - 2011年12月28日 01:31:33
On 12/27/2011 03:11 PM, Jeff Whitaker wrote:
> On 12/27/11 12:07 PM, Logi Ragnarsson wrote:
>> Hello,
>>
>> Is it supposed to be possible to do a filled contour plot with alpha
>> levels in the colour map? I'm plotting weather data on top of maps and
>> would very much like to plot low levels of wind and precipitation as
>> mostly transparent, with higher levels more opaque.
>>
>> If I replace the meat of the plotting code with these two lines:
>>
>> basemap.bluemarble()
>> basemap.contourf(x, y, precipitation,
>> colors=colorConverter.to_rgba_array([
>> # no colour for zero -> fully transparent
>> (1,0,0,0.5),
>> (0,1,0,1),
>> (0,1,1,0.5),
>> (0,0,1,1),
>> (1,0,1,0.5)
>> ]), levels=[
>> # no level for zero -> fully transparent
>> 0.001,
>> 0.01,
>> 0.1,
>> 1,
>> 10
>> ])
>>
>> I end up with the (deliberately) pretty horrible looking plot in the
>> attachment. The alpha values in the colors argument are completely
>> ignored, but having no colour specified for values below 0.001 (mm/hr)
>> causes those areas to be left transparent. I'm plotting the Blue
>> Marble simply to have something visible under the weather plot.
>>
>> Is this supposed to work at all in any way?
>>
>> I'm using matplotlib 1.1.0 and basemap 1.0.2 on debian with the 'Agg'
>> back-end. The data being plotted is a netCDF dataset read from the
>> output of the WRF weather model.
>>
>> Regards,
>> Logi
>>
>
> Logi: It looks like alpha transparency is controlled with the alpha
> keyword, so you can't specify different alphas for each contour level.
> You may have to call contourf multiple times, changing the alpha as
> needed for each set of contour levels.
It looks like this is something I can fix by modifying ListedColormap. 
It is discarding the alpha values, and I don't think there is any reason 
it needs to do so.
Eric
>
> -Jeff
>
> ------------------------------------------------------------------------------
> Write once. Port to many.
> Get the SDK and tools to simplify cross-platform app development. Create
> new or port existing apps to sell to consumers worldwide. Explore the
> Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
> http://p.sf.net/sfu/intel-appdev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Jeff W. <js...@fa...> - 2011年12月28日 01:12:22
On 12/27/11 12:07 PM, Logi Ragnarsson wrote:
> Hello,
>
> Is it supposed to be possible to do a filled contour plot with alpha 
> levels in the colour map? I'm plotting weather data on top of maps and 
> would very much like to plot low levels of wind and precipitation as 
> mostly transparent, with higher levels more opaque.
>
> If I replace the meat of the plotting code with these two lines:
>
> basemap.bluemarble()
> basemap.contourf(x, y, precipitation, 
> colors=colorConverter.to_rgba_array([
> # no colour for zero -> fully transparent
> (1,0,0,0.5),
> (0,1,0,1),
> (0,1,1,0.5),
> (0,0,1,1),
> (1,0,1,0.5)
> ]), levels=[
> # no level for zero -> fully transparent
> 0.001,
> 0.01,
> 0.1,
> 1,
> 10
> ])
>
> I end up with the (deliberately) pretty horrible looking plot in the 
> attachment. The alpha values in the colors argument are completely 
> ignored, but having no colour specified for values below 0.001 (mm/hr) 
> causes those areas to be left transparent. I'm plotting the Blue 
> Marble simply to have something visible under the weather plot.
>
> Is this supposed to work at all in any way?
>
> I'm using matplotlib 1.1.0 and basemap 1.0.2 on debian with the 'Agg' 
> back-end. The data being plotted is a netCDF dataset read from the 
> output of the WRF weather model.
>
> Regards,
> Logi
>
Logi: It looks like alpha transparency is controlled with the alpha 
keyword, so you can't specify different alphas for each contour level. 
You may have to call contourf multiple times, changing the alpha as 
needed for each set of contour levels.
-Jeff
From: Thomas G. <goe...@gm...> - 2011年12月26日 21:55:53
Hi all,
i have a lot of label entrys, which i want to put above the figure. My
problem is, i use 2 yaxes so a simple axes([]) call isn`t working.
Plotting graphs with only one x and y axes, using i.e.
"axes([0.1,0.1,0.9,0.8)]" worked perfect. Printing the legends for the
plots is working too, but the legend is above the figure, see example
code below. So how do i shrink the figure size so the legend isn`t
overlapping the graphs?
### Example code ###
import numpy as np
import matplotlib.pylab as mpl
fig = mpl.figure()
ax1 = fig.add_subplot(111)
# Using axes won`t work here
# mpl.axes([0.1,0.1,0.9,0.7])
x = np.linspace(1,10,10)
y = np.linspace(1,10,10)
ax1.plot(x,y**2,'g-',label='y(x)=x**2')
ax1.legend(bbox_to_anchor=(0.,0.92,1.,.1),
		loc=10,ncol=1,mode='expand',borderaxespad=0.)
ax2 = ax1.twinx()
ax2.plot(x,y,'b.',label='y(x)=x')
ax2.legend(bbox_to_anchor=(0.,1.,1.,.1),
		loc=10,ncol=1,mode='expand',borderaxespad=0.)
mpl.show()
-- 
Answer: Because we read from top to bottom, left to right!
Question: Why should i start my reply below the quoted text?
From: Luke J. <ubu...@go...> - 2011年12月26日 20:52:19
Hello,
I am plotting polar graphs for a university project, the data is
confidential but I based the work on this example
http://matplotlib.sourceforge.net/examples/pylab_examples/polar_demo.html
and fortunately
the same problem occurs with this. If you take that code and change the
last four lines from:
ax.set_rmax(2.0)grid(True)
ax.set_title("And there was much rejoicing!", fontsize=20)show()
To:
ax.set_rmax(3.01)
ax.set_rmin(2.91)
grid(True)ax.set_title("And there was much rejoicing!", fontsize=20)show()
and then run the script.
The min and max needs to be very tight so that the data I am looking at can
be displayed properly. With the tight axis range, the labels end up of to
the top right, they are just visible on my screen (1920x1080) when the
graph is maximised.
After some experimenting the smaller the range between the maximum and
minimum values the further to the right the labels go. I have not looked
into the coding of the polar module as my python knowledge is not great,
but my guess is that the labels are a set distance from the radial markers.
So my question is how do I move the radial labels back to the correct
location?
I hope I have not missed the answer in the documentation. I have installed
version 1.1.0 of matplotlib and its still a problem in it, thanks for the
good instructions on how to do it on ubuntu.
I look forward to any help.
Luke
From: sigma.z.1980 <ate...@gm...> - 2011年12月26日 05:47:53
hi everyone, I run python 2.7.2. in Eclipse (recently upgraded from 2.6). I
have a problem with installing matplotlib (I found the version for python
2.7. MacOs 10.3, no later versions). If I run python in terminal using arch
-i386 python, and then 
from matplotlib.pylab import *
and similar stuff, everything works fine. If I run python in eclipse or just
without arch -i386, I can import matplotlib as 
from matplotlib import *
but actually nothing gets imported. If I do it in the same way as above, I
get the message
no matching architecture in universal wrapper
which means there's conflict of versions or something like that. I tried
reinstalling the interpreter and adding matplotlib to forced built-ins, but
nothing helped. For some reason I didn't have this problem with numpy and
tkinter. 
Any suggestions are appreciated. 
-- 
View this message in context: http://old.nabble.com/problems-importing-matplotlib-in-macos-tp33037227p33037227.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Brad M. <bra...@gm...> - 2011年12月24日 23:11:12
>
> . My ygrid values are also ordered smallest to lowest, although the
> spacing as y is increased is much less uniform.
>
Sorry, of course I meant ygrid values are ordered smallest to highest...
From: Brad M. <bra...@gm...> - 2011年12月24日 23:04:54
Happy holidays everyone,
I'm still working on getting these pcolormesh plots that I'm interested in.
Basically I have a grid of data that is irregular but not random. My xgrid
values are something similar to [0, 1, 2, 3, 4, 4.5, 5, 5.5, 6, 7, 8 ,9 ,
10] to give you a sense. My ygrid values are also ordered smallest to
lowest, although the spacing as y is increased is much less uniform.
Perhaps importantly, the y values available for one x value are not the
same available for the neighboring x value. For every (x,y) point I have I
have a corresponding value for z. Qualitatively, you can imagine my dataset
as being a set of data on a line sqrt(1-x). For each x,y point on the line
sqrt(1-x) I have a z value. If this z value were something like
z=f(x,y)=1-x, then my output plot should look like the line sqrt(1-x), but
with greater intensity at x=0 and lesser as it moves towards x=1.
Of course, I'm trying to do a pcolormesh plot, and so I figured I needed to
pad "0"s into my data to make the other parts of the plot black (in the
'hot' color scheme). So for each x value, I added some extra 0's at the y
points which are around my sqrt(1-x) data, so that all of this area would
interpolate to 0.
I've tried using griddata to interpolate onto a regular grid. Sometimes my
input works correctly and I get a plot that is what I would expect it to
be. However, other times (with slightly different data sets or a different
grid that I'm interpolating to) I get bad interpolation apparently around
the edges of the plot and get large values there (whereas most of it should
just be 0). Also, it appears that griddata will run very, very slowly on
the size of data that I need to interpolate to (extrapolations based on
small tests would suggest days possibly with no guarantee that the results
would not be in error).
Can anyone think of why what I'm doing might not be working correctly with
griddata? What situations cause griddata to fail? Maybe if I knew them I
could make sure they don't happen. Or perhaps there is another alternative
I could try? I suppose I couldn't use RectBivariateSpline unless my input
grid was fully rectangular (which my current distribution of y values
prevents)? Or is this incorrect?
Or, can anyone think of another way I can show the data I'm trying to show?
I might be able to figure out how to draw the line (for example) sqrt(1-x)
with a linesize which is proportional to the z=f(x,y) value, but that sort
of distorts the line sqrt(1-x) which I'm trying to preserve the shape of.
Thanks for any help you can give. I really appreciate it! Please let me
know if I can provide more information that would help.
Best,
Brad
From: Mario F. <mar...@ao...> - 2011年12月24日 15:42:48
Hi there,
I want to examine a vector field and therefore i used "quiver" to
visualize said field:
> import numpy as np
> import matplotlib.pyplot as plt
> 
> # points
> x, y = np.meshgrid(np.arange(0, 2*np.pi, 0.1),
> np.arange(0, 1*np.pi, 0.1))
> # derivatives
> dx = -2*np.sin(x)*np.cos(y)
> dy = np.cos(x)*np.sin(y)
> 
> # plot
> plt.figure()
> plt.quiver(dx, dy, color='b')
> 
> # beautiful axis
> a = plt.gca()
> x_a, y_a = a.get_xaxis(), a.get_yaxis()
> a.axis('tight')
> # TODO: We should not multiply with 10 here.
> x_a.set_ticks(np.arange(0, 2*np.pi*10+1, np.pi*10/4))
> y_a.set_ticks(np.arange(0, 1*np.pi*10+1, np.pi*10/4))
> labels = [
> r'0ドル$',
> r'$\frac{1}{4}\pi$',
> r'$\frac{1}{2}\pi$',
> r'$\frac{3}{4}\pi$',
> r'$\pi$',
> r'$\frac{5}{4}\pi$',
> r'$\frac{3}{2}\pi$',
> r'$\frac{7}{4}\pi$',
> r'2ドル \pi$']
> a.set_xticklabels(labels)
> a.set_yticklabels(labels[:5])
> 
> # show
> plt.show()
(The plot looks like a double swirl, if anyone is interested in that
information)
At first I do not know why I have to multiply with 10 at the ticks, but
thats not the point.
It is much more important that I would like to set the image to a
certain width before saving. It should be both "tight" and "equal", so
after setting the width the height could be calculated automatically.
As a workaround I use the images and strech them vertically, but then
the x/y axis tick labels look strange.
So: How to set a certain width?
Thanks and a merry Christmas,
Keba
From: Ilan S. <isc...@en...> - 2011年12月23日 16:55:58
Hello,
I am pleased to announce the release of Enthought Python Distribution, EPD
version 7.2, along with its "EPD Free" counterpart. The highlights of this
release are: the addition of GDAL and updates to over 30 packages, including
SciPy, matplotlib and IPython. The new IPython 0.12 includes the HTML
notebook, which caused the Tornado web-server also to be added to EPD.
To see which libraries are included in the free vs. full version, please see:
 http://www.enthought.com/products/epdlibraries.php
The complete list of additions, updates and fixes is in the change log:
 http://www.enthought.com/products/changelog.php
About EPD
---------
The Enthought Python Distribution (EPD) is a "kitchen-sink-included"
distribution of the Python programming language, including over 90
additional tools and libraries. The EPD bundle includes NumPy, SciPy,
IPython, 2D and 3D visualization tools, and many other tools.
EPD is currently available as a single-click installer for Windows XP,
Vista and 7, MacOS (10.5 and 10.6), RedHat 3, 4, 5 and 6, as well as
Solaris 10 (x86 and x86_64/amd64 on all platforms).
All versions of EPD (32 and 64-bit) are free for academic use. An
annual subscription including installation support is available for
individual and commercial use. Additional support options, including
customization, bug fixes and training classes are also available:
 http://www.enthought.com/products/epd_sublevels.php
- Ilan
From: David W. <dav...@gm...> - 2011年12月21日 21:13:48
Hello all,
I am installing matplotlib on a remote network in a virtualenv setup. The installation goes great but when I try to run the testing, matplotlib freezes and has to be killed from another terminal. I've attached the complete output.
Cheers,
Dave 
----
David Welch
dav...@gm...
Something you entered
transcended parameters.
So much is unknown.
-Salon Magazine, Error Haiku Challenge
From: Brad M. <bra...@gm...> - 2011年12月21日 16:55:06
Jeff,
Thanks. That indeed did work (after downloading python-dev package). I just
didn't know that 'install' was the argument that I was supposed to pass to
it =)
After installing I tried griddata again. My input data was originally a
list. The new griddata didn't like this and so I simply used
a=array(thelist) to convert to an array and tried again. It took quite a
bit longer than the old griddata, but the resulting output now looks
correct! Better a slow and correct answer than a fast and garbage one.
Thanks again Jeff (and thanks for the new griddata if you are the one that
made it)!
Brad
On Wed, Dec 21, 2011 at 5:55 AM, Jeff Whitaker <js...@fa...> wrote:
> On 12/21/11 12:31 AM, Brad Malone wrote:
>
> Hi, I'm still working on my interpolating from an irregularly space grid
> and then running pcolormesh on the resulting output. With some of the newer
> data I've been plotting I've noticed that my plots are complete garbage. I
> realized that this was actually because of the output from griddata rather
> than some problem with pcolormesh/pcolor/etc (basically I get huge negative
> values like -80000 from the interpolation when all of my data points lie
> within [0,20]) .
>
> Googling I found out that the default griddata has some problems, and
> that there is a better, more robust version available through natgrid. I
> downloaded the natgrid-0.2.1 package from here
> http://sourceforge.net/projects/matplotlib/files%2Fmatplotlib-toolkits%2Fnatgrid-0.2/
> .
>
> My question now is, how do I install this and give it a shot? I'm
> running on Ubuntu (or Xubuntu rather). The README doesn't seem to have any
> directions.
>
> Brad:
>
> python setup.py install should do it. matplotlib will automatically use
> it if it's installed.
>
> -Jeff
>
>
> Also, let's say that this new griddata doesn't work for me, is there
> something else I could try? The interpolation problems are strange, because
> I can break my data into 3 segments (I read 3 files to obtain the data so
> this is the natural way to do it) and I can plot and interpolate correctly
> any segment individually. It's only when I do all 3 segments together that
> the interpolation begins to fail.
>
> Any ideas?
>
> Thanks for the continued help!
>
> Brad
>
>
> ------------------------------------------------------------------------------
> Write once. Port to many.
> Get the SDK and tools to simplify cross-platform app development. Create
> new or port existing apps to sell to consumers worldwide. Explore the
> Intel AppUpSM program developer opportunity. appdeveloper.intel.com/joinhttp://p.sf.net/sfu/intel-appdev
>
>
>
> _______________________________________________
> Matplotlib-users mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
From: Jeff W. <js...@fa...> - 2011年12月21日 13:56:00
On 12/21/11 12:31 AM, Brad Malone wrote:
> Hi, I'm still working on my interpolating from an irregularly space 
> grid and then running pcolormesh on the resulting output. With some of 
> the newer data I've been plotting I've noticed that my plots are 
> complete garbage. I realized that this was actually because of the 
> output from griddata rather than some problem with 
> pcolormesh/pcolor/etc (basically I get huge negative values like 
> -80000 from the interpolation when all of my data points lie within 
> [0,20]) .
>
> Googling I found out that the default griddata has some problems, and 
> that there is a better, more robust version available through natgrid. 
> I downloaded the natgrid-0.2.1 package from here 
> http://sourceforge.net/projects/matplotlib/files%2Fmatplotlib-toolkits%2Fnatgrid-0.2/. 
>
>
> My question now is, how do I install this and give it a shot? I'm 
> running on Ubuntu (or Xubuntu rather). The README doesn't seem to have 
> any directions.
Brad:
python setup.py install should do it. matplotlib will automatically use 
it if it's installed.
-Jeff
>
> Also, let's say that this new griddata doesn't work for me, is there 
> something else I could try? The interpolation problems are strange, 
> because I can break my data into 3 segments (I read 3 files to obtain 
> the data so this is the natural way to do it) and I can plot and 
> interpolate correctly any segment individually. It's only when I do 
> all 3 segments together that the interpolation begins to fail.
>
> Any ideas?
>
> Thanks for the continued help!
>
> Brad
>
>
> ------------------------------------------------------------------------------
> Write once. Port to many.
> Get the SDK and tools to simplify cross-platform app development. Create
> new or port existing apps to sell to consumers worldwide. Explore the
> Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
> http://p.sf.net/sfu/intel-appdev
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Nico S. <nic...@gm...> - 2011年12月21日 13:31:12
> I don't see it.
You're right. -- I've looked at it again and I can confirm that the
outlines are drawn with LINETOs.
> This shows a set of vertices with a matching set of LINETO (after an
> initial MOVETO). contour and contourf generate piece-wise linear paths
> with vertices on grid cell boundaries; they make no attempt to smooth
> out the contours.
I looked at the example in
http://matplotlib.sourceforge.net/examples/pylab_examples/contourf_log.html
and used the point information in the LINETOs to reproduce the figure.
It seems that, except for the blue patches in the corners, this
information is really rough. Take a peek at the file I attached; left:
matplotlib rendering, right: lines manually redrawn.
Do you know what's going on?
--Nico
On Tue, Dec 13, 2011 at 11:39 PM, Eric Firing <ef...@ha...> wrote:
> On 12/13/2011 11:03 AM, Nico Schlömer wrote:
>> Hi all,
>>
>> when drawing contourf plots, I inspected the underlying
>> matplotlib.path.Path elements that determine the curves and noticed
>> that they are all of code LINETO (see
>> http://matplotlib.sourceforge.net/api/path_api.html#matplotlib.path.Path)
>> although the number of vertices is 6, actually suggesting a CURVE4.
>>
>> Would that be a bug?
>
> I don't see it.
>
> x = np.arange(9)
> x.shape = (3,3)
> cs = contourf(x, 1)
> print cs.collections.get_paths()
>
> This shows a set of vertices with a matching set of LINETO (after an
> initial MOVETO). contour and contourf generate piece-wise linear paths
> with vertices on grid cell boundaries; they make no attempt to smooth
> out the contours.
>
> Eric
>
>>
>> Cheers,
>> Nico
>
>
> ------------------------------------------------------------------------------
> Systems Optimization Self Assessment
> Improve efficiency and utilization of IT resources. Drive out cost and
> improve service delivery. Take 5 minutes to use this Systems Optimization
> Self Assessment. http://www.accelacomm.com/jaw/sdnl/114/51450054/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Nils W. <nw...@ia...> - 2011年12月21日 08:53:41
On 2011年12月20日 10:48:42 -0600
 Ryan May <rm...@gm...> wrote:
> On Tue, Dec 20, 2011 at 8:00 AM, Nils Wagner
> <nw...@ia...> wrote:
>> Hi all,
>>
>> How do I use animation.FuncAnimation to plot real-life
>> data from parsing a text file ?
> 
> Here's a version that does what I think you want:
> 
> import matplotlib.pyplot as plt
> import matplotlib.animation as animation
> import sys
> import time
> import re
> 
> x_data = [] # x
> y_data = [] # y
> 
> fig = plt.figure()
> ax = fig.add_subplot(111)
> curve,= ax.plot([],[],lw=2)
> ax.set_xlim(0,5)
> ax.set_ylim(0,25)
> ax.grid()
> 
> def tail_f(file):
> while True:
> where = file.tell() # current file position, an 
>integer (may
> be a long integer).
> line = file.readline()
> if re.search('without errors',line): break
> # Always yield the line so that we return back to the 
>event loop. If we
> # need to go back and read again, we'll get a free 
>delay from the
> # animation system.
> yield line
> if not line:
> file.seek(where) # seek(offset[, whence]) 
>->None. Move to
> new file position.
> 
> 
> def run(line, curve, x, y):
> if re.search('x=',line):
> liste = line.split('=')
> x.append(liste[1].strip())
> if re.search('y=',line):
> liste = line.split('=')
> y.append(liste[1].strip())
> 
> curve.set_data(x,y)
> print x,y
> return curve
> 
> # The passed in frames can be a func that returns a 
>generator. This
> # generator keeps return "frame data"
> def data_source(fname=sys.argv[1]):
> return tail_f(open(fname))
> 
> # This init function initializes for drawing returns any 
>initialized
> # artists.
> def init():
> curve.set_data([],[])
> return curve
> 
> line_ani = animation.FuncAnimation(fig, run, 
>data_source, init_func=init,
> fargs=(curve,x_data,y_data), interval=100)
> 
> plt.show()
> 
> 
> Ben was also right in that you could subclass 
>FuncAnimation and
> override/extend methods. This would have the benefit of 
>giving more
> control over the handling of seek(). (Something else for 
>my todo
> list...)
> 
> Ryan
> 
> -- 
> Ryan May
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma
Hi Ryan,
is it possible to autoscale the axes whenever it is needed 
by a new chunk of data ?
Nils
1 message has been excluded from this view by a project administrator.

Showing results of 208

1 2 3 .. 9 > >> (Page 1 of 9)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /