2
$\begingroup$

I want to do a MatrixPlot and set the ticks to be from $-1$ to $1$ for both axes. Here in this (post Specify and rename ticks in FrameTicks) it is said FrameTicks work in this way

FrameTicks -> {{leftYTicks, rightYTicks}, {bottomXTicks, topXTicks}}

But when I try to do it using the following command

MatrixPlot[{{1, 0.316287, 0.0926149}, {0.0382826, 0.60648, 
   0.115326}, {0.136868, 0.511539, 0.135918}}, 
 FrameTicks -> {{{-1, 0, 1}, None}, {{-1, 0, 1}, None}}]

I get the plot below. Why it doesn't work properly? enter image description here

$\endgroup$

1 Answer 1

5
$\begingroup$

The coordinates 0 and –1 are not visible in the plot because they lie outside the plot. What you want is to set the labels –1, 0, 1 at the coordinates 1, 2, 3.

ticks = Transpose[{Range[3], Range[-1, 1]}]

(* {{1, -1}, {2, 0}, {3, 1}} *)

MatrixPlot[{{1, 0.316287, 0.0926149}, {0.0382826, 0.60648, 
   0.115326}, {0.136868, 0.511539, 0.135918}}, 
 FrameTicks -> {{ticks, None}, {ticks, None}}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.