Matplotlib imshow: Data rotated?

前端 未结 4 1207
清酒与你
清酒与你 2021-02-07 02:21

I was trying to plot some data with scatter. My code is

import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
from scipy.interpolate import         


        
相关标签:
4条回答
  • 2021-02-07 02:22

    BTW, you could use marker='s' to draw squares in your scatter plot instead of circles and then just keep your original code.

    0 讨论(0)
  • 2021-02-07 02:35

    Consider to use pcolormesh or contourf if you want to plot data of the form f(X, Y) = Z. imshow simply plots data Z, scaling and resampling has do be done manually.

    0 讨论(0)
  • 2021-02-07 02:36

    Look at the keyword arguments of imshow. There is origin. The default is "upper", but you want "lower".

    The default makes sense for plotting images, that usually start at the top-left corner. For most matrix-plotting, you'll want origin="lower"

    0 讨论(0)
  • 2021-02-07 02:39

    It's not inverted, just flipped. The origin for imshow default to the upper left rather than the lower left. imshow has a parameter to specify the origin, it's named origin. Alternatively you can set the default in your matplotlib.conf.

    0 讨论(0)
提交回复
热议问题