CharlieShe
CharlieShe

Reputation: 63

How to change x-axis label values for (contourf) in pylab

I am plotting in pylab with contourf and it plots nicely. However the x-axis label values get assiged from 0 to 100 in y direction and from 0 to 1000 in x direction, since I have 1000 data points in x-direction, and 100 data points in y-direction. But I would like the x-axis to be labeled from -4 to 4 and the y-axis to be labeled from 0 to 1000. I just want to change the label.

    pylab.contourf(-pac[:,100,:])  #pac is a 3D data distribution
    pylab.colorbar()
    savefig("PAC Concentration.png")
    pylab.close()

Thanks in Advavance

Upvotes: 0

Views: 1098

Answers (1)

Thorsten Kranz
Thorsten Kranz

Reputation: 12755

Use the extent keyword argument.

pylab.contourf(-pac[:,100,:], extent=[-4, 4, 0, 1000])  #pac is a 3D data distribution
pylab.colorbar()
savefig("PAC Concentration.png")
pylab.close()

Upvotes: 4

Related Questions