Search code examples
pythonmatplotlibplotaxeshealpy

Adding Axes in Cartview using Healpy


I've created a zoomed-in image using the following code:

map = hp.read_map(filename)

hp.cartview(map, title=t,lonra = [-50,50], latra = [-70,-45],\
            max = 1, min = -1, unit = 'mk')
hp.graticule()
plt.show()

enter image description here

How can I add an axis to the image so it's obvious where this zoomed-in image is?

Thanks!


Solution

  • Possible workaround: save the image to an array with

    lonra = [-50,50]
    latra = [-70,-45]
    test=hp.cartview(map, return_projected_map=True, lonra=lonra, latra=latra)
    

    and then plot the image with something like:

    plt.imshow(test, origin='lower',extent=(lonra[1],lonra[0],latra[0],latra[1]), interpolation = 'none')
    

    But I strongly suspect that there should also be a solution provided within cartview().