# How to draw a rectangle on a Map#

sunpy provides a convenient method called draw_quadrangle() to draw rectangles on maps. In this guide, we will demonstrate four different methods to draw a rectangle on a sunpy.map.Map.

## Specify corners with a single SkyCoord#

We will use one SkyCoord to represent the two opposite corners.

import matplotlib.pyplot as plt

import astropy.units as u
from astropy.coordinates import SkyCoord

import sunpy.data.sample
import sunpy.map

aia_map = sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE)

fig = plt.figure()

aia_map.plot(axes=ax, clip_interval=(1, 99.99)*u.percent)

coords = SkyCoord(Tx=(100, 500) * u.arcsec, Ty=(200, 500) * u.arcsec,frame=aia_map.coordinate_frame)

plt.show()


## Specify corners with separate SkyCoord#

We will use two SkyCoord to represent the two opposite corners.

fig = plt.figure()

aia_map.plot(axes=ax, clip_interval=(1, 99.99)*u.percent)

bottom_left = SkyCoord(100 * u.arcsec, 200 * u.arcsec, frame=aia_map.coordinate_frame)
top_right = SkyCoord(500 * u.arcsec, 500 * u.arcsec, frame=aia_map.coordinate_frame)

plt.show()


## Specify one corner with a width and height#

We will use one SkyCoord to represent the bottom left and supply a width and height to complete the rectangle.

fig = plt.figure()

aia_map.plot(axes=ax, clip_interval=(1, 99.99)*u.percent)

bottom_left = SkyCoord(100 * u.arcsec, 200 * u.arcsec, frame=aia_map.coordinate_frame)
width = 400 * u.arcsec
height = 300 * u.arcsec

plt.show()


## Using pixel coordinates#

We will use a SkyCoord to work out the pixel coordinates instead of using coordinates as we do above.

fig = plt.figure()