ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 27 Oct 2015 15:01:40 +0100Modifying x-axis/y-axis with plottinghttps://ask.sagemath.org/question/30291/modifying-x-axisy-axis-with-plotting/Hello,
I have been looking at the sage documentation, particularly at the plot function:
http://doc.sagemath.org/html/en/reference/plotting/sage/plot/plot.html#sage.plot.plot.plot
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?Tue, 27 Oct 2015 11:31:50 +0100https://ask.sagemath.org/question/30291/modifying-x-axisy-axis-with-plotting/Answer by slelievre for <p>Hello,</p>
<p>I have been looking at the sage documentation, particularly at the plot function:
<a href="http://doc.sagemath.org/html/en/reference/plotting/sage/plot/plot.html#sage.plot.plot.plot">http://doc.sagemath.org/html/en/refer...</a> </p>
<p>I notice that in the examples they have a means of restricting the x values, like so:</p>
<pre><code>plot(x^2, (x, 0, 10))
</code></pre>
<p>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..</p>
<p>Can someone be of assistance in helping me figure out where this is document, if anywhere?</p>
<p>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?</p>
https://ask.sagemath.org/question/30291/modifying-x-axisy-axis-with-plotting/?answer=30293#post-id-30293Typing
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.
Tue, 27 Oct 2015 13:29:49 +0100https://ask.sagemath.org/question/30291/modifying-x-axisy-axis-with-plotting/?answer=30293#post-id-30293Answer by kcrisman for <p>Hello,</p>
<p>I have been looking at the sage documentation, particularly at the plot function:
<a href="http://doc.sagemath.org/html/en/reference/plotting/sage/plot/plot.html#sage.plot.plot.plot">http://doc.sagemath.org/html/en/refer...</a> </p>
<p>I notice that in the examples they have a means of restricting the x values, like so:</p>
<pre><code>plot(x^2, (x, 0, 10))
</code></pre>
<p>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..</p>
<p>Can someone be of assistance in helping me figure out where this is document, if anywhere?</p>
<p>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?</p>
https://ask.sagemath.org/question/30291/modifying-x-axisy-axis-with-plotting/?answer=30294#post-id-30294You may find [this tutorial](http://doc.sagemath.org/html/en/prep/Symbolics-and-Basic-Plotting.html#basic-2d-plotting) slightly more helpful. But you're right that this is not explicitly stated in the plot documentation as such. I've opened [Ticket 19486](http://trac.sagemath.org/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](http://doc.sagemath.org/html/en/reference/calculus/sage/symbolic/expression.html#sage.symbolic.expression.Expression.plot), though even there this syntax is just assumed by example.Tue, 27 Oct 2015 15:01:40 +0100https://ask.sagemath.org/question/30291/modifying-x-axisy-axis-with-plotting/?answer=30294#post-id-30294