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



Showing 8 results of 8

From: John H. <jdh...@ac...> - 2006年05月25日 21:49:55
>>>>> "JUAN" == JUAN ERNESTO FLORES BELTRAN <jua...@ho...> writes:
 JUAN> Hi you all, I am trying to get the mouse location in
 JUAN> coordenates, i have been able to get the X and Y position in
 JUAN> pixels however getting the location in coordinates has not
 JUAN> been possible. My code as follows:
 JUAN> self.figura = Figure(figsize=(8,4), facecolor=0.99, dpi=70,
 JUAN> frameon=True) self.vista=self.figura.add_subplot(111)
 JUAN> self.canvas = FigureCanvasGTK(self.figura)
 JUAN> self.canvas.connect("button_press_event", self.location)
You want matplotlib events, not gtk events
self.canvas.mpl_connect("button_press_event", self.location)
 ^^^^
JDH
From: JUAN E. F. B. <jua...@ho...> - 2006年05月25日 21:46:15
Hi you all,
I am trying to get the mouse location in coordenates, i have been able to 
get the X and Y position in pixels however getting the location in 
coordinates has not been possible. My code as follows:
-----------------------------------------------------------------------------------------------------------
self.figura = Figure(figsize=(8,4), facecolor=0.99, dpi=70, frameon=True)
self.vista=self.figura.add_subplot(111)
self.canvas = FigureCanvasGTK(self.figura)
self.canvas.connect("button_press_event", self.location)
-----------------------------------------------------------------------------------------------------------
def location(self,widget, event):
 print event.x, event.y
-----------------------------------------------------------------------------------------------------------
however when i try:
-----------------------------------------------------------------------------------------------------------
def location(self,widget, event):
 print event.x, event.y
-----------------------------------------------------------------------------------------------------------
i do get the folowing:
AttributeError: xdata
Any sugestion to get the xdata value??
Thanks for your answers, any help highly appretiated
Juan
From: Graeme O'K. <gj...@ne...> - 2006年05月25日 15:39:59
Seems the last email didn't deliver the attachement (even though I =20
received it back?)
The attachment is here again but just in case, here's the code as =20
plain text:
#!/usr/bin/env python
#
# ported fnnls.m to fnnls.py
#
# gjok - 20050816
#
import sys, math
import numpy, numpy.linalg.linalg as la
def any(X) : return len(numpy.nonzero(X)) !=3D 0
def find(X) : return numpy.nonzero(X)
def norm(X, d) : return max(numpy.sum(abs(X)))
#
# x, w =3D fnnls(XtX, Xty, tol)
#
def fnnls(XtX, Xty, tol =3D 0) :
#FNNLS	Non-negative least-squares.
#
# 	Adapted from NNLS of Mathworks, Inc.
# [x,w] =3D nnls(X, y)
#
#	x, w =3D fnnls(XtX,Xty) returns the vector X that solves x =3D =
pinv(XtX)=20
*Xty
#	in a least squares sense, subject to x >=3D 0.
#	Differently stated it solves the problem min ||y - Xx|| if
#	XtX =3D X'*X and Xty =3D X'*y.
#
#	A default tolerance of TOL =3D MAX(SIZE(XtX)) * NORM(XtX,1) * =
EPS
#	is used for deciding when elements of x are less than zero.
#	This can be overridden with x =3D fnnls(XtX,Xty,TOL).
#
#	[x,w] =3D fnnls(XtX,Xty) also returns dual vector w where
#	w(i) < 0 where x(i) =3D 0 and w(i) =3D 0 where x(i) > 0.
#
#	See also NNLS and FNNLSb
#	L. Shure 5-8-87
#	Revised, 12-15-88,8-31-89 LS.
#	(Partly) Copyright (c) 1984-94 by The MathWorks, Inc.
#	Modified by R. Bro 5-7-96 according to
# Bro R., de Jong S., Journal of Chemometrics, 1997, 11, 393-401
# 	Corresponds to the FNNLSa algorithm in the paper
#=09
#	Rasmus bro
#	Chemometrics Group, Food Technology
#	Dept. Dairy and Food Science
#	Royal Vet. & Agricultural
#	DK-1958 Frederiksberg C
#	Denmark
#	rb...@kv...
#	http://newton.foodsci.kvl.dk/users/rasmus.html
# Reference:
# Lawson and Hanson, "Solving Least Squares Problems", Prentice-=20
Hall, 1974.
#
# initialize variables
 m =3D XtX.shape[0]
 n =3D XtX.shape[1]
 if tol =3D=3D 0 :
 eps =3D 2.2204e-16
 tol =3D 10 * eps * norm(XtX,1)*max(m, n);
 #end
 P =3D numpy.zeros(n, numpy.Int16)
 P[:] =3D -1
 Z =3D numpy.arange(0,n)
 z =3D numpy.zeros(m, numpy.Float)
 x =3D numpy.array(P)
 ZZ =3D numpy.array(Z)
 w =3D Xty - numpy.dot(XtX, x)
 # set up iteration criterion
 iter =3D 0
 itmax =3D 30 * n
 # outer loop to put variables into set to hold positive coefficients
 while any(Z) and any(w[ZZ] > tol) :
 wt =3D w[ZZ].max()
 t =3D find(w[ZZ] =3D=3D wt)
 t =3D t[-1:][0]
 t =3D ZZ[t]
 P[t] =3D t
 Z[t] =3D -1
 PP =3D find(P !=3D -1)
 ZZ =3D find(Z !=3D -1)
 if len(PP) =3D=3D 1 :
 XtyPP =3D Xty[PP]
 XtXPP =3D XtX[PP, PP]
 z[PP] =3D XtyPP / XtXPP
 else :
 XtyPP =3D numpy.array(Xty[PP])
 XtXPP =3D numpy.array(XtX[PP, numpy.array(PP)[:, =20
numpy.NewAxis]])
 z[PP] =3D numpy.dot(XtyPP, la.generalized_inverse(XtXPP))
 #end
 z[ZZ] =3D 0
# inner loop to remove elements from the positive set which no longer =20=
belong
 while any(z[PP] <=3D tol) and (iter < itmax) :
 iter +=3D 1
 iztol =3D find(z <=3D tol)
 ip =3D find(P[iztol] !=3D -1)
 QQ =3D iztol[ip]
 if len(QQ) =3D=3D 1 : alpha =3D x[QQ] / (x[QQ] - z[QQ])
 else :
 x_xz =3D x[QQ] / (x[QQ] - z[QQ])
 alpha =3D x_xz.min()
 #end
 x +=3D alpha * (z - x)
 iabs =3D find(abs(x) < tol)
 ip =3D find(P[iabs] !=3D -1)
 ij =3D iabs[ip]
 Z[ij] =3D numpy.array(ij)
 P[ij] =3D -1
 PP =3D find(P !=3D -1)
 ZZ =3D find(Z !=3D -1)
 if len(PP) =3D=3D 1 :
 XtyPP =3D Xty[PP]
 XtXPP =3D XtX[PP, PP]
 z[PP] =3D XtyPP / XtXPP
 else :
 XtyPP =3D numpy.array(Xty[PP])
 XtXPP =3D numpy.array(XtX[PP, numpy.array(PP)[:, =20
numpy.NewAxis]])
 z[PP] =3D numpy.dot(XtyPP, =
la.generalized_inverse(XtXPP))
 #endif
 z[ZZ] =3D 0
 #end while
 x =3D numpy.array(z)
 w =3D Xty - numpy.dot(XtX, x)
 #end while
 return x, w
#end def
if __name__ =3D=3D '__main__' :
#
# test [x, w] =3D fnnls(Xt.X, Xt.y, tol)
# to solve min ||y - X.x|| s.t. x >=3D 0
#
# matlab:lsqnonneg
# X =3D [1, 10, 4, 10; 4, 5, 1, 12; 5, 1, 9, 20];
# y =3D [4; 7; 4]
# x =3D lsqnonneg(X, y) =3D> x =3D [0.9312; 0.3683; 0; 0];
#
 X =3D numpy.array([[1, 10, 4, 10], [4, 5, 1, 12], [5, 1, 9, 20]], =20=
numpy.Float)
 y =3D numpy.array([4, 7, 4], numpy.Float)
 if False :
 X =3D numpy.array([[1, 10, 4, 10],
 [4, 5, 1, 12],
 [5, 1, 9, 20],
 [4, 3, 2, 1]], numpy.Float)
 y =3D numpy.array([4, 7, 4, 1], numpy.Float)
 #end
 if False :
 X =3D numpy.zeros((20, 20), numpy.Float)
 for n in range(20) : X[n,:] =3D numpy.arange(0.0, 400.0, step =20=
=3D 20)
 y =3D numpy.arange(0.0, 20.0)
 #end
 Xt =3D numpy.transpose(numpy.array(X))
 x, w =3D fnnls(numpy.dot(Xt, X), numpy.dot(Xt, y))
 print 'X =3D ', X
 print 'y =3D ', y
 print 'x =3D ', x
#end if __name__ =3D=3D '__main__'
Begin forwarded message:
> From: Graeme O'Keefe <gj...@ne...>
> Date: 25 May 2006 8:46:07 PM
> To: matplotlib user list <mat...@li...>
> Subject: [Matplotlib-users] Fwd: python version of nnls/fnnls
>
>
> Dear matplotlibers,
>
> I seem to use Non Negative Least Squares every couple of months and =20=
> the most recent problem I solved reminded me that I meant to post =20
> this last November.
>
> fnnls.py is a port of fnnls.m which was written by Rasmus Bro =20
> (http://newton.foodsci.kvl.dk/users/rasmus.html, code available at =20
> http://www.ub.es/gesq/mcr/als/fnnls.m, and also available on Matlab =20=
> Central).
>
> I've retained Rasmus' comments and translated the matlab to python/=20
> numpy.
>
=EF=BF=BC
>
> I've used this to linearise problems such as:
> 	fitting Neutron TOF data with a E0 energy spectrum of gaussians =20=
> (with energy-resolutions a function of TOF =3D> E): exp(-((E - E0) / =20=
> deltaE)^2)
> 	fitting Cerebral Blood Flow data with a k-spectrum set of =20
> exponentials: exp(-kt)
> 	fitting BGO detector pulses (to detect/correct pile-up) with =20
> Tdelay-spectrum of exponentials: exp(-(t - Tdelay) / tau)
>
> Hope others find it as useful as I have.
>
> regards,
>
>
> Graeme
>
>
>
> Graeme O'Keefe, PhD, MACPSEM
> Principal Medical Physicist
> Centre for PET
> Austin Hospital
> Tel: (613)-9496-5767
> Fax: (613) 9458-5023
>
>
From: Alan G I. <ai...@am...> - 2006年05月25日 15:18:27
On 2006年5月25日, Graeme O'Keefe apparently wrote: 
> fnnls.py 
And it is ... where?
Cheers,
Alan Isaac
From: Graeme O'K. <gj...@ne...> - 2006年05月25日 10:44:47
Dear matplotlibers,
I seem to use Non Negative Least Squares every couple of months and =20
the most recent problem I solved reminded me that I meant to post =20
this last November.
fnnls.py is a port of fnnls.m which was written by Rasmus Bro (http://=20=
newton.foodsci.kvl.dk/users/rasmus.html, code available at http://=20
www.ub.es/gesq/mcr/als/fnnls.m, and also available on Matlab Central).
I've retained Rasmus' comments and translated the matlab to python/=20
numpy.
=EF=BF=BC
I've used this to linearise problems such as:
	fitting Neutron TOF data with a E0 energy spectrum of gaussians =20=
(with energy-resolutions a function of TOF =3D> E): exp(-((E - E0) / =20
deltaE)^2)
	fitting Cerebral Blood Flow data with a k-spectrum set of =20
exponentials: exp(-kt)
	fitting BGO detector pulses (to detect/correct pile-up) with =
Tdelay-=20
spectrum of exponentials: exp(-(t - Tdelay) / tau)
Hope others find it as useful as I have.
regards,
Graeme
Graeme O'Keefe, PhD, MACPSEM
Principal Medical Physicist
Centre for PET
Austin Hospital
Tel: (613)-9496-5767
Fax: (613) 9458-5023
On Wed, 2006年05月24日 at 17:39 +0800, Allan Noriel Estrella wrote:
> is there a way to modify the toolbars in matplotlib and add more
> functions, like a button for averaging the data displayed then display
> it; draw threshold levels and have a spin up button to change the
> level while drawing it?
To accomplish similar goals, I embed a matplotlib panel (including
toolbar) in a wxPython application (and use the 'WXAgg' backend).
Additional GUI elements (menus, controls etc.) can be added around the
matplotlib panel for all the additional functionality you might need. 
With wxPython, the NavigationalToolbar object could easily be subclassed
and additional elements added, if need be.
You could equally well do this using an alternative toolkit-of-choice
(Tk, gtk, Qt etc.). 
See the "embedding_in_*.py" files from the matplotlib examples set.
Bryan
From: Graeme O'K. <gra...@pe...> - 2006年05月25日 03:40:33
Dear matplotlibers,
I seem to use Non Negative Least Squares every couple of months and =20
the most recent problem I solved reminded me that I meant to post =20
this last November.
fnnls.py is a port of fnnls.m which was written by Rasmus Bro (http://=20=
newton.foodsci.kvl.dk/users/rasmus.html, code available at http://=20
www.ub.es/gesq/mcr/als/fnnls.m, and also available on Matlab Central).
I've retained Rasmus' comments and translated the matlab to python/=20
numpy.
=EF=BF=BC
I've used this to linearise problems such as:
	fitting Neutron TOF data with a E0 energy spectrum of gaussians =20=
(with energy-resolutions a function of TOF =3D> E): exp(-((E - E0) / =20
deltaE)^2)
	fitting Cerebral Blood Flow data with a k-spectrum set of =20
exponentials: exp(-kt)
	fitting BGO detector pulses (to detect/correct pile-up) with =
Tdelay-=20
spectrum of exponentials: exp(-(t - Tdelay) / tau)
Hope others find it as useful as I have.
regards,
Graeme
Graeme O'Keefe, PhD, MACPSEM
Principal Medical Physicist
Centre for PET
Austin Hospital
Tel: (613)-9496-5767
Fax: (613) 9458-5023
From: Ramon F. <fel...@in...> - 2006年05月25日 02:28:34
Hi --
I'm trying to create a scatter plot that represents a matrix
cross-referencing two categorical lists. For example, given the
following:
Joe	San Francisco
Sam	Seattle
Frank	New York
Frank	Boston
Frank	Miami
Andrew	Miami
I would like a scatter plot with names on one axis and cities on the
other, with a plot mark at the axis intersections where there is a
match. Is there a way to map directly from such categories to matplotlib
datasets, or do I first need to map this to a numerical indexing scheme
and then visualize it? Is there a simple way to at least have the
categories used as value labels on the axes?
I'm new to matplotlib, so if this turns out to be a poor fit for this
tool, any pointers to better tools (preferrably python-based) would be
appreciated.
Thank you in advance for your time,
Ramon
----+----
This email message (and any attached document) contains information from =
Ingenuity Systems Inc. which may be considered confidential by =
Ingenuity, or which may be privileged or otherwise exempt from =
disclosure under law, and is for the sole use of the individual or =
entity to whom it is addressed. Any other dissemination, distribution =
or copying of this message is strictly prohibited. If you receive this =
message in error, please notify me and destroy the attached message (and =
all attached documents) immediately.=20

Showing 8 results of 8

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