Then I try this
#!/usr/bin/python
import os,sys
import Image
import matplotlib.pyplot as plt
jpgfile = Image.open("t002.jpg")
fig = plt.imshow(jpgfile)
ax = fig.add_subplot(111)
ax.set_xlabel('normlized resistivities')
ay.set_ylabel('normlized velocities')
fig.savefig("fig.jpg")
But then I have
AttributeError: 'AxesImage' object has no attribute 'add_subplot'
How to setup xlabel and ylabel and then save new image as a file?
It should be enough to simply do
plt.figure()
plt.imshow(jpgfile)
plt.xlabel('normlized resistivities')
plt.ylabel('normlized velocities')
plt.savefig('out.jpg')
Your current error is because imshow
does not return a Figure
.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments