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

Showing 6 results of 6

From: Ken M. <mc...@ii...> - 2009年02月21日 21:19:47
I've finally been able to update the WxMpl library so it's compatible 
with MPL 0.98:
	http://agni.phys.iit.edu/~kmcivor/wxmpl/downloads/wxmpl-1.3.0.tar.gz
It's been tested on Debian Lenny (Python 2.5.2, MPL 0.98.1, wxPython 
2.6.3.2) and Mac OS 10.5.5 (MacPython 2.5.4, MPL 0.98.1 and 0.98.6svn, 
wxPython 2.8.9.1). Please let me know if you encounter any problems.
My thanks to everyone for the patches and feedback, and for being so 
patient.
Ken
From: Eric F. <ef...@ha...> - 2009年02月21日 19:34:22
Thomas Robitaille wrote:
> Hello,
> 
> I am using matplotlib to show an image using:
> 
> fig = figure()
> ax = fig.add_subplot(111)
> ax.imshow(image)
> 
> After doing this, I want to find the contours for a different image 
> (with different dimensions), but I do not want to interact with the 
> current figure or axes, I just want to retrieve the set of 
> LineCollection objects for the contours. The issue is that if I do
> 
> c = contour(image2)
> 
> the contours are stored inside c, but at the same time they are plotted 
> in the current figure. If I use
> 
> ax.contour(image2)
> 
> then the contours are not plotted immediately, but the view interval has 
> already been changed inside ax.
The workaround for now may be to call ax.set_autoscale_on(False) before 
your call to ax.contour. You could also save the datalim before and 
restore them afterwards.
This sort of request has come up before, though, and the longer-term 
solution might be some refactoring in contour.py. As it is, everything 
is done when the ContourSet is instantiated; one does not have the 
option of simply calculating the contours, for example.
Eric
> 
> So essentially, I am wondering if it is possible to retrieve a set of 
> LineCollection objects without acting in any way on the current figure/axes.
> 
> Thanks for any help,
> 
> Thomas
> 
> ------------------------------------------------------------------------------
> 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
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Thomas R. <tho...@gm...> - 2009年02月21日 14:00:47
Hello,
I am using matplotlib to show an image using:
fig = figure()
ax = fig.add_subplot(111)
ax.imshow(image)
After doing this, I want to find the contours for a different image 
(with different dimensions), but I do not want to interact with the 
current figure or axes, I just want to retrieve the set of 
LineCollection objects for the contours. The issue is that if I do
c = contour(image2)
the contours are stored inside c, but at the same time they are plotted 
in the current figure. If I use
ax.contour(image2)
then the contours are not plotted immediately, but the view interval has 
already been changed inside ax.
So essentially, I am wondering if it is possible to retrieve a set of 
LineCollection objects without acting in any way on the current figure/axes.
Thanks for any help,
Thomas
From: Nils W. <nw...@ia...> - 2009年02月21日 10:22:04
Attachments: truss.png
Hi all,
I have written a small program for optimization of truss 
structures. The design variables are the cross sectional
areas of the truss elements (attached figure).
One way to visualize the results is to use the linewidth
as a parameter.
Is it also possible to use different ("continuous") colors 
corresponding to the values of the design variables ?
 
Any pointer would be appreciated.
Thanks in advance.
Nils
Postprocessing
from scipy import io, set_printoptions
from numpy import zeros, arange, outer, identity, loadtxt, 
ones, shape, dot, r_, where, min, max
set_printoptions(precision=4,linewidth=150)
from pylab import spy, show, plot, subplot, figure, 
imshow, scatter, title, text, annotate, xlabel, ylabel, 
savefig
from scipy.linalg import eigh, norm, solve
#
# Visualization of the
# results of a sizing optimization problem
#
N = 45 # Number of nodes
nele = 136 # Number of elements
coord = 
loadtxt('coord.inp',comments='#',usecols=(1,2)).astype(float)
inz = 
loadtxt('connect.inp',comments='#',usecols=(1,2)).astype(int)
cross = loadtxt('crossopt.dat')
cross_max = max(cross)
cross_min = min(cross)
a = 1.9/(cross_max-cross_min)
b = 2.-a*cross_max
def model(cross):
 """ Model plot """
 scatter(coord[:,0],coord[:,1])
 title('Plane truss structure')
 for iele in arange(0,nele):
 p_j = coord[inz[iele,1]-1]
 p_i = coord[inz[iele,0]-1]
 linewidth = a*cross[iele]+b
 print iele, linewidth
 plot 
