# 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)

edit retag close merge delete

Sort by ยป oldest newest most voted

The documentation of plotting options is indeed cumbersome and hard to track. As you can see in the doc of the plot function:

sage: plot?


 * For the other keyword options that the "plot" function can
take, refer to the method "show()" and the further options
below.


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.

more