SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S



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


Showing 12 results of 12

From: Tom V. <to...@so...> - 2010年09月07日 23:55:11
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 to...@cr..., or at
cds...@go.... 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
From: Brian L. <bal...@la...> - 2010年09月07日 23:50:38
Hey all, 
I think I know the answer here as "no" or something, but say I have a curve I want to plot and I want the color to change along the curve to denote the 3rd variable is there anyway to do this is matplotlib?
What I mean is take the simple plot
from pylab import *
plot(range(30), range(30, 60), lw=10)
and say that the 3rd variable is 
inten = [val ** 2 for val in range(30)]
then can the line change color along its length according to a specified color table?
In IDL this is done by just giving a color array with the same length as the data then the line changes with the current colortable.
 
Thanks much, 
Brian
-- 
Brian A. Larsen
Space Science and Applications
Group ISR-1
Los Alamos National Laboratory
PO Box 1663, MS-D466
Los Alamos, NM 87545
USA
(For overnight add:
SM-30, Bikini Atoll Road)
Phone: 505-665-7691
Fax: 505-665-7395
email: bal...@la...
Correspondence /
Technical data or Software Publicly Available
From: Joshua H. <jos...@gm...> - 2010年09月07日 21:34:45
Hey y'all,
I recently read about Chernoff faces
(http://en.wikipedia.org/wiki/Chernoff_face) in one of Edward Tufte's
books (great read btw) and would like to mess around with them in
matplotlib. My current approach is to generate the faces as images,
and then use them as markers on an x-y plot (like the example I
found in the Tufte book). I just realized, though, that I have no idea how to
incorporate images as position markers in matplotlib, or if it's even
possible. My search of the mpl docs didn't turn up much.
Any ideas?
--Joshua Holbrook
From: Amenity A. <am...@en...> - 2010年09月07日 18:45:53
Enthought Python Distribution Webinar
September 10
This Friday,Warren Weckesser will host the first of three webinars in
a series on solving differential equations in Python. We will take a 
close
look at the two tools available for solving ordinary differential 
equations
in SciPy: the "odeint" function and the "ode" class.
Two examples will be discussed: (1) the famous Lorenz equations that
exhibit chaos, and (2) the Gray-Scott reaction-diffusion equations in 
1D,
from which we will obtain a system of ordinary differential equations
by using the "Method of Lines". The demonstrations also include 3D 
plots
and animation using Matplotlib.
Enthought Python Distribution Webinar
How do I...solve differential equations with Python?
Part I: SciPy Tools
Friday, September 10: 1pm CST/6pm UTC
Wait list (for non EPD subscribers):
email:am...@en...
Early in 2011, Warren will host Part II: boundary value problems, and in
the spring he'll follow up with a third installment to the series.
Have a fantastic September,
The Enthought Team
From: Aman T. <ama...@gm...> - 2010年09月07日 17:37:28
Hi,
I seem to be encountering a strange problem. I'm using a SpanSelector and a
RectangularSelector in my application and they seem to be working in Linux
but not in Windows. I'm using wxpython as the gui layer. Has anyone else
encountered similar issues?
Thanks,
Aman
From: Francesco M. <fra...@go...> - 2010年09月07日 16:14:49
Dear Joe,
finally I had time to come back to my python scritp for the contour plots.
You're code works very nicelly and does exactly what I need.
Thank you for the help
Francesco
2010年7月26日 Joe Kington <jki...@wi...>:
> It sounds like you're wanting a gaussian kernel density estimate (KDE) (not
> the desktop!). The other options you mentioned are for interpolation, and
> are not at all what you're wanting to do.
>
> You can use scipy.stats.kde.gaussian_kde(). However, it currently doesn't
> take a weights array, so you'll need to modify it for your use case.
>
> If you prefer, I have faster version of a gaussian KDE that can take a
> weights array. It's actually slower than the scipy's gaussian kde for a low
> number of points, but for hundreds, thousands, or millions of points, it's
> several orders of magnitude faster. (Though the speedup depends on the
> covariance of the points... higher covariance = slower, generally speaking)
>
> Here's a quick pastebin of the code. http://pastebin.com/LNdYCZgw
>
> To use it, you do something like the below... (assuming the code in the
> pastebin is saved in a file called fast_kde.py)
>
> import numpy as np
> import matplotlib.pyplot as plt
> from fast_kde import fast_kde
>
> # From your description of your data...
> weights, x, y = np.loadtxt('chain.txt', usecols=(0,4,6)).T
>
> kde_grid = fast_kde(x, y, gridsize=(200,200), weights=weights)
>
> # Plot the grid
> plt.figure()
> plt.imshow(kde_grid, extent=(x.min(), x.max(), y.max(), y.min())
>
> # Reverse the y-axis
> plt.gca().invert_yaxis()
>
> plt.show()
>
> Hope that helps a bit,
> -Joe
>
>
>
>
> On Sat, Jul 24, 2010 at 3:56 AM, montefra <fra...@go...>
> wrote:
>>
>> Hi,
>>
>> I am writing a program that reads three columns (one column containing the
>> weights, the other two containing the values I want to plot) from a file
>> containing the results from a MonteCarlo Markov Chain. The file contains
>> thousends of lines. Then create the 2D histogram and make contourplots.
>> Here
>> is a sample of the code (I don't know if is correct, it's just to show
>> what
>> I do)
>>
>> >>> import numpy as np
>> >>> import matplotlib.pyplot as mplp
>> >>> chain = np.loadtxt("chain.txt", usecols=[0,4,6])  #read columns 0
>> >>> (the
>> >>> weights), 4 and 6 (the data), from the file "chain.txt"
>> >>> h2D, xe, ye = np.histogram2D(chain[:,1],chain[:,2],
>> >>> weights=chain[:,0])
>> >>> #create the 2D histogram
>> >>> x = (xe[:-1] + xe[1:])/2. #x and y values for the plot (I use the mean
>> >>> of each bin)
>> >>> y = (ye[:-1] + ye[1:])/2.
>> >>> mplp.figure()  #open the figure
>> >>> mplp.contourf(x, y, h2D.T, origin='lower') #contour plot
>>
>> As it is the contours are not smooth and they look not that nice. After
>> days
>> of searches I've found three methods and tried, unsuccesfully, to apply
>> them
>> 1) 2d interpolation: I got "segmentation fault" (on a quadcore machine
>> with
>> 8Gb of RAM)
>> 2) Rbf (radial basis functions): I got wrong contours
>> 3) ndimage: it creates spurious features (like secondary peaks parallel to
>> the direction of the main one)
>>
>> Before beginning with Python, I used to use IDL to plot, and there is a
>> function 'smooth' that smooth for you 2D histograms. I haven't found
>> anything similar for Python.
>> Does anyone have an idea or suggestion on how to do it?
>>
>> Thank in advance
>> Francesco
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Smooth-contourplots-tp29253884p29253884.html
>> Sent from the matplotlib - users mailing list archive at Nabble.com.
>>
>>
>>
>> ------------------------------------------------------------------------------
>> 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://ad.doubleclick.net/clk;226879339;13503038;l?
>> http://clk.atdmt.com/CRS/go/247765532/direct/01/
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
-- 
personals: mon...@ya..., mon...@ho... (messenger),
fra...@go....
work: mon...@mp...
http://picasaweb.google.it/franz.bergesund
From: Benjamin R. <ben...@ou...> - 2010年09月07日 16:06:14
2010年9月7日 Guillaume Chérel <gui...@gm...>
> Hello,
>
> I'm trying to draw circles with the scatter function. They are supposed
> to represent trees in the savannah. It is thus important that they are
> displayed with a proper size, that is, one which represents their actual
> size on the field. After quite some confusion, I've found out (I think)
> that the size argument one can specify with the scatter function is
> given as a disk's surface in pixels square (I think that's what means
> the "points^2" in the documentation and from my own tests)
>
> What I would like is to give a surface in unit^2, where "unit" is the
> unit of my data, and which you can read on the plot's axes ticks. For
> example, each tree has coordinates like x=3500, y=2210. (The unit here
> is centimeters but we don't really need to know this). Say I want to
> draw a tree which canopy is 200 cm wide. That makes a disk which radius
> is 100, or surface 100^2*PI. How can I draw this?
>
> Many thanks,
> Guillaume
>
>
>
Guillaume,
Using scatter is probably not the way to go about what you want. The
circles for scatter are a fixed size and if you zoom in, they will not scale
accordingly.
You probably want to create patches of Circles:
http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.patches.Circle
http://www.mail-archive.com/mat...@li.../msg06786.html
Or even utilize a collection of Circles:
http://matplotlib.sourceforge.net/api/collections_api.html#matplotlib.collections.CircleCollection
Note that for a CircleCollection, you would use 'offset' to indicate the
center of each circle. After creating the collection, you would then use
ax.add_collection() function to add that collection to the axes.
I hope that is helpful.
Ben Root
From: Guillaume C. <gui...@gm...> - 2010年09月07日 14:08:41
 Hello,
I'm trying to draw circles with the scatter function. They are supposed 
to represent trees in the savannah. It is thus important that they are 
displayed with a proper size, that is, one which represents their actual 
size on the field. After quite some confusion, I've found out (I think) 
that the size argument one can specify with the scatter function is 
given as a disk's surface in pixels square (I think that's what means 
the "points^2" in the documentation and from my own tests)
What I would like is to give a surface in unit^2, where "unit" is the 
unit of my data, and which you can read on the plot's axes ticks. For 
example, each tree has coordinates like x=3500, y=2210. (The unit here 
is centimeters but we don't really need to know this). Say I want to 
draw a tree which canopy is 200 cm wide. That makes a disk which radius 
is 100, or surface 100^2*PI. How can I draw this?
Many thanks,
Guillaume
From: Torsten H. <Tor...@ph...> - 2010年09月07日 12:26:10
Hi all,
is there an easy way to draw an arrow in a 3D Plot (just a single arrow).
I couldn't find any useful example in the 1.0.0 docu.
Best regards,
Torsten. 
From: Jae-Joon L. <lee...@gm...> - 2010年09月07日 03:00:54
On Tue, Sep 7, 2010 at 11:04 AM, Paul Ivanov <piv...@gm...> wrote:
> Is this a reasonable way of achieving the desired result?
>
Yes.
You may take a look at the legend guide.
http://matplotlib.sourceforge.net/users/legend_guide.html
For your original question, it is not possible to do that with the
current legend implementation. However, you may put the legend inside
the AnnotationBbox, which enables this. I'm posting the example for
any future reference.
Regards,
-JJ
# small example
ax = plt.subplot(1,1,1)
ax.plot([0,1], label='ax1')
leg = ax.legend()
ax.legend_ = None # remove the legend from the axes.
ax2 = ax.twinx()
ax2.plot([1,0], 'r--',label='ax2')
leg2 = ax2.legend() # create a legend
# add leg as AnnotationBbox
from matplotlib.offsetbox import AnnotationBbox
leg3 = AnnotationBbox(leg._legend_box, (0, 1),
 xybox=(-5, 0),
 xycoords=leg2.legendPatch,
 boxcoords="offset points",
 box_alignment=(1., 1.), pad=0,
 )
# adjust zorder so that leg3 is drawn after leg2
leg3.zorder = leg2.zorder+0.1
ax2.add_artist(leg3)
From: Paul I. <piv...@gm...> - 2010年09月07日 02:04:43
Paul Ivanov, on 2010年09月06日 18:01, wrote:
> I want to have two legends (from different axes) positioned right up
> against on another.
> 
> Here's a static example, except I want the second legend to be defined
> relative to the first (if leg is moved, I want leg2 to move as well). I
> can't seem to figure out the proper bbox_to_anchor and bbox_transform
> parameters to pass to the second legend() to make this work.
> 
> # small example
> ax = plt.subplot(1,1,1)
> ax2 = ax.twinx()
> ax.plot([0,1], label='ax1')
> ax2.plot([1,0], 'r--',label='ax2')
> leg = ax.legend(loc='lower left', borderaxespad=0,
> 	bbox_to_anchor=(.85,.85))
> leg2 = ax2.legend(loc='upper left', borderaxespad=0,
> 	bbox_to_anchor=(.85,.85))
> 
I guess I really just want one legend, so I figured out an alternative
solution:
# alternative to having two legends
ax = plt.subplot(1,1,1)
ax2 = ax.twinx()
lines= ax.plot([0,1], label='ax1')
lines2= ax2.plot([4,3], 'r--',label='ax2')
lines.extend(lines2)
labels = [l.get_label() for l in lines]
leg = ax.legend(lines, labels)
Is this a reasonable way of achieving the desired result?
thanks,
Paul
From: Paul I. <piv...@gm...> - 2010年09月07日 01:01:31
I want to have two legends (from different axes) positioned right up
against on another.
Here's a static example, except I want the second legend to be defined
relative to the first (if leg is moved, I want leg2 to move as well). I
can't seem to figure out the proper bbox_to_anchor and bbox_transform
parameters to pass to the second legend() to make this work.
# small example
ax = plt.subplot(1,1,1)
ax2 = ax.twinx()
ax.plot([0,1], label='ax1')
ax2.plot([1,0], 'r--',label='ax2')
leg = ax.legend(loc='lower left', borderaxespad=0,
	bbox_to_anchor=(.85,.85))
leg2 = ax2.legend(loc='upper left', borderaxespad=0,
	bbox_to_anchor=(.85,.85))
thanks in advance,
Paul Ivanov

Showing 12 results of 12

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





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

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

More information about our ad policies

Ad destination/click URL:

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