Re: [Matplotlib-users] Permission error after installing MPL 1.0 on Mac
Jeremy Conlin writes: > > I recently installed MPL on two Macs, one running 10.6 and another > running 10.5. When I try to plot, I get the following error: > > TclError: couldn't open > "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ site-packages/matplotlib/mpl-data/images/home.ppm": > permission denied > > After checking, it's true that only the owner has read permissions. > This is easy enough on my end, but I wonder if there is a problem with > the distributed installer that should have the correct permissions for > these images. > > Has anyone else seen this problem or is it just me? > > Jeremy > I'm having the exact same problem. I recently installed python 2.6 on 2 different macs, one using OS X 10.5 and one using 10.6. One is a powerPC and one's intel, but I get the same error. -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Composing image from hex tiles using RegularPolyCollection
Hi all, I will explain what I’m trying to achieve first, then the approaches I’ve attempted so far, with results. I have data on a 2D grid which I want to present as an image — a la pyplot.imshow() — except that the grid is hexagonal, not rectangular. The grid can be represented in multiple ways, I use a regular 2D array with the convention that the lower left hex is (0,0), x increases to the right (crossing vertical hex boundaries) and y increases upwards slanting to the right. Ideally, I’d also be able to have a colorbar. I’m giving my routines three input vectors: x, y and c. X and y are initially integers, then transformed to centerpoint coordinates using x, y = x+.5*y, y*np.cos(np.pi/6) while c is used to look up values in a colormap. I first tried to adapt ‘scatter_demo2.py’ to my needs. Unfortunately, the pyplot.scatter routine fails when given ‘c’ or ’s’ keywords, as has been reported elsewhere by somebody else: http://stackoverflow.com/questions/20524888/attributeerror-numpy-ndarray-object-has-no-attribute-get-matrix I’ve dug around in the code for a bit without finding out how this arises. It seems to me it has to do with how transforms are being handed around and at what point their representation is changed from objects to pure matrices. This backend appears to expect to see objects only, but is handed matrices instead. I’ve hacked my way around that one in backends/backend_macosx.py by changing lines around 79-80 from master_transform = master_transform.get_matrix() all_transforms = [t.get_matrix() for t in all_transforms] to try: master_transform = master_transform.get_matrix() except AttributeError: pass try: all_transforms = [t.get_matrix() for t in all_transforms] except AttributeError: pass (which is a dirty hack, but I don’t know how to do it right) Now I can run the scatter_demo2 script, and I can obviously have it produce hexes at uniform size, but the size of the hexagons are set independently of the axes. Good for symbols used to mark arbitrary coordinates, not so good when I try to cover the plane without gaps. Next, I’ve tried creating the patches one by one, essentially this: r = 1./np.sqrt(3) for xy, cc in zip(zip(x, y), c): hexp = mpl.patches.RegularPolygon(xy, 6, radius=r, facecolor=cc, edgecolor=’none') ax.add_patch(hexp) ax.autoscale_view() ax.figure.canvas.draw() This works as I want it to, but becomes unbearably slow when the number of hexes grows beyond a few thousand. Given that RegularPolygon can do the trick, it seems likely that RegularPolyCollection should also be able to? This is what I tried: ax = gca() collection = RegularPolyCollection( 6, # a pentagon rotation=(np.pi/7,), sizes=(.5/np.sqrt(3),), facecolors = cc, edgecolors = None, linewidths = (1,), offsets = zip(xx,yy), transOffset = ax.transData, ) #collection.set_transform(ax.transData) ax.add_collection(collection, autolim=True) ax.autoscale_view() ax.figure.canvas.draw() This produces dots of minute sizes at the desired coordinates. I can tweak the size to make them bigger, but they don’t scale with the axes, as for the scatter_demo script used initially. Digging in the docs, I found a reference to the set_transform() method of Artists, so I tried setting that to ax.transData (the line commented out in the above snippet), and voila! I have hexagons covering the plane again. Strangely enough, they’re not in the right place anymore (and the locations change when zooming in or out), the sizes aren’t _quite_ right, the autoscaling of axes appear to believe the patches are where I wanted them to be, not where they appear on the plot, results are very different if saving to a figure instead of drawing to a figure window, etc. Is there a way I can make RegularPolyCollection patches transform with axes coordinates in the same way that RegularPolygon patches do? Am I barking up the wrong tree, is there another, blindingly obvious, way I should be doing this? The observant reader will also notice the strange rotation keyword given to RegularPolyCollection. This keyword is ignored in the macosx backend, and I have been unable to find out why. Thank you for all tips and pointers --Tom Grydeland -- Start Your Social Network Today - Download eXo Platform Build your Enterprise Intranet with eXo Platform Software Java Based Open Source Intranet - Social, Extensible, Cloud Ready Get Started Now And Turn Your Intranet Into A Collaboration Platform http://p.sf.net/sfu/ExoPlatform ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] zoom a plot
Thank you for your quick answer. I understand the performance issue you mentioned. For now it is only a proof of concept. I just figured out how to do it in theory by using figure.subplot.left|right|bottom|top plus a few other settings. I'll certainly look at the webagg backend. Are there any examples available? -- View this message in context: http://matplotlib.1069221.n5.nabble.com/zoom-a-plot-tp43952p43954.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Want excitement? Manually upgrade your production database. When you want reliability, choose Perforce Perforce version control. Predictably reliable. http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] [Ann] Early-bird registration extended for EuroSciPy 2015
Head over to https://www.euroscipy.org/2015/ for more information. -- Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] dynamically add subplots to figure
On Tue, Jun 2, 2009 at 07:33, John Hunter wrote: > On Tue, Jun 2, 2009 at 9:03 AM, Tom Vaughan wrote: >> Is it possible to add subplots to a figure if I don't know in advance >> how many subplots I need to add? >> >> What I do now is I call add_subplot like add_subplot(i, 1, i) where i >> is 1 initially, and just increases by 1 on each call. This almost >> works. Except the first plot takes up the whole figure, the second >> plot is placed on top of the bottom half of the first plot, etc. Is >> there a way to "resize" the plots when a subplot is added? Or how >> would I "re-plot" the previous subplots? > > See the Axes.change_geometry command > > http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.SubplotBase.change_geometry twinx() does not return an axes that contains the change_geometry method. How then can I do the equivalent on this axes? Calling twinx() again on the original axes after change_geometry() has been called does not do the trick. Thanks. -Tom -- Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] pylab
Sebastian Haase-3 wrote: > > Thanks for the info -- very informative -- maybe this post could be > somehow added or linked to from http://www.scipy.org/PyLab > > -- Sebastian Haase > Sebastian - I've done as you suggest... I added a link to this post on nabble - do you think there is a better URL for it than http://www.nabble.com/pylab-td24910613.html ? -- View this message in context: http://www.nabble.com/pylab-tp24910613p24914380.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] dynamically add subplots to figure
Great. That worked. Thanks! -Tom On Thu, Jul 16, 2009 at 11:23, Jae-Joon Lee wrote: > One work around is to call > > self.figure.subplots_adjust() > > after geometry changed. After this call, the twinx-ed axes will have > the same axes position as the original one. > > Another option is to use mpl_toolkits.axes_grid > (http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#parasiteaxes). > But the previous solution seems to be much easier for you. > Regards, > > -JJ > > > On Thu, Jul 16, 2009 at 1:16 PM, Tom Vaughan wrote: >> On Tue, Jun 2, 2009 at 07:33, John Hunter wrote: >>> On Tue, Jun 2, 2009 at 9:03 AM, Tom Vaughan wrote: >>>> Is it possible to add subplots to a figure if I don't know in advance >>>> how many subplots I need to add? >>>> >>>> What I do now is I call add_subplot like add_subplot(i, 1, i) where i >>>> is 1 initially, and just increases by 1 on each call. This almost >>>> works. Except the first plot takes up the whole figure, the second >>>> plot is placed on top of the bottom half of the first plot, etc. Is >>>> there a way to "resize" the plots when a subplot is added? Or how >>>> would I "re-plot" the previous subplots? >>> >>> See the Axes.change_geometry command >>> >>> http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.SubplotBase.change_geometry >> >> twinx() does not return an axes that contains the change_geometry >> method. How then can I do the equivalent on this axes? Calling twinx() >> again on the original axes after change_geometry() has been called >> does not do the trick. Thanks. >> >> -Tom >> >> -- >> Enter the BlackBerry Developer Challenge >> This is your chance to win up to $100,000 in prizes! For a limited time, >> vendors submitting new applications to BlackBerry App World(TM) will have >> the opportunity to enter the BlackBerry Developer Challenge. See full prize >> details at: http://p.sf.net/sfu/Challenge >> ___ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > -- Website: www.software6.net E-mail/Google Talk: tom (at) software6 (dot) net Mobile: +1 (310) 751-0187 -- 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Gridspy dashboard - Web based Matplotlib
Hi. I would like to introduce my usage of Matplotlib... " Gridspy provides you with an interactive view of resource usage in your building. It gives you hard data on your consumption patterns and helps you to make informed decisions. ... The Gridspy allows you to access and monitor your consumption patterns in real-time using a standard web browser on your PC, laptop or mobile phone. The data is presented in high resolution and updated each second as you watch. The moment a light is turned on in your house, you can see the change on your Gridspy dashboard from across the room or across the planet. " We use Matplotlib to prepare graphs in PNG format that form an essential part of our dashboard here (it loads nice and fast, trust me): http://your.gridspy.co.nz/powertech/ The blog discusses our Python Twisted backend, and other stuff: http://blog.gridspy.co.nz/ Finally you can follow my progress as I take this product to market on twitter: http://www.twitter.com/gridspy/ It has been a fantastic system to work with, and it was easy to generate beautiful and meaningful graphs. Thanks to everyone who has made this possible! What is everyone else working on? -Tom -- 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] How to make little sparklines
Hi
I was asked off list how I created the little sparklines using Matplotlib.
There are two ways I create these:
The live graphs on the demo page (http://your.gridspy.co.nz/powertech/)
are created by a great little jquery app (so yeah, not matplotlib):
http://omnipotent.net/jquery.sparkline/
To get the data to the browser in order to render the sparkline, you
will need some sort of mechanism similar to Ajax (or at least a form of
it) called Comet. There is a great tutorial on using orbited for this here
http://cometdaily.com/2008/10/10/scalable-real-time-web-architecture-part-2-a-live-graph-with-orbited-morbidq-and-jsio/
If any of you need more help doing that, I am happy to provide some
source code examples.
If instead, you want to create static line graphs using matplotlib such
as those on this page:
http://your.gridspy.co.nz/powertech/history/04Nov2009.htm
http://your.gridspy.co.nz/powertech/graph/tiny/3-3-04Nov2009.png?c=2 (an
example)
To render static sparklines I use the following matplot lib code:
def render_simple_line(sensors, resolution = 'hour', span = 1,
start=None, end=None, fig=None, column=0):
"""Builds a figure that shows the given sensors at the given
resolution and span in the given time period.
"""
if fig is None:
fig=Figure()
fig.set_facecolor('white')
fig.set_edgecolor('white')
axes = fig.add_axes([0.00,0.00,1.0,1.0], axisbg='w', frame_on=False)
axes.set_xticks([])
axes.set_yticks([])
axes.set_axis_off()
if start is None:
start = datetime.datetime.now()
if end is None:
end = start + datetime.timedelta(days=1)
first_date = start.strftime('%Y-%m-%d')
last_date = end.strftime('%Y-%m-%d')
desc = [("mean", pk) for pk in sensors]
np_table = data_table_matrix(desc, resolution, first_date,
last_date, span )
#note that np_table[0] is datetime objects and [1] is data
if np_table.size == 0:
return None
#replace nulls with 0
np_table[1:][np_table[1:] == np.array([None])] = 0
#replace -ve values
np_table[1:][np_table[1:] < np.array([0])] = 0
axes.xaxis.set_major_formatter(DateFormatter('%H'))
fig.autofmt_xdate()
base = np.zeros(np_table.shape[1])
color = color_list[column % len(color_list)][1]
axes.fill_between(np_table[0], base, np_table[column + 1], facecolor
= color)
return fig
I pass fig in so it is easy to pass a figure from the ipython console,
since ipython makes special figures that are interactive.
-Tom
PS: Dan - I replied to your email directly but it bounced.
--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] How to make little sparklines
Hi
I was asked off list how I created the little sparklines using Matplotlib.
There are two ways I create these:
The live graphs on the demo page (http://your.gridspy.co.nz/powertech/)
are created by a great little jquery app (so yeah, not matplotlib):
http://omnipotent.net/jquery.sparkline/
To get the data to the browser in order to render the sparkline, you
will need some sort of mechanism similar to Ajax (or at least a form of
it) called Comet. There is a great tutorial on using orbited for this here
http://cometdaily.com/2008/10/10/scalable-real-time-web-architecture-part-2-a-live-graph-with-orbited-morbidq-and-jsio/
If any of you need more help doing that, I am happy to provide some
source code examples.
If instead, you want to create static line graphs using matplotlib such
as those on this page:
http://your.gridspy.co.nz/powertech/history/04Nov2009.htm
http://your.gridspy.co.nz/powertech/graph/tiny/3-3-04Nov2009.png?c=2 (an
example)
To render static sparklines I use the following matplot lib code:
def render_simple_line(sensors, resolution = 'hour', span = 1,
start=None, end=None, fig=None, column=0):
"""Builds a figure that shows the given sensors at the given
resolution and span in the given time period.
"""
if fig is None:
fig=Figure()
fig.set_facecolor('white')
fig.set_edgecolor('white')
axes = fig.add_axes([0.00,0.00,1.0,1.0], axisbg='w', frame_on=False)
axes.set_xticks([])
axes.set_yticks([])
axes.set_axis_off()
if start is None:
start = datetime.datetime.now()
if end is None:
end = start + datetime.timedelta(days=1)
first_date = start.strftime('%Y-%m-%d')
last_date = end.strftime('%Y-%m-%d')
desc = [("mean", pk) for pk in sensors]
np_table = data_table_matrix(desc, resolution, first_date,
last_date, span )
#note that np_table[0] is datetime objects and [1] is data
if np_table.size == 0:
return None
#replace nulls with 0
np_table[1:][np_table[1:] == np.array([None])] = 0
#replace -ve values
np_table[1:][np_table[1:] < np.array([0])] = 0
axes.xaxis.set_major_formatter(DateFormatter('%H'))
fig.autofmt_xdate()
base = np.zeros(np_table.shape[1])
color = color_list[column % len(color_list)][1]
axes.fill_between(np_table[0], base, np_table[column + 1], facecolor
= color)
return fig
I pass fig in so it is easy to pass a figure from the ipython console,
since ipython makes special figures that are interactive.
-Tom
PS: Dan - I replied to your email directly but it bounced.
--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib slow compared to gnuplot?
It looks like you are storing your source data in a python list. Matplotlib runs much faster if you store your data using a numpy array instead. I'm no expert, but it certianly sped up my graph drawing. -Tom Message: 5 Date: Wed, 11 Nov 2009 08:53:58 -0600 From: Mike Anderson Subject: [Matplotlib-users] matplotlib slow compared to gnuplot? To: matplotlib-users@lists.sourceforge.net Message-ID: Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Hi all, Previously I was a user of gnuplot but have been giving matplotlib a try. One thing I've run in to right away is that matplotlib appears to be significantly slower. A script to produce a dozen plots was taking me ~1 second with gnuplot, and now takes me ~18 seconds with matplotlib. I'm curious if anyone knows how to speed things up. To figure out what is taking most of the time, I've used cProfile and pstats and below is the top 15 functions taking the most time. (note: "plotStackedJobsVsTime" is my function that uses matplotlib.) My script, for the curious, is at http://www.hep.wisc.edu/cms/comp/routerqMonitor/prodJobMonitorPlots_matplotlib.py and produces these plots: http://www.hep.wisc.edu/cms/comp/routerqMonitor/index.html Any hints at what I can do to speed up my script? Or is it out of my hands because it's all in matplotlib? Thanks for any help, Mike -- 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Incomplete rendering of line plot
I've run into a case where the rendering in a line plot is incomplete and some lines are not drawn at all. Basically I have a dataset (see below) where I know two points go to a value of zero. When I plot the points and do interactive pan/zoom sometimes the line going down to zero is there and sometimes not. After a bunch of playing around trying to reduce the problem to a minimum the script below is what I got. If I tried to make the 'y' array much smaller then the problem went away. I played with antialias and interactive settings with no benefit. Changing the window size can also produce the same effect I'm describing. Finally, when I use savefig to save in various formats the results varied, perhaps just a side-effect of the size of the saved figure. I'm using Matplotlib 0.99.1.1 built from source with the TkAgg backend on CentOS-5 with python 2.6. This same problem was also evident using GtkAgg and MacOSX backends so I don't think the details of my build are relevant (but I can supply if needed). Thanks, Tom import numpy import matplotlib.pyplot as plt y = numpy.array([ 4., 2., 2., 3., 3., 2., 2., 6., 6., 5., 5., 4., 4., 7., 7., 2., 2., 4., 4., 2., 2., 2., 2., 4., 4., 4., 4., 4., 4., 7., 7., 3., 3., 5., 5., 4., 4., 5., 5., 4., 4., 7., 7., 6., 6., 2., 2., 2., 2., 5., 5., 4., 4., 4., 4., 6., 6., 3., 3., 4., 4., 3., 3., 2., 2., 3., 3., 4., 4., 4., 4., 4., 4., 6., 6., 5., 5., 4., 4., 7., 7., 3., 3., 4., 4., 4., 4., 5., 5., 4., 4., 7., 7., 3., 3., 4., 4., 4., 4., 6., 6., 4., 4., 4., 4., 4., 4., 2., 2., 5., 5., 6., 6., 3., 3., 5., 5., 4., 4., 0., 0., 5., 5., 1., 1., 4., 4., 5., 5., 4.]) plt.figure() plt.plot(y) plt.figure() plt.plot(y) plt.xlim(-7200, 6500) # Does it go down to 0 now? -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Radar / Spider Chars
Hello all, Just a quick question which I can't seem to find an answer to on google or in the documentation. Is it possible to produce a Radar or Spider chart: http://en.wikipedia.org/wiki/Radar_chart with Matplotlib? I can see that you can produce polar plots, however the only references I can find to "radar" plots are the "radar" green colour in the examples file. Just wondering whether it was worth pursuing this technique or using a different method (if anyone knows of a python library that can do this I would appreciate it?) Kind regards, Tom - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Radar / Spider Chars
Hello all, Just a quick question which I can't seem to find an answer to on google or in the documentation. Is it possible to produce a Radar or Spider chart: http://en.wikipedia.org/wiki/Radar_chart with Matplotlib? I can see that you can produce polar plots, however the only references I can find to "radar" plots are the "radar" green colour in the examples file. Just wondering whether it was worth pursuing this technique or using a different method (if anyone knows of a python library that can do this I would appreciate it?) Kind regards, Tom - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [IPython-user] 'pause' in order to cycle though a bunch of plots
I've had the same problem. You can write a pause function using the python input() function but it hangs the GIL and as a result your window becomes unresponsive. If anyone knows a GIL friendly way to pause i would also be very interested. On Fri, Nov 14, 2008 at 1:12 PM, Benjamin J. Racine <[EMAIL PROTECTED]> wrote: > I use pause in matlab to cycle through an interactive do-loop and view a > bunch of plots in interactively... > > Don't bother reproducing it here, but I am just wondering if this is > possible in ipython/matplotlib > > Many thanks, > > Ben Racine > ___ > IPython-user mailing list > [EMAIL PROTECTED] > http://lists.ipython.scipy.org/mailman/listinfo/ipython-user > > - 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] fourier demo
Hi, I am cross-posting this from wxPython users list since the demo is an example wxPython app with embedded matplotlib objects. To the wxpython / matplotlib community: I wanted to share the enclosed "Fourier Demo" GUI, which is a reimplementation of one of the very first MATLAB GUIs that I worked on at MathWorks in 1993 (right when Handle Graphics was introduced in MATLAB 4). It presents you with two waveforms - a Fourier transform pair - and allows you to manipulate some parameters (via clicking the waveforms and dragging, and controls) and shows how the waveforms are related. I was very happy about how easily it came together and the performance of the resulting GUI. In particular the matplotlib events and interaction with wx is quite nice. The 'hitlist' of matplotlib figures is very convenient. Note this is some of my first wx GUI programming so if you see anything that could be handled with a better pattern / class / etc, I am very open to such suggestions! Sincerely, Tom K. http://www.nabble.com/file/p21407452/sigdemo.py sigdemo.py -- View this message in context: http://www.nabble.com/fourier-demo-tp21407452p21407452.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] FourierDemo now on wxPyWiki
After some positive feedback and subsequent discussion on the wxPython users list, I decided to add a wiki page for the Fourier Demo I posted earlier: http://wiki.wxpython.org/MatplotlibFourierDemo Robin, et. al., do you think this warrants moving up into a new category (e.g. RecipesMatplotlib) in the Recipes section? I added it in the RecipesOther but there are so many recipes there that it seems kind of buried. Best, Tom K. -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Help with simply plotting 2d array, please
LKeene wrote:
>
>
> - I have a numpy.ndarray of data with 350 rows and 500 columns. How do
> I display it in the upper-left hand corner of the frame client with no
> tick marks/labels, etc...just the colormap at screen
> coords(0,0)->(349,499) (rows,columns)? Could someone post a few lines
> to do this? Thanks so much in advance!
>
> -L
>
Hmm... interesting problem...
Here's a simple example where the image fills the frame - note the
properties such as xticks, yticks = [], position=[0,0,1,1], and the size of
the Frame itself... on my platform (Mac OS X) the height of the frame should
be 22 pixels more than the image (discovered by trial and error).
The border of the axes is still visible in black - obscuring the outer
pixels of the image - does anyone know how to shut that off?
import matplotlib
matplotlib.interactive(False)
matplotlib.use('WXAgg')
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
from matplotlib.figure import Figure
from matplotlib.pyplot import setp
import numpy as np
import wx
class MatplotlibFrame(wx.Frame):
def __init__(self, *args, **kwargs):
wx.Frame.__init__(self, *args, **kwargs)
self.figure = Figure()
print self.figure
self.canvas = FigureCanvasWxAgg(self, -1, self.figure)
self.subplot = self.figure.add_subplot(111)
#cdata = np.random.rand(351, 501)
cdata = np.zeros((351, 501))
cdata[::50, ::50] = 1
self.subplot.imshow(cdata, aspect='equal', interpolation='nearest')
setp(self.subplot, xticks=[], yticks=[], position=[0,0,1,1])
def repaint(self):
self.canvas.draw()
class App(wx.App):
def OnInit(self):
frame = MatplotlibFrame(parent=None, title="an image", size=(501,
351+22))
frame.Show()
return True
app = App()
app.MainLoop()
--
View this message in context:
http://www.nabble.com/Help-with-simply-plotting-2d-array%2C-please-tp22214482p22216497.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] dynamically add subplots to figure
Is it possible to add subplots to a figure if I don't know in advance how many subplots I need to add? What I do now is I call add_subplot like add_subplot(i, 1, i) where i is 1 initially, and just increases by 1 on each call. This almost works. Except the first plot takes up the whole figure, the second plot is placed on top of the bottom half of the first plot, etc. Is there a way to "resize" the plots when a subplot is added? Or how would I "re-plot" the previous subplots? Thanks. -Tom -- OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] dynamically add subplots to figure
On Tue, Jun 2, 2009 at 07:33, John Hunter wrote: > On Tue, Jun 2, 2009 at 9:03 AM, Tom Vaughan wrote: >> Is it possible to add subplots to a figure if I don't know in advance >> how many subplots I need to add? >> >> What I do now is I call add_subplot like add_subplot(i, 1, i) where i >> is 1 initially, and just increases by 1 on each call. This almost >> works. Except the first plot takes up the whole figure, the second >> plot is placed on top of the bottom half of the first plot, etc. Is >> there a way to "resize" the plots when a subplot is added? Or how >> would I "re-plot" the previous subplots? > > See the Axes.change_geometry command > > http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.SubplotBase.change_geometry > > As in this example:: > > import matplotlib.pyplot as plt > > # start with one > fig = plt.figure() > ax = fig.add_subplot(111) > ax.plot([1,2,3]) > > # now later you get a new subplot; change the geometry of the existing > n = len(fig.axes) > for i in range(n): > fig.axes[i].change_geometry(n+1, 1, i+1) Awesome. Thanks. Strangely this doesn't quite work for me. Luckily I keep a list of my subplots. So I do: def new_subplot(self): nsubplots = len(self.__subplots) + 1 for i, subplot in enumerate(self.__subplots): subplot.change_geometry(nsubplots, 1, i + 1) subplot = self.figure.add_subplot(nsubplots, 1, nsubplots) subplot.grid(True) self.__subplots.append(subplot) self.__subplot = subplot Interestingly, if I were to 'print dir(self.figure.axes[i])' I can see the change_geometry attribute, but when I attempt to call it, I am told "AttributeError: 'AxesSubplot' object has no attribute 'change_geomtry'" This lead me to what I have above. Thanks. -Tom -- OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] dynamically add subplots to figure
On Tue, Jun 2, 2009 at 08:40, John Hunter wrote: > On Tue, Jun 2, 2009 at 10:18 AM, Tom Vaughan wrote: > >> Interestingly, if I were to 'print dir(self.figure.axes[i])' I can see >> the change_geometry attribute, but when I attempt to call it, I am >> told "AttributeError: 'AxesSubplot' object has no attribute >> 'change_geomtry'" This lead me to what I have above. >> > > Check your spelling: 'change_geomtry' Whoops. Thanks. -Tom -- OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] dynamically add subplots to figure
On Tue, Jun 2, 2009 at 07:33, John Hunter wrote: > On Tue, Jun 2, 2009 at 9:03 AM, Tom Vaughan wrote: >> Is it possible to add subplots to a figure if I don't know in advance >> how many subplots I need to add? >> >> What I do now is I call add_subplot like add_subplot(i, 1, i) where i >> is 1 initially, and just increases by 1 on each call. This almost >> works. Except the first plot takes up the whole figure, the second >> plot is placed on top of the bottom half of the first plot, etc. Is >> there a way to "resize" the plots when a subplot is added? Or how >> would I "re-plot" the previous subplots? > > See the Axes.change_geometry command > > http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.SubplotBase.change_geometry To follow-up on this a bit, the second, third, etc subplots all seem to get stuck with the first subplot's x-axis. Let's say the first plot is -60 to 60, and the second plot is 2 - 4. The data in the second plot is plotted on the correct scale (2 to 4), but I still see -60 to 60. Actually, this isn't entirely correct. When I add a third subplot, the second subplot becomes correct. So the -60 to 60 only sticks to the most recently added subplot. Any ideas? Thanks. -Tom -- OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] dynamically add subplots to figure
On Tue, Jun 2, 2009 at 11:59, John Hunter wrote:
> On Tue, Jun 2, 2009 at 1:51 PM, Tom Vaughan wrote:
>> On Tue, Jun 2, 2009 at 07:33, John Hunter wrote:
>>> On Tue, Jun 2, 2009 at 9:03 AM, Tom Vaughan wrote:
>>>> Is it possible to add subplots to a figure if I don't know in advance
>>>> how many subplots I need to add?
>>>>
>>>> What I do now is I call add_subplot like add_subplot(i, 1, i) where i
>>>> is 1 initially, and just increases by 1 on each call. This almost
>>>> works. Except the first plot takes up the whole figure, the second
>>>> plot is placed on top of the bottom half of the first plot, etc. Is
>>>> there a way to "resize" the plots when a subplot is added? Or how
>>>> would I "re-plot" the previous subplots?
>>>
>>> See the Axes.change_geometry command
>>>
>>> http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.SubplotBase.change_geometry
>>
>> To follow-up on this a bit, the second, third, etc subplots all seem
>> to get stuck with the first subplot's x-axis. Let's say the first plot
>> is -60 to 60, and the second plot is 2 - 4. The data in the second
>> plot is plotted on the correct scale (2 to 4), but I still see -60 to
>> 60.
>>
>> Actually, this isn't entirely correct. When I add a third subplot, the
>> second subplot becomes correct. So the -60 to 60 only sticks to the
>> most recently added subplot.
>>
>> Any ideas?
>
> post some code
>
I thought this might be required...
We have a variety of telemetry applications that all require some sort
of visual display of data. We've created a widget based upon
matplotlib that can be used stand-alone (reads JSON formatted data
files), or within PyGTK applications and can plot data sets in
"real-time". So the whole thing is excessively complex. I'd be happy
to package up the whole thing if anyone is interested. Currently it
requires the latest Ubuntu release with several additional development
libraries like GLib. What I've posted below is just the abstract plot
widget.
I think the relevant parts are:
from matplotlib.figure import Figure
self.figure = Figure()
self.__subplots = []
self.subplot_new()
self.__axl = self.figure.gca()
self.__axl.yaxis.set_label_position('left')
self.__axl.yaxis.tick_left()
self.__axr = self.__axl.twinx()
self.__axr.yaxis.set_label_position('right')
self.__axr.yaxis.tick_right()
and then:
def subplot_new(self):
nsubplots = len(self.__subplots) + 1
subplot = self.figure.add_subplot(nsubplots, 1, nsubplots)
subplot.grid(True)
self.__subplots.append(subplot)
self.__subplot = subplot
for i, subplot in enumerate(self.__subplots):
subplot.change_geometry(nsubplots, 1, i + 1)
and then:
def __plot__(self, x, y, style='-', color=0xFF,
xlabel=None, ylabel=None):
IBackend.__plot__(self, x, y, style=style,
color=color, xlabel=xlabel, ylabel=ylabel)
if xlabel != None:
self.__subplot.set_xlabel(xlabel)
if ylabel != None:
self.__subplot.set_ylabel(ylabel)
self.__subplot.plot(x, y, style, color='#%06X' % (color))
self.__subplot.grid(True)
def plotr(self, *args, **kwargs):
self.figure.sca(self.__axr)
if not kwargs.has_key('color'):
kwargs['color'] = 0x00FF00
self.__plot__(*args, **kwargs)
def plotl(self, *args, **kwargs):
self.figure.sca(self.__axl)
if not kwargs.has_key('color'):
kwargs['color'] = 0xFF
self.__plot__(*args, **kwargs)
The whole thing:
from __future__ import with_statement
# standard python libraries
try:
import json
except:
import simplejson as json
import re
import os
import time
# matplotlib.sf.net
import matplotlib
import numpy
# www.gtk.org
import gtk
# our own libraries
from elrond.macros import clamp
from elrond.util import Object, Property
def parse(f):
x = []
y = []
fd = open(f, 'r')
lines = [l.strip() for l in fd.readlines()]
fd.close()
for i, line in enumerate(lines):
data = filter(lambda x: x != '', re.split('[, ]', line.strip()))
try:
[Matplotlib-users] set gca()
Hi, I am new to Matplotlib. I am using matplotlib under ipython. A function script generates a figure that has three subplots. The thing is that I would like to continue to interact with a specific subplot under the interactive prompt through pylab after I run that function. However, gca() returns the last subplot which is not what I want. The question is if there is any way to tell gca() which Axes is the current Axes. Thanks, Tom -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Dark or inverted color scheme
Is there a simple way to essentially invert the default plotting color scheme so that the figure background is black and all text, ticks, axes, axis labels, etc are white? I think what I want is to redefine the RGB definitions of the standard color values 'b', 'y', 'k', etc so that I can make a plot figure with a black background using the same script as one for the normal white background. A spent a little while googling and didn't find anything apart from specifically setting different colors for every single plot element. This would be tiresome. Thanks in advance for any help, Tom -- 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] who (F/OSS science) uses matplotlib?
On 06/05/2012 10:14 AM, Kevin Hunter wrote: > At 10:47pm -0400 Sun, 03 Jun 2012, Tom Dimiduk wrote: >> Very few people outside my group use it at the moment, but that looks >> to be changing at least a bit. I will hopefully get a paper out about >> the code by the end of the summer. > > I'm in a similar boat with the research on which I'm working, paper and > all. I don't know if folks will end up using it or not, but at least it > is available (github), if not well advertised to the (decidedly small) > niche of folks who would be interested. > What is your project? Like probably anyone in this situation, I have written a bunch of little convenience tools working with images, a simple matplotlib based gui to provide richer imshow image interaction (clicking to get pixel coordinates), more user friendly wrappers around scipy functions to do what is at least the most common case for us, and things of that sort. Is any of this stuff I should be looking to upstream or split off into the start of a scientific imaging library for python? -- 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] contour3D custom levels possible?
Hello everyone, does anybody know why the contour3D function has a fixed set of levels? contour3D(X, Y, Z, levels=10, **kwargs) I want to plot only one line for one level. With "contourf" it works: from mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot as plt fig = plt.figure() ax = axes3d.Axes3D(fig) X, Y, Z = axes3d.get_test_data(0.05) cset = ax.contourf(X, Y, Z, 0) # doesn't work with contour ax.clabel(cset, fontsize=9, inline=1) plt.show() Many greetings, Tom -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] contour3D custom levels possible?
Hello, I thought that it has to be like Ben wrote: -def contour(self, X, Y, Z, levels=10, **kwargs): +def contour(self, X, Y, Z, *args, **kwargs): Your suggestion Eric ( contour(X, Y, Z, [0] ) doesn't work as the levels are still the same. Can you translate this thread for a "normal" user? Is this a bug and will be fixed in a newer version of matplotlib or what do I have to do to get "less levels"? Thank you for your help. Tom Am 01.08.2010 20:12 schrieb Eric Firing: > On 08/01/2010 07:35 AM, Benjamin Root wrote: >> On Sun, Aug 1, 2010 at 9:55 AM, Tom Arens > <mailto:tak...@gmx.de>> wrote: >> >> Hello everyone, >> >> does anybody know why the contour3D function has a fixed set of levels? >> >> contour3D(X, Y, Z, levels=10, **kwargs) >> >> I want to plot only one line for one level. With "contourf" it works: >> >> >> >> from mpl_toolkits.mplot3d import axes3d >> import matplotlib.pyplot as plt >> >> fig = plt.figure() >> ax = axes3d.Axes3D(fig) >> X, Y, Z = axes3d.get_test_data(0.05) >> cset = ax.contourf(X, Y, Z, 0) # doesn't work with contour >> ax.clabel(cset, fontsize=9, inline=1) >> >> plt.show() >> >> >> >> Many greetings, >> Tom >> >> >> Hmm, interesting. Looking at the contour3d call signature, it appears >> that 'levels' was put into the call signature to basically remove that >> keyword argument from the kwargs that get passed down to the 2-d version >> of contour. It is never used in the body of contour3d(). >> >> I would guess that this is might be a remnant of some original code that >> actually used the levels parameter. Simply removing levels=0 from the >> call signature seems to fix it (and passing [0] to levels as well since >> it expects a sequence). >> >> As a matter of consistency, I think the call signature should be changed >> to better match the call signature for contourf3d() and for the 2-d >> version of contour(). > > Ben, > > Good idea, go ahead. The contourf3d docstring can also be modified to > match your change to the contour3d docstring. > > I would consider all this as bug-fixing, so it can go in branch and trunk. > > Thanks. > > Eric > >> >> Ben Root >> > > -- > The Palm PDK Hot Apps Program offers developers who use the > Plug-In Development Kit to bring their C/C++ apps to Palm for a share > of $1 Million in cash or HP Products. Visit us here for more details: > http://p.sf.net/sfu/dev2dev-palm > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] [ANN] grima -- pygtk+ widget that embeds matplotlib
Hello, Today we have made Grima available as free software under the MIT license. Grima is a pygtk+ widget that embeds matplotlib. Basically, this means that Grima allows matplotlib to play nicely with the GTK+ main loop. Grima is hosted on GitHub at http://github.com/cdsi/grima. Please note that this is a very early alpha release. There is very little documentation on how to use Grima, or on its future plans. Our needs are related to being able to visualize arbitrary sets of time series data (like device measurements), as well as store and retrieve this data in a modular way. We plan to provide a mechanism to work with structured JSON data in couchdb or redis. For now, applications simply pass x and y values per the current matplotlib API. We have decided to make Grima available at this point so that others have the opportunity to evolve it beyond our own limited scope. Contributions (ideas, critiques, patches) are welcomed. To start, please take a look at: http://github.com/cdsi/grima/blob/master/bin/grima-subplot.py. I am more than happy to answer any questions. You may contact me directly at t...@creativedigitalsys.com, or at cdsi-l...@googlegroups.com. The latter is a Google Group that covers Grima as well as some other bits of free software also released today. A list of these are up at http://github.com/cdsi. Thank you, -Tom PS - A special thanks to the matplotlib community, and to http://unpythonic.blogspot.com/2007/08/using-threads-in-pygtk.html for all of the excellent work upon which Grima is based. -- Visit our website: http://software6.net/ Follow us on Twitter: http://twitter.com/software6 -- This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] caveats found installing matplotlib from svn source on python 2.7 in mac os x Leopard
ayg256 wrote: > > First of all, thanks to the matplotlib developers for all the great job. > I > have just successfully installed matplotlib from source (r8827) in my > macbook for python 2.7. However, I found a couple of bumps in the road > that > I'd like to share: > > ... > > Cheers, > > AY > Dear AY, Thanks so much for posting your followup. I just went through building matplotlib 1.0.0 from source on my new iMac and your directions were invaluable. I did need to make some minor modifications to match the peculiarities of my setup - for example I am installing it with python 2.6. PYC FILE ISSUES After install and the manual copy to /Library/Python/2.6/site-packages (which is where numpy and scipy get built on this machine), the pyc files are pointing to /usr/local/lib still, which is something that shows up in ipython when browsing functions, and in backtraces... apparently this is a bug in python that got fixed in 2.7. To work around, I just remade the pyc files. I recompiled them all with compileall.compile_dir. The copying and pyc compilation had to be done with sudo commands since I didn't have permissions. FOURIER DEMO - PROBLEM AND FIX IN "lines.py" Next I tried my wx-based gui http://wiki.wxpython.org/MatplotlibFourierDemo. It raised assertions in lines.py, particularly the part where it tries to access path, affine = self._transformed_path.get_transformed_path_and_affine() (line 286) since self._transformed_path is None. When I fixed that by inserting if self._transformed_path is None: self._transform_path() then it ran into problems with ind += self.ind_offset since ind_offset didn't exist. I fixed that by adding if hasattr(self, 'ind_offset'): Is modifying lines.py the only way to fix this, or should I do something else in the fourier demo? Best regards, Happy New Year to all, etc, - Tom K. -- View this message in context: http://old.nabble.com/caveats-found-installing-matplotlib-from-svn-source-on-python-2.7-in-mac-os-x-Leopard-tp30478244p30575604.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] memory usage with repeated imshow
I am using matplotlib pylab in association with ipython -pylab to show many large (~2000x2000 or larger) images. Each time I show another image it consumes more memory until eventually exhausting all system memory and making my whole system unresponsive. The easiest way to replicate this behaviour is with a = ones((,)) imshow(a) optionally close() and then imshow(a) again. I am using ipython .10.1 and matplotlib 0.99.3. Is there something I should be doing differently to avoid this problem? Is it fixed in a later version? Thanks, Tom -- The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Any update on streamline plot
Hi, I've written a script to roughly emulate the elegant streamline plots found in Mathematica. The code is available at http://www.atm.damtp.cam.ac.uk/people/tjf37/streamplot.py and example plots at http://www.atm.damtp.cam.ac.uk/people/tjf37/streamlines1.png and streamlines2.png. It's a pretty hacky script, but fast and fairly robust. If anyone finds this script useful and has comments/suggestions, I'm happy to do a bit more work. It would also be helpful if anyone has suggestions on a particular issue I had. Currently, to plot variable-width lines (i.e. streamlines2.png) I use a plot command for each line segment which is very slow and nasty. Is there a better way I'm missing? Tom -- The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] memory usage with repeated imshow
Thank you for your help. I upgraded to the latest development version, and as you said, memory use dropped a ton. I will have to test more to confirm that the problem is completely gone, but this appears to bring memory usage down to something quite manageable (at least on my 8gb box ...). Tom On 02/09/2011 07:30 PM, Robert Abiad wrote: > Tom, > > I just went through this, though with version 1.01 of mpl, so it may be > different. You can read the > very long thread at: > > http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg20031.html > > Those who maintain mpl don't think there is a memory leak. What I found was > that imshow() does > consume a lot of memory (now fixed in the development version) and that the > first 2 or so uses build > on each other, but after that it levels off giving back memory after close(). > There is a > discrepancy between what python reports it's using and what the OS reports (I > had 500MB from the OS, > but only 150MB from python). There is a chance that ipython is caching your > results (try ipython > -pylab -cs 0), but when I ran without ipython, python still had a large > portion of memory. > > -robert > > On 2/9/2011 3:52 PM, Tom Dimiduk wrote: >> I am using matplotlib pylab in association with ipython -pylab to show >> many large (~2000x2000 or larger) images. Each time I show another >> image it consumes more memory until eventually exhausting all system >> memory and making my whole system unresponsive. >> >> The easiest way to replicate this behaviour is with >> a = ones((,)) >> imshow(a) >> >> optionally >> >> close() >> >> and then >> >> imshow(a) >> >> again. I am using ipython .10.1 and matplotlib 0.99.3. Is there >> something I should be doing differently to avoid this problem? Is it >> fixed in a later version? >> >> Thanks, >> Tom >> >> -- >> The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: >> Pinpoint memory and threading errors before they happen. >> Find and fix more than 250 security defects in the development cycle. >> Locate bottlenecks in serial and parallel code that limit performance. >> http://p.sf.net/sfu/intel-dev2devfeb >> ___ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- > The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: > Pinpoint memory and threading errors before they happen. > Find and fix more than 250 security defects in the development cycle. > Locate bottlenecks in serial and parallel code that limit performance. > http://p.sf.net/sfu/intel-dev2devfeb > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Any update on streamline plot
> Ben, John: Later this week or next, I'll take a crack at adding both of > these to quiver.py and > axes.py (one under the name "streamlines", the other as "streamplot"). This is a great idea. I've had some time to improve the code, and so you have something better to work with! If you have any questions or need the code modifying, I'm happy to help - should have free time at the weekend and next week. I've also added density in both directions (nice idea - hadn't thought about this) and variable color as well as width. The new code is at http://www.atm.damtp.cam.ac.uk/people/tjf37/streamplot.py and there are new sample plots at http://www.atm.damtp.cam.ac.uk/people/tjf37/streamlines1.png and http://www.atm.damtp.cam.ac.uk/people/tjf37/streamlines2.png . > You probably want to use a compound path (one object for the entire > plot). See the tutorial athttp://matplotlib.sourceforge.net/users/path_tutorial.html, in > particular the compound path for the histogram example near the end, > and let me know if you have any questions. John, thanks for the hints. In the end I used a LineCollection for each streamline because I didn't see how to set different properties (colour and width) for different portions of the line in the compound path. LineCollection performs well enough for this plot so I'm happy with this solution. Tom -- The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Imshow x and y transposed?
It appears to me that when imshow tells you that the mouse cursor is at x=50, y=100 That corresponds to array element im[100, 50] Is there a reason imshow does not have x be the first coordinate of the array as I would think of as conventional usage? Tom -- Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Imshow x and y transposed?
Ah thanks. I am used to the general math/physics convention of x axis being first. Caught between conventions I guess. Good to know why things are done differently. I am using the mouse click event.xdata and event.ydata as indexes into an array. From what you say, it looks like I want to use im[im.shape[1]-y, x] to get the pixel a user clicked on. Is that correct? Thanks agaian, Tom On 03/15/2011 05:35 PM, Eric Firing wrote: > On 03/15/2011 10:23 AM, Tom Dimiduk wrote: >> It appears to me that when imshow tells you that the mouse cursor is at >> x=50, y=100 >> >> That corresponds to array element >> im[100, 50] >> >> Is there a reason imshow does not have x be the first coordinate of the >> array as I would think of as conventional usage? > > That is not conventional usage. Instead, for images, it common for the > image to correspond to a printout of memory, using the C convention. > Hence the column index is X, and incrementing the row index yields the > next line down on the page, thereby corresponding to a decrease in the Y > coordinate. > > Eric > >> >> Tom > > -- > Colocation vs. Managed Hosting > A question and answer guide to determining the best fit > for your organization - today and in the future. > http://p.sf.net/sfu/internap-sfd2d > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Qt4 Backend Gui Keycode patch
The arrow keys were not being correctly detected in the Qt4 backend of
the matplotlib gui code, so I went in and hooked up keycodes for them.
I haven't submitted patches before, but I thought this was worth passing
on, so I have attached it. Is this something worth submitting? How
would I go about doing that?
Tom
--- backend_qt4.py 2011-04-11 11:37:21.200228001 -0400
+++ /home/tdimiduk/download/matplotlib/lib/matplotlib/backends/backend_qt4.py
2011-04-11 11:44:46.77000 -0400
@@ -126,11 +126,7 @@
keyvald = { QtCore.Qt.Key_Control : 'control',
QtCore.Qt.Key_Shift : 'shift',
QtCore.Qt.Key_Alt : 'alt',
-QtCore.Qt.Key_Return : 'enter',
-QtCore.Qt.Key_Left : 'left',
-QtCore.Qt.Key_Right : 'right',
-QtCore.Qt.Key_Up : 'up',
-QtCore.Qt.Key_Down : 'down'
+QtCore.Qt.Key_Return : 'enter'
}
# left 1, middle 2, right 3
buttond = {1:1, 2:3, 4:2}
--
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Best way to cycle through numpy images using scroll?
Here is how am solving this problem. It isn't terribly fast either, but
it works for me. I wrote something with pygame that was faster, but it
had its own set of problems.
Tom
---
import numpy as np
import pylab
class plotter:
def __init__(self, im, i=0):
self.im = im
self.i = i
self.vmin = im.min()
self.vmax = im.max()
self.fig = pylab.figure()
pylab.gray()
self.ax = self.fig.add_subplot(111)
self.draw()
self.fig.canvas.mpl_connect('key_press_event',self.key)
def draw(self):
if self.im.ndim is 2:
im = self.im
if self.im.ndim is 3:
im = self.im[...,self.i]
self.ax.set_title('image {0}'.format(self.i))
pylab.show()
self.ax.imshow(im, vmin=self.vmin, vmax=self.vmax,
interpolation=None)
def key(self, event):
old_i = self.i
if event.key=='right':
self.i = min(self.im.shape[2]-1, self.i+1)
elif event.key == 'left':
self.i = max(0, self.i-1)
if old_i != self.i or old_j != self.j:
self.draw()
self.fig.canvas.draw()
def show(im, i=0):
plotter(im, i)
On 08/17/2011 01:26 PM, Keith Hughitt wrote:
> I'm also looking into a similar issue, and would be interested to see
> what approaches others have taken.
>
> Has anyone found a good framework-independent solution?
>
> Keith
>
> On Wed, Aug 10, 2011 at 5:15 PM, David Just <mailto:just.da...@mayo.edu>> wrote:
>
> I have an array of images stored as an array of numpy arrays. I
> need to be able to efficiently scroll through that set of images.
>My first attempt at doing this goes something like this:
>
> --init--
>
> self.ax <http://self.ax> = pyplot.imshow(imgdta[0],
> interpolation='spline36', cmap=cm.gray, picker=True) # draw the
> plot @UndefinedVariable
> pyplot.axes().set_axis_off()
> self.fig = self.ax.get_figure()
> self.canvas = FigureCanvasGTKAgg(self.fig)
>
> --onscroll--
> self.ax.set_array(imdta[n]) # 0 < n < num_images
> self.canvas.draw()
>
>
> This method of changing the image data does not seem to be very
> preferment. It takes ~.25 seconds to go from one image to the next.
>Can anybody suggest a faster way? This also ends up in a canvas
> that’s much larger than I need, is there a better way to define my
> view area?
>
>
> Thank you,
> Dave.
>
>
> --
> uberSVN's rich system and user administration capabilities and model
> configuration take the hassle out of deploying and managing
> Subversion and
> the tools developers use with it. Learn more about uberSVN and get a
> free
> download at: http://p.sf.net/sfu/wandisco-dev2dev
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> <mailto:Matplotlib-users@lists.sourceforge.net>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
>
> --
> Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
> user administration capabilities and model configuration. Take
> the hassle out of deploying and managing Subversion and the
> tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
--
Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
user administration capabilities and model configuration. Take
the hassle out of deploying and managing Subversion and the
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Best way to cycle through numpy images using scroll?
Excellent! That sped things up quite a bit. I can now flip through my small images with no perceivable delay. I will look forward to trying out the new interpolation setting when it gets here, since I have some larger images that still lag slightly. If others want, I can repost my code with Ben's changes. Thanks a bunch! Tom On 08/17/2011 03:30 PM, Benjamin Root wrote: > Two issues with your code that should significantly speed things up. > > First, by calling imshow() each time for the draw, there is significant > overhead caused by this. Instead -- (and this is a huge speedup) -- > save the object returned by the first call to imshow(). That object has > a method ".set_array()" that will allow you to just change the data > contained within the AxesImage object. This is *much* faster than > calling imshow() repeatedly. Note that the array going into set_array() > will have to be of the same shape as the original image. > > Second, by setting the "interpolation" kwarg to *None*, you are merely > telling imshow() to use the default interpolation specified in your > rcParams file. Instead, you probably want "nearest". Actually, > supposedly, the upcoming release is supposed to support a new value > "none" for absolutely no interpolation at all. The idea would be that > one would pre-interpolate the image data before sending it to imshow() > and have imshow set to do no interpolations at all. Therefore, the > images display much faster. > > I hope this helps! > Ben Root -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] equivalent of currentpoint?
Hi, I am very new to matplotlib (running 0.87.5 on Mac OS X) and just joined this maillist today. I just discovered "getp" and "setp" today, very nice! I am wondering if there is an analog of the axes and/or figure's 'currentpoint' property to access the current mouse location, and the figure's 'windowbuttonmotionfcn' (and up and down respectively) for responding to mouse click events? Thanks in advance, Tom Krauss - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] equivalent of currentpoint?
I just found Section 3.14 Event Handling in the User's Guide, so never mind! Thanks anyway and sorry for the newbie spam - I broke the rule about reading the manual first before asking! I will try some examples. - Tom On Jan 8, 2007, at 3:58 PM, Tom Krauss wrote: > I am wondering if there is an analog of the axes and/or figure's > 'currentpoint' property to access the current mouse location, and > the figure's 'windowbuttonmotionfcn' (and up and down respectively) > for responding to mouse click events? - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] multiple lines, multiple plots, single figure
if you're building an app i would suggest using the OO interface. There are good examples in the examples directory. But basically you get a figure either by constructing it or using pylab.gcf and you can add_axes to the figure and plot on them. It is much more scalable for an app than the pylab interface. as for your original question, i'm afraid i've never seen the behavior before and don't have a good answer. --Tom On 1/19/07, Jonathon Anderson <[EMAIL PROTECTED]> wrote: > It's definitely not the behavior I'm seeing here. In my matploblibrc file, > hold is set to True. Is there another value that might be influencing this? > > In any case, I don't want the behavior to be dependent on a config file: I'm > building an application. Do you know how I might specify this behavior at > run-time? > > ~jonathon > > > On 1/19/07, Tom Denniston > <[EMAIL PROTECTED]> wrote: > > It might depend on what's in your matplotlib rc file but by default > > the behavior I have always seen was each plot command adds to the > > current figure (pylab.gcf()) until you do a pylab.clf(). > > > > So the two commands lists you have below end up being functionally > equivalent. > > > > --Tom > > > > On 1/19/07, Jonathon Anderson < [EMAIL PROTECTED]> wrote: > > > I have several lines of data that I want to plot on the same graph, but > > > every time I run the pylab.plot() function it redraws the graph from > > > nothing. I've tried pylab.plot(*, hold=True) and pylab.hold(True), but > it > > > still happens. Can I add data to an existing figure, or do I have to > pass > > > all the data at once? > > > > > > e.g., Do I have to do this: > > > > > > pylab.plot(x1, y1, x2, y2, x3, y3, ...) > > > > > > or can I do this: > > > > > > pylab.plot(x1, y1) > > > pylab.plot(x2, y2) > > > pylab.plot(x3, y3) > > > ... > > > > > > ~jonathon anderson > > > > > > > - > > > Take Surveys. Earn Cash. Influence the Future of IT > > > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > > > opinions on IT & business topics through brief surveys - and earn cash > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > > > > ___ > > > Matplotlib-users mailing list > > > Matplotlib-users@lists.sourceforge.net > > > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > > > > > > > > > > - > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib plotting performance
Oops that was the TKAgg profile results. These are the WxAgg results
attached. Sorry about that.
On 7/5/07, Tom Denniston <[EMAIL PROTECTED]> wrote:
I've been trying to profile and speed up an app that uses matplotlib.
I tried to write an example using simple pylab commands to reproduce
the slowness. What I found was I could get a huge speedup just
avoiding unnecessary redraws. I'm down now to passable behavior.
Plotting 6 series in two windows takes about one and a quarter
seconds. I would like to improve this further, however, if it is
possible which is why I am posting.
The results with show() in between plots are:
In [5]: run u:/tdennist/test2.py
10.128132637
In [6]: run u:/tdennist/test2.py
10.3122053602
And without the superfluous draws:
In [7]: run u:/tdennist/test2.py
1.83904865901
In [8]: run u:/tdennist/test2.py
1.86751011294
In [9]: run u:/tdennist/test2.py
1.84959890227
Where 1.85 seconds is the time to do 2 iteractions of drawing 2 plots
with 3 lines each. So about 0.9 to 1.0 sec to draw the plots once.
Is there anything obvious I can do to speed this up? I looked a
profile results of this and found most of the time is spent in "draw"
functions. I attached the profile results in kcachegrind format for
the faster method.
Under the animation section there is a suggestion that things are
faster if you pre allocate the line and then just update it's x or y
data. Given the profile results, however, I don't think this would
help much and it would be kinda inconvenient for my app because I
don't know how many series I am gonna plot up front.
Also at the very bottom is the contents of my rc params. I am using
WxAgg on windows with matplotlib 0.90.1 and python 2.5.
Code
---
import timeit
setup='''
import matplotlib
matplotlib.use('WXAgg')
from matplotlib.widgets import Cursor
import pylab, numpy
pylab.clf()
#pylab.show()
'''
code='''
fig = pylab.gcf()
p1 = fig.add_axes([0.075, 0.05, 0.8, .4], axisbg='#33')
cursor = Cursor(p1, useblit=True, color='green', linewidth=2.5 )
p2 = fig.add_axes([0.075, 0.55, 0.8, .4], axisbg='#33')
def test(n):
for i in range(3):
p1.plot(numpy.random.rand(n))
#pylab.show()
for i in range(3):
p2.plot(numpy.random.rand(n))
#pylab.show()
test(1000)
pylab.show()
'''
print timeit.Timer(code, setup=setup).timeit(2)
rc Params
figure.subplot.right 0.9
mathtext.cal cmsy10.ttf
font.fantasy fantasy
xtick.minor.pad 3
tk.pythoninspect False
legend.labelsep 0.005
image.aspect equal
font.cursive cursive
figure.subplot.hspace 0.2
xtick.direction in
axes.facecolor w
ytick.direction in
legend.pad 0.2
axes.axisbelow False
lines.markersize 6
figure.dpi 80
text.usetex False
text.fontangle normal
patch.edgecolor k
ps.useafm False
lines.solid_joinstyle miter
font.monospace monospace
xtick.minor.size 2
figure.subplot.wspace 0.2
savefig.edgecolor w
text.fontvariant normal
image.cmap jet
axes.edgecolor k
tk.window_focus False
text.fontsize medium
font.serif serif
savefig.facecolor w
ytick.minor.size 2
mathtext.mathtext2 False
numerix numpy
font.stretch normal
text.dvipnghack False
ytick.color k
lines.linestyle -
xtick.color k
xtick.major.pad 3
text.fontweight normal
patch.facecolor b
figure.figsize (8, 6)
axes.linewidth 1.0
lines.linewidth 0.5
savefig.dpi 150
verbose.fileo sys.stdout
svg.image_noscale False
font.size 12.0
lines.antialiased True
polaraxes.grid True
toolbar toolbar2
pdf.compression 6
grid.linewidth 0.5
figure.facecolor 0.75
ps.usedistiller False
legend.isaxes True
figure.edgecolor w
mathtext.tt cmtt10.ttf
contour.negative_linestyle (6.0, 6.0)
image.interpolation bilinear
lines.markeredgewidth 0.5
legend.axespad 0.02
lines.marker None
lines.solid_capstyle projecting
axes.titlesize large
backend TkAgg
xtick.major.size 5
legend.fontsize small
legend.shadow False
mathtext.it cmmi10.ttf
font.variant normal
xtick.labelsize small
legend.handletextsep 0.02
ps.distiller.res 6000
patch.linewidth 0.5
lines.dash_capstyle butt
lines.color b
figure.subplot.top 0.9
legend.markerscale 0.6
patch.antialiased True
font.style normal
grid.linestyle :
axes.labelcolor k
text.color k
mathtext.rm cmr10.ttf
interactive True
savefig.orientation portait
svg.image_inline True
ytick.major.size 5
axes.grid False
plugins.directory .matplotlib_plugins
grid.color k
timezone UTC
ytick.major.pad 3
legend.handlelen 0.05
lines.dash_joinstyle miter
datapath
c:\local\python25\lib\site-packages\matplotlib-0.87.7-py2.5-win32.egg\matplotlib\mpl-data
image.lut 256
figure.subplot.bottom 0.1
legend.numpoints 4
font.sans-serif sans-serif
font.family serif
axes.labelsize medium
ytick.minor.pad 3
axes.hold True
verbose.level silent
mathtext.nonascii cmex10.ttf
figure.subplot.left 0.125
text.fontstyle normal
font.weight normal
matht
[Matplotlib-users] Irregular Dates
Hi Folks,
Newbie question here...
I have a question about plotting data with irregular dates. Here's a
sample of my data (completely fabricated):
2007-06-29 20:22:03, 612
2007-07-18 09:07:03, 658
2007-07-19 11:07:05, 600
2007-07-19 15:12:07, 734
etc., etc., etc..
What I mean by this is that I'm not collecting the data at regular time
intervals. So I'd like to plot this, and have found that the plot_date
function seems to be designed for specific known time intervals. Instead
I am currently converting each timestamp to an integer in seconds since
the epoch, and then plotting that. It works fine, except that I'd then
like to be able to display the correct dates in for the x-axis rather
than integers. I'm not sure how to override the values that are
displayed on the x-axis. Can anyone help out?
Here's my current code (this is within Django - import statements
omitted):
start_date = datetime.date(2006, 3, 1)
end_date = datetime.date(2007, 3, 31)
logs = Item.objects.filter(processing_start__range=(start_date,
end_date))
dates = [float(time.mktime(p.processing_start.timetuple())) for p in
logs]
durations = [float(p.duration()) for p in logs]
matplotlib.use('Cairo')
fig = Figure()
canvas = FigureCanvas(fig)
ax = fig.add_subplot(111)
ax.plot(dates, durations)
ax.set_title('Durations from %s to %s' % (start_date, end_date))
ax.grid(True)
ax.set_xlabel('Date')
ax.set_ylabel('Duration in Minutes')
canvas.draw()
imdata=StringIO()
fig.savefig(imdata,format='png')
return HttpResponse(imdata.getvalue(), mimetype='image/png')
Any help appreciated.
Thanks, Tom
--
--
Tom Haddon
mailto:[EMAIL PROTECTED]
m +1.415.871.4180
www.greenleaftech.net
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Irregular Dates
On Wed, 2007-07-18 at 18:37 -0500, John Hunter wrote: > On 7/18/07, Tom Haddon <[EMAIL PROTECTED]> wrote: > \> What I mean by this is that I'm not collecting the data at regular time > > intervals. So I'd like to plot this, and have found that the plot_date > > function seems to be designed for specific known time intervals. Instead > > Nope, it makes so assumption about the intervals between your dates. I think you mean it makes no assumption about the intervals between my dates? If so, I must be missing something. How am I supposed to pass the data to the plot_date function? If I pass it in as integers from epoch I get an error saying "year is out of range". If I pass it in as datetime objects I get an error saying "TypeError: float is required". Thanks, Tom > > JDH -- -- Tom Haddon mailto:[EMAIL PROTECTED] m +1.415.871.4180 www.greenleaftech.net - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Irregular Dates
On Wed, 2007-07-18 at 20:02 -0500, John Hunter wrote:
> On 7/18/07, Tom Haddon <[EMAIL PROTECTED]> wrote:
> > I think you mean it makes no assumption about the intervals between my
> > dates? If so, I must be missing something. How am I supposed to pass the
> > data to the plot_date function? If I pass it in as integers from epoch I
> > get an error saying "year is out of range". If I pass it in as datetime
> > objects I get an error saying "TypeError: float is required".
> > m +1.415.871.4180
> > www.greenleaftech.net
>
> Use the function matplotlib.dates.epoch2num to convert your epoch data
> into the mpl date format. That or use "plot" with native python
> datetime obects in the latest mpl release.
John,
Thanks for the help so far. Think I'm making progress. However, I now
have a graph that's solid blue (the default line color, I guess). No
line, just solid blue.
Here's the data:
dates = [732748.962546, 732748.898183, 732748.846273, 732748.793252,
732748.569873, 732748.351782, 732748.296273, 732748.24015,
732748.046238, 732747.990046, 732747.484074, 732747.428762,
732746.858449, 732746.171238, 732745.759757, 732744.970671,
732744.879271, 732744.759259, 732744.344653, 732744.282025,
732744.169954, 732744.101169, 732744.047153, 732743.997037,
732743.412755, 732743.274005, 732743.124907, 732743.074074,
732743.019931, 732742.921481, 732742.870613, 732742.611551,
732742.300451, 732742.249977, 732741.995475, 732741.687882,
732741.425336, 732741.361088, 732741.117581, 732740.613704,
732739.330208, 732738.073218, 732738.013472, 732737.963576,
732737.912951, 732737.587951, 732737.522905, 732737.46213,
732737.405926, 732737.072662, 732736.909317, 732736.861215,
732736.810127, 732736.702442, 732736.411354, 732736.291123]
durations = [66.969, 68.234, 64.36,
67.61, 72.016, 71.0833329,
65.203, 72.25, 64.906, 72.344,
73.234, 68.953, 72.313,
62.969, 69.547, 71.313,
63.984, 68.171, 69.266,
65.937, 67.437, 71.703,
68.86, 62.816667, 63.266,
68.953, 67.094, 64.0, 69.234,
69.781, 64.031, 64.313, 63.75,
63.43, 63.5, 63.234, 63.383,
67.813, 63.101, 63.914,
67.781, 61.484, 64.047,
62.734, 64.171, 62.586,
66.61, 63.101, 67.297,
64.187, 63.203, 60.367, 63.25,
63.203, 64.383334, 62.5]
And here's the code:
matplotlib.use('Cairo')
fig = Figure()
canvas = FigureCanvas(fig)
ax = fig.add_subplot(111)
ax.plot_date(dates, durations)
ax.set_title('Title')
ax.grid(True)
ax.set_xlabel('Date')
ax.set_ylabel('Duration in Minutes')
canvas.draw()
imdata=StringIO()
fig.savefig(imdata,format='png')
return HttpResponse(imdata.getvalue(), mimetype='image/png')
Any ideas what I'm missing?
Thanks, Tom
>
> JDH
--
--
Tom Haddon
mailto:[EMAIL PROTECTED]
m +1.415.871.4180
www.greenleaftech.net
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] [Fwd: Re: Irregular Dates]
Hmm, looks like I was just missing a third argument '-' from the
plot_date function.
Thanks, Tom
Forwarded Message ----
From: Tom Haddon <[EMAIL PROTECTED]>
To: John Hunter <[EMAIL PROTECTED]>
Cc: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] Irregular Dates
Date: Thu, 19 Jul 2007 13:39:58 -0700
On Wed, 2007-07-18 at 20:02 -0500, John Hunter wrote:
> On 7/18/07, Tom Haddon <[EMAIL PROTECTED]> wrote:
> > I think you mean it makes no assumption about the intervals between my
> > dates? If so, I must be missing something. How am I supposed to pass the
> > data to the plot_date function? If I pass it in as integers from epoch I
> > get an error saying "year is out of range". If I pass it in as datetime
> > objects I get an error saying "TypeError: float is required".
> > m +1.415.871.4180
> > www.greenleaftech.net
>
> Use the function matplotlib.dates.epoch2num to convert your epoch data
> into the mpl date format. That or use "plot" with native python
> datetime obects in the latest mpl release.
John,
Thanks for the help so far. Think I'm making progress. However, I now
have a graph that's solid blue (the default line color, I guess). No
line, just solid blue.
Here's the data:
dates = [732748.962546, 732748.898183, 732748.846273, 732748.793252,
732748.569873, 732748.351782, 732748.296273, 732748.24015,
732748.046238, 732747.990046, 732747.484074, 732747.428762,
732746.858449, 732746.171238, 732745.759757, 732744.970671,
732744.879271, 732744.759259, 732744.344653, 732744.282025,
732744.169954, 732744.101169, 732744.047153, 732743.997037,
732743.412755, 732743.274005, 732743.124907, 732743.074074,
732743.019931, 732742.921481, 732742.870613, 732742.611551,
732742.300451, 732742.249977, 732741.995475, 732741.687882,
732741.425336, 732741.361088, 732741.117581, 732740.613704,
732739.330208, 732738.073218, 732738.013472, 732737.963576,
732737.912951, 732737.587951, 732737.522905, 732737.46213,
732737.405926, 732737.072662, 732736.909317, 732736.861215,
732736.810127, 732736.702442, 732736.411354, 732736.291123]
durations = [66.969, 68.234, 64.36,
67.61, 72.016, 71.0833329,
65.203, 72.25, 64.906, 72.344,
73.234, 68.953, 72.313,
62.969, 69.547, 71.313,
63.984, 68.171, 69.266,
65.937, 67.437, 71.703,
68.86, 62.816667, 63.266,
68.953, 67.094, 64.0, 69.234,
69.781, 64.031, 64.313, 63.75,
63.43, 63.5, 63.234, 63.383,
67.813, 63.101, 63.914,
67.781, 61.484, 64.047,
62.734, 64.171, 62.586,
66.61, 63.101, 67.297,
64.187, 63.203, 60.367, 63.25,
63.203, 64.383334, 62.5]
And here's the code:
matplotlib.use('Cairo')
fig = Figure()
canvas = FigureCanvas(fig)
ax = fig.add_subplot(111)
ax.plot_date(dates, durations)
ax.set_title('Title')
ax.grid(True)
ax.set_xlabel('Date')
ax.set_ylabel('Duration in Minutes')
canvas.draw()
imdata=StringIO()
fig.savefig(imdata,format='png')
return HttpResponse(imdata.getvalue(), mimetype='image/png')
Any ideas what I'm missing?
Thanks, Tom
>
> JDH
--
--
Tom Haddon
mailto:[EMAIL PROTECTED]
m +1.415.871.4180
www.greenleaftech.net
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 3D plotting support
You might take a look at tvtk.mlab and mavayi. http://www.scipy.org/Cookbook/MayaVi On 8/14/07, Eric Firing <[EMAIL PROTECTED]> wrote: > Kaushik Ghose wrote: > > Hi Everyone, > > > > I vaguely remember a comment from a poster a short while back that > > suggested that 3D support in matplotlib was not serious. I would like to > > ask what plans there are for 3D plotting support in this great library. > > There are no plans. The topic keeps coming up, but no one has come > forward to put steady work into it. It is not entirely clear how much > can be done using the present approach, which is a layer on top of a > fundamentally 2D framework. > > Eric > > > > thanks! > > -Kaushik > > > - > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] matlab porting question
Hi, What's the equivalent command in matplotlib to matlab's "surf"? I assume it's Axes3D.plot_surface. But this doesn't see to work. The code to be ported is: s = surf(linspace(0,2,100), linspace(-1,1,100), fe'); But in matplotlib I've come up with: terrain = R.randn(100, 100) / 1 nbumps = 20 f = lambda x: [int(v) for v in x] bumpsx = 100 * R.rand(1, nbumps) bumpsx = map(f, bumpsx.round()) bumpsy = 100 * R.rand(1, nbumps) bumpsy = map(f, bumpsy.round()) f = lambda x: [abs(v) for v in x] terrain[bumpsx, bumpsy] = map(f, abs(R.randn(1, nbumps))) # TODO: abs(randn(nbumps, nbumps)) f = lambda x, y: I.lfilter((N.ones((1, x,)) / x)[0], 1, y) fterrain = (f(20, f(15, terrain).conj().T)).conj().T x = N.linspace(0, 2, 100) y = N.linspace(-1, 1, 100) z = fterrain surface = axes3d.plot_surface(x, y, z) The problem is that x, y, and z all should have the same shape (or at least I assume from the simple3d.py example). But in what's above, x and y have a shape of (100,), and z has a shape of (100,100). What should I do instead? I'm more than happy to share all the source code if that would be instructive. Thanks. -Tom - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] autoscale question
Hi, I have matplotlib 0.90.1 on YellowDog 3 PPC with Python 2.5 and all the support libraries built by hand, and matplotlib-0.90.1 on Ubuntu Feisty x86 via `aptitude install`. And let's say I have: import pylab pylab.plot([2.2, 2.3, 2.4], [0, 5, 1]) pylab.show() Why on the YellowDog 3 system would the x-axis show up as 0 - 2.5, and on the Ubuntu Feisty system would the x-axis show up as 2.2 - 2.4? I am attempting to resolve an autoscale problem elsewhere, and I must of screwed something up when I built matplotlib. But what? Thanks. -Tom - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] autoscale question
On 8/23/07, Fabrice Silva <[EMAIL PROTECTED]> wrote: > Le Wed, 22 Aug 2007 18:21:40 -0700, Tom Vaughan a écrit: > > > Why on the YellowDog 3 system would the x-axis show up as 0 - 2.5, and > > on the Ubuntu Feisty system would the x-axis show up as 2.2 - 2.4? I am > > attempting to resolve an autoscale problem elsewhere, and I must of > > screwed something up when I built matplotlib. But what? > > Are you sure you have the same pref defined in conf files like > ~/.matplotlib/.matplotlibrc for example ? i deleted these on both machines. is there a way to force a particular behaviour using ~/.matplotlib/.matplotlibrc? -tom > > > > -- > Fabrice Silva > [EMAIL PROTECTED] > 06.15.59.07.61 > > > - > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] autoscale question
On 8/22/07, John Hunter <[EMAIL PROTECTED]> wrote: > On 8/22/07, Tom Vaughan <[EMAIL PROTECTED]> wrote: > > > Why on the YellowDog 3 system would the x-axis show up as 0 - 2.5, and > > on the Ubuntu Feisty system would the x-axis show up as 2.2 - 2.4? I > > am attempting to resolve an autoscale problem elsewhere, and I must of > > screwed something up when I built matplotlib. But what? > > The only explanation that makes sense to me is that you are picking up > different versions of mpl. Did you ever install from svn on any > system? You can print > > >>> import matplotlib > >>> print matplotlib.__version__ > > but that doesn't always help, because frequently different svn > versions will print the same version number. We should adopt the > numpy and scipy system of tagging the version w/ the svn revision > number > > JDH > sorry for the tardy reply (fsck'd mail filter)... on yellowdog 3... Python 2.5.1 (r251:54863, Jun 21 2007, 14:27:05) [GCC 4.1.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import matplotlib >>> print matplotlib.__version__ 0.90.1 on ubuntu feisty... Python 2.5.1 (r251:54863, May 2 2007, 16:56:35) [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import matplotlib >>> print matplotlib.__version__ 0.87.7 funny. i thought these were the same version. so is the 0.90.1 behaviour the correct behavior? thanks. -tom - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Default Image Size
Hi Folks,
I'm creating a basic graph as follows:
revnos = [ p['revno'] for p in data ]
durations = [ p['duration'] for p in data ]
majorFormatter = FormatStrFormatter('%d')
matplotlib.use('Cairo')
fig = Figure()
canvas = FigureCanvas(fig)
ax = fig.add_subplot(111)
ax.plot(revnos, durations, '-')
ax.set_title('PQM pre-commit hook durations from Revision %s to %s' %
(revnos[0], revnos[-1]))
ax.xaxis.set_major_formatter(majorFormatter)
ax.grid(True)
ax.set_xlabel('Revision')
ax.set_ylabel('Duration in Minutes')
canvas.draw()
fig.savefig(OUTPUTFILE)
Seems to give me a default size of 1200x900 (which I assume is somehow
related to my screen size) - I've tried altering the fig = line as
follows:
fig = Figure(figsize=(8,6), dpi=100)
but can't seem to change the output size of the image.
Thanks, Tom
--
--
Tom Haddon
mailto:[EMAIL PROTECTED]
m +1.415.871.4180
www.greenleaftech.net
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] edgecolor with usetex=True, usedistiller='pdf'
Hello,
When using usetex=True and
savefig(file, facecolor='w', edgecolor='w')
The behavior of the generated EPS file is more like:
facecolor=None
edgecolor='w'
That is, the image's facecolor is tranparent...taking on the background
color of the latex document---while the edgecolor is definitely white.
This seems inconsistent to me, and I was wondering if there was a quick
solution. I actually like that the facecolor is transparent (or
nonexistent)...and I would like the same to hold for the edgecolor. As of
now, I have an ugly white border around my image.
Also, it seems like there needs to be an extra keyword or option. Suppose
someone wanted a white facecolor in the (usetex=True) EPS file. It doesn't
seem like this is currently possible. It would be nice if I could specify:
savefig(file, facecolor=None, edgecolor=None)
Thoughts?
\documentclass{article}
\usepackage{pstricks}
\usepackage{graphicx}
\begin{document}
\psframe*[linecolor=blue](-10in,-10in)(10in,10in)
\includegraphics{test}
from matplotlib import rc, rcParams
rc('text', usetex=True)
rc('ps', usedistiller='xpdf')
from pylab import *
subplot(111,axisbg='red')
plot(range(10))
savefig('test.eps', facecolor='white', edgecolor='white')
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] edgecolor with usetex=True, usedistiller='pdf'
On 9/23/07, Tom Johnson <[EMAIL PROTECTED]> wrote: > > > Also, it seems like there needs to be an extra keyword or option. Suppose > someone wanted a white facecolor in the (usetex=True) EPS file. It doesn't > seem like this is currently possible. It would be nice if I could specify: > > savefig(file, facecolor=None, edgecolor=None) It would also be nice if we could specify the axis background color to be None as well (again, perhaps only useful when creating an EPS)...when using the plot command. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] edgecolor with usetex=True, usedistiller='pdf'
Any comments on this? The behavior is, at best, inconsistent. At worst, the current behavior is incorrect, as it is not possible to have a white facecolor when using usetex/xpdf. On 9/23/07, Tom Johnson <[EMAIL PROTECTED]> wrote: > > On 9/23/07, Tom Johnson <[EMAIL PROTECTED]> wrote: > > > > > > Also, it seems like there needs to be an extra keyword or option. > > Suppose someone wanted a white facecolor in the (usetex=True) EPS file. It > > doesn't seem like this is currently possible. It would be nice if I could > > specify: > > > > savefig(file, facecolor=None, edgecolor=None) > > > It would also be nice if we could specify the axis background color to be > None as well (again, perhaps only useful when creating an EPS)...when using > the plot command. > > > - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Equal Aspect Ratio with colorbar
How can I keep a 1:1 aspect ratio after adding a colorbar? ratio='exact' seems to include the colorbar in the calculations. For example, if I have a circle and color itI want it to still look like a circle (rather than an ellipse) after adding the colorbar. ~t - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] edgecolor with usetex=True, usedistiller='pdf'
On 9/27/07, Darren Dale <[EMAIL PROTECTED]> wrote:
> On Thursday 27 September 2007 01:28:46 am Tom Johnson wrote:
> > On 9/26/07, Darren Dale <[EMAIL PROTECTED]> wrote:
> > > I used your script to create the eps file, and created the attached
> > > postscript
> > > (you need an \end{document} in your latex code).
> >
> > Whoops!
> >
> >
> > Do you see anything wrong
> >
> > > with the resulting postscript? It looks fine to me.
> >
> > Indeed. I didn't realize this before, but the problem is actually with the
> > pdf. I have attached it. Can you confirm that your pdf looks like mine?
>
> No, it does not look like yours. See attached.
Interesting.
>
> > Mine looks like this no matter which viewer I use (acrobat, evince, xpdf).
> > This makes me wonder if it is 1) the eps file or 2) the compilation
> > process.
>
> It is probably a problem with either ghostscript or pdftops.
>
> > Actually, the problem exists as early as the dvi file.
>
> The dvi looks fine here, and so does my pdf. It is often the case that
> problems with usetex are solved by updating the external dependencies. I am
> using:
>
> GPL Ghostscript 8.60
> pdftops version 3.00
> pdfeTeX 3.141592-1.30.5-2.2 (tetex-3.0_p1)
>
>
>
Hmm...I have:
ESP Ghostscript 8.15.04 (2007-03-14)
pdftops version 3.01(coming from libpoppler1 version 0.5.4-0ubuntu8)
pdfeTeX 3.141592-1.21a-2.2 (tetex-3.0.dfsg.3-4)
The CUPS page (http://www.cups.org/espgs/index.php) indicates that ESP
8.15.04 and GPL 8.57 have merged into 8.60. This is probably the
solution. So I will give that a try as a first fix and report back to
the list.
However, it will be a little while before I can provide a status
updateI have a presentation very soon and do not have the time to
regenerate all my images so that the background matches my
presentation background. Since my setup had been creating
'transparent' facecolors, I did not bother setting facecolor at all
and kept the default. :(
Thanks!
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] edgecolor with usetex=True, usedistiller='pdf'
On 9/27/07, Tom Johnson <[EMAIL PROTECTED]> wrote: > However, it will be a little while before I can provide a status > updateI have a presentation very soon and do not have the time to > regenerate all my images so that the background matches my > presentation background. Since my setup had been creating > 'transparent' facecolors, I did not bother setting facecolor at all > and kept the default. :( Assuming that GPL 8.60 fixes the problem, do you anticipate that mpl will move to support None as a color? I realize this is a nontrivial change to the color functionality...but there is a major portability benefit. With None as an option, I would probably always set the axis background color, figure facecolor, and figure edgecolor to None. Then, my figures would work no matter which theme I selected for my presentationand it avoids the situation I am in now, which requires significant time to regenerate images. > > Thanks! > - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Histogram on shared axis
Is it possible to have a figure with two-plots such that f(x) is plotted against x onaxis 1 (on the right) histogram of f(x) is plotted horizontally (on the right) sharing the y-axis of axis 1 (sorry, this is proportional font, ascii art) f(x) ^ | | | counts < -> x I want count=0 to be on the shared y-axis. Perhaps log of counts as well...so normal histogram options. Thanks. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Histogram on shared axis
>histogram of f(x) is plotted horizontally (on the right) sharing > the y-axis of axis 1 Typo: histogram of f(x) is plotted horizontally (on the LEFT) sharing the y-axis of axis 1 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Colormap for LineCollection
I would like to plot a set of lines where the color of each line is parametrized. Then I want to add a colorbar to the plot. For example, suppose I plot y=x+b for various values of b. For each line, I would like to set the color to a particular value of b. When plotting, all b values are normalized and applied to a colormap. The colormap will show all colors... I can create a LineCollection containing all my lines...but I must specify the colors as RGB tuplesand I haven't figured out how to add a colorbar such that the scale on the colorbar will match the parametrized b values. Ideas? - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Adjust width between subplots
I'd like to make the separation distance between two subplots to be much smaller. How can I achieve this? - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Adjust width between subplots
On Nov 27, 2007 11:48 AM, John Hunter <[EMAIL PROTECTED]> wrote: > Use the subplots_adjust paramters, eg > > fig.subplots_adjust(hspace=0) > This wasn't working for me... from pylab import * f = gcf() f.subplots_adjust(hspace=0) f.add_subplot(121) f.add_subplot(122) show() Adjusting the space after adding the subplots did not work either (using SVN). - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Adjust width between subplots
Doh! Sorry, I adjusted the wrong space. On Nov 27, 2007 11:56 AM, Tom Johnson <[EMAIL PROTECTED]> wrote: > On Nov 27, 2007 11:48 AM, John Hunter <[EMAIL PROTECTED]> wrote: > > Use the subplots_adjust paramters, eg > > > > fig.subplots_adjust(hspace=0) > > > > This wasn't working for me... > > from pylab import * > f = gcf() > f.subplots_adjust(hspace=0) > f.add_subplot(121) > f.add_subplot(122) > show() > > Adjusting the space after adding the subplots did not work either (using SVN). > - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Nested Subplots?
Is it possible to have nested subplots? I would like to have 2 rowswith the top row having two columns and the bottom row having one column. For the bottom plot, I'd like to be able to choose between the following: 1) The size of the bottom plot expands to fill the entire horizontal space. 2) The size of the bottom plot is unchanged (same as the other two plots) and is simply centered in the bottom row. x x x Thanks. - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Scatter Plot, Legend
I am plotting multiple scatter plots to the same axis. For each scatter plot, all points have the same shape and color. I would like the legend to display the shape and color of the data points in each collection (rather than displaying a rectangle for the color). The result should be similar to the output from: plot(range(10), 'bo', label='1') legend() The benefit with scatter is that I can have each data point being a different size. - SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] transparent background for encapsulated postscript output
On Dec 14, 2007 11:28 AM, Jeff Whitaker <[EMAIL PROTECTED]> wrote: > Mike: Postscript doesn't support alpha transparency. It might work > with PDF though. pstricks (tex) provides transparency... http://tug.org/PSTricks/main.cgi?file=Examples/Colors/colors#transparency http://tug.org/PSTricks/main.cgi?file=pst-plot/3D/examples#coor Is there any way to get similar hacks into matplotlib? I'm guessing this is a lot of work though. - SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] draw_if_interactive and ipython
Hi all, I wasn't sure if this should be sent to matplotlib or ipython. I'm got a number of questions, and any help would be greatly appreciated. The docstring for draw_if_interactive says: """This should be overriden in a windowing environment if drawing should be done in interactive python mode""" (there should be two d's in overridden) First, I'm not quite sure what this meansdoesn't 'interactive' imply 'interactive python mode'? So shouldn't this function always need overriding (strange that this doesn't have two d's)? The definition is: if matplotlib.is_interactive(): figManager = Gcf.get_active() if figManager is not None: figManager.canvas.draw() Now, when I load with ipython -pylab, the definition is: def wrapper(*args,**kw): wrapper.called = False out = func(*args,**kw) wrapper.called = True return out Ipython says the definition is in genutils.py (ipython) but I can't find it in there, and I don't know what "func" is. This is the ipython part of my email: What does this function mean/do...and where can I find where 'func' is defined. Finally, the real reason for my email. I've been writing functions which perform more complicated plot commands. In general, I don't want the substeps to be shown, so I call matplotlib.interactive(False) and then restore the state at the end of the function. Then I call pylab.draw_if_interactive(). The first issue is that this doesn't really work. Essentially this is what I am doing: $ ipython -pylab In [1]: ioff() In [2]: plot(range(10)) In [3]: ion() In [4]: draw_if_interactive() On doing this, nothing shows up, unless I call show(). But the following works without calling show $ ipython -pylab In [1]: plot(range(10)) Why? Assuming I can get this to work...it seems like a good solution so long as my functions are called from "ipython -pylab", but I would also like to be able to call such functions inside a GUIand I am concerned with the ramifications of the pylab.draw_if_interactive() call. The only pylab command in the plot functions is the draw_if_interactive...and my (wxPython) GUI uses OO matplotlib throughout. Is this an issue? Do I need to overwrite this function? If so, what needs to change so that I can use my functions in a GUI (where I manually call draw) and in ipython. The quickest solution is to have each function accept an keyword which tells it whether or not to call draw_if_interactive()...but this is pain...and doesn't seem very elegant. None of the matplotlib functions call draw_if_interactive()...so perhaps there is another way to temporarily turn off interactive mode and then restore the state. Thanks. - SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] matplotlib/__init__.py
I was looking at rc_params() and saw if not os.path.exists(fname): message = 'could not find rc file; returning defaults' ret = dict([ (key, tup[0]) for key, tup in defaultParams.items()]) warnings.warn(message) return ret Is this correct? It seems that it returns a regular dictionary rather than an instance of RcParams. ~tj - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Forcing draw_if_interactive() to bring up new window...
I have functions which plot multiple items to an axis. Often, I have the function explicitly turn interactive mode off and then I turn it back on to what it was before my function was called. At the end of my function, I call draw_if_interactive(). Suppose the user had interactive mode on prior to the function call. The problem I am having is that draw_if_interactive() seems to have no effect---no figure is drawn unless the user makes a subsequent call to show(). Is there a way around this? - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Differences in appearance between FigureCanvasAgg and FigureCanvasWxAgg
FigureCanvasAgg seems to make fonts appear much larger that FigureCanvasWxAgg. I am trying to get plots generated interactively in a wx window to appear the same as those that I generate in a no display batch script that outputs .png files. I use FigureCanvasWxAgg for the former and FigureCanvasAgg for the latter. Is there a reason why the same font size would appear much larger in FigureCanvasAgg than FigureCanvasWxAgg. Is there another, better, way to achieve uniformity accross png outputs and wx on screen display? It doesn't look like one can use the FigureCanvasAgg for wx embedding or the FigureCanvasWxAgg for png generation because the former will not accept a parent window and the latter requires one. If anyone has any ideas I would greatly appreciate suggestions. --Tom ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Differences in appearance between FigureCanvasAgg and FigureCanvasWxAgg
Thank you John. I will try as you suggest. I really appreciate your help. --Tom On 6/10/06, John Hunter <[EMAIL PROTECTED]> wrote: > >>>>> "Tom" == Tom Denniston <[EMAIL PROTECTED]> writes: > >Tom> FigureCanvasAgg seems to make fonts appear much larger that >Tom> FigureCanvasWxAgg. I am trying to get plots generated >Tom> interactively in a wx window to appear the same as those that >Tom> I generate in a no display batch script that outputs .png >Tom> files. I use FigureCanvasWxAgg for the former and >Tom> FigureCanvasAgg for the latter. Is there a reason why the >Tom> same font size would appear much larger in FigureCanvasAgg >Tom> than FigureCanvasWxAgg. Is there another, better, way to >Tom> achieve uniformity accross png outputs and wx on screen >Tom> display? > >Tom> It doesn't look like one can use the FigureCanvasAgg for wx >Tom> embedding or the FigureCanvasWxAgg for png generation because >Tom> the former will not accept a parent window and the latter >Tom> requires one. > >Tom> If anyone has any ideas I would greatly appreciate >Tom> suggestions. > > backend_agg and backend_wxagg both use the same underlying pixel > buffer, so you should be able to get uniformity between them. Note, > matplotlib has a different default dpi setting for figures for display > and saving, and you might want to try forcing them to be the same with > > dpi = 72 > fig = figure(dpi=dpi) > plot something > fig.savefig(somefile, dpi=dpi) > > If that doesn't help, the only other possibility is that the > PIXELS_PER_INCH defaults are getting you screwed up. This was > included for display devices which have a different number of pixels > per inch; see > http://groups.google.com/groups?q=screen+dpi+x11&hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&selm=7077.26e81ad5%40swift.cs.tcd.ie&rnum=5 > for some info about screen dpi. I vaguely recall that there was some > good reason for including the pixels_per_inch constant *and* dpi,, but > now I suspect the system may be overdetermined and we should drop this > and just use the dpi setting. In any case, each backend defines their > own (see src/_backend_wxagg.cpp and backends/backend_wx.py) and the > defaults are different in backend_agg and backend_wx). > > > If the dpi suggestion above doesn't work, try setting PIXELS_PER_INCH > in backend_wx.py to 72. > > JDH > > > ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Line plots and missing data
When you do a line scatter plot in excel and data is missing between two observations excel doesn't connect those two observations with a line. So what you see is a line with gaps where the data is missing. Missing data is defined as having x values but no y value or vice versa. Is there a good way to get similar behavior in matplotlib? I tried to attach a bmp that had an example but the mail server rejected it on the grounds it was too large. --Tom Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Line plots and missing data
Thanks John and Darren. I think i'll use the nan trick for now but the masked array looks incredibly powerful. I'll take a look at the masked array demo. Thanks once again for your help and some really awesome plotting software! --Tom On 6/27/06, Darren Dale <[EMAIL PROTECTED]> wrote: > On Tuesday 27 June 2006 14:16, Tom Denniston wrote: > > When you do a line scatter plot in excel and data is missing between > > two observations excel doesn't connect those two observations with a > > line. So what you see is a line with gaps where the data is missing. > > Missing data is > > defined as having x values but no y value or vice versa. Is there a > > good way to get similar behavior in matplotlib? > > If you are using 0.87.3, you can do this: > > plot([1.1, 2, nan, 3, 5]) > > > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Alpha and colorbar using contourf
When I use contourf with an alpha argument and the "hot" color scheme. The alpha causes the colors to come out lighter but the colorbar does not adjust accordingly. Is this a bug or do I simply need to adjust the colorbar in some manner?
Below is an adaptation of pcolor.py from the screenshots page and attached is the output I see.
I am using matplotlib 0.87.7:
In [3]: matplotlib.__version__Out[3]: '0.87.7'
--
from __future__ import divisionfrom pylab import *
def func3(x,y): return (1- x/2 + x**5 + y**3)*exp(-x**2-y**2)
dx, dy = 0.025, 0.025x = arange(-3.0, 3.0, dx)y = arange(-3.0, 3.0, dy)X,Y = meshgrid(x, y)
Z = func3(X, Y)
cset = contourf(Z, arange(-1.2,1.6,0.5), origin='lower', extent=(-3,3,-3,3), alpha=.5 )
axis('off')hot()colorbar()title('Some like it hot')show('example')
example.png
Description: PNG image
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Alpha and colorbar using contourf
Thanks Eric.
On 11/9/06, Eric Firing <[EMAIL PROTECTED]> wrote:
Tom,This is a bug. It looks like I completely forgot about handling alphawhen I rewrote the colorbar code. I will try to get it fixed in the
next few days. Thanks for the report.EricTom Denniston wrote:> When I use contourf with an alpha argument and the "hot" color scheme.> The alpha causes the colors to come out lighter but the colorbar does
> not adjust accordingly. Is this a bug or do I simply need to adjust the> colorbar in some manner?>>>> Below is an adaptation of pcolor.py from the screenshots page and> attached is the output I see.
>> I am using matplotlib 0.87.7:>> In [3]: matplotlib.__version__> Out[3]: '0.87.7'>> -->>>>
> from __future__ import division> from pylab import *>> def func3(x,y):> return (1- x/2 + x**5 + y**3)*exp(-x**2-y**2)>> dx, dy = 0.025, 0.025> x = arange(-3.0, 3.0
, dx)> y = arange(-3.0, 3.0, dy)> X,Y = meshgrid(x, y)>> Z = func3(X, Y)>>> cset = contourf(Z, arange(-1.2,1.6,0.5),>origin='lower',>extent=(-3,3,-3,3), alpha=.5
>)>>> axis('off')> hot()> colorbar()> title('Some like it hot')> show('example')>>>
>>> >> -> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo>
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642>>> >> ___
> Matplotlib-users mailing list> Matplotlib-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/matplotlib-users-Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/matplotlib-users
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Alpha and colorbar using contourf
Thanks, Eric. I will try it. On 11/14/06, Eric Firing <[EMAIL PROTECTED]> wrote: Tom,I have made several changes in svn to improve the ability of colorbar totrack changes in colormap and alpha. It works with imshow, pcolor, and contourf. The implementation could be improved--maybe later. Here areminimal illustrations you can use with ipython -pylab:figure(); C = pcolor(rand(3,3)); colorbar(); C.set_alpha(0.5); draw()figure(); C = contourf(rand(3,3)); colorbar(); C.set_alpha(0.5); draw()figure(); C = imshow(rand(3,3)); colorbar(); C.set_alpha(0.4); draw()The agg backend has trouble rendering the "continuous" colorbar withnon-unit alpha; it comes out somewhat striped. Turning on antialiasing makes it better for small to moderate alpha, but causes similarartifacts to appear for alpha=1, so I don't know of any good solution.Good appearance is more important for the most common case of alpha=1,so I am leaving antialiasing off. I haven't checked other backends that support alpha.Eric-Take Surveys. Earn Cash. Influence the Future of ITJoin SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cashhttp://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___Matplotlib-users mailing listMatplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] artist.py
I've been profiling some of my code which builds many somewhat complex graphs. I've noticed that it spends almost all it's time in the __init__ of the artist class. The time there is almost entirely spent on calling identity_transform which builds a SeperableTransform that does no transforming--from what I can tell--which is consistent with the name. The identity transform function buid a bunch of other objects all of which are the same each time. My question is, does it really need to build all these objects over and over again. Given that Artist's __init__ is called by so many things wouldn't it be better to have some static constants to define these default transformation functions? Am I missing something subtle or would this be an improvement? What do people think? def zero(): return Value(0) def one() : return Value(1) def origin(): return Point( zero(), zero() ) def unit_bbox(): """ Get a 0,0 -> 1,1 Bbox instance """ return Bbox( origin(), Point( one(), one() ) ) def identity_affine(): """ Get an affine transformation that maps x,y -> x,y """ return Affine(one(), zero(), zero(), one(), zero(), zero()) def identity_transform(): """ Get an affine transformation that maps x,y -> x,y """ return SeparableTransformation(unit_bbox(), unit_bbox(), Func(IDENTITY), Func(IDENTITY)) - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] artist.py
Sorry meant to send this to the whole list:
John,
Thanks for the fix. After reading Eric's email I started to question
my profiling results but I still (without your fix) seem to see a
significant time when in Artist when generating large volumes of
graphs. I need to rebuild my matplotlib against svn and test your fix
now to see if that solves the problem.
Thanks for your help.
--Tom
On 12/5/06, John Hunter <[EMAIL PROTECTED]> wrote:
> >>>>> "Christopher" == Christopher Barker <[EMAIL PROTECTED]> writes:
>
>Christopher> This sounds like a job for properties! make
>Christopher> _transform a property, and code that gets and sets it
>Christopher> directly should still work. though People that were
>Christopher> accessing an underscored name directly should expect
>Christopher> this kind of problem.
>
> The matplotlib artist kwarg properties act like python properties or
> enthought traits, with some advantages and disadvantages over each
> (mostly disadvantages, alas). We've discussed migrating to one or
> another over the years, but haven't bitten the bullet. At each point
> it's easier to extend the exiting implementation than refactor the
> whole bit; the tyranny of small decisions.
>
> Here are some of the pros and cons as I see them of enthought traits
> vs python properties
>
> Pros:
> * compatibility with the rest of the enthought tool suite
> * built in observer pattern
> * automatic UI for wx users
> * performance is better than python properties last time I looked
> * matplotlib ships with enthought traits built in
>
> Cons:
> * smaller user base than python properties may imply
> fewer 3rd party enhancements, less support, etc
> * we have to maintain our copy of enthought traits to keep it
> current and building or require an additional dependency
>
> I spent some time working on matplotlib rc properties as enthought
> traits as a precursor to porting matplotlib properties to traits.
> Here is some example code showing how to define some representative rc
> properties and construct a matplotlib artist using traits. Because
> matplotlib ships with enthought traits already, you can run this
> script with just matplotlib. Unfortunately, we do not ship the ex UI
> component so you can't test that part. I'm a bit of a traits newbie
> so there are probably better ways to do what I have done below.
>
> import sys, os, re
> import matplotlib.enthought.traits as traits
> from matplotlib.cbook import is_string_like
> from matplotlib.artist import Artist
>
> doprint = True
> flexible_true_trait = traits.Trait(
>True,
>{ 'true': True, 't': True, 'yes': True, 'y': True, 'on': True, True:
> True,
> 'false': False, 'f': False, 'no': False, 'n': False, 'off': False,
> False: False
> } )
> flexible_false_trait = traits.Trait( False, flexible_true_trait )
>
> colors = {
>'c' : '#00bfbf',
>'b' : '#ff',
>'g' : '#008000',
>'k' : '#00',
>'m' : '#bf00bf',
>'r' : '#ff',
>'w' : '#ff',
>'y' : '#bfbf00',
>'gold' : '#FFD700',
>'peachpuff': '#FFDAB9',
>'navajowhite' : '#FFDEAD',
>}
>
> def hex2color(s):
>"Convert hex string (like html uses, eg, #efefef) to a r,g,b tuple"
>return tuple([int(n, 16)/255.0 for n in (s[1:3], s[3:5], s[5:7])])
>
> class RGBA(traits.HasTraits):
># r,g,b,a in the range 0-1 with default color 0,0,0,1 (black)
>r = traits.Range(0., 1., 0.)
>g = traits.Range(0., 1., 0.)
>b = traits.Range(0., 1., 0.)
>a = traits.Range(0., 1., 1.)
>def __init__(self, r=0., g=0., b=0., a=1.):
>self.r = r
>self.g = g
>self.b = b
>self.a = a
>def __repr__(self):
>return 'r,g,b,a = (%1.2f, %1.2f, %1.2f, %1.2f)'%\
> (self.r, self.g, self.b, self.a)
>
> def tuple_to_rgba(ob, name, val):
>tup = [float(x) for x in val]
>if len(tup)==3:
>r,g,b = tup
>return RGBA(r,g,b)
>elif len(tup)==4:
>r,g,b,a = tup
>return RGBA(r,g,b,a)
>else:
>raise ValueError
> tuple_to_rgba.info = 'a RGB or RGBA tuple of floats'
>
> def hex_to_rgba(ob, name,
[Matplotlib-users] Using Apple's freetype2 for mpl on OS X
Hi folks- I'd like to report a possible way for OS X mpl users to use Apple's freetype2 (in their X11), to see if there are any problems with it I may need to be aware of, and if not, to offer it as a possible solution to others installing mpl from source on OS X. I know Apple's freetype2 was "broken" in Panther, but it's possible things are different with Tiger. The basic issue is that Apple's X11 installs a version of freetype2 under /usr/X11R6/ which might be usable by mpl, and which can conflict with other copies users might install to build mpl. With Panther (10.3), I followed mpl build instructions and installed my own freetype2. I tried two different methods: using i-Installer, and directly from source (into /usr/local/). Both approaches worked fine with mpl. However, using either version led to problems with other X11 software I tried to install. The issues I remember had to do with GTK (i.e., installing PyGTK and an unrelated GTK app, geda, from source). There were troublesome issues having to do with freetype2 and some other X11 libs. According to some anecdotal reports I found online, it appears Apple did something strange to the freetype version (at least in Panther versions of X11), so gcc/ld would link against it even if a more recent version was in /usr/local/, but then there would be freetype issues at runtime. My eventual solution involved removing various parts of Apple's X11, and putting links in /usr/X11R6/ to the new installs in /usr/local/. (I have a script to do this, if anyone needs it.) This was such a headache that when I just upgraded to Tiger (10.4; a clean install), I thought I'd see if mpl could be installed using the new freetype2 in Apple's X11. (I also did not install zlib, since 10.4 includes it in /usr/lib/.) To do so, I had to modify "add_ft2font_flags" in setupext.py, adding this to the top: # Added to provide access to Apple's freetype2 when their X11 is installed if sys.platform=='darwin': # Add paths to Apple's X11R6. module.library_dirs.extend( ['/usr/X11R6/lib']) module.include_dirs.extend( ['/usr/X11R6/include']) (Also, the docstring is incorrect and should be fixed to refer to freetype2 rather than gd.) With this change, mpl built without any errors, and as far as I can tell so far, is working just fine. I've come across a few missing font/font replacement warnings, but I don't know whether installing a new freetype2 would have avoided these. If anyone can see a problem with this procedure, please let me know. Otherwise, it means that Tiger users who have installed Apple's X11 need to install just one library (libpng) before installing mpl, so long as the above change is made to setupext.py. I don't know if the change would have any ramifications for those who don't install X11 or who do install it and *also* install freetype2 in /usr/local/. If no problems are anticipated, perhaps the change can be incorporated into mpl. Thanks for any feedback on this. -Tom - This mail sent through IMP: http://horde.org/imp/ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Py2exe missing buttons icons on navigation toolbar
Hello,
I have a simple program
---graf.py--
import matplotlib.pyplot as plt
plt.plot([1,2,3,8,0,9,1,10,5])
plt.ylabel('some numbers')
plt.show()
--
If I look to a matplotlib figures on my screen using the exe made with
py2exe I mis all the buttons but one of the navigation bar.
If I work direct with the Python interpreted they are there.
I use the current version of Pythonxy
setup.py --
from distutils.core import setup
import py2exe
import matplotlib
name = 'graf.py'
INCLUDES = [ 'sip' , 'matplotlib.numerix.random_array'
#, 'PyQt4._qt'
, 'matplotlib.backends'
,
'matplotlib.backends.backend_qt4agg']
#['matplotlib.backends.backend_qt4agg']
EXCLUDES = []
[ '_gtkagg' , '_tkagg' , 'Tkconstants' , 'Tkinter' ,'tcl' ]
#['_tkagg' , '_ps' , '_fltkagg' , 'Tkinter' , 'Tkconstants' , '_cairo' ,
'_gtk' , 'gtkcairo' ,
# 'pydoc' , 'sqlite3' , 'bsddb' , 'curses' , 'tcl' ,
'_wxagg' , '_gtagg' , '_cocoaagg' , '_wx' ]
DLL_EXCLUDES = ['MSVCP90.dll']
ICON_RESOURSES = []
OTHER_RESOURCES = []
DATA_FILES = matplotlib.get_py2exe_datafiles()
setup(name = name,
version = '1.0',
options = { "py2exe" : { 'compressed' : 1,
'optimize' : 2,
'bundle_files' : 2,
'includes' : INCLUDES,
'excludes' : EXCLUDES,
'dll_excludes' : DLL_EXCLUDES }
} ,
console = [ { 'script' : name,
'icon_resources' : ICON_RESOURSES,
'other_resources' : OTHER_RESOURCES, } ] ,
description = 'Hele mooie',
author = 'Tom van der Hoeven',
author_email = 't...@vanderhoeven.biz' ,
maintainer = 'Tom van der Hoeven',
maintainer_email = 't...@vanderhoeven.biz',
license = '',
url = 'http://projecthomepage.com',
data_files = DATA_FILES,
)
-
can you help me
Tom
--
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world?
http://p.sf.net/sfu/oracle-sfdevnlfb
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Py2exe missing buttons icons on navigation toolbar
Dear Sebastian,
Your solution is simple, well described and it works with minimal effort
Thank you so much!
I hope the Matplotlib devellopers will take some action.
Tom
Op 6-2-2011 13:16, Sebastian Voigt schreef:
> Hello Tom,
>
> I encountered the same problem recently. The toolbar icons are a mix of
> png and svg images. The png images are displayed properly while the svg
> icons are not shown. This is a problem with PyQt. I found a proposal on
> the web, where you should add the line
>
> import PyQt4.QtXml
>
> somewhere to your code. This is because xml support is needed to read
> svg files. However, this did not work for me. Instead I now use a rather
> ugly workaround: I rename the original *.png icon files to *.svg for
> those icons that are expected to be svg files. Qt will then find an svg
> file but it's clever enough to load it as png.
> Save those modified files somewhere as resources. Add them to the
> data_files list in your setup script and they will overwrite the
> original files at every build so you don't have to care any more.
>
> You can find out which files have to be renamed by looking into
> PACKAGEPATH/matplotlib/backends/backend_qt4.py line 399 and below.
> Another approach would be to directly rename the files in
> NavigationToolbar2QT._init_toolbar() to *.png since matplotlib provides
> png and svg files for every icon.
>
> Greetings,
> Sebastian
>
>
> Am 06.02.2011 11:20, schrieb Tom van der Hoeven:
>> Hello,
>>
>> I have a simple program
>> ---graf.py--
>>
>> import matplotlib.pyplot as plt
>> plt.plot([1,2,3,8,0,9,1,10,5])
>> plt.ylabel('some numbers')
>> plt.show()
>> --
>> If I look to a matplotlib figures on my screen using the exe made with
>> py2exe I mis all the buttons but one of the navigation bar.
>> If I work direct with the Python interpreted they are there.
>> I use the current version of Pythonxy
>>
>> setup.py --
>> from distutils.core import setup
>> import py2exe
>> import matplotlib
>>
>> name = 'graf.py'
>> INCLUDES = [ 'sip' , 'matplotlib.numerix.random_array'
>> #, 'PyQt4._qt'
>> , 'matplotlib.backends'
>> ,
>> 'matplotlib.backends.backend_qt4agg']
>> #['matplotlib.backends.backend_qt4agg']
>> EXCLUDES = []
>> [ '_gtkagg' , '_tkagg' , 'Tkconstants' , 'Tkinter' ,'tcl' ]
>> #['_tkagg' , '_ps' , '_fltkagg' , 'Tkinter' , 'Tkconstants' , '_cairo' ,
>> '_gtk' , 'gtkcairo' ,
>> # 'pydoc' , 'sqlite3' , 'bsddb' , 'curses' , 'tcl' ,
>> '_wxagg' , '_gtagg' , '_cocoaagg' , '_wx' ]
>> DLL_EXCLUDES = ['MSVCP90.dll']
>> ICON_RESOURSES = []
>> OTHER_RESOURCES = []
>> DATA_FILES = matplotlib.get_py2exe_datafiles()
>>
>> setup(name = name,
>> version = '1.0',
>> options = { "py2exe" : { 'compressed' : 1,
>>'optimize' : 2,
>>'bundle_files' : 2,
>>'includes' : INCLUDES,
>>'excludes' : EXCLUDES,
>> 'dll_excludes' : DLL_EXCLUDES }
>> } ,
>> console = [ { 'script' : name,
>> 'icon_resources' : ICON_RESOURSES,
>> 'other_resources' : OTHER_RESOURCES, } ] ,
>> description = 'Hele mooie',
>> author = 'Tom van der Hoeven',
>> author_email = 't...@vanderhoeven.biz' ,
>> maintainer = 'Tom van der Hoeven',
>> maintainer_email = 't...@vanderhoeven.biz',
>> license = '',
>> url = 'http://projecthomepage.com',
>> data_files = DATA_FILES,
>> )
>> -
>> can you help me
>>
>> Tom
