# ellipse()

### Example

![](https://768248463-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqbs7pgU3AVBY06Rl9M31%2Fuploads%2F7GyPOnsfr09SIP2nvSXU%2Fspaces_qbs7pgU3AVBY06Rl9M31_uploads_LG2ir8ZKuxVt6rJ5R1qr_ellipse.png?alt=media\&token=d030596d-f5a8-495f-a074-7736ab6b653d)

```python
ellipse(200, 200, 300, 150)
```

### Syntax

```python
ellipse(x, y, width, height)
```

<table><thead><tr><th width="167">Input</th><th>Description</th></tr></thead><tbody><tr><td>x</td><td>x co-ordinate of the center</td></tr><tr><td>y</td><td>y co-ordinate of the center</td></tr><tr><td>width</td><td>width of the ellipse (length in x direction)</td></tr><tr><td>height</td><td>height of the ellipse (length in y direction)</td></tr></tbody></table>

<figure><img src="https://768248463-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqbs7pgU3AVBY06Rl9M31%2Fuploads%2FEB3H2QlGFI6hnNJ9HIGr%2Fimage.png?alt=media&#x26;token=6204faa1-3ad5-477b-be37-bde2120536d6" alt=""><figcaption></figcaption></figure>

### Description

**ellipse()** draws an ellipse on the canvas, using the inputs to determine the position and dimension of the shape. The width and height of the ellipse must always be parallel to the x-axis and y-axis respectively - this can only be changed separately with a rotation.

## Modes <a href="#modes" id="modes"></a>

By default, the **x** and **y** inputs refer to the center of the ellipse.

This can be changed using `ellipseMode()`, with an input of **CENTER**, **CORNERS**, **CORNER**, or **RADIUS**.

#### ellipseMode(CENTER)

This is the default mode. The code:

```python
ellipse(x, y, width, height)
```

will use **(x,y)** as the center coordinates and **width** and **height** as the dimensions.

![](https://768248463-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqbs7pgU3AVBY06Rl9M31%2Fuploads%2F63welyH6mKdMX7szquxJ%2Fspaces_qbs7pgU3AVBY06Rl9M31_uploads_QlBjjeydULcgrVfjyiQd_image.png?alt=media\&token=5df566ae-ec92-41ac-9b20-cc98abb99cb9)

#### ellipseMode(CORNERS)

This mode is for specifying the coordinates of opposite corners of the ellipse's bounding box. The code:

```python
ellipse(x1, y2, x2, y2)
```

![](https://768248463-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqbs7pgU3AVBY06Rl9M31%2Fuploads%2FIE51W2lNUm7iIUjeOHyj%2Fimage.png?alt=media\&token=3ca8d785-d2fc-4cd1-84d7-b310c364adfe)

#### ellipseMode(CORNER)

This mode is for specifying the **corner** of the ellipse's bounding box together with the **width** and **height**. The code:

```python
ellipse(x, y, width, height)
```

will use **(x,y)** as the bottom left corner of the ellipse's bounding box and **width** and **height** as the dimensions.

![](https://768248463-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqbs7pgU3AVBY06Rl9M31%2Fuploads%2FgnKfQUhEVamsguTXMRuv%2Fimage%20\(1\).png?alt=media\&token=720ba19a-fa60-4854-b6db-4878f3a649bd)

#### ellipseMode(RADIUS)

This mode is for specifying the **center** of the ellipse together with **half the width** and **half the height**. The code:

```python
ellipse(x, y, wRadius, hRadius)
```

will use **(x,y)** as the center coordinates and **wRadius \* 2** and **hRadius \* 2** as the dimensions.

![](https://768248463-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqbs7pgU3AVBY06Rl9M31%2Fuploads%2FJx8kQKzQqPyvD5WqGErQ%2Fimage%20\(2\).png?alt=media\&token=e791c9ce-747c-4ba8-84b9-32b4942c3a38)

{% hint style="info" %}
Find these documents helpful? Let the people who made them help your child learn to code at [**Strivemath**](https://www.strivemath.com/)<mark style="color:blue;">**!**</mark>

We'd love to hear your Feedback/Comments [here](https://docs.google.com/forms/d/e/1FAIpQLSeqorBAGTya-YBRI-VFjJxtgQtCz3ucGDI96K96sNyuaGuvdw/viewform?usp=sf_link).
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://learnpython.strivemath.com/p5-python-web/reference/shapes/2d/ellipse.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
