[Matplotlib-users] Animations for non-autonomous linear differential equations

2008-08-26 Thread Nils Wagner

Hi all,

I was wondering if it is possible to produce animations
like

http://www.math.uh.edu/~josic/nonautonomous/

with pylab ?

Further information is available in a recent paper
by K. Josic and R. Rosenbaum published in SIAM Review.

See http://dx.doi.org/10.1137/060677057

Cheers,
 Nils
 
 
from scipy.integrate import odeint
from scipy.linalg import eig
from pylab import plot, show, legend, xlabel, ylabel
from numpy import zeros, linspace, dot, sin, cos, exp
#
#   K. Josic, R. Rosenbaum
#   Unstable solutions of nonautonomous linear differential equations
#   SIAM Review Vol. 50 No. 3 (2008) pp. 570--584
#
def A(t):

tmp = zeros((2,2),float)
tmp[0,0] = -1-9*(cos(6*t))**2+12*sin(6*t)*cos(6*t)
tmp[0,1] = 12*(cos(6*t))**2+9*sin(6*t)*cos(6*t)
tmp[1,0] = -12*(sin(6*t))**2+9*sin(6*t)*cos(6*t)
tmp[1,1] = -1-9*(sin(6*t))**2-12*sin(6*t)*cos(6*t)
return tmp

def func(x,t):

return dot(A(t),x)

x_0 = zeros(2,float) # Initial conditions
x_0[0] = -2.44
x_0[1] =  1.23

x_0[0] =  5.0  
x_0[1] =  0.0 

T = linspace(0,3,300)

x = odeint(func,x_0,T)
#
# Analytical solution of Vinograds example
#
y_1 =  exp(2*T)*(cos(6*T)+2*sin(6*T))+2*exp(-13*T)*(2*cos(6*T)-sin(6*T))  
y_2 =  exp(2*T)*(2*cos(6*T)-sin(6*T))-2*exp(-13*T)*(cos(6*T)+2*sin(6*T))  

plot(T,x[:,0])
plot(T,x[:,1])
plot(T,y_1,'r.')
plot(T,y_2,'g.')
xlabel(r'Time $t$[s]')
legend((r'$x_1$',r'$x_2$',r'$y_1$',r'$y_2$'))

for t in T:

   w, vr = eig(A(t))
   print vr[:,0], vr[:,1]

show()
-
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


Re: [Matplotlib-users] Animations for non-autonomous linear differential equations

2008-08-26 Thread Jeff Whitaker
Nils Wagner wrote:
> Hi all,
>
> I was wondering if it is possible to produce animations
> like
>
> http://www.math.uh.edu/~josic/nonautonomous/
>
> with pylab ?
>

Yes.  See http://www.scipy.org/Cookbook/Matplotlib/Animations

-Jeff


-- 
Jeffrey S. Whitaker Phone  : (303)497-6313
Meteorologist   FAX: (303)497-6449
NOAA/OAR/PSD  R/PSD1Email  : [EMAIL PROTECTED]
325 BroadwayOffice : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg


-
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


Re: [Matplotlib-users] SVG backend fails with locale change

2008-08-26 Thread Mathieu Leplatre
On Mon, Aug 25, 2008 at 7:17 PM, Michael Droettboom <[EMAIL PROTECTED]> wrote:
> Thanks for spotting this.  I don't think a lot of us ever use non-English
> locales, so that's fallen through the cracks.
>
> backend_svg.py was using '%s' to convert floats, to limit the number of
> digits written to the file.  This works fine with regular floats (since they
> do not follow the locale unless explicitly asked to do so), but numpy arrays
> seem to always follow the locale.  (Not certain whether that inconsistency
> could be considered a bug in Numpy).
>
> In any case, I've committed a workaround to matplotlib, which unfortunately
> results in slightly larger SVG files.  This is now fixed in SVN r6049.  Look
> there for a patch if you just want to fix your local backend_svg.py.
>
Thanks for your lightspeed fix submit ! I patched it and it works fine.
Mathieu.

> Cheers,
> Mike
>
> Mathieu Leplatre wrote:
>>
>> Hi,
>>
>> If I change the locale using cairo backend, the result is fine.
>> But with SVG backend, every objects collapse on top-left corner.
>>
>> As you can see here :
>> http://mathieu-leplatre.info/media/matplotlib-svg/localechange-svg.svg
>>
>> I exported it to png with inkscape to reveal objects outside of frame :
>> http://mathieu-leplatre.info/media/matplotlib-svg/localechange-svg.png
>>
>> Cairo output is fine :
>> http://mathieu-leplatre.info/media/matplotlib-svg/localechange-cairo.svg
>>
>> I guess it's not a unicode problem, since the strings have no
>> non-ascii characters.
>>
>> The code is quite straightforward, it allows me to choose the date
>> language for the formatters.
>> Let me know if I should fill a bug report.
>> Thank you all !
>>
>> 
>> import locale, matplotlib
>> from datetime import datetime
>> matplotlib.use('svg')
>> import pylab, numpy
>>
>> locale.setlocale(locale.LC_ALL, 'fr_FR.UTF-8')
>> today = datetime.today().strftime("%A")
>>
>> pylab.title( today )
>> pylab.plot( range(10), numpy.random.randn( 10 ))
>> pylab.savefig('localechange-%s' % matplotlib.get_backend())
>> 
>>
>> -
>> 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
>>
>
> --
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
>
>

-
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] tick line formatting

2008-08-26 Thread Uri Laserson
Hi,

Is it possible to create tick marks that go outwards (i.e., point towards
the label) rather than inwards?

Thanks!
Uri


-- 
Uri Laserson
PhD Candidate, Biomedical Engineering
Harvard Medical School (Genetics)
Massachusetts Institute of Technology (Mathematics)
phone +1 917 742 8019
[EMAIL PROTECTED]
-
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] axis formatting

2008-08-26 Thread Uri Laserson
Hi,

Is it possible to create plots that only have a single x-axis on the bottom
and a single y-axis on the left, while suppressing an upper or right axis
(i.e., have the graph be "open")?

Thanks!
Uri


-- 
Uri Laserson
PhD Candidate, Biomedical Engineering
Harvard Medical School (Genetics)
Massachusetts Institute of Technology (Mathematics)
phone +1 917 742 8019
[EMAIL PROTECTED]
-
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] set font and color problem

2008-08-26 Thread sa6113

Dear All,
how can I set more color and font for my plot, as I know matplotlib just
supporte 8 color strings and five fonts.
Is there any way to extend it for all color and font from system ?
has every one any useful code about that?
Thanks
-- 
View this message in context: 
http://www.nabble.com/set-font-and-color-problem-tp19175632p19175632.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


-
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