(r_[p_i[0],p_j[0]],r_[p_i[1],p_j[1]],'r-',lw=linewidth)
 xlabel('$x$')
 ylabel('$y$')
model(cross)
savefig('truss')
show()
From: C M <cmp...@gm...> - 2009年02月21日 09:15:12
Hi, I have two picking questions. First, If I do this inside a pick
handler function:
def OnPick(self, event):
 if isinstance(event.artist, Line2D):
 thisline = event.artist
 xdata = thisline.get_xdata()
 ydata = thisline.get_ydata()
I can grab the data from a line. Fine.
Now I'd like to do two things:
1) WIthin this same pick handler function, have another if conditional,
but for the case when the user is picking the legend. In other words, I
want to pick the legend artist, not a Line2D artist.
2) Modify the above so the user can pick only the actual points on a line,
but not the connecting line if I have plotted it like 'o-' style (connected
points).
I hope this is clear. Any help is appreciated. Thanks.
Che
From: Eric F. <ef...@ha...> - 2009年02月21日 01:07:16
Jeff Whitaker wrote:
> Armin Moser wrote:
>> Jeff Whitaker wrote:
>> 
>>> Armin Moser wrote:
>>> 
>>>> Hi,
>>>>
>>>> I would like to interpolate an array of shape (801,676) to regularily
>>>> spaced datapoints using griddata. This interpolation is quick if the
>>>> (x,y) supporting points are computed as X,Y = meshgrid(x,y). If this
>>>> condition is not fullfilled the delaunay triangulation is extremely
>>>> slow, i.e. not useable. Is this a known property of the used
>>>> triangulation? The triangulation can be performed with matlab without
>>>> any problems.
>>>>
>>>> Armin
>>>> 
>>>> 
>>> Armin: You could try installing the natgrid toolkit and see if that
>>> speeds up griddata at all. If not, please post a test script with data
>>> and maybe we can figure out what is going on.
>>> 
>> I have already tried natgrid and it didn't improve the situation. As
>> suggested I append a script demonstrating the problem.
Reducing the original grid from 676x801 to 100x120, I get benchmarks of 
about 6 seconds with natgrid and 0.15 s with Robert's delaunay. This 
seems quite repeatable.
I also tried randomizing x and y in the first benchmark with natgrid, 
and it made only a slight difference.
Eric
>>
>> Thanks
>> Armin
>> 
> 
> Armin: On my mac, your two benchmarks take 15 and 14 seconds. Do you 
> consider that too slow?
> 
> Perhaps this is just a toy example to test griddata, but I assume you 
> realize that you wouldn't normally use griddata to interpolate data on 
> one regular grid to another regular grid. griddata is strictly for 
> interpolating scatter data (not on a regular mesh) to a regular mesh.
> 
> -Jeff
>> ------8<-------------
>> from numpy import *
>> from pylab import *
>> import time
>>
>> deg2rad = pi/180.0
>> ai = 0.12*deg2rad
>> x = linspace(13,40,676)
>> y = linspace(10,22,801)
>>
>> x = x*deg2rad
>> y = y*deg2rad
>> [x,y] = meshgrid(x,y)
>> z = (x**2+y**2)
>>
>> xi = linspace(x.min(),x.max(),x.shape[1])
>> yi = linspace(y.min(),y.max(),y.shape[0])
>> tic= time.time()
>> zi = griddata(x.flatten(),y.flatten(),z.flatten(),xi,yi)
>> toc = time.time()
>> print toc-tic
>>
>> fac = 2*pi/1.2681
>> nx = fac * (cos(y)*cos(x) - cos(ai))
>> ny = fac * (cos(y)*sin(x))
>> nz = fac * (sin(y) + sin(ai))
>> np = sqrt(nx**2 + ny**2)
>>
>> z = (np**2+nz**2)*exp(-0.001*nz)
>>
>> xi = linspace(np.min(),np.max(),x.shape[1])
>> yi = linspace(nz.min(),nz.max(),y.shape[0])
>> tic = time.time()
>> zi = griddata(np.flatten(),nz.flatten(),z.flatten(),xi,yi)
>> toc = time.time()
>> print toc-tic
>> 
> 
> 

Showing 6 results of 6

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 によって変換されたページ (->オリジナル) /