On Jan 23, 2008, at 6:08 PM, William Stein wrote:

> On Jan 23, 2008 6:00 PM, Robert Bradshaw  
> <[EMAIL PROTECTED]> wrote:
>>
>> On Jan 23, 2008, at 5:53 PM, Jason Grout wrote:
>>
>>> Hi everyone,
>>>
>>> What is the difference between x.plot() and x.show() for an  
>>> object x?
>>> For that matter, what about view()?  Of course, right now it
>>> depends on
>>> the object, but what is the general guideline?
>>>
>>> I'm refactoring a patch that rlm just posted that adds show(list of
>>> graphs) functionality to show.  I'm making it so that show(list of
>>> anything) recursively plots the items of the list and displays a  
>>> tiled
>>> array of the item plots.  However, I don't know how to generically
>>> plot
>>> an item and get the graphic output without displaying that plot.  I
>>> can
>>> do [i.plot() for i in list], but what about objects that don't  
>>> have a
>>> plot function, but do have a show() function?
>>
>> x.plot() returns a plot object, which can be stored, composed with
>> other plot objects, etc. x.show() actually renders the plot and shows
>> it (e.g. in the notebook, or poping up the rendered .png, etc). Show
>> also produces non-plot data, e.g. latexing with jsmath for symbolic
>> expressions in the notebook. For instance, if E is an elliptic curve,
>> E.show() is a latexed representation, while E.plot() is a plot.
>>
>> Recently, the __str__ command of a plot object has been modified to
>> call self.show().
>
> Actually I modified the _repr_ method.  The __str__ method is as  
> before,
> so if you do
>   sage: print x.plot()
> you go something like
>    GraphicsObject ...

Sorry, I stand corrected... This is one case where I think __str__ !=  
__repr__ is good.

>> This is nice because one doesn't have to type
>>
>> x.plot().show()
>>
>> anymore, but does make things a bit more confusing, and it is a bit
>> unsettling that just printing an object starts up an external
>
> Indeed.  But I think it does make things a lot easier to just use,  
> and reduces
> a lot of unnecessary typing (and makes plotting work more like in
> Mathematica). Also new users who just want to learn graphics just
> have to learn a few plot commands, and they get lots out of that
> immediately; they don't have to learn both "plot" and "show", and
> exactly how to combine them just to get going.

Overall, I think it's a good move too.

>> program. I don't know about view, but I don't think that's very
>> standard.
>
> view and show were both on about equal footing nearly 3 years ago.
> There doesn't seem much of a point for view though.   view versus
> show was supposed to be something like $ ... $  versus $$ ... $$
> in latex.

So should we get rid of view then?

- Robert


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@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-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to