yikesthisisamess
yikesthisisamess

Reputation: 83

How to stop fits files from being imported upside down python

When importing a fits image in python it gets imported upside down.

This is the code i'm using:

import numpy as np
from astropy.io get fits
import matplotlib.pyplot as plt

im = fits.getdata('myimage.fits')

plt.imshow(im, cmap='gray')
plt.colorbar()

Again I just want to view the image and it opens upside down. When I open it in an image viewer I have on my computer it looks fine so I know I didn't save it upside down. Is there any way to prevent this from happening?

Upvotes: 0

Views: 566

Answers (1)

Beta
Beta

Reputation: 50

You can specify the keyword argument origin= 'lower' or origin='upper' in your call to imshow.

Upvotes: 1

Related Questions