Ask Your Question

Modifying x-axis/y-axis with plotting

asked 2015-10-27 11:31:50 +0200

sagenibble gravatar image


I have been looking at the sage documentation, particularly at the plot function:

I notice that in the examples they have a means of restricting the x values, like so:

plot(x^2, (x, 0, 10))

However, I can't seem to find any documentation on this feature. The function definition for the plot function does not many any mention of being able to do this, so it follows that I am not entirely sure what exactly I can do with this feature..

Can someone be of assistance in helping me figure out where this is document, if anywhere?

Additionally, is there a way then to modify the scale of the x/y axis with the plot function, or modify the steps between displayed values?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2015-10-27 15:01:40 +0200

kcrisman gravatar image

You may find this tutorial slightly more helpful. But you're right that this is not explicitly stated in the plot documentation as such. I've opened Ticket 19486 for this issue. Note that historically plotting was carried out through

sage: X = something()
sage: plot(X)
sage: X.plot()

where the latter two commands were the same, e.g. for symbolic expressions, though even there this syntax is just assumed by example.

edit flag offensive delete link more

answered 2015-10-27 13:29:49 +0200

slelievre gravatar image


sage: plot?

gives you the documentation for plot.

One of the first paragraphs in that documentation says

Type "plot.options" for a dictionary of the default options for
plots. You can change this to change the defaults for all future
plots. Use "plot.reset()" to reset to the default options.

Also, if you do

sage: p = plot(x^2, (x,0,1))

and then

sage: p?

you will get more information about Graphics objects, including how to get log scale on the axes etc.

edit flag offensive delete link more

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: 2015-10-27 11:31:50 +0200

Seen: 1,132 times

Last updated: Oct 27 '15