sageplot seems broken with sage 5.12

50 views
Skip to first unread message

pong

unread,
Nov 11, 2013, 3:34:40 PM11/11/13
to sage-s...@googlegroups.com
I have just re-run on an old latex file which uses sageplot. It seems to be broken.

However, the exact same codes (which I attached) work with sage 5.9 on another machine.

The problem does not seem to be coming from sagetex.sty since they are exactly the same on both machines.

Any fix or get around to the problem?

-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Processing Sage code for testplot.tex...
Code block begin...end
Initializing plots directory
Plot 0
**** Error in Sage code on line 10 of testplot.tex! Traceback follows.
Traceback (most recent call last):
  File "testplot.sagetex.py", line 15, in <module>
    _st_.plot(_sage_const_0 , format='notprovided', _p_=G.plot(),figsize=[_sage_const_3 ,_sage_const_3 ])
  File "/opt/sage/local/lib/python2.7/site-packages/sagetex.py", line 252, in plot
    _p_.save(filename=plotfilename, **kwargs)
  File "/opt/sage/local/lib/python2.7/site-packages/sage/misc/decorators.py", line 458, in wrapper
    return func(*args, **kwds)
  File "/opt/sage/local/lib/python2.7/site-packages/sage/plot/graphics.py", line 2732, in save
    transparent=transparent)
  File "/opt/sage/local/lib/python2.7/site-packages/matplotlib/figure.py", line 1370, in savefig
    self.canvas.print_figure(*args, **kwargs)
  File "/opt/sage/local/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 2055, in print_figure
    **kwargs)
  File "/opt/sage/local/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 1848, in print_pdf
    return pdf.print_pdf(*args, **kwargs)
  File "/opt/sage/local/lib/python2.7/site-packages/matplotlib/backends/backend_pdf.py", line 2301, in print_pdf
    self.figure.draw(renderer)
  File "/opt/sage/local/lib/python2.7/site-packages/matplotlib/artist.py", line 54, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/opt/sage/local/lib/python2.7/site-packages/matplotlib/figure.py", line 1006, in draw
    func(*args)
  File "/opt/sage/local/lib/python2.7/site-packages/matplotlib/artist.py", line 54, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/opt/sage/local/lib/python2.7/site-packages/matplotlib/axes.py", line 2086, in draw
    a.draw(renderer)
  File "/opt/sage/local/lib/python2.7/site-packages/matplotlib/artist.py", line 54, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/opt/sage/local/lib/python2.7/site-packages/matplotlib/collections.py", line 695, in draw
    return Collection.draw(self, renderer)
  File "/opt/sage/local/lib/python2.7/site-packages/matplotlib/artist.py", line 54, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/opt/sage/local/lib/python2.7/site-packages/matplotlib/collections.py", line 259, in draw
    self._offset_position)
  File "/opt/sage/local/lib/python2.7/site-packages/matplotlib/backends/backend_pdf.py", line 1548, in draw_path_collection
    output(*self.gc.pop())
  File "/opt/sage/local/lib/python2.7/site-packages/matplotlib/backends/backend_pdf.py", line 2093, in pop
    assert self.parent is not None
AssertionError
**** Running Sage on testplot.sage failed! Fix testplot.tex and try again.

testplot.tex

kcrisman

unread,
Nov 11, 2013, 8:25:06 PM11/11/13
to sage-s...@googlegroups.com
Hi Pong,

Huh, that is weird.    I wonder if perhaps the syntax/meaning of graph plotting changed somewhat recently? At any rate I can confirm the same problem.  It does seem to work at the command line.

William Stein

unread,
Nov 11, 2013, 10:06:01 PM11/11/13
to sage-support
On Mon, Nov 11, 2013 at 5:25 PM, kcrisman <kcri...@gmail.com> wrote:
> Hi Pong,
>
> Huh, that is weird. I wonder if perhaps the syntax/meaning of graph
> plotting changed somewhat recently? At any rate I can confirm the same
> problem. It does seem to work at the command line.

No it doesn't. This is just a straight bug in Sage (more precisely,
in Matplotlib I think) which sagetex reveals. As Pong points out, it
has nothing to do with sagetex itself. Try this:

L = {0:[1,2,5,6], 1:[2,4,6], 3:[2,4,5,6], 4:[2,5], 5:[6]};
G = Graph(L)
p = G.plot()
p.save('a.pdf')

# BOOM!

-- william
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support...@googlegroups.com.
> To post to this group, send email to sage-s...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/groups/opt_out.



--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

Wai Yan Pong

unread,
Nov 12, 2013, 1:13:43 PM11/12/13
to sage-s...@googlegroups.com
Thank you for all the replies. I tried saving some plots as pdf on my system Matplotlib (1.3.1), it seems to work. If, as William said, it's a problem of Matplotlib, can someone reproduce that error? And report the bug upstream? I know very little about Matplotlib to be honest.

Meanwhile, is there any work around? I'm in the middle of writing a graph theory test... many of you can imagine how frustrated if sageplot does not work.



--
You received this message because you are subscribed to a topic in the Google Groups "sage-support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-support/-U8mbMsXAU8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-support...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages