In Sage the plots appear "inline", but the plots are saved as files in a 
directory structure within the working worksheet directory. From my reading 
here:
http://ipython.org/ipython-doc/dev/interactive/htmlnotebook.html#the-notebook-format
it appears that the ipython notebook saves everything inside a single json 
file, which is probably also how one gets everything "inline". I am just 
thinking out loud; not sure if this is exactly how it works - but it does 
look like it is not compatible with how the Sage plots work.

There are two possible solutions:
1. Find out how matplotlib plots are handled. They must be saved in some 
directory as png files before they are displayed in the ipython notebook. 
If you can find that directory, then give that path along with a file name 
to the Sage's plot command, like this:

plot(x).save('/path/to/directory/file.png')


2. Use Sage to plot, but at the last step, take the matplotlib Figure 
object out of sage. Then use some direct matplotlib calls to show this 
figure (I don't know exactly what they should be), like this:

p = plot(x) + plot(x^2) + list_plot(range(5))
pm = p.matplotlib(<pass other options as you see fit>) # This is a 
matplotlib Figure object
from matplotlib import pyplot as plt
# Some matplotlib commands which can incorporate this Figure object into 
the plt object
plt.show()


On Friday, May 31, 2013 9:41:34 PM UTC+8, Jose Guzman wrote:
>
> Hi everyboydy! 
>
>
> Is there any way to display Sage plots in inline mode? I've tried sage 
> ipython notebook -pylab=inline but It did not work. 
>
>
> Declaring %pylab inline does not help, for example: 
>
>  >>> from sage.all import* 
>  >>> t = var('t') 
>  >>> plot(sin(t), 0, 2*pi) 
>
> n _plot_args(self, tup, kwargs) 
>      290             tup = tup[:-1] 
>      291         elif len(tup) == 3: 
> --> 292             raise ValueError('third arg must be a format string') 
>      293         else: 
>      294             linestyle, marker, color = None, None, None 
>
> ValueError: third arg must be a format string 
>
> Thanks! 
>
> Jose 
>
> -- 
> Jose Guzman 
> http://www.ist.ac.at/~jguzman/ 
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to