On Tuesday 25 March 2008, William Stein wrote:
> On Tue, Mar 25, 2008 at 6:44 AM, Martin Albrecht
>
> <[EMAIL PROTECTED]> wrote:
> >  This should be R's home base:
> >
> >  # first we compute some data
> >  b = 10
> >  st = []
> >  for i in range(500):
> >   A = random_matrix(ZZ,160,160, x=-2**b, y=2**b)
> >   t = cputime()
> >   E = A.echelon_form()
> >   st.append(cputime(t))
> >
> >  #now we plot a histogram using R
> >
> >  from rpy import r
> >
> >  r.png('histogram.png',width=640,height=480)
> >  r.hist(st,r.seq(1.2,3.7,0.02),main="SAGE HNF Histogram",col="lightblue",
> >  prob=True, xlab="seconds")
> >  r.lines(r.density(st,bw=0.05),col="black")
> >  r.rug(st)
> >  r.dev_off()
> >
> >  I hope that helps, pylab should also print histograms.
>
> On the other hand, please *don't* get really frustrated if the above
> doesn't work, since it does *not* work on OS X for me (R is still
> quite new in Sage and there are a lot of kinks).

Sorry, your computer is faster - my bad, try this:

r.png('histogram.png',width=640,height=480)
r.hist(st,main="SAGE HNF Histogram",col="lightblue",
prob=True, xlab="seconds")
r.lines(r.density(st,bw=0.05),col="black")
r.rug(st)
r.dev_off()

Note that the parameter r.seq() disappeared from r.hist. It tells hist how to 
print/sample (?) the data and I hardcoded a minimum of 1.2. Disclaimer: My R 
knowledge is completely represented in the last two lines so I might be 
talking nonsense about the effect of a sequence as the second parameter to 
r.hist.

Cheers,
Martin

-- 
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_www: http://www.informatik.uni-bremen.de/~malb
_jab: [EMAIL PROTECTED]


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to