Mover las marcas x o y en Matplotlib hacia arriba

I have a numpy array with random values. I have plotted the values in the array using imshow() so that each element shows as a grey-scale square. The problem is that the labels (0, 1, 2 etc) start at the bottom corner. I would like to move them along a bit so they are centred underneath each square. Is there a straight-forward way of doing this?

preguntado el 31 de julio de 12 a las 13:07

1 Respuestas

Acabo de encontrar http://matplotlib.sourceforge.net/examples/pylab_examples/image_interp.html and the most straightforward way is just to have grid(True) ->woohoo!

Respondido 31 Jul 12, 13:07

grid(True) has nothing to do with changing the labels. By default imagesc put labels at the center of each square. - imsc

@imsc You are probably right as I don't know Matplotlib well at all. But for what I'm doing, having grid(True) moved the labels along and saved me having to faff about too much. - WOT

Can you post your code/image with grid(True) and grid(False). As far as I know grid is not suppose to move the label. Anyway, it will help others who may face the same problem. - imsc

@imsc the weirdest thing, now my labels are dead-centre under the cells, regardless of grid(True). They seem to have fixed themselves and display in the centre. - WOT

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.