Ask Your Question

Define range of y axis, instead of just x axis?

asked 2013-06-21 11:08:56 -0500

anonymous user


updated 2015-01-14 02:52:04 -0500

FrédéricC gravatar image

I was able to successfully define & display a graph of a linear equation, with the following statement:

plot(2*x+1, (-5,5))

The (-5, 5), successfully specifies an x axis range; but i haven't found any success in being able to explicitly define the range of the y axis.

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted

answered 2013-06-21 11:32:04 -0500

kcrisman gravatar image
plot(2*x+1, (x,-5,5),ymin=1,ymax=5)

is the preferred syntax.

edit flag offensive delete link more


plot(2*x+1, (-5,5),ymin=-4,ymax=4) This worked, thanks. What if the given the function: y^2 = x How would 1 plot it? I was able to do: plot(sqrt(x)) But as you know, one can't find the sqrts of negative number; so only the top half of the graph was displayed. The bottom half wasn't displayed :

bxdin gravatar imagebxdin ( 2013-06-21 11:50:08 -0500 )edit

Your best option here is to use `implicit_plot`. Try `implicit_plot(y^2==x,(x,-5,5),(y,-5,5))`.

calc314 gravatar imagecalc314 ( 2013-06-21 16:15:41 -0500 )edit

y^2 =x is not a function; it fails the vertical line test. You could also try A=plot(sqrt(x),(x,0,1)) B=plot(-sqrt(x),(x,0,1)) show(A+B,xmin=-1,xmax=1)

dazedANDconfused gravatar imagedazedANDconfused ( 2013-06-21 16:19:32 -0500 )edit

Or you could do `var('y'); plot(y^2,(y,-5,5),axes_labels=['$y$','$x$'])` if you wanted to be tricky - see [this link](

kcrisman gravatar imagekcrisman ( 2013-06-24 08:37:44 -0500 )edit

answered 2013-06-21 11:37:07 -0500

ndomes gravatar image
plot(2*x+1, (-5,5),ymin=-4,ymax=4)



doesn't show the options ymin, ymax, but some examples do.

You can look for the options:


P = plot(2*x+1)

Then type


and hit the tab key

edit flag offensive delete link more


This is because ymin, ymax are actually an option to show(). The documentation in plot() links to the documentation of show() for this and many other options. It also mentions ymin/ymax explicitly in a special "Note" section.

ppurka gravatar imageppurka ( 2013-06-22 05:55:10 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-06-21 11:08:56 -0500

Seen: 1,416 times

Last updated: Jun 21 '13