# Plotting with .get\_transform?

**URL:** <https://community.openastronomy.org/t/plotting-with-get-transform/937>\
**Category:** Astropy\
**Tags:** question\
**Created:** [March 12, 2024, 4:22am UTC](https://community.openastronomy.org/t/plotting-with-get-transform/937 "2024-03-12T04:22:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sepiagiraffe](https://dub1.discourse-cdn.com/flex005/user_avatar/community.openastronomy.org/sepiagiraffe/32/517_2.png) [@sepiagiraffe](https://community.openastronomy.org/u/sepiagiraffe)\
**Post date:** [March 12, 2024, 4:22am UTC](https://community.openastronomy.org/t/plotting-with-get-transform/937/1 "2024-03-12T04:22:21Z")

</div>

Hello!

I’m having issues with plotting things on top of images (using imshow, and SkyCoord). When I try plotting on top of an image with a SkyCoord object, I have to use ax.get\_transform(‘fk5’) to get it to line up, but I don’t understand why if the coordinates are in ICRS and the image should be in ICRS.

I have a point I want to plot as a SkyCoord object (In this case it’s the known center of the source):  
center = SkyCoord('18:57:25.59555586 ', ‘+16:24:55.8404388’, unit=(un.hourangle, un.deg));

When I go to plot it, I try:  
ax.plot(center.ra.degree, center.dec.degree, markersize=15, marker=‘\*’, color=‘white’);

Now, using the ax.get\_transform, with different arguments passed I get a variety of different plots I don’t understand.

Using ax.get\_transform(‘icrs’), which means it would transform the passed coordinates (which are in ICRS as it’s the SkyCoord default, right?) that are in ICRS, to the WCS (or the image’s coordinates), right? However, it seems that doesn’t work exactly… As I get the orange star.  
Now, if I try ax.get\_transform(‘fk5’), it works (albeit some error)! Which is the black star (under the white dot).

However, this would mean the coordinates should be in FK5 (they’re not), and/or the image would be in FK5 (which I find hard to believe).

Also, just to try it I did ax.get\_transform(‘world’), which also works?! This is the white dot (which is on top of the black star).

I tried looking around in the documentation, and what I came up with was: in ax.get\_transform(‘frame’) the frame and the frame of the coordinates should be the same, even the documentation uses ax.get\_transform(‘fk5’), but if ICRS is the standard why would the example use FK5.

 ![all](https://europe1.discourse-cdn.com/flex005/uploads/openastronomy/original/1X/34dff58b03139f353674ff97a94239fc712fdd0b.png)

---

<div class="post-metadata">

**Author:** ![ayshih](https://dub1.discourse-cdn.com/flex005/user_avatar/community.openastronomy.org/ayshih/32/84_2.png) [@ayshih](https://community.openastronomy.org/u/ayshih)\
**Post date:** [March 12, 2024, 6:47pm UTC](https://community.openastronomy.org/t/plotting-with-get-transform/937/2 "2024-03-12T18:47:40Z")

</div>

Everything you have described indicates that your WCS is in FK5, even if that is not what is intended. Can you print out `ax.wcs.wcs`?

---

<div class="post-metadata">

**Author:** ![sepiagiraffe](https://dub1.discourse-cdn.com/flex005/user_avatar/community.openastronomy.org/sepiagiraffe/32/517_2.png) [@sepiagiraffe](https://community.openastronomy.org/u/sepiagiraffe)\
**Post date:** [March 12, 2024, 7:39pm UTC](https://community.openastronomy.org/t/plotting-with-get-transform/937/3 "2024-03-12T19:39:59Z")

</div>

Ah! It seems you are right!  
flag: 137  
naxis: 2  
crpix: 0x7fe937a483d0  
256.00 257.00  
pc: 0x7fe937a4f4c0  
pc[0]: 1.0000 0.0000  
pc[1]: -0.0000 1.0000  
cdelt: 0x7fe937a5a3d0  
-4.1667e-08 4.1667e-08  
crval: 0x7fe937a4c490  
284.36 16.416  
cunit: 0x7fe937a58450  
“deg”  
“deg”  
ctype: 0x7fe937a56790  
“RA—SIN”  
“DEC–SIN”  
lonpole: 180.000000  
latpole: 16.415511  
restfrq: 0.000000  
restwav: 0.000000  
npv: 0  
npvmax: 64  
pv: 0x7fe9985d4000  
nps: 0  
npsmax: 8  
ps: 0x7fe937a512b0  
cd: 0x7fe937a5b6e0  
cd[0]: 0.0000 0.0000  
cd[1]: 0.0000 0.0000  
crota: 0x7fe937a5c0f0  
0.0000 0.0000  
altlin: 4  
velref: 3  
alt: ’ ’  
colnum: 0  
colax: 0x7fe937a57180  
0 0  
cname: 0x7fe937a4ecf0  
UNDEFINED  
UNDEFINED  
crder: 0x7fe937a4fd20  
UNDEFINED UNDEFINED  
csyer: 0x7fe937a506b0  
UNDEFINED UNDEFINED  
czphs: 0x7fe937a4ec70  
UNDEFINED UNDEFINED  
cperi: 0x7fe937a4f740  
UNDEFINED UNDEFINED  
wcsname: UNDEFINED  
timesys: UNDEFINED  
trefpos: UNDEFINED  
trefdir: UNDEFINED  
plephem: UNDEFINED  
timeunit: UNDEFINED  
dateref: UNDEFINED  
mjdref: 0.000000000 0.000000000  
timeoffs: UNDEFINED  
dateobs: “2021-07-02”  
datebeg: UNDEFINED  
dateavg: UNDEFINED  
dateend: UNDEFINED  
mjdobs: 59397.000000000  
mjdbeg: UNDEFINED  
mjdavg: UNDEFINED  
mjdend: UNDEFINED  
jepoch: UNDEFINED  
bepoch: UNDEFINED  
tstart: UNDEFINED  
tstop: UNDEFINED  
xposure: UNDEFINED  
telapse: UNDEFINED  
timsyer: UNDEFINED  
timrder: UNDEFINED  
timedel: UNDEFINED  
timepixr: UNDEFINED  
obsgeo: UNDEFINED UNDEFINED UNDEFINED  
UNDEFINED UNDEFINED UNDEFINED  
obsorbit: UNDEFINED  
radesys: “FK5”  
equinox: 2000.000000000  
specsys: “TOPOCENT”  
ssysobs: UNDEFINED  
velosys: UNDEFINED  
zsource: UNDEFINED  
ssyssrc: UNDEFINED  
velangl: UNDEFINED  
aux: 0x0  
ntab: 0  
tab: 0x0  
nwtb: 0  
wtb: 0x0  
types: 0x7fe937a4ca30  
2200 2201  
lngtyp: “RA”  
lattyp: “DEC”  
lng: 0  
lat: 1  
spec: -1  
time: -1  
cubeface: -1  
err: 0x0  
lin: (see below)  
cel: (see below)  
spc: (see below)  
m\_flag: 137  
m\_naxis: 2  
m\_crpix: 0x7fe937a483d0 (= crpix)  
m\_pc: 0x7fe937a4f4c0 (= pc)  
m\_cdelt: 0x7fe937a5a3d0 (= cdelt)  
m\_crval: 0x7fe937a4c490 (= crval)  
m\_cunit: 0x7fe937a58450 (= cunit)  
m\_ctype: 0x7fe937a56790 (= ctype)  
m\_pv: 0x7fe9985d4000 (= pv)  
m\_ps: 0x7fe937a512b0 (= ps)  
m\_cd: 0x7fe937a5b6e0 (= cd)  
m\_crota: 0x7fe937a5c0f0 (= crota)

```
m_colax: 0x7fe937a57180 (= colax)
m_cname: 0x7fe937a4ecf0 (= cname)
m_crder: 0x7fe937a4fd20 (= crder)
m_csyer: 0x7fe937a506b0 (= csyer)
m_czphs: 0x7fe937a4ec70 (= czphs)
m_cperi: 0x7fe937a4f740 (= cperi)
  m_aux: 0x0 (= aux)
  m_tab: 0x0 (= tab)
  m_wtb: 0x0 (= wtb)

```

lin.\*  
flag: 137  
naxis: 2  
crpix: 0x7fe937a483d0  
256.00 257.00  
pc: 0x7fe937a4f4c0  
pc[0]: 1.0000 0.0000  
pc[1]: -0.0000 1.0000  
cdelt: 0x7fe937a5a3d0  
-4.1667e-08 4.1667e-08  
dispre: 0x0  
disseq: 0x0  
piximg: (nil)  
imgpix: (nil)  
i\_naxis: 0  
unity: 1  
affine: 1  
simple: 1  
err: 0x0  
tmpcrd: 0x7fe937a585f0  
m\_flag: 0  
m\_naxis: 0  
m\_crpix: 0x0  
m\_pc: 0x0  
m\_cdelt: 0x0  
m\_dispre: 0x0  
m\_disseq: 0x0

cel.\*  
flag: 137  
offset: 0  
phi0: 0.000000  
theta0: 90.000000  
ref: 284.36 16.416 180.00 16.416  
prj: (see below)  
euler: 284.36 73.584 180.00 0.28260 0.95924  
latpreq: 0 (not required)  
isolat: 0  
err: 0x0

prj.\*  
flag: 105  
code: “SIN”  
r0: 57.295780  
pv: (0)  
0.0000 0.0000  
phi0: 0.000000  
theta0: 90.000000  
bounds: 7

```
   name: "orthographic/synthesis"

```

category: 1 (zenithal)  
pvrange: 102  
simplezen: 1  
equiareal: 0  
conformal: 0  
global: 0  
divergent: 0  
x0: 0.000000  
y0: 0.000000  
err: 0x0  
w: 0.017453 0.0000 1.0000 -1.0000 0.0000  
0.0000 0.0000 0.0000 0.0000 0.0000  
m: 0  
n: 0  
prjx2s: 0x0133eeda90  
prjs2x: 0x0133eee320

spc.\*  
flag: 0  
type: " "  
code: " "  
crval: UNDEFINED  
restfrq: 0.000000  
restwav: 0.000000  
pv: (not used)  
w: 0.0000 0.0000 0.0000 (remainder unused)  
isGrism: 0  
err: 0x0  
spxX2P: 0x0  
spxP2S: 0x0  
spxS2P: 0x0  
spxP2X: 0x0

Would astropy default to FK5, or does it choose it based on the original file? I looked in the FITS header and it never said FK5 or ICRS.

---

<div class="post-metadata">

**Author:** ![ayshih](https://dub1.discourse-cdn.com/flex005/user_avatar/community.openastronomy.org/ayshih/32/84_2.png) [@ayshih](https://community.openastronomy.org/u/ayshih)\
**Post date:** [March 13, 2024, 5:00pm UTC](https://community.openastronomy.org/t/plotting-with-get-transform/937/4 "2024-03-13T17:00:25Z")

</div>

The two FITS keywords to look for are `RADESYS` and `EQUINOX`. It sounds like `RADESYS` is not defined in your FITS header, so I’m guessing that `EQUINOX` is explicitly defined in your header to be `2000`. The FITS standard says:

```auto
RADESYSa – [string; default: ’FK4’, ’FK5’, or ’ICRS’: see
    below]. Name of the reference frame of equatorial or eclip-
    tic coordinates, whose value must be one of those speci-
    fied in Table 24. The default value is ’FK4’ if the value of
    EQUINOXa < 1984.0, ’FK5’ if ’EQUINOX’a ≥ 1984.0, or
    ’ICRS’ if ’EQUINOX’a is not given.

```

That is, you’re getting FK5 rather than ICRS because `EQUINOX` is defined.

---

<div class="post-metadata">

**Author:** ![sepiagiraffe](https://dub1.discourse-cdn.com/flex005/user_avatar/community.openastronomy.org/sepiagiraffe/32/517_2.png) [@sepiagiraffe](https://community.openastronomy.org/u/sepiagiraffe)\
**Post date:** [March 25, 2024, 6:46pm UTC](https://community.openastronomy.org/t/plotting-with-get-transform/937/5 "2024-03-25T18:46:06Z")

</div>

Got it! Thank you so much!!
