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).

sage: r.hist(st,r.seq(1.2,3.7,0.02),main="SAGE HNF Histogram",col="lightblue",
....: prob=True, xlab="seconds")
---------------------------------------------------------------------------
<class 'rpy.RPy_RException'>              Traceback (most recent call last)

/Users/was/edu/2007-2008/sage/<ipython console> in <module>()

<class 'rpy.RPy_RException'>: Error in hist.default(c(0.859615,
0.815768, 0.78896, 0.805914999999999,  :
  some 'x' not counted; maybe 'breaks' do not span range of 'x'

sage: r.lines(r.density(st,bw=0.05),col="black")
---------------------------------------------------------------------------
<class 'rpy.RPy_RException'>              Traceback (most recent call last)

/Users/was/edu/2007-2008/sage/<ipython console> in <module>()

<class 'rpy.RPy_RException'>: Error in plot.xy(xy.coords(x, y), type =
type, ...) :
  plot.new has not been called yet

sage: r.rug(st)
Warning message:
In function (x, ticksize = 0.03, side = 1, lwd = 0.5, col = par("fg"),  :
  some values will be clipped
---------------------------------------------------------------------------
<class 'rpy.RPy_RException'>              Traceback (most recent call last)

/Users/was/edu/2007-2008/sage/<ipython console> in <module>()

<class 'rpy.RPy_RException'>: Error in axis(side = side, at = at,
labels = labels, ...) :
  plot.new has not been called yet

sage: r.dev_off()
{'null device': 1}

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
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