Ask Your Question
1

Tick labels in a matrix plot

asked 2016-01-13 04:37:55 -0500

I want to plot the following matrix m with k and l in {-2, ..., 2}:

m = [[k+l for k in range(-2,3)] for l in range(-2,3)]

with matrix_plot:

m_plot = matrix_plot(m, origin='lower')

The ticks on both axes are automatically set to {0 , ... , 5}, but I want the ticks to be {-2, -1, 0, 1, 2} on both axes. I could not figure out how to do this.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
1

answered 2016-01-13 05:12:58 -0500

Hello,

You could use the option ticks and tick_formatter as follows

sage: matrix_plot(m, ticks=[[0,1,2,3,4],[0,1,2,3,4]], tick_formatter=[[-2,-1,0,1,2],[-2,-1,0,1,2]])

These are documented in the function plot and you can access the help with

sage: 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: 2016-01-13 04:37:55 -0500

Seen: 198 times

Last updated: Jan 13 '16