On Dec 28, 2007 4:38 PM, William Stein <[EMAIL PROTECTED]> wrote:
>
>
> On Dec 27, 2007 8:35 AM, David Joyner <[EMAIL PROTECTED]> wrote:
> >
> > On Dec 27, 2007 12:45 AM, William Stein <[EMAIL PROTECTED]> wrote:
> > > On Dec 26, 2007 10:19 PM, David Joyner <[EMAIL PROTECTED]> wrote:
> >
> > >
> > > > I'm thinking of adding matplotlib and jmol to the history and completely
> > > > rewriting the graphics section. Thoughts?
> > >
> > > Yes, please do.   Definitely add how to use pylab as well, i.e., do
> > >   sage: import pylab
> > >   sage: pylab.[tab key]
> > > to get Matlab-like graphics.  Make sure people realize the issues
> > > with Sage types versus floats, etc.
> >
> >
> > I cannot get one example of pylab from
> > http://matplotlib.sourceforge.net/screenshots.html
> > to work on the sage command line (including the first one, which
> > is I think included in the sage ref manual).
> >
> > However, from the python command line, the pie chart
> > example works great:
> >
> > from pylab import *
> > # make a square figure and axes
> > figure(1, figsize=(8,8))
> > ax = axes([0.1, 0.1, 0.8, 0.8])
> > labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
> > fracs = [15,30,45, 10]
> > figure(1)
> > pie(fracs, labels=labels)
> > # figure(2) showa some optional features.  autopct is used to label
> > # the percentage of the pie, and can be a format string or a function
> > # which takes a percentage and returns a string.  explode is a
> > # len(fracs) sequuence which gives the fraction of the radius to
> > # offset that slice.
> > figure(2, figsize=(8,8))
> > explode=(0, 0.05, 0, 0)
> > pie(fracs, explode=explode, labels=labels, autopct='%1.1f%%', shadow=True)
> > savefig('/home/wdj/pie_demo')
> >
> > Do you see what I'm doing wrong here?
>
> I just pasted that in exactly in Sage at the command line and it worked
> fine.  Above you say "it doesn't work".  What is the error?!!

The errors below were the same on both an ubuntu 64bit machine and
an intel macbook.


----------------------------------------------------------------------
| SAGE Version 2.9.1.1, Release Date: 2007-12-25                     |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
sage: from pylab import *
sage: # make a square figure and axes
sage: figure(1, figsize=(8,8))
<matplotlib.figure.Figure instance at 0x3991758>
sage: ax = axes([0.1, 0.1, 0.8, 0.8])
sage: labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
sage: fracs = [15,30,45, 10]
sage: figure(1)
<matplotlib.figure.Figure instance at 0x3991758>
sage: pie(fracs, labels=labels)

([<matplotlib.patches.Wedge instance at 0x3a32a70>,
  <matplotlib.patches.Wedge instance at 0x3a32b90>,
  <matplotlib.patches.Wedge instance at 0x3a32cf8>,
  <matplotlib.patches.Wedge instance at 0x3a32e60>],
 [<matplotlib.text.Text instance at 0x3a32b00>,
  <matplotlib.text.Text instance at 0x3a32c68>,
  <matplotlib.text.Text instance at 0x3a32dd0>,
  <matplotlib.text.Text instance at 0x3a32f38>])
sage: # figure(2) showa some optional features.  autopct is used to label
sage: # the percentage of the pie, and can be a format string or a function
sage: # which takes a percentage and returns a string.  explode is a
sage: # len(fracs) sequuence which gives the fraction of the radius to
sage: # offset that slice.
sage: figure(2, figsize=(8,8))
<matplotlib.figure.Figure instance at 0x3a340e0>
sage: explode=(0, 0.05, 0, 0)
sage: pie(fracs, explode=explode, labels=labels, autopct='%1.1f%%', shadow=True)
---------------------------------------------------------------------------
<type 'exceptions.TypeError'>             Traceback (most recent call last)

/mnt/drive_hda1/sagefiles/sage-2.8.13.alpha1/<ipython console> in <module>()

/home/wdj/wdj/sagefiles/sage-2.8.13.alpha1/local/lib/python2.5/site-packages/matplotlib/pyplot.py
in pie(*args, **kwargs)
   1757         hold(h)
   1758     try:
-> 1759         ret =  gca().pie(*args, **kwargs)
   1760         draw_if_interactive()
   1761     except:

/home/wdj/wdj/sagefiles/sage-2.8.13.alpha1/local/lib/python2.5/site-packages/matplotlib/axes.py
in pie(self, x, explode, labels, colors, autopct, pctdistance, shadow,
labeldistance)
   3535                       facecolor=colors[i%len(colors)])
   3536             slices.append(w)
-> 3537             self.add_patch(w)
   3538             w.set_label(label)
   3539

/home/wdj/wdj/sagefiles/sage-2.8.13.alpha1/local/lib/python2.5/site-packages/matplotlib/axes.py
in add_patch(self, p)
   1143         self._set_artist_props(p)
   1144         p.set_clip_box(self.bbox)
-> 1145         self._update_patch_limits(p)
   1146         self.patches.append(p)
   1147         p._remove_method = lambda h: self.patches.remove(h)

/home/wdj/wdj/sagefiles/sage-2.8.13.alpha1/local/lib/python2.5/site-packages/matplotlib/axes.py
in _update_patch_limits(self, p)
   1151         xys = self._get_verts_in_data_coords(
   1152             p.get_transform(), p.get_verts())
-> 1153         self.update_datalim(xys)
   1154
   1155

/home/wdj/wdj/sagefiles/sage-2.8.13.alpha1/local/lib/python2.5/site-packages/matplotlib/axes.py
in update_datalim(self, xys)
   1178
   1179
-> 1180         self.dataLim.update_numerix_xy(xys, -1)
   1181
   1182

<type 'exceptions.TypeError'>: Bbox::update_numerix_xy expected numerix array
sage: savefig('/home/wdj/pie_demo')
sage:



>
>
> william
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to