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.Sun, 11 Nov 2018 15:56:49 +0100How do i change the x and y steps of an plot?https://ask.sagemath.org/question/44237/how-do-i-change-the-x-and-y-steps-of-an-plot/So i want a coordinate system that has different steps for example.
i have this
plot(-1/2*x+1,(x,-2, 8), rgbcolor=('#00c147')) #h1
how can i change the steps at the x-axis, at the moment it prints the numbers at {-2,2,4,6,8}
and i want it to be {-2,-1,0,1,2,3,4,5,6,7,8}
how can i customize those steps at the x and y-axis and how can i make it printable that for example 1 step has the distance of 0.5cm+0.5cm on a plain A4 paper.
at the moment 1 is at 1.5cm, 2 at 3cm EDIT:(nvm the printer had the wrong settings)Sun, 11 Nov 2018 15:03:26 +0100https://ask.sagemath.org/question/44237/how-do-i-change-the-x-and-y-steps-of-an-plot/Answer by tmonteil for <p>So i want a coordinate system that has different steps for example.</p>
<p>i have this</p>
<pre><code>plot(-1/2*x+1,(x,-2, 8), rgbcolor=('#00c147')) #h1
</code></pre>
<p>how can i change the steps at the x-axis, at the moment it prints the numbers at {-2,2,4,6,8}
and i want it to be {-2,-1,0,1,2,3,4,5,6,7,8}</p>
<p>how can i customize those steps at the x and y-axis and how can i make it printable that for example 1 step has the distance of 0.5cm+0.5cm on a plain A4 paper.</p>
<p>at the moment 1 is at 1.5cm, 2 at 3cm EDIT:(nvm the printer had the wrong settings)</p>
https://ask.sagemath.org/question/44237/how-do-i-change-the-x-and-y-steps-of-an-plot/?answer=44239#post-id-44239The documentation of plotting options is indeed cumbersome and hard to track. As you can see in the doc of the plot function:
sage: plot?
You can read:
* For the other keyword options that the "plot" function can
take, refer to the method "show()" and the further options
below.
So, you can access to more options by doing:
sage: p = plot(-1/2*x+1,(x,-2, 8), rgbcolor=('#00c147'))
sage: p.show?
Then you will read how to use a `ticks` option, so that at the end, you can do something like:
sage: plot(-1/2*x+1,(x,-2, 8), rgbcolor=('#00c147'), ticks=(range(-2,9),range(-3,3)))
There are many more options. In particular, you can see how to pass most `matplotlib` tricks to tune your plot.
Sun, 11 Nov 2018 15:56:49 +0100https://ask.sagemath.org/question/44237/how-do-i-change-the-x-and-y-steps-of-an-plot/?answer=44239#post-id-44239