change grid interval in astropy curved axis

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>import astropy.units as u
import numpy as np
from astropy.io import fits
from astropy.wcs import WCS
import matplotlib.pyplot as plt
from astropy.visualization import simple_norm
from astropy.coordinates import SkyCoord, Galactic
file = "hi4pi-hvc-vlsr-gal-car.fits"
hdul = fits.open(file)
hdr = hdul[0].header
data = hdul[0].data
wcs = WCS(hdr)
norm = simple_norm(data, "linear")
# Plot image on axes ax
fig, ax = plt.subplots(figsize=(10, 6), subplot_kw={"projection": wcs})
cmap = plt.get_cmap("RdBu", 20)
im = ax.imshow(data, cmap=cmap)
ax.set_xlabel("Galactic Longitude")
ax.set_ylabel("Galactic Latitude")
overlay = ax.get_coords_overlay("icrs")
major_ticks = np.arange(0, 360, 30)
#ax.set_xticks(major_ticks)
overlay.grid(color="grey", ls="dotted")
plt.colorbar(im, orientation="horizontal")
plt.savefig("area.png", dpi=300, bbox_inches="tight")
plt.show()
</code>
<code>import astropy.units as u import numpy as np from astropy.io import fits from astropy.wcs import WCS import matplotlib.pyplot as plt from astropy.visualization import simple_norm from astropy.coordinates import SkyCoord, Galactic file = "hi4pi-hvc-vlsr-gal-car.fits" hdul = fits.open(file) hdr = hdul[0].header data = hdul[0].data wcs = WCS(hdr) norm = simple_norm(data, "linear") # Plot image on axes ax fig, ax = plt.subplots(figsize=(10, 6), subplot_kw={"projection": wcs}) cmap = plt.get_cmap("RdBu", 20) im = ax.imshow(data, cmap=cmap) ax.set_xlabel("Galactic Longitude") ax.set_ylabel("Galactic Latitude") overlay = ax.get_coords_overlay("icrs") major_ticks = np.arange(0, 360, 30) #ax.set_xticks(major_ticks) overlay.grid(color="grey", ls="dotted") plt.colorbar(im, orientation="horizontal") plt.savefig("area.png", dpi=300, bbox_inches="tight") plt.show() </code>
import astropy.units as u
import numpy as np
from astropy.io import fits
from astropy.wcs import WCS
import matplotlib.pyplot as plt
from astropy.visualization import simple_norm
from astropy.coordinates import SkyCoord, Galactic

file = "hi4pi-hvc-vlsr-gal-car.fits"
hdul = fits.open(file)
hdr = hdul[0].header
data = hdul[0].data
wcs = WCS(hdr)
norm = simple_norm(data, "linear")

# Plot image on axes ax
fig, ax = plt.subplots(figsize=(10, 6), subplot_kw={"projection": wcs})
cmap = plt.get_cmap("RdBu", 20)
im = ax.imshow(data, cmap=cmap)
ax.set_xlabel("Galactic Longitude")
ax.set_ylabel("Galactic Latitude")

overlay = ax.get_coords_overlay("icrs")
major_ticks = np.arange(0, 360, 30)
#ax.set_xticks(major_ticks)
overlay.grid(color="grey", ls="dotted")
plt.colorbar(im, orientation="horizontal")

plt.savefig("area.png", dpi=300, bbox_inches="tight")
plt.show()

I want to set the RA grid to np.arange(0,360,30), a 30 degrees interval instead of 90 degrees interval.

and the dec label on the right is better to be Dec but I have no idea how to change it.


the fits file is here: Westmeier 2018

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>WCS Keywords
Number of WCS axes: 2
CTYPE : 'GLON' 'GLAT'
CRVAL : np.float64(180.000000024) np.float64(0.0)
CRPIX : np.float64(2162.0) np.float64(1080.0)
PC1_1 PC1_2 : np.float64(1.0) np.float64(0.0)
PC2_1 PC2_2 : np.float64(0.0) np.float64(1.0)
CDELT : np.float64(-0.0833333333) np.float64(0.0833333333)
NAXIS : 4323 2144
</code>
<code>WCS Keywords Number of WCS axes: 2 CTYPE : 'GLON' 'GLAT' CRVAL : np.float64(180.000000024) np.float64(0.0) CRPIX : np.float64(2162.0) np.float64(1080.0) PC1_1 PC1_2 : np.float64(1.0) np.float64(0.0) PC2_1 PC2_2 : np.float64(0.0) np.float64(1.0) CDELT : np.float64(-0.0833333333) np.float64(0.0833333333) NAXIS : 4323 2144 </code>
WCS Keywords

Number of WCS axes: 2
CTYPE : 'GLON' 'GLAT' 
CRVAL : np.float64(180.000000024) np.float64(0.0) 
CRPIX : np.float64(2162.0) np.float64(1080.0) 
PC1_1 PC1_2  : np.float64(1.0) np.float64(0.0) 
PC2_1 PC2_2  : np.float64(0.0) np.float64(1.0) 
CDELT : np.float64(-0.0833333333) np.float64(0.0833333333) 
NAXIS : 4323  2144

I don’t know how to set the grid intervals of overlay.grid. I checked the documentation but there seems to not have any functions.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật