Hi, I have an idea using ImageMagic. In terminal: $ convert -resize x350 file.png file2.png
In notebook: from IPython.display import display, Image display(Image('/path/to/directory/file2.png')) Would you please show me how to do "convert -resize x350 file.png file2.png" in notebook ? I usually input the following. $ sage -ipython notebook from sage.all import * ... Thanks, Y. Sato 2014年9月29日月曜日 11時47分19秒 UTC+9 sat...@gmail.com: > > Hi, > > I made an example. > > from IPython.display import display, Image > x = var('x') > plot(sin(x), 0, 2*pi, figsize= 4).save('/path/to/directory/file.png') > display(Image('/path/to/directory/file.png')) > > Thanks. > y. Sato > On Sunday, September 28, 2014 11:57:52 AM UTC+9, P Purkayastha wrote: >> >> You can use the "figsize" keyword to resize your image. See this: >> >> http://www.sagemath.org/doc/reference/plotting/sage/plot/graphics.html#sage.plot.graphics.Graphics.show >> >> More examples can be found in the plot() documentation: >> >> http://www.sagemath.org/doc/reference/plotting/sage/plot/plot.html#sage.plot.plot.plot >> >> On Friday, September 26, 2014 11:04:45 AM UTC+8, sat...@gmail.com wrote: >>> >>> Hello, >>> >>> Would you teach me how to change image size ? >>> >>> Thanks! >>> >> > >> Yoshihiro Sato >>> >>> On Thursday, June 6, 2013 4:18:54 PM UTC+9, Jose Guzman wrote: >>>> >>>> This was a very good idea! >>>> >>>> Now I generate the plots as you mentioned: >>>> >>>> The trick was to use IPython.display to take the png files. Like this: >>>> >>>> >>>> x = var('x') >>>> plot(sin(x), 0, 2*pi).save('/path/to/directory/file.png') >>>> from IPython.display import display, Image >>>> display(Image('/path/to/directory/file.png')) >>>> >>>> On Sunday, June 2, 2013 11:34:06 AM UTC+2, P Purkayastha wrote: >>>>> >>>>> 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. For more options, visit https://groups.google.com/d/optout.