Re: [Matplotlib-users] how do i get rid of the whitespace around this plot?
here's an example
a call to pyplot.axis() after I call pcolor straightens it out though. thx
gokhan, and sorry to all for not picking that up in the docs myself.
and finally, `demolishor' is a great and hilarious song by a band called the
acacia strain, in case there are parties interested in music that might make
your officemates think you're satanic. i am delighted this thread generated
such an enthusiastic response in this regard.
ta ta
On Fri, Aug 28, 2009 at 3:32 PM, John Hunter wrote:
> On Fri, Aug 28, 2009 at 1:59 PM, DEMOLISHOR! the
> Demolishor wrote:
> > This is the result from a call to pyplot.pcolor() -- why do the axes
> > automatically expand beyond the range of the data? And how can I set them
> > back? I am not seeing an obvious keyword argument in the pcolor docs to
> do
> > this...
> >
>
> could you post a complete example that replicates the problem?
>
> JDH
>
Here you go.
#!/usr/bin/env python
import numpy
from matplotlib import pyplot
bi_mean = [1,2]
cov_mat = [[1, 2],
[2, 1]]
xy_data = numpy.random.multivariate_normal(bi_mean, cov_mat, 10)
x_data = [pt[0] for pt in xy_data]
y_data = [pt[1] for pt in xy_data]
zfill, xbins, ybins = numpy.histogram2d(x_data, y_data, bins=[100,100],
range=((-3.2,7.2),(-3.2,7.2)))
xpts = numpy.linspace(-3.2, 7.2, 100)
ypts = numpy.linspace(-3.2, 7.2, 100)
pyplot.pcolor(ypts, xpts, zfill)
pyplot.colorbar()
pyplot.savefig('pyplot1.png')
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] SVG output: possible bug
Greetings,
I am using matplotlib to generate an SVG plot containing a mixture of
Annotations and Circles. I noticed that the annotation text does not appear
at exactly the correct location when outputting to SVG. The difference is
minor, but definitely present.
The following will reproduce the problem in the form of two files, an svg
and a png:
--
from matplotlib.pyplot import figure
from matplotlib.text import Annotation
from matplotlib.patches import Circle
from matplotlib.transforms import IdentityTransform
f = figure(1)
a = f.add_subplot(111)
text = Annotation('H', (0.4, 0.4), va='center', ha='center',
size='xx-large', transform=IdentityTransform())
a.add_artist(text)
a.grid(True)
f.savefig("incorrect.svg")
f.savefig("correct.png")
--
IdentityTransform() is used to workaround a bug in add_artist() (see
http://www.nabble.com/Annotation-add_artist-bug-tt19052971.html )
Further investigation reveals that this problem occurs with ps and pdf
output as well. It seems that all backend_*.py files in
/usr/share/pyshared/matplotlib/backends suffer from this problem. I have
poked around in a few files but can't see any obvious fixes.
Has anyone encountered this problem before and found a decent workaround?
Thanks,
Craig
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Licence Question
Hi All, Im new to matplotlib, and I love it, but I have a question about the Licence agreement. I am wanting to develop a commercial closed source application for my company using python and matplotlib. I have tried reading the Licence agreement, but have trouble understanding it. Could someone please tell me under what conditions I can use matplotlib in a closed source application? Kind Regards, Craig -- ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Additional changes required to use wxmpl-1.2.9 with matplotlib-0.98.3
Many thanks to Paulo Meira for his modifications to wxmpl.py to make it
compatible with matplotlib-0.98.3. However, I had to make one change to his
file for it to work with my application. Also, I had to modify one line in
matplotlib/backends/backend_wx.py. I'm not sure why I had to make these
changes--maybe I'm doing something wrong in my python/wx/wxmpl/matplotlib
application. Anyway, here are patches that illustrate the changes I had to
make. The patches are attached, but I'm not sure how this list handles
patches, so the text is also pasted below. I hope this helps someone...if I'm
doing something wrong, suggestions will be appreciated.
Craig Finch
--- ./wxmpl.py2008-11-21 13:03:02.0 -0500
+++ ./wxmpl_new.py2008-11-21 14:28:35.0 -0500
@@ -1203,7 +1203,8 @@
if doRepaint:
self.gui_repaint()
else:
-FigureCanvasWxAgg.draw(self, repaint)
+#FigureCanvasWxAgg.draw(self, repaint)
+FigureCanvasWxAgg.draw(self)
# Don't redraw the decorations when called by _onPaint()
if doRepaint:
--- backend_wx.py2008-11-21 14:24:17.0 -0500
+++ backend_wx_new.py2008-11-21 14:26:24.0 -0500
@@ -1098,7 +1098,7 @@
DEBUG_MSG("_onPaint()", 1, self)
drawDC = wx.PaintDC(self)
if not self._isDrawn:
-self.draw(drawDC=drawDC)
+FigureCanvasWx.draw(self, drawDC=drawDC)
else:
self.gui_repaint(drawDC=drawDC)
evt.Skip()
wxmpl.patch
Description: Binary data
backend_wx.patch
Description: Binary data
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Crash when trying to show a semilog or log-log plot
I am using matplotlib-0.98.5.2 and getting a strange crash when trying to show() a window with semilog or log-log axes. Here is a simple script that will cause the crash: import pylab from numpy import * x = arange(1., 10., 0.1) y = x**2 pylab.semilogx(x,y) pylab.show() At the end of this message is a sample of the output. I had to cut it down because it's apparently stuck in a loop in pyparsing.py and keeps outputting the same repetitive message. Did I find a bug here? Any suggestions would be appreciated. Craig Sample output: -- File "//usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py", line 352, in expose_event self._render_figure(self._pixmap, w, h) File "//usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py", line 75, in _render_figure FigureCanvasAgg.draw(self) File "//usr/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py", line 279, in draw self.figure.draw(self.renderer) File "//usr/lib/python2.4/site-packages/matplotlib/figure.py", line 772, in draw for a in self.axes: a.draw(renderer) File "//usr/lib/python2.4/site-packages/matplotlib/axes.py", line 1601, in draw a.draw(renderer) File "//usr/lib/python2.4/site-packages/matplotlib/axis.py", line 710, in draw tick.draw(renderer) File "//usr/lib/python2.4/site-packages/matplotlib/axis.py", line 193, in draw self.label1.draw(renderer) File "//usr/lib/python2.4/site-packages/matplotlib/text.py", line 452, in draw bbox, info = self._get_layout(renderer) File "//usr/lib/python2.4/site-packages/matplotlib/text.py", line 252, in _get_layout w, h, d = renderer.get_text_width_height_descent( File "//usr/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py", line 152, in get_text_width_height_descent ox, oy, width, height, descent, fonts, used_characters = \ File "//usr/lib/python2.4/site-packages/matplotlib/mathtext.py", line 2808, in parse box = self._parser.parse(s, font_output, fontsize, dpi) File "//usr/lib/python2.4/site-packages/matplotlib/mathtext.py", line 2259, in parse self._expression.parseString(s) File "/usr/lib/python2.4/site-packages/pyparsing.py", line 1065, in parseString loc, tokens = self._parse( instring, 0 ) File "/usr/lib/python2.4/site-packages/pyparsing.py", line 998, in _parseCache value = self._parseNoCache( instring, loc, doActions, callPreParse ) File "/usr/lib/python2.4/site-packages/pyparsing.py", line 941, in _parseNoCache loc,tokens = self.parseImpl( instring, preloc, doActions ) File "/usr/lib/python2.4/site-packages/pyparsing.py", line 2577, in parseImpl return self.expr._parse( instring, loc, doActions, callPreParse=False ) File "/usr/lib/python2.4/site-packages/pyparsing.py", line 998, in _parseCache value = self._parseNoCache( instring, loc, doActions, callPreParse ) File "/usr/lib/python2.4/site-packages/pyparsing.py", line 941, in _parseNoCache loc,tokens = self.parseImpl( instring, preloc, doActions ) File "/usr/lib/python2.4/site-packages/pyparsing.py", line 2325, in parseImpl loc, exprtokens = e._parse( instring, loc, doActions ) File "/usr/lib/python2.4/site-packages/pyparsing.py", line 998, in _parseCache value = self._parseNoCache( instring, loc, doActions, callPreParse ) File "/usr/lib/python2.4/site-packages/pyparsing.py", line 941, in _parseNoCache loc,tokens = self.parseImpl( instring, preloc, doActions ) File "/usr/lib/python2.4/site-packages/pyparsing.py", line 2690, in parseImpl loc, tokens = self.expr._parse( instring, loc, doActions, callPreParse=False ) File "/usr/lib/python2.4/site-packages/pyparsing.py", line 998, in _parseCache value = self._parseNoCache( instring, loc, doActions, callPreParse ) File "/usr/lib/python2.4/site-packages/pyparsing.py", line 941, in _parseNoCache loc,tokens = self.parseImpl( instring, preloc, doActions ) File "/usr/lib/python2.4/site-packages/pyparsing.py", line 2325, in parseImpl loc, exprtokens = e._parse( instring, loc, doActions ) File "/usr/lib/python2.4/site-packages/pyparsing.py", line 998, in _parseCache value = self._parseNoCache( instring, loc, doActions, callPreParse ) File "/usr/lib/python2.4/site-packages/pyparsing.py", line 941, in _parseNoCache - snip - File "/usr/lib/python2.4/site-packages/pyparsing.py", line 2309, in parseImpl loc, resultlist = self.exprs[0]._parse( instring, loc, doActions, callPreParse=False ) File "/usr/lib/python2.4/site-packages/pyparsing.py", line 998, in _parseCache value = self._parseNoCache( instri
Re: [Matplotlib-users] Crash when trying to show a semilog or log-log plot
Okay, I figured it out. The people who maintain the Gentoo ebuild for matplotlib decided to remove the "unnecessary" copies of fonts, pycxx and pyparser that are bundled with matplotlib. The latest version of the ebuild contains code that explicitly removes the bundled fonts, pyparser and pycxx modules. I would never have thought to look there if you hadn't pointed this out. I posted a bug on Gentoo (260025) requesting that they use the bundled pyparsing module, and check with the matplotlib developers about the other "redundant" packages before deleting them. Thanks for your help. Craig - Original Message From: Michael Droettboom To: Craig Finch Cc: [email protected] Sent: Monday, February 23, 2009 9:49:06 AM Subject: Re: [Matplotlib-users] Crash when trying to show a semilog or log-log plot Strange. I am unable to reproduce this with 0.98.2 (0.98.3 or 0.98.5)... It's happening inside of the math expression renderer, which is used to draw the exponents that happen with semilog and log-log axes. It doesn't, however, appear to be font-related, which is a frequent installation/system problem. What is strange about this traceback is that it is using the system-wide installed version of pyparsing.py, and not the one that comes with matplotlib. matplotlib is very sensitive to small version changes in pyparsing, so we distribute our own copy and try to use it. If you temporarily move /usr/lib/python2.4/site-packages/pyparsing.py to another location, does that solve the problem? If so, I will look into how we're importing pyparsing.py to ensure we always use the local copy. Mike Craig Finch wrote: > I am using matplotlib-0.98.5.2 and getting a strange crash when trying to > show() a window with semilog or log-log axes. Here is a simple script that > will cause the crash: > > import pylab > from numpy import * > x = arange(1., 10., 0.1) > y = x**2 > pylab.semilogx(x,y) > pylab.show() > > At the end of this message is a sample of the output. I had to cut it down > because it's apparently stuck in a loop in pyparsing.py and keeps outputting > the same repetitive message. Did I find a bug here? Any suggestions would > be appreciated. > >Craig > > Sample output: > -- > File > "//usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py", line > 352, in expose_event > self._render_figure(self._pixmap, w, h) > File > "//usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py", > line 75, in _render_figure > FigureCanvasAgg.draw(self) > File > "//usr/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py", line > 279, in draw > self.figure.draw(self.renderer) > File "//usr/lib/python2.4/site-packages/matplotlib/figure.py", line 772, in > draw > for a in self.axes: a.draw(renderer) > File "//usr/lib/python2.4/site-packages/matplotlib/axes.py", line 1601, in > draw > a.draw(renderer) > File "//usr/lib/python2.4/site-packages/matplotlib/axis.py", line 710, in > draw > tick.draw(renderer) > File "//usr/lib/python2.4/site-packages/matplotlib/axis.py", line 193, in > draw > self.label1.draw(renderer) > File "//usr/lib/python2.4/site-packages/matplotlib/text.py", line 452, in > draw > bbox, info = self._get_layout(renderer) > File "//usr/lib/python2.4/site-packages/matplotlib/text.py", line 252, in > _get_layout > w, h, d = renderer.get_text_width_height_descent( > File > "//usr/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py", line > 152, in get_text_width_height_descent > ox, oy, width, height, descent, fonts, used_characters = \ > File "//usr/lib/python2.4/site-packages/matplotlib/mathtext.py", line 2808, > in parse > box = self._parser.parse(s, font_output, fontsize, dpi) > File "//usr/lib/python2.4/site-packages/matplotlib/mathtext.py", line 2259, > in parse > self._expression.parseString(s) > File "/usr/lib/python2.4/site-packages/pyparsing.py", line 1065, in > parseString > loc, tokens = self._parse( instring, 0 ) > File "/usr/lib/python2.4/site-packages/pyparsing.py", line 998, in > _parseCache > value = self._parseNoCache( instring, loc, doActions, callPreParse ) > File "/usr/lib/python2.4/site-packages/pyparsing.py", line 941, in > _parseNoCache > loc,tokens = self.parseImpl( instring, preloc, doActions ) > File "/usr/lib/python2.4/site-packages/pyparsing.py", line 2577, in > parseImpl > return self.expr._pa
[Matplotlib-users] psd
Hi I have some data for a 24hr period with a sample rate of 100 samples/second. I want to create a power spectrum using matplotlibs function psd. I want it to have 10 minute windows with a 50% overlap, but cant seem to get the syntax right. My code is as follows: NFFT = len(data) Fs = 100 window=np.hanning(Fs*60*10) noverlap = window*0.5 plt.psd(data, NFFT, Fs, window, noverlap ) anyone kow how to do this properly??? Thanks, D -- Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] psd
Hi, thanks for that. I've made the following changes: NFFT = 100*60*10# Linked to window size Fs = stream[0].stats.sampling_rate win = np.hanning(NFFT) overlap = NFFT/2 power, freq = plt.psd(data, NFFT, Fs, win, overlap) but it returns the following error: Traceback (most recent call last): File "/home/davcra/Desktop/python_scripts/welchPSD.py", line 20, in power, freq = plt.psd(data, NFFT, Fs, win, overlap) File "/usr/lib/python2.7/site-packages/matplotlib/pyplot.py", line 2322, in psd ret = ax.psd(x, NFFT, Fs, Fc, detrend, window, noverlap, pad_to, sides, scale_by_freq, **kwargs) File "/usr/lib/python2.7/site-packages/matplotlib/axes.py", line 7876, in psd sides, scale_by_freq) File "/usr/lib/python2.7/site-packages/matplotlib/mlab.py", line 389, in psd scale_by_freq) File "/usr/lib/python2.7/site-packages/matplotlib/mlab.py", line 419, in csd noverlap, pad_to, sides, scale_by_freq) File "/usr/lib/python2.7/site-packages/matplotlib/mlab.py", line 268, in _spectral_helper thisX = windowVals * detrend(thisX) TypeError: 'int' object is not callable On Mon, Jan 30, 2012 at 12:13 PM, Fabrice Silva wrote: > Le lundi 30 janvier 2012 à 11:45 +, David Craig a écrit : > > Hi I have some data for a 24hr period with a sample rate of 100 > > samples/second. I want to create a power spectrum using matplotlibs > > function psd. I want it to have 10 minute windows with a 50% overlap, > > but cant seem to get the syntax right. My code is as follows: > > > > NFFT = len(data) > > Fs = 100 > > window=np.hanning(Fs*60*10) > > noverlap = window*0.5 > > plt.psd(data, NFFT, Fs, window, noverlap ) > > > > anyone kow how to do this properly??? > > Be careful to use a suitable value for NFFT. It must be linked to your > windows size, not the total data length, and you would rather use a > power of 2 for efficience. Do not use it to increase the frequency > resolution (use pad_to instead). > > Fs = 100 > NFFT = Fs*60*10 > Pxx, f = plt.psd(data, NFFT, Fs, window=np.hanning(NFFT), NFFT/2) > > -- > Fabrice Silva > > > > -- > Try before you buy = See our experts in action! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-dev2 > ___ > Matplotlib-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] specgram
Hi, I am trying to produce a spectrogram for my data set and am having an issue with the color map. My data is filtered between 0.02 and 1.0Hz, but specgram() produces an image in the range 0 to 10Hz. Also the color map is not set properly. I would like to have it so the colormap ranges from the min and max powers obtained by specgram. Anyone know how to do this? My code is below. Pxx, freqs, bins, im = plt.specgram(data, NFFT=nfft, Fs=sps, detrend=py.detrend_none, window=py.window_hanning, noverlap=nfft/2, cmap=None, xextent=None, pad_to=None, sides='default', scale_by_freq=None) plt.ylim(0,1) plt.colorbar() plt.show() thanks, D -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] seconds to julian time
Hi, I have a plot that covers a 10 day period on its x-axis in seconds. I would like to change it to julian days, is this possible with matplotlib and if so how do I do it?? D -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] specgram memory problem
Hi, I am using matplotlib to produce some spectrograms for seismic data. I am looking at a 10 day period with a sample rate of 20sps. I would like to have my spectrogram to be composed of 10 minute windows with an overlap of 90%. However when I try and run my script I run out of memory. I can produce the spectrogram for a maximum of 3 days before an error occurs. I have also tried to produce a spectrogram for each day and stick them together using subplot, but I then get the error given below. Anyone know a way around this?? Thanks, David Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/matplotlib/backends/backend_gtk.py", line 394, in expose_event self._render_figure(self._pixmap, w, h) File "/usr/lib/python2.7/site-packages/matplotlib/backends/backend_gtkagg.py", line 75, in _render_figure FigureCanvasAgg.draw(self) File "/usr/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 394, in draw self.figure.draw(self.renderer) File "/usr/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File "/usr/lib/python2.7/site-packages/matplotlib/figure.py", line 798, in draw func(*args) File "/usr/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File "/usr/lib/python2.7/site-packages/matplotlib/axes.py", line 1946, in draw a.draw(renderer) File "/usr/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File "/usr/lib/python2.7/site-packages/matplotlib/image.py", line 354, in draw im = self.make_image(renderer.get_image_magnification()) File "/usr/lib/python2.7/site-packages/matplotlib/image.py", line 569, in make_image transformed_viewLim) File "/usr/lib/python2.7/site-packages/matplotlib/image.py", line 201, in _get_unsampled_image x = self.to_rgba(self._A, self._alpha) File "/usr/lib/python2.7/site-packages/matplotlib/cm.py", line 194, in to_rgba x = self.cmap(x, alpha=alpha, bytes=bytes) File "/usr/lib/python2.7/site-packages/matplotlib/colors.py", line 551, in __call__ rgba = np.empty(shape=xa.shape+(4,), dtype=lut.dtype) MemoryError -- Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Change xaxis labels
Hi, I have a plot and the xaxis shows number of seconds after a start point. I would like to convert them to days anyone know how to do this. I have looked at the documentation but cant find what I need. -- Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] specgram memory problem
I'm using a lenovo laptop with fedora 16. It has 2.9 GiB memory and 4 intel core CPUs @ 2.3GHz each. Available disk space is 147.9GiB. numpy 1.6.0 matplotlib 1.0.1 On 6 Feb 2012, at 10:29, Fabrice Silva wrote: > On Sat, Feb 4, 2012 at 9:44 AM, Fabrice Silva mrs.fr> wrote: >> Le vendredi 03 février 2012 à 17:39 +, David Craig a >> écrit : >>> sure how to get it to plot the outputs from specgram. I use >>> specgram as follows, >>> Pxx, freqs, bins, im = plt.specgram(..) >>> what am I trying imshow?? >> >> >> plt.specgram computes the spectrogram and when calls >> imshow to display >> the resulting array into an image >> >> Please tell the shape of Pxx, and try the following >> >> import numpy as np >> import matplotlib.pyplot as plt >> a = np.empty((12000, 14400), dtype=float) >> plt.imshow(a) >> plt.show() > > Le samedi 04 février 2012 à 10:30 +, David Craig a écrit : >> Pxx has shape (6001, 1430) and when I tried the lines of code it >> returned the following memory error, >> >> Traceback (most recent call last): >> File "/usr/lib/python2.7/site-packages/matplotlib/backends/ >> backend_gtk.py", line 394, in expose_event >> self._render_figure(self._pixmap, w, h) >> File "/usr/lib/python2.7/site-packages/matplotlib/backends/ >> backend_gtkagg.py", line 75, in _render_figure >> FigureCanvasAgg.draw(self) >> File "/usr/lib/python2.7/site-packages/matplotlib/backends/ >> backend_agg.py", line 394, in draw >> self.figure.draw(self.renderer) >> File "/usr/lib/python2.7/site-packages/matplotlib/artist.py", >> line 55, in draw_wrapper >> draw(artist, renderer, *args, **kwargs) >> File "/usr/lib/python2.7/site-packages/matplotlib/figure.py", >> line 798, in draw >> func(*args) >> File "/usr/lib/python2.7/site-packages/matplotlib/artist.py", >> line 55, in draw_wrapper >> draw(artist, renderer, *args, **kwargs) >> File "/usr/lib/python2.7/site-packages/matplotlib/axes.py", line >> 1946, in draw >> a.draw(renderer) >> File "/usr/lib/python2.7/site-packages/matplotlib/artist.py", >> line 55, in draw_wrapper >> draw(artist, renderer, *args, **kwargs) >> File "/usr/lib/python2.7/site-packages/matplotlib/image.py", >> line 354, in draw >> im = self.make_image(renderer.get_image_magnification()) >> File "/usr/lib/python2.7/site-packages/matplotlib/image.py", >> line 569, in make_image >> transformed_viewLim) >> File "/usr/lib/python2.7/site-packages/matplotlib/image.py", >> line 201, in _get_unsampled_image >> x = self.to_rgba(self._A, self._alpha) >> File "/usr/lib/python2.7/site-packages/matplotlib/cm.py", line >> 193, in to_rgba >> x = self.norm(x) >> File "/usr/lib/python2.7/site-packages/matplotlib/colors.py", >> line 802, in __call__ >> val = ma.asarray(value).astype(np.float) >> File "/usr/lib/python2.7/site-packages/numpy/ma/core.py", line >> 2908, in astype >> output = self._data.astype(newtype).view(type(self)) >> MemoryError > > Please, answer on the mailing list, > It confirms that the troubles lie in the rendering of images. Could > you > tell the versions of numpy and matplotlib you are using, and the > characteristics of the computer you are working on ? > > > -- > > Try before you buy = See our experts in action! > The most comprehensive online learning library for Microsoft > developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, > MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-dev2 > ___ > Matplotlib-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] specgram memory problem
uname -a gives, Linux David 3.2.2-1.fc16.i686 #1 SMP Thu Jan 26 03:38:31 UTC 2012 i686 i686 i386 GNU/Linux On Mon, Feb 6, 2012 at 6:07 PM, Benjamin Root wrote: > > > On Mon, Feb 6, 2012 at 11:59 AM, David Craig wrote: > >> I'm using a lenovo laptop with fedora 16. It has 2.9 GiB memory and 4 >> intel core CPUs @ 2.3GHz each. Available disk space is 147.9GiB. >> numpy 1.6.0 >> matplotlib 1.0.1 >> >> > 32-bit or 64-bit OS? Please use 'uname -a' to tell us, because you can > install a 32-bit OS on a 64-bit machine. > > Ben Root > > -- Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] add a single x tick label
Hi, I have a plot of a time series and I would like to add a single extra tick mark and label to the plot in a different color to the already existing tick marks. Is this possible?? Thanks, D -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] x-axis ticks and labels
Hi, I am trying to relabel the x-axis on a plot. I want it to have 10 evenly spaced labels ranging from 274 at zero to 283 at one increment short of the axis. My code is as follows: im.axes.xaxis.set_major_locator(py.MaxNLocator(10)) im.axes.xaxis.set_ticklabels(range(274,284)) My understanding is that MaxNLocator defines the number of spaces between labels. I've tried a few variations on the above but can only seem to get the last label to be 282 or 284. Anyone know what I am doing wrong. Thanks D -- Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] surface plot
Hi, I have an array defined by 3 variables p(x,z,t). I would like to produce a surface plot with colors defined by p and animate it. That is plot the value of p at all x and z, over time (t). My code to get p is below but I really have no idea how to plot this. Anyone know the best way to go about this? thanks, D # 2D Finite Distance Wave Equation. from pylab import * from numpy import math ion() # Set up variables. nx = 100 nz = 100 nsteps = 300 c = 3500 dt = 10**-4 h = 1 t = arange(0,nsteps,dt) # Define source as a spike. s = zeros(nsteps) s[1] = 1 s[2] = 2 s[3] = 1 # Position source. xs = 50 zs = 50 ##plot(t,s) ##show() # Set up pressure field. p=empty([nx,nz,nsteps]) for t in range(0,nsteps-1): for z in range(0,nz-1): for x in range(0,nx-1): p[x,z,t] = 0 # Solve wave equation. for t in range(2,nsteps-1): for z in range(1,nz-1): for x in range(2,nx-1): p[xs,zs,t] = s[t] k = (c*dt/h)**2 p[x,z,t] = 2*p[x,z,t-1] - p[x,z,t-2] + k*(p[x+1,z,t-1]-4*p[x,z,t-1]+p[x-1,z,t-1]+p[x,z+1,t-1]+p[x,z-1,t-1]) #Plot somehow draw() #close() -- Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] basemap problem
Hi, I recently installed basemap and python imaging library on my laptop. I have an i686 machine with fedora 16 on it. I just tried some test plots and basemap seems to work fine but according to the documentation to use the bluemarble(), etopo(), shadedrelief() and warpimage() instance methods I need PIL. SO I installed it via yum, $ sudo yum install python-imaging.i686 however only the bluemarble method works. If I try any of the others I get the following error. AttributeErrorTraceback (most recent call last) /usr/lib/python2.7/site-packages/IPython/utils/py3compat.pyc in execfile(fname, *where) 173 else: 174 filename = fname --> 175 __builtin__.execfile(filename, *where) /home/davcra/Desktop/python_scripts/blue_marble.py in () 10 11 ---> 12 m.shadedrelief() 13 plt.show() AttributeError: 'Basemap' object has no attribute 'shadedrelief' Anyone know what I did wrong Thanks David -- Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] draw lines in basemap
Hi,
I'm trying to produce a map with 12 locations marked on it and straight
lines plotted between each point and all other points on the map. I have
the map with the locations ok but am having trouble getting the lines.
My code is below anyone know how to do this??
Thanks
D
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import matplotlib.lines as lines
import numpy as np
m = Basemap(llcrnrlon=-11.5,llcrnrlat=51.0,urcrnrlon=-4.5,urcrnrlat=56.0,
resolution='i',projection='cass',lon_0=-4.36,lat_0=54.7)
lats = [53.5519317,53.8758499, 54.2894659, 55.2333142,
54.9846137,54.7064869, 51.5296651, 51.5536226, 51.7653115, 52.1625237,
52.5809163, 52.9393892]
lons = [-9.9413447, -9.9621948, -8.9583439, -7.6770179, -8.3771698,
-8.7406732, -8.9529546, -9.7907148, -10.1531573, -10.4099873,
-9.8456417, -9.4344939]
x, y = m(lons, lats)
for i in range(len(lons)):
for j in range(len(lons)):
if i == j: continue
m.plot([x[i],y[i]],[x[j],y[j]],'k')
m.plot(x, y, 'bD', markersize=10)
m.drawcoastlines()
#m.drawmapboundary()
#plt.savefig('/media/A677-86E0/dot_size'+str(i)+'.png')
plt.show()
--
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] 3d plotting
Hi,
I'm using surface_plot to view the results of solving the 2d wave equation.
It works fine (code is below) except I would like to add a color bar and
fix the limits on the vertical axis. When I add the color bar a new one is
added in every iteration instead of overwriting the previous one, anyone
know how I can prevent this?
Also is it possible to specify a view point when plotting?
Thanks
D
import matplotlib.pyplot as plt
import numpy as np
import pylab as py
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
pi = np.pi
#Set up grid.
fig = py.figure()
ax = Axes3D(fig)
nx = 50
nz = 50
X = np.arange(0, nx, 1)
Y = np.arange(0, nz, 1)
X, Y = np.meshgrid(X, Y)
nsteps = 100
# Constants for equation.
c = 4000
dt = 1e-4
h = 1
# Set up source.
xs = 0
zs = 0
#fig2 = py.figure()
ts = np.arange(dt,nsteps*dt,dt)
s = 0.5*np.sin(2*pi*100*ts)
#py.plot(ts,s)
#py.show()
# Homogeneous pressure field.
p = np.zeros([nx, nz, nsteps])
# Solve equation.
for t in range(0,nsteps-1):
for z in range(0,nz-1):
for x in range(0,nx-1):
p[xs,zs,t] = s[t]
k = (c*dt/h)**2
p[x,z,t] = 2*p[x,z,t-1] - p[x,z,t-2] +
k*(p[x+1,z,t-1]-4*p[x,z,t-1]+p[x-1,z,t-1]+p[x,z+1,t-1]+p[x,z-1,t-1])
snap = p[:,:,t]
surf = ax.plot_surface(X,Y,snap, rstride=1, cstride=1, cmap=cm.jet,
linewidth=0)
#fig.colorbar(surf, shrink=0.5, aspect=5)
#py.draw()
py.savefig('/home/davcra/Desktop/plots/2Dwave/'+str(t))
--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Problem using plot_surface.
Hi, I have three variables I would like to plot using plot_surface but I keep getting the error given at the bottom. Anyone know what I am doing wrong?? My code is as follows, fig3 = plt.figure() ax = Axes3D(fig3) X = np.zeros((78,1)) Y = np.zeros((78,1)) Z = np.zeros((78,1)) for p in range(len(data)): X[p,0] = data[p][1] #distance Y[p,0] = data[p][3] #azimuth Z[p,0] = data[p][4] #snr X, Y = np.meshgrid(X, Y) surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet) ValueErrorTraceback (most recent call last) /home/davcra/python_scripts/plot_snr_az.py in () 48 Z[p,0] = data[p][4] #snr 49 X, Y = np.meshgrid(X, Y) ---> 50 surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet) 51 #fig.colorbar(surf, shrink=0.5, aspect=5) 52 #plt.show() /usr/lib64/python2.6/site-packages/mpl_toolkits/mplot3d/axes3d.pyc in plot_surface(self, X, Y, Z, *args, **kwargs) 616 normals.append(np.cross(v1, v2)) 617 --> 618 polyc = art3d.Poly3DCollection(polys, *args, **kwargs) 619 if cmap is not None: 620 polyc.set_array(np.array(avgz)) /usr/lib64/python2.6/site-packages/mpl_toolkits/mplot3d/art3d.pyc in __init__(self, verts, *args, **kwargs) 282 ''' 283 --> 284 PolyCollection.__init__(self, verts, *args, **kwargs) 285 self._zsort = 1 286 self._sort_zpos = None /usr/lib64/python2.6/site-packages/matplotlib/collections.pyc in __init__(self, verts, sizes, closed, **kwargs) 666 Collection.__init__(self,**kwargs) 667 self._sizes = sizes --> 668 self.set_verts(verts, closed) 669 __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd 670 /usr/lib64/python2.6/site-packages/mpl_toolkits/mplot3d/art3d.pyc in set_verts(self, verts, closed) 304 def set_verts(self, verts, closed=True): 305 '''Set 3D vertices.''' --> 306 self.get_vector(verts) 307 # 2D verts will be updated at draw time 308 PolyCollection.set_verts(self, [], closed) /usr/lib64/python2.6/site-packages/mpl_toolkits/mplot3d/art3d.pyc in get_vector(self, segments3d) 297 segis.append((si, ei)) 298 si = ei --> 299 xs, ys, zs = zip(*points) 300 ones = np.ones(len(xs)) 301 self._vec = np.array([xs, ys, zs, ones]) ValueError: need more than 0 values to unpack WARNING: Failure executing file: thanks, David -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] installing basemap
Hi, I previously installed basemap by using the yum command. This installed version 0.99.4. I want to install the latest version so I can use shaded relief etc. This may be more of a linux problem but as I am more familiar with python than linux I thought someone here may be able to help. Following the website instructions ( http://matplotlib.github.com/basemap/users/installing.html) I downloaded the latest version and untarred it. Then in the basemap directory (which contains geos-3.2.0) I try to set the environment variable GEOS_DIR to point to the location of libgeos_c and geos_c.h. I use the find command to locate the files, *find / -name geos_c.h* returns the location of that file as * /usr/lib/basemap-1.0.1/geos-3.2.0/capi/geos_c.h* and *find / -name libgeos** returns */libgeos_c_la-geos_c.Plo /usr/lib/libgeos-3.3.1.so /usr/lib/libgeos_c.so.1.7.1 /usr/lib/libgeos_c.so.1* so I set GEOS_DIR to /usr/lib(not sure if this is correct). I then cd to the basemap directory and run, python setup.py install [davcra@David basemap-1.0.1]$ sudo python setup.py install [sudo] password for davcra: checking for GEOS lib in /root checking for GEOS lib in /usr checking for GEOS lib in /usr/local checking for GEOS lib in /sw checking for GEOS lib in /opt checking for GEOS lib in /opt/local Can't find geos library . Please set the environment variable GEOS_DIR to point to the location where geos is installed (for example, if geos_c.h is in /usr/local/include, and libgeos_c is in /usr/local/lib, set GEOS_DIR to /usr/local), or edit the setup.py script manually and set the variable GEOS_dir (right after the line that says "set GEOS_dir manually here". The problem seems to be with GEOS_DIR but I am not sure what I should set it to. Thanks D -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] trouble with pcolor
Hi, I am trying to use pcolor to visualise three variables. For example if I have a value for z at x and a value for z at y something like [x1, x2, x3] = [z1, z2, z3] and [y1, y2, y3] = [z2, z1, z3]. Then I use meshgrid to create the grid for x and y, X, Y = meshgrid(x, y) the result is two array's of shape (3,3). I then need to reshape Z to use pcolor, which is what I am having trouble with. I know I want a result like, y3 0 0 z3 y2 z1 0 0 y1 0 z2 0 x1 x2 x3 but have no idea how to create it. Anyone able to help?? thanks D -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] installing basemap
Hi again,
So I removed everything and started again ( with version 1-0-2 :) )
but am still having trouble, GEOS_DIR seems to be set correctly but I
get the following error when trying to make the GEOS library with,
sudo make; make install
make[3]: Entering directory `/home/davcra/basemap-1.0.2/geos-3.3.1/src'
test -z "/home/davcra/lib" || /bin/mkdir -p "/home/davcra/lib"
/bin/sh ../libtool --mode=install /usr/bin/install -c libgeos.la
'/home/davcra/lib'
libtool: install: /usr/bin/install -c .libs/libgeos-3.3.1.so
/home/davcra/lib/libgeos-3.3.1.so
libtool: install: (cd /home/davcra/lib && { ln -s -f libgeos-3.3.1.so
libgeos.so || { rm -f libgeos.so && ln -s libgeos-3.3.1.so libgeos.so;
}; })
libtool: install: /usr/bin/install -c .libs/libgeos.lai
/home/davcra/lib/libgeos.la
libtool: install: /usr/bin/install -c .libs/libgeos.a /home/davcra/lib/libgeos.a
libtool: install: chmod 644 /home/davcra/lib/libgeos.a
libtool: install: ranlib /home/davcra/lib/libgeos.a
libtool: finish:
PATH="/usr/ncl_files/bin:/usr/ncl_files/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/davcra/.local/bin:/home/davcra/bin:/sbin"
ldconfig -n /home/davcra/lib
--
Libraries have been installed in:
/home/davcra/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
--
make[3]: Nothing to be done for `install-data-am'.
make[3]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/src'
make[2]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/src'
make[1]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/src'
Making install in capi
make[1]: Entering directory `/home/davcra/basemap-1.0.2/geos-3.3.1/capi'
make[2]: Entering directory `/home/davcra/basemap-1.0.2/geos-3.3.1/capi'
test -z "/home/davcra/lib" || /bin/mkdir -p "/home/davcra/lib"
/bin/sh ../libtool --mode=install /usr/bin/install -c
libgeos_c.la '/home/davcra/lib'
libtool: install: warning: relinking `libgeos_c.la'
libtool: install: (cd /home/davcra/basemap-1.0.2/geos-3.3.1/capi;
/bin/sh /home/davcra/basemap-1.0.2/geos-3.3.1/libtool --tag CXX
--mode=relink g++ -DGEOS_INLINE -pedantic -Wall -ansi -Wno-long-long
-ffloat-store -g -O2 -version-info 8:1:7 -no-undefined -o libgeos_c.la
-rpath /home/davcra/lib libgeos_c_la-geos_c.lo
libgeos_c_la-geos_ts_c.lo ../src/libgeos.la )
mv: cannot move `libgeos_c.so.1.7.1' to `libgeos_c.so.1.7.1U': Permission denied
libtool: install: error: relink `libgeos_c.la' with the above command
before installing it
make[2]: *** [install-libLTLIBRARIES] Error 1
make[2]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/capi'
make[1]: *** [install-am] Error 2
make[1]: Leaving directory `/home/davcra/basemap-1.0.2/geos-3.3.1/capi'
make: *** [install-recursive] Error 1
any ideas??
thanks
D
On 3/31/12 5:48 AM, David Craig wrote:
> Hi, I previously installed basemap by using the yum command. This
> installed version 0.99.4. I want to install the latest version so I
> can use shaded relief etc. This may be more of a linux problem but as
> I am more familiar with python than linux I thought someone here may
> be able to help.
> Following the website instructions
> (http://matplotlib.github.com/basemap/users/installing.html) I
> downloaded the latest version and untarred it. Then in the basemap
> directory (which contains geos-3.2.0) I try to set the environment
> variable GEOS_DIR to point to the location of libgeos_c and geos_c.h.
> I use the find command to locate the files,
> /find / -name geos_c.h/ returns the location of that file as
> //usr/lib/basemap-1.0.1/geos-3.2.0/capi/geos_c.h/
> and
> /find / -name libgeos*/
> returns
> //libgeos_c_la-geos_c.Plo
> /usr/lib/libgeos-3.3.1.so <http://libgeos-3.3.1.so>
> /usr/lib/libgeos_c.so.1.7.1
> /usr/lib/libgeos_c.so.1/
> so I set GEOS_DIR to /usr/lib(not sure if this is correct).
> I then cd to the basemap directory and run,
> python setup.py install
> [davcra@... basemap-1.0.1]$ sudo python setup.py install
> [sudo] password for davcra:
> checking for GEO
[Matplotlib-users] Problem using barbs function
Hi,
I'm having a problem using matplotlibs barbs function. I'm trying to
plot some wind barbs on a map created with basemap. My code is as follows,
m =
Basemap(llcrnrlon=-35.0,llcrnrlat=40.0,urcrnrlon=10.0,urcrnrlat=68.0,
resolution='i',projection='lcc',lon_0=-12.5,lat_0=54.0)
m.drawcoastlines()
m.bluemarble()
m.drawcoastlines()
# draw parallels
m.drawparallels(np.arange(40,68,5),labels=[1,0,0,0])
# draw meridians
m.drawmeridians(np.arange(-35, 10, 5),labels=[0,0,0,1])
x, y = m(lons, lats)
m.barbs(lons,lats,us,vs, barbcolor = 'r', flagcolor = 'r')
plt.show()
where x, y, us and vs are lists with shape (64,). I get the following error,
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', (382, 0))
---
ValueErrorTraceback (most recent
call last)
/home/davcra/python_scripts/plot_synops.py in ()
63 #m.plot(x,y,'ro', ms=5)
64 plt.suptitle(record['date'])
---> 65 m.barbs(x,y,us,vs, barbcolor = 'r', flagcolor = 'r')
66 #m.xlim(-35.0, 10.0)
67 #m.ylim(40.0, 68.0)
/usr/lib64/python2.6/site-packages/mpl_toolkits/basemap/__init__.pyc
in barbs(self, x, y, u, v, *args, **kwargs)
2924 retnh = ax.barbs(x,y,unh,vnh,*args,**kwargs)
2925 kwargs['flip_barb']=True
-> 2926 retsh = ax.barbs(x,y,ush,vsh,*args,**kwargs)
2927 try:
2928 plt.draw_if_interactive()
/usr/lib64/python2.6/site-packages/matplotlib/axes.pyc in
barbs(self, *args, **kw)
5888 """
5889 if not self._hold: self.cla()
-> 5890 b = mquiver.Barbs(self, *args, **kw)
5891 self.add_collection(b)
5892 self.update_datalim(b.get_offsets())
/usr/lib64/python2.6/site-packages/matplotlib/quiver.pyc in
__init__(self, ax, *args, **kw)
776 self.set_transform(transforms.IdentityTransform())
777
--> 778 self.set_UVC(u, v, c)
779
780 __init__.__doc__ = """
/usr/lib64/python2.6/site-packages/matplotlib/quiver.pyc in
set_UVC(self, U, V, C)
952
953 def set_UVC(self, U, V, C=None):
--> 954 self.u = ma.masked_invalid(U, copy=False).ravel()
955 self.v = ma.masked_invalid(V, copy=False).ravel()
956 if C is not None:
/usr/lib64/python2.6/site-packages/numpy/ma/core.pyc in
masked_invalid(a, copy)
1976 condition = ~(np.isfinite(a))
1977 if hasattr(a, '_mask'):
-> 1978 condition = mask_or(condition, a._mask)
1979 cls = type(a)
1980 else:
/usr/lib64/python2.6/site-packages/numpy/ma/core.pyc in mask_or(m1,
m2, copy, shrink)
1383 _recursive_mask_or(m1, m2, newmask)
1384 return newmask
-> 1385 return make_mask(umath.logical_or(m1, m2), copy=copy,
shrink=shrink)
1386
1387
/usr/lib64/python2.6/site-packages/numpy/ma/core.pyc in make_mask(m,
copy, shrink, flag, dtype)
1265 # We won't return after this point to make sure we
can shrink the mask
1266 # Fill the mask in case there are missing data
-> 1267 m = filled(m, True)
1268 # Make sure the input dtype is valid
1269 dtype = make_mask_descr(dtype)
/usr/lib64/python2.6/site-packages/numpy/ma/core.pyc in filled(a,
fill_value)
406 """
407 if hasattr(a, 'filled'):
--> 408 return a.filled(fill_value)
409 elif isinstance(a, ndarray):
410 # Should we check for contiguity ? and
a.flags['CONTIGUOUS']:
/usr/lib64/python2.6/site-packages/numpy/ma/core.pyc in filled(self,
fill_value)
2929 result = self._data.copy()
2930 try:
-> 2931 np.putmask(result, m, fill_value)
2932 except (TypeError, AttributeError):
2933 fill_value = narray(fill_value, dtype=object)
ValueError: putmask: mask and data must be the same size
WARNING: Failure executing file:
Anyone know whats going on here??
Thanks in advance,
D
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
[email protected]
https://lists.sourcefor
[Matplotlib-users] basemap and fill_between()
Hi, I'm having a problem usinf fill_between() with basemap. I plot two great circles and want to shade the region between them. My code is below, it doesnt give any error just creates the plot without filling the area. Does anyone know if it's possible to do this or should I try a different method? Thanks, David from mpl_toolkits.basemap import Basemap from pylab import * ### PARAMETERS FOR MATPLOTLIB : import matplotlib as mpl rcParams['font.size'] = 10. rcParams['font.family'] = 'Comic Sans MS' rcParams['axes.labelsize'] = 8. rcParams['xtick.labelsize'] = 6. rcParams['ytick.labelsize'] = 6. def shoot(lon, lat, azimuth, maxdist=None): """Shooter Function Original javascript on http://williams.best.vwh.net/gccalc.htm Translated to python by Thomas Lecocq """ glat1 = lat * pi / 180. glon1 = lon * pi / 180. s = maxdist / 1.852 faz = azimuth * pi / 180. EPS= 0.005 if ((abs(cos(glat1)) EPS): sy = sin(y) cy = cos(y) cz = cos(b + y) e = 2. * cz * cz - 1. c = y x = e * cy y = e + e - 1. y = (((sy * sy * 4. - 3.) * y * cz * d / 6. + x) * d / 4. - cz) * sy * d + tu b = cu * cy * cf - su * sy c = r * sqrt(sa * sa + b * b) d = su * cy + cu * sy * cf glat2 = (arctan2(d, c) + pi) % (2*pi) - pi c = cu * cy - su * sy * cf x = arctan2(sy * sf, c) c = ((-3. * c2a + 4.) * f + 4.) * c2a * f / 16. d = ((e * cy * c + cz) * sy * c + y) * sa glon2 = ((glon1 + x - (1. - c) * d * f + pi) % (2*pi)) - pi baz = (arctan2(sa, b) + pi) % (2 * pi) glon2 *= 180./pi glat2 *= 180./pi baz *= 180./pi return (glon2, glat2, baz) #Create a basemap around N. Atlantic m = Basemap(llcrnrlon=-45.0,llcrnrlat=30.0,urcrnrlon=15.0,urcrnrlat=75.0, resolution='i',projection='merc',lon_0=-17.5,lat_0=60.0) m.drawcountries(linewidth=0.5) m.drawcoastlines(linewidth=0.5) m.bluemarble() m.drawparallels(arange(40.,75.,10.),labels=[1,0,0,0],color='black',dashes=[1,0],labelstyle='+/-',linewidth=0.2) # draw parallels m.drawmeridians(arange(-45.,15.,10.),labels=[0,0,0,1],color='black',dashes=[1,0],labelstyle='+/-',linewidth=0.2) # draw meridians # Shade region defined by great circles. x1, y1 = -9.1676613, 51.602 az1 = 270. az2 = 290. maxdist = 2000 x2, y2, baz = shoot(x1, y1, az1, maxdist) x3, y3, baz = shoot(x1, y1, az2, maxdist) m.drawgreatcircle(x1, y1, x2, y2, del_s=10, color='gray', lw=1.) m.drawgreatcircle(x1, y1, x3, y3, del_s=10, color='gray', lw=1.) a=linspace(x3,x1) b=linspace(y2,y1) c=linspace(y3,y1) fill_between(a, b, c, where=None, alpha=0.2) show() -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] ginput with undefined number of points
Hi, I trying to define an area in a pcolor plot (several plots) using the ginput(). However since it is an irregular shape and will be different in each plot so I cant define how many points there will be before hand, I've tried the following but it requires a double click at each point, which I would like to avoid as it duplicates points |x = randn(10,10) imshow(x) button = False points = [] while button == False: points.append(ginput(1)) button = waitforbuttonpress() | Anyone know a better way to go about this?? thanks Dave -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] histogran2d and polar axis
Hi, This one has been driving me crazy all day. I have three vectors, azimuth, frequency and power, which I would like to histogram and plot on a polar axis. I can plot a scatter plot this way no problem but the histogram gets messed up somehow. An example is below, anybody know how to do this properly?? import random import numpy as np import matplotlib.pyplot as plt baz = np.zeros((20)) freq = np.zeros((20)) pwr = np.zeros((20)) for x in range(20): baz[x] = random.randint(20,25)*10 freq[x] = random.randint(1,10)*10 pwr[x] = random.randint(-10,-1)*10 baz = baz*np.pi/180. abins = np.linspace(0,2*np.pi,360) sbins = np.linspace(1, 100) H, xedges, yedges = np.histogram2d(baz, freq, bins=(abins,sbins), weights=pwr) plt.figure(figsize=(14,14)) plt.subplot(111, polar=True) #plt.scatter(baz, freq, c=pwr) plt.pcolormesh(H) plt.show() -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Fwd:
http://smallshop.lt/gbwpmas.php -- Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122912 ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Matplotlib 0.99.3 win32 py2.6 crashes on import
I just installed matplotlib-0.99.3.win32-py2.6.exe on this Win2000 PC. When I try: from matplotlib import pyplot as plt it crashes Python with an apparent NULL-pointer reference. If I run python -v then it crashes just after: # c:\python26\lib\site-packages\matplotlib\transforms.pyc matches c:\python26\li b\site-packages\matplotlib\transforms.py import matplotlib.transforms # precompiled from c:\python26\lib\site-packages\ma tplotlib\transforms.pyc matplotlib-0.99.1.win32-py2.6.exe worked fine on this PC. Regards, Craig McQueen -- ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib 0.99.3 win32 py2.6 crashes on import
Christoph Gohlke wrote: > > On 5/31/2010 1:53 AM, Craig McQueen wrote: >> I just installed matplotlib-0.99.3.win32-py2.6.exe on this Win2000 PC. >> When I try: >> from matplotlib import pyplot as plt >> >> it crashes Python with an apparent NULL-pointer reference. If I run >> python -v >> >> then it crashes just after: >> # c:\python26\lib\site-packages\matplotlib\transforms.pyc matches >> c:\python26\li >> b\site-packages\matplotlib\transforms.py >> import matplotlib.transforms # precompiled from >> c:\python26\lib\site-packages\ma >> tplotlib\transforms.pyc >> >> matplotlib-0.99.1.win32-py2.6.exe worked fine on this PC. >> >> Regards, >> Craig McQueen > > > I can not reproduce the crash in a Virtual Machine with Windows 2000 > SP4, Python 2.6.5, numpy 1.4.1, and matplotlib 0.99.3. > > Exactly which versions are you using, and how did you install Python > (for all users?). What is your CPU? > > matplotlib-0.99.3.win32-py2.6 was built against numpy 1.4.1, libpng > 1.4.2 and zlib 1.2.5, while matplotlib-0.99.1.win32-py2.6 was built > against numpy 1.3.0, libpng 1.2.3x, and zlib 1.2.3. > > Christoph > Ah--installing numpy 1.4.1 fixed the issue. I had numpy 1.3.0 installed before that. Thanks for such a helpful response. I wasn't aware that matplotlib is "built against" a particular version of numpy (not quite sure what that means either, unless numpy provides a direct C API as well as the Python API; please excuse my ignorance). (To answer your questions in case that's still useful somehow... I'm using Windows 2000 SP4, Python 2.6.5, on a Pentium 4 PC. I installed Python for all users.) Thanks and regards, Craig McQueen -- ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Memory Usage
Hi all, I am using matplotlib to create a static graph from a few fairly large data sets. (Over 500,000 samples) I know you can pull out datasets of an axes by using the functions get_xdata() and get_ydata(), which leads me to wonder how matplotlib handles large data sets? Does it keep the entire data sets stored in memory? The application I am trying develop I hope to be able to run on low end PC's with little RAM. If data sets are indeed stored in RAM, is there a way to discard the plot data after a plot had been created to leave just a static image? Or, read and store data points directly from a file? Thanks for your help. Craig -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Problem with GTK backends after compiling matplotlib
I successfully built Python 2.7.2, NumPy 1.61, and Scipy 0.9.0 in my home directory on a Centos5 system. I am trying to build matplotlib 1.0.1 in my home directory, but I am having a problem with the GTK backends. I also built pycairo 1.2.2, pygobject 2.14.2, and pygtk 2.10.6 in my home directory (using the libraries and headers installed in the default system locations). I downloaded a few pygtk examples from the tutorial section of their web site and ran them to verify that pygtk works correctly. Here is the error I get when I run a script that contains only the line "import matplotlib.pyplot": python2.7 test.py --verbose-helpful $HOME=/home/cfinch CONFIGDIR=/home/cfinch/.matplotlib matplotlib data path /home/cfinch/.local/lib/python2.7/site-packages/matplotlib/mpl-data loaded rc file /home/cfinch/.local/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc matplotlib version 1.0.1 verbose.level helpful interactive is False units is False platform is linux2 Using fontManager instance from /home/cfinch/.matplotlib/fontList.cache Traceback (most recent call last): File "test.py", line 1, in import matplotlib.pyplot File "/home/cfinch/.local/lib/python2.7/site-packages/matplotlib/pyplot.py", line 95, in new_figure_manager, draw_if_interactive, show = pylab_setup() File "/home/cfinch/.local/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 25, in pylab_setup globals(),locals(),[backend_name]) File "/home/cfinch/.local/lib/python2.7/site-packages/matplotlib/backends/backend_gtkagg.py", line 10, in from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\ File "/home/cfinch/.local/lib/python2.7/site-packages/matplotlib/backends/backend_gtk.py", line 28, in from matplotlib.backends.backend_gdk import RendererGDK, FigureCanvasGDK File "/home/cfinch/.local/lib/python2.7/site-packages/matplotlib/backends/backend_gdk.py", line 29, in from matplotlib.backends._backend_gdk import pixbuf_get_pixels_array ImportError: No module named _backend_gdk Here is the beginning of my matplotlib build log, which shows that the build process is actually finding the GTK libraries: basedirlist is: ['/home/cfinch'] BUILDING MATPLOTLIB matplotlib: 1.0.1 python: 2.7.2 (default, Aug 30 2011, 12:57:00) [GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] platform: linux2 REQUIRED DEPENDENCIES numpy: 1.6.1 freetype2: 9.10.3 * WARNING: Could not find 'freetype2' headers in any * of '/home/cfinch/include', '.', * '/usr/include/freetype2'. OPTIONAL BACKEND DEPENDENCIES libpng: 1.2.10 Tkinter: no * TKAgg requires Tkinter wxPython: no * wxPython not found Gtk+: gtk+: 2.10.4, glib: 2.12.3, pygtk: 2.10.6, pygobject: 2.14.2 Mac OS X native: no Qt: no Qt4: no Cairo: 1.2.2 OPTIONAL DATE/TIMEZONE DEPENDENCIES datetime: present, version unknown dateutil: 1.5 pytz: 2010o OPTIONAL USETEX DEPENDENCIES dvipng: 1.5 ghostscript: 8.70 latex: 3.141592 pdftops: 3.00 SNIP --- There are no errors in the build or install logs, but I can post the rest of it if necessary. Also, the library _backend_gdk.so is present in ~/lib/python2.7/site-packages/matplotlib/backends/. Any suggestions would be appreciated! -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free "Love Thy Logs" t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Problem with GTK backends after compiling matplotlib
I corrected the problem with the FreeType2 header file and rebuilt matplotlib from scratch, but I'm getting the same error. Centos5 puts the file ft2build.h in /usr/lib but matplotlib looks for it in /usr/lib/freetype2. I used this command: PKG_CONFIG_PATH=/home/cfinch/lib/pkgconfig python2.7 setup.py build &> build_log.txt and got this output: basedirlist is: ['/home/cfinch'] BUILDING MATPLOTLIB matplotlib: 1.0.1 python: 2.7.2 (default, Aug 30 2011, 12:57:00) [GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] platform: linux2 REQUIRED DEPENDENCIES numpy: 1.6.1 freetype2: 9.10.3 OPTIONAL BACKEND DEPENDENCIES libpng: 1.2.10 Tkinter: no * TKAgg requires Tkinter wxPython: no * wxPython not found Gtk+: gtk+: 2.10.4, glib: 2.12.3, pygtk: 2.10.6, pygobject: 2.14.2 Mac OS X native: no Qt: no Qt4: no Cairo: 1.2.2 OPTIONAL DATE/TIMEZONE DEPENDENCIES datetime: present, version unknown dateutil: 1.5 pytz: 2010o OPTIONAL USETEX DEPENDENCIES dvipng: 1.5 ghostscript: 8.70 latex: 3.141592 pdftops: 3.00 [Edit setup.cfg to suppress the above messages] pymods ['pylab'] packages ['matplotlib', 'matplotlib.backends', 'matplotlib.backends.qt4_editor', 'matplotlib.projections', 'matplotlib.testing', 'matplotlib.testing.jpl_units', 'matplotlib.tests', 'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.axes_grid', 'mpl_toolkits.axes_grid1', 'mpl_toolkits.axisartist', 'matplotlib.sphinxext', 'matplotlib.numerix', 'matplotlib.numerix.mlab', 'matplotlib.numerix.ma', 'matplotlib.numerix.linear_algebra', 'matplotlib.numerix.random_array', 'matplotlib.numerix.fft', 'matplotlib.tri', 'matplotlib.delaunay'] running install running build running build_py ... There are no errors in the rest of the build or install logs. Further, I rebuild pycairo, pygtk, and matplotlib just to make sure one of them wasn't missing a freetype dependency. Unfortunately, I am still getting exactly the same error as before. Any other suggestions? Craig ____ From: Eric Firing To: [email protected] Sent: Tuesday, August 30, 2011 6:19 PM Subject: Re: [Matplotlib-users] Problem with GTK backends after compiling matplotlib On 08/30/2011 12:14 PM, Craig Finch wrote: > I successfully built Python 2.7.2, NumPy 1.61, and Scipy 0.9.0 in my > home directory on a Centos5 system. I am trying to build matplotlib > 1.0.1 in my home directory, but I am having a problem with the GTK > backends. I also built pycairo 1.2.2, pygobject 2.14.2, and pygtk 2.10.6 > in my home directory (using the libraries and headers installed in the > default system locations). I downloaded a few pygtk examples from the > tutorial section of their web site and ran them to verify that pygtk > works correctly. > > Here is the error I get when I run a script that contains only the line > "import matplotlib.pyplot": > > python2.7 test.py --verbose-helpful > $HOME=/home/cfinch > CONFIGDIR=/home/cfinch/.matplotlib > matplotlib data path > /home/cfinch/.local/lib/python2.7/site-packages/matplotlib/mpl-data > loaded rc file > /home/cfinch/.local/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc > matplotlib version 1.0.1 > verbose.level helpful > interactive is False > units is False > platform is linux2 > Using fontManager instance from /home/cfinch/.matplotlib/fontList.cache > Traceback (most recent call last): > File "test.py", line 1, in > import matplotlib.pyplot > File > "/home/cfinch/.local/lib/python2.7/site-packages/matplotlib/pyplot.py", > line 95, in > new_figure_manager, draw_if_interactive, show = pylab_setup() > File > "/home/cfinch/.local/lib/python2.7/site-packages/matplotlib/backends/__init__.py", > line 25, in pylab_setup > globals(),locals(),[backend_name]) > File > "/home/cfinch/.local/lib/python2.7/site-packages/matplotlib/backends/backend_gtkagg.py", > line 10, in > from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, > FigureCanvasGTK,\ > File > "/home/cfinch/.local/lib/python2.7/site-packages/matplotlib/bac
Re: [Matplotlib-users] Problem with GTK backends after compiling matplotlib
I figured it out! I accidentally did something weird. When I built NumPy and SciPy, I used the --user option to tell distutils to build them in my home directory. I had not realized that --user installs the packages in ~/.local/lib/python2.7/site-packages/. I was assuming they would be installed in ~/lib/python2.7/site-packages, but I didn't notice they were "missing" until just now. When I reinstalled NumPy and Scipy using the option --prefix=/home/cfinch and then rebuilt matplotlib, everything started working. I didn't have to rebuild pycairo or pygtk; I just had to get everything in the same location. This is the first I've heard of installing anything in a .local directory...why is that even an option??? Thanks for your help! ____ From: Craig Finch To: Eric Firing ; "[email protected]" Sent: Wednesday, August 31, 2011 4:31 PM Subject: Re: [Matplotlib-users] Problem with GTK backends after compiling matplotlib I corrected the problem with the FreeType2 header file and rebuilt matplotlib from scratch, but I'm getting the same error. Centos5 puts the file ft2build.h in /usr/lib but matplotlib looks for it in /usr/lib/freetype2. I used this command: PKG_CONFIG_PATH=/home/cfinch/lib/pkgconfig python2.7 setup.py build &> build_log.txt and got this output: basedirlist is: ['/home/cfinch'] BUILDING MATPLOTLIB matplotlib: 1.0.1 python: 2.7.2 (default, Aug 30 2011, 12:57:00) [GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] platform: linux2 REQUIRED DEPENDENCIES numpy: 1.6.1 freetype2: 9.10.3 OPTIONAL BACKEND DEPENDENCIES libpng: 1.2.10 Tkinter: no * TKAgg requires Tkinter wxPython: no * wxPython not found Gtk+: gtk+: 2.10.4, glib: 2.12.3, pygtk: 2.10.6, pygobject: 2.14.2 Mac OS X native: no Qt: no Qt4: no Cairo: 1.2.2 OPTIONAL DATE/TIMEZONE DEPENDENCIES datetime: present, version unknown dateutil: 1.5 pytz: 2010o OPTIONAL USETEX DEPENDENCIES dvipng: 1.5 ghostscript: 8.70 latex: 3.141592 pdftops: 3.00 [Edit setup.cfg to suppress the above messages] pymods ['pylab'] packages ['matplotlib', 'matplotlib.backends', 'matplotlib.backends.qt4_editor', 'matplotlib.projections', 'matplotlib.testing', 'matplotlib.testing.jpl_units', 'matplotlib.tests', 'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.axes_grid', 'mpl_toolkits.axes_grid1', 'mpl_toolkits.axisartist', 'matplotlib.sphinxext', 'matplotlib.numerix', 'matplotlib.numerix.mlab', 'matplotlib.numerix.ma', 'matplotlib.numerix.linear_algebra', 'matplotlib.numerix.random_array', 'matplotlib.numerix.fft', 'matplotlib.tri', 'matplotlib.delaunay'] running install running build running build_py ... There are no errors in the rest of the build or install logs. Further, I rebuild pycairo, pygtk, and matplotlib just to make sure one of them wasn't missing a freetype dependency. Unfortunately, I am still getting exactly the same error as before. Any other suggestions? Craig From: Eric Firing To: [email protected] Sent: Tuesday, August 30, 2011 6:19 PM Subject: Re: [Matplotlib-users] Problem with GTK backends after compiling matplotlib On 08/30/2011 12:14 PM, Craig Finch wrote: > I successfully built Python 2.7.2, NumPy 1.61, and Scipy 0.9.0 in my > home directory on a Centos5 system. I am trying to build matplotlib > 1.0.1 in my home directory, but I am having a problem with the GTK > backends. I also built pycairo 1.2.2, pygobject 2.14.2, and pygtk 2.10.6 > in my home directory (using the libraries and headers installed in the > default system locations). I downloaded a few pygtk examples from the > tutorial section of their web site and ran them to verify that pygtk > works correctly. > > Here is the error I get when I run a script that contains only the line > "import matplotlib.pyplot": > > python2.7 test.py --verbose-helpful > $HOME=/home/cfinch > CONFIGDIR=/home/cfinch/.matplotlib > matplotlib data path > /home/cfinch/.local/lib/python2.7/site-packages/matplotlib/mpl-data > loaded rc file > /home/cfinch/.local/lib/pyth
[Matplotlib-users] 1d weighted histogram with log y-axis not colored correctly
Hi folks,
Lately I've been working with some data that is too copious to fit in
memory, so I've had to write a wrapper for pyplot.hist that bins the data in
chunks and then draws it like so:
pyplot.hist(x_edges, bins=100, weights=bin_contents,
histtype='stepfilled', facecolor='g')
However, when I try to set the histogram's y-scale to logarithmic the
colors get all messed up (see attached). Any ideas? This is w/ matplotlib
0.99.0.
Thanks in advance.
--cb
# Example script
import numpy as
np
import matplotlib.pyplot as
plt
# generate some data on
log-scale
x =
10**np.random.uniform(size=1)
# bin the data myself
bins, xed = np.histogram(x, bins=100, range=(0,
10))
# plot the data as a weighted histo
plt.hist(np.linspace(0, 10, 100), bins=100, weights=bins,
histtype='stepfilled',
facecolor='g')
plt.yscale('log')
plt.savefig("test.png")
plt.clf()
<>--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Closing matplotlib window in osx
HI, im running the latest version of matplotlib on osX. I write my script and execute it in iterm with python script.py and it works great. However matplotlib window doesn't close on a keyboard interrupt, only closing once the matplotlib window is selected again. A minor inconvenience, but one that adds precious seconds to each dev. cycle. Any suggestions on how to fix this? Craig Stewart PhD Research Student Negotiated Interaction Department of Computing Science University of Glasgow Glasgow G128QQ Scotland, UK -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] use legend's 'best' location for a text box
Hi, I'm drawing a histogram and I would like to place a text box within the axes that shows the number of events. I like the way I can pass "loc='best'" to pyplot.legend() and it automatically does its best to avoid my data. Is there any way to replicate this for a simple call to pyplot.text(), like so: ax.text(0.05, 0.95, 'Entries: ' + len(myData), transform=ax.transAxes, fontsize=14, verticalalignment='top', bbox=dict(boxstyle='square', facecolor='white')) Thanks in advance! --craig -- Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] trouble with show() not drawing in interactive mode w/ WxAgg
So I rebuilt Python so that I would have Tkinter support, and using TkAgg I get the behavior I want, so it's not mission critical to me to figure this out anymore. But if anyone is interested in tracking it down I will be glad to help. On Wed, Sep 26, 2012 at 8:06 AM, Craig the Demolishor wrote: > Hi all, > I've been having some trouble getting interactive mode to work > correctly with the WxAgg backend. I have these versions: > > [craigb@xx hists]$ python > Python 2.7.3 (default, Aug 13 2012, 16:13:38) > [GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. >>>> import matplotlib >>>> matplotlib.__version__ > '1.1.1rc' >>>> import wx >>>> wx.__version__ > '2.8.12.1' >>>> > > > When I do something like this, > >>>> from matplotlib import pyplot >>>> import numpy >>>> pyplot.plot(numpy.arange(10), numpy.arange(10), 'r.') > [] >>>> pyplot.show() > > I get a good-looking window with my plot. I can mouse over the window > and get coordinates, there are buttons on the bottom of the window > that I can push, etc. However, if I turn on interactive mode (I read > somewhere that it's bad to turn on interactive mode after you've > already made a plot, so below I've exited and started a new > interactive session), > >>>> from matplotlib import pyplot >>>> import numpy >>>> pyplot.ion() >>>> pyplot.plot(numpy.arange(10), numpy.arange(10), 'r.') > [] > > Nothing shows at this point. If I continue, > >>>> pyplot.show() > > Still nothing shows. If I exit right now, I get a brief glimpse of my > plot before python exits completely. I can get the plot to show by > doing > >>>> pyplot.draw() > > But it's only the top half of the plot, and if I drag another window > on top of it, it doesn't automatically redraw. No buttons, no > mouse-over niceness. Issuing pyplot.draw() again gets me the full > plot, but no mouse-overs, no buttons, and no redraw. > > Both MPL and wxPython were built from source on a RHEL5.8 machine, so > maybe it's the libraries I am linking against...? Anyway, I've > attached two screenshots of what my plots look like when they finally > are drawn. Many many thanks in advance! > > --cb -- How fast is your code? 3 out of 4 devs don\\\'t know how their code performs in production. Find out how slow your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219672;13503038;z? http://info.appdynamics.com/FreeJavaPerformanceDownload.html ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Sphinx plot extension source/build directory issues
Hello, I'm trying to use the matplotlib Sphinx plot extension to add some diagrams to Sphinx documentation. However, I've come across a couple of issues. First, my Sphinx documentation uses the "separate directories for source and build" option. It seems that matplotlib doesn't work well with this option, because: 1) I think the "pyplot" directory should be under the "source" directory. But I had to put it one level up from the "source" directory otherwise it wouldn't be found. 2) When I try to build, I get error messages such as: /home/craig-nat/MySoftware/cobs-python/doc/source/index.rst:: WARNING: image file not readable: build/pyplots/cobsr_overhead.png It should be "../build/pyplots/cobsr_overhead.png" instead I think. Secondly, on Windows, it generates the plots and creates links to the images. However, the image filename gets any spaces stripped out of it, so Sphinx can't locate the images. On further investigation I'm pretty sure that the problem is with Sphinx itself, not the matplotlib extension--the problem happens even if I just add a ".. image::" in Sphinx. I thought I should at least mention it here in case anyone else is coming across the same issue. I'll plan to report it to the Sphinx developers. Regards, Craig McQueen -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
