[Python] How to scatter plot marker size based on astronomy image data?

Discussão em 'Python' iniciado por Stack, Julho 25, 2025.

  1. Stack

    Stack Membro Participativo

    For example, in this code I plot a astronomy FITS image:

    def displayimage(img, wcs):
    fig, ax = plt.subplots(
    figsize=(5, 3), layout="compressed", subplot_kw={"projection": wcs.celestial}
    )
    norm = simple_norm(img, vmin=0, vmax=np.nanmax(img.value), stretch="linear")
    im = ax.imshow(img, norm=norm, cmap="viridis", origin="lower")
    lon = ax.coords[0]
    lat = ax.coords[1]
    lon.set_axislabel("RA")
    lat.set_axislabel("Dec")
    plt.colorbar(im)
    plt.show()

    displayimage(cube)


    Now I want to scatter some hollow circles based on coordinates and size such as:

    (RA, Dec, Size) = (120*u.deg, 30*u.deg, 25*u.arcmin)


    how to calculate the s value in matplotlib.pyplot.scatter(x, y, s) so that the size of circles matches the data?

    Continue reading...

Compartilhe esta Página