How to set labels with MATPLOTLIB?

Richard Rublev

I have my image enter image description here

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?

Hannes Ovrén

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to clear matplotlib labels in legend?

From Dev

How to center labels in histogram in matplotlib

From Dev

How to create hierarchic labels in matplotlib

From Dev

Matplotlib + Pandas = how to see labels ?

From Java

How do I set the figure title and axes labels font size in Matplotlib?

From Dev

How do I set limits on ticks, colors, and labels for colorbar contourf matplotlib

From Dev

How do I set the size of the axes patch so that the plot labels aren't clipped (matplotlib)

From Dev

How to set legend labels MPChart

From Dev

How to set custom labels on the bars?

From Dev

How to change separation between tick labels and axis labels in Matplotlib

From Dev

How to change separation between tick labels and axis labels in Matplotlib

From Dev

How to get different number of ticks and labels in matplotlib?

From Dev

how to show tick labels on top of matplotlib plot?

From Dev

How to add group labels for bar charts in matplotlib?

From Dev

Matplotlib: How to force integer tick labels?

From Dev

matplotlib - How to add two labels to one scatterplot

From Dev

Labels not showing up with ax.set_xlabels in Matplotlib

From Dev

PyQt How to set header labels with QTreeView

From Dev

Vioplot R: How to set axis labels

From Dev

How to set the numbers of labels displayed in a pie chart?

From Dev

PyQt How to set header labels with QTreeView

From Dev

How to set labels above the input with @media?

From Dev

Grid of labels - how to set constraints in Xcode?

From Dev

How to set R corrplot diagonal numeric labels?

From Dev

How to set labels and values in horizontal bar charts?

From Dev

How to set the xticklabels for date in matplotlib

From Dev

How to set default colormap in Matplotlib

From Dev

How to set default matplotlib style?

From Dev

How to avoid overlapping of labels & autopct in a matplotlib pie chart?

Related Related

  1. 1

    How to clear matplotlib labels in legend?

  2. 2

    How to center labels in histogram in matplotlib

  3. 3

    How to create hierarchic labels in matplotlib

  4. 4

    Matplotlib + Pandas = how to see labels ?

  5. 5

    How do I set the figure title and axes labels font size in Matplotlib?

  6. 6

    How do I set limits on ticks, colors, and labels for colorbar contourf matplotlib

  7. 7

    How do I set the size of the axes patch so that the plot labels aren't clipped (matplotlib)

  8. 8

    How to set legend labels MPChart

  9. 9

    How to set custom labels on the bars?

  10. 10

    How to change separation between tick labels and axis labels in Matplotlib

  11. 11

    How to change separation between tick labels and axis labels in Matplotlib

  12. 12

    How to get different number of ticks and labels in matplotlib?

  13. 13

    how to show tick labels on top of matplotlib plot?

  14. 14

    How to add group labels for bar charts in matplotlib?

  15. 15

    Matplotlib: How to force integer tick labels?

  16. 16

    matplotlib - How to add two labels to one scatterplot

  17. 17

    Labels not showing up with ax.set_xlabels in Matplotlib

  18. 18

    PyQt How to set header labels with QTreeView

  19. 19

    Vioplot R: How to set axis labels

  20. 20

    How to set the numbers of labels displayed in a pie chart?

  21. 21

    PyQt How to set header labels with QTreeView

  22. 22

    How to set labels above the input with @media?

  23. 23

    Grid of labels - how to set constraints in Xcode?

  24. 24

    How to set R corrplot diagonal numeric labels?

  25. 25

    How to set labels and values in horizontal bar charts?

  26. 26

    How to set the xticklabels for date in matplotlib

  27. 27

    How to set default colormap in Matplotlib

  28. 28

    How to set default matplotlib style?

  29. 29

    How to avoid overlapping of labels & autopct in a matplotlib pie chart?

HotTag

Archive