Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python: Matplotlib imshow shift xlabel numbers

Is it possible to shift the x and y axis label numbers for example +2 ? For example i have this image created, but i want that the label numbers begin with 2:

enter image description here

My code for this was :

jacaardMatrix = 1.662887377173091485e-01    3.432835820895522305e-01    3.568320278503046006e-01
5.065963060686015651e-02    3.160270880361173984e-01    3.374888691006233121e-01
3.093987157034442520e-02    1.802120141342756221e-01    1.748178980228928259e-01


fig2=plt.figure()  
plt.title("Radius and FRC Jacaard Values for Scoring System: "+str(i))
plt.xlabel('Radius')
plt.ylabel('FRC Size')
plt.imshow(jacaardMatrix)
like image 511
Varlor Avatar asked Oct 29 '25 16:10

Varlor


1 Answers

You can use the extent argument of imshow to set the scale of the plot. To have it scale from 2 to 5 use

plt.imshow(jacaardMatrix, extent=[2,5,2,5])

where the first two numbers denote the x range and the second two numbers the y range.

like image 157
ImportanceOfBeingErnest Avatar answered Oct 31 '25 06:10

ImportanceOfBeingErnest



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!