Ask Your Question
2

How do i change the x and y steps of an plot?

asked 2018-11-11 15:03:26 +0100

neory gravatar image

updated 2018-11-11 16:54:38 +0100

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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2018-11-11 15:56:49 +0100

tmonteil gravatar image

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?

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.

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

1 follower

Stats

Asked: 2018-11-11 15:03:26 +0100

Seen: 941 times

Last updated: Nov 11 '18