Opened 5 years ago
Last modified 5 years ago
#17498 closed enhancement
Pictures in the doc through ".. plot::" directive — at Version 13
Reported by:  ncohen  Owned by:  

Priority:  major  Milestone:  sage6.5 
Component:  documentation  Keywords:  
Cc:  vbraun, vdelecroix, tmonteil, jmantysalo, fredrik.johansson  Merged in:  
Authors:  Nathann Cohen  Reviewers:  
Report Upstream:  N/A  Work issues:  
Branch:  public/17498 (Commits)  Commit:  8bbec182e0e68f4679dab359717fe92eb0388c5f 
Dependencies:  Stopgaps: 
Description (last modified by )
With this branch, one can use the ".. PLOT::" directive defined in matplotlib through Sphinx.
As it expects the picture to be defined as a matplotlib one, I added a small function called 'draw' that translates a Sage object into a matplotlib one through a temporary .png file (I know, I know...)
While it works as it is, it is probably not implemented as it should.
Soooo let us fix this and use that feature !
Nathann
Associated sagedevel thread at: https://groups.google.com/d/topic/sagedevel/JnuAAd7iH2g/discussion
Change History (13)
comment:1 Changed 5 years ago by
 Branch set to public/17498
 Status changed from new to needs_review
comment:2 Changed 5 years ago by
 Commit set to b5848d11328b1b785f54789ba9ccd7bc6d4cc981
comment:3 Changed 5 years ago by
 Description modified (diff)
comment:4 followups: ↓ 5 ↓ 10 Changed 5 years ago by
This should be automatic (show the output of Sage plot
commands in doctests), not manual.
comment:5 in reply to: ↑ 4 ; followup: ↓ 6 Changed 5 years ago by
This should be automatic (show the output of Sage
plot
commands in doctests), not manual.
True, though I do not know how to make it work. Can you ?
comment:6 in reply to: ↑ 5 Changed 5 years ago by
Replying to ncohen:
True, though I do not know how to make it work. Can you ?
No, I don't know anything about Sphinx. But perhaps somebody knows...
comment:7 followups: ↓ 8 ↓ 9 Changed 5 years ago by
Would be nice to have an easy way to put several images to an array. For example to have posets P
and Q
so that P.is_foo()
is true and Q.is_foo()
is false, or to show ordinal products P*Q
and Q*P
.
comment:8 in reply to: ↑ 7 Changed 5 years ago by
Would be nice to have an easy way to put several images to an array.
Also True, but this should not be sphinxrelated code: with this branch you can have in the doc "any picture that Sage can produce". Thus if you can produce in Sage a picture which is a combination of several pictures you can have it in the manual.
What you need is purely Sage code. This thing is only an interface between Sage and the .. PLOT::
directive defined in matplotlib.
Nathann
comment:9 in reply to: ↑ 7 Changed 5 years ago by
Replying to jmantysalo:
Would be nice to have an easy way to put several images to an array.
GraphicsArray
does that.
comment:10 in reply to: ↑ 4 Changed 5 years ago by
Replying to jdemeyer:
This should be automatic (show the output of Sage
plot
commands in doctests), not manual.
I guess these are two different things. In a thematic tutorial for examples, you might want to have some pictures without showing the actual commands that provide them at first.
comment:11 Changed 5 years ago by
At LMFDB, we convert Sage Plots P
to an encoded string here. Maybe it produces better results this way? We also use StringIO
instead of a temp file ... not sure if that makes sense here (in fact, I don't understand how the actual image ends up in the HTML anyways.)
comment:12 Changed 5 years ago by
 Commit changed from b5848d11328b1b785f54789ba9ccd7bc6d4cc981 to 8bbec182e0e68f4679dab359717fe92eb0388c5f
Branch pushed to git repo; I updated commit sha1. New commits:
8bbec18  trac #17498: No import, less margins

comment:13 Changed 5 years ago by
 Description modified (diff)
Branch pushed to git repo; I updated commit sha1. New commits:
trac #17498: Pictures in the doc through ".. plot::" directive