[Fixed]-Getting Inverted image from Django html view

1👍

✅

Just place the [0, 0] in the lower left corner of the axes with:

subplot.imshow(image, extent=[0, 10, 0, 10], origin='lower')

Please have a look at the imshow() docs

Update: How to check and set a default image.origin value

  1. Check:

    >>> import matplotlib as mpl
    >>> print(mpl.rcParams['image.origin'])
    upper
    
  2. Set lower as a default value (docs):

    $ echo "image.origin : lower" >> .config/matplotlib/matplotlibrc
    
  3. Check again:

    >>> import matplotlib as mpl
    >>> print(mpl.rcParams['image.origin'])
    upper
    

Leave a comment