Specifying ranges for x and y in plot()

4 views
Skip to first unread message

Greg Landweber

unread,
Feb 4, 2008, 1:24:55 PM2/4/08
to sage-...@googlegroups.com
I am trying to control the range of values for x and y in a plot.
According to plot?, I should be able to specify xmin, xmax, ymin, ymax
as in:

plot(sin,(0,1),ymin=-2,ymax=2)

However, plot does not recognize any of these additional parameters, giving me:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/greg/.sage/sage_notebook/worksheets/admin/3/code/51.py",
line 4, in <module>
plot(sin,(Integer(0),Integer(1)),ymin=-Integer(2),ymax=Integer(2))
File "/Applications/sage/local/lib/python2.5/site-packages/sympy/plotting/",
line 1, in <module>
File "sage_object.pyx", line 92, in
sage.structure.sage_object.SageObject.__repr__
File "/Applications/sage/local/lib/python2.5/site-packages/sympy/plotting/plot.py",
line 476, in _repr_
File "/Applications/sage/local/lib/python2.5/site-packages/sympy/plotting/plot.py",
line 721, in show
File "/Applications/sage/local/lib/python2.5/site-packages/sympy/plotting/plot.py",
line 837, in save
File "/Applications/sage/local/lib/python2.5/site-packages/sympy/plotting/plot.py",
line 1050, in _render_on_subplot
File "/Users/was/build/sage-2.10/local/lib/python2.5/site-packages/matplotlib/lines.py",
line 279, in __init__
File "/Users/was/build/sage-2.10/local/lib/python2.5/site-packages/matplotlib/artist.py",
line 394, in update
AttributeError: Unknown property ymin

Also, when I try:

plot(sin,(0,1))

for some reason the x axis ranges from -1 to +1, while its plots x
from 0 to 1 as expected.

Thanks for the help!

-- Greg

William Stein

unread,
Feb 4, 2008, 2:01:11 PM2/4/08
to sage-...@googlegroups.com
> Thanks for the help.

Do

plot(whaterver).show(xmin=0, xmax=1, ymin=0, ymax=1)

William

Simon King

unread,
Feb 4, 2008, 4:36:35 PM2/4/08
to sage-newbie
Dear Sage team,

On 4 Feb., 20:01, "William Stein" <wst...@gmail.com> wrote:
> On Feb 4, 2008 10:24 AM, Greg Landweber <greg.landwe...@gmail.com> wrote:
> > I am trying to control the range of values for x and y in a plot.
> > According to plot?, I should be able to specify xmin, xmax, ymin, ymax
> > as in:
>
> > plot(sin,(0,1),ymin=-2,ymax=2)
<snip>
> Do
>
>   plot(whaterver).show(xmin=0, xmax=1, ymin=0, ymax=1)
>

This means, xmax etc is *not* an option of plot but an option of the
show-method of a Graphics object created by plot, isn't it? In
contrast to, e.g., plot_points, which, according to the examples after
"plot?", has a meaning to the plot object itself?

If this is true then i think it is misleading to list xmax after "PLOT
OPTIONS", and i suggest:
- start "plot?" with a description on how to create a Graphics object
by "plot" (this is what "plot?" tells now), but make clear that this
only concerns *creation* but not *display* of a plot. In particular,
here one should only provide options that are relevant for creation of
the plot.
- end "plot?" by providing informations on how to display the Graphics
object created by plot. This should either be a pointer to or a copy
of the informations provided by "Graphics.show?". Here, the display
options "xmax" etc are to be listed.

Yours
Simon
Reply all
Reply to author
Forward
0 new messages