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
BTW, you could use marker='s' to draw squares in your scatter plot instead of circles and then just keep your original code.
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.
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"
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
.