# Removing the title and the margin of the X and Y axis

**URL:** <https://community.plotly.com/t/removing-the-title-and-the-margin-of-the-x-and-y-axis/66597>\
**Category:** 📊 Plotly Python\
**Tags:** question\
**Created:** [August 1, 2022, 10:19am UTC](https://community.plotly.com/t/removing-the-title-and-the-margin-of-the-x-and-y-axis/66597 "2022-08-01T10:19:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BeginnerDash](https://avatars.discourse-cdn.com/v4/letter/b/53a042/32.png) [@BeginnerDash](https://community.plotly.com/u/BeginnerDash)\
**Post date:** [August 1, 2022, 10:19am UTC](https://community.plotly.com/t/removing-the-title-and-the-margin-of-the-x-and-y-axis/66597/1 "2022-08-01T10:19:39Z")

</div>

![space](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/4/0/4096b57fc02f6dfa5c555762711c716beb820175.png)

Hello,

How do you remove the titles and the margins of the Y and X axis please (in red) ? I would like to expand my graph on their sides.

The code is :

```
def test_graph():
    import plotly.express as px

    x = [1, 3, 2]
    y = [2, 3, 4]

    data_canada = px.data.gapminder().query("country == 'Canada'")
    fig = px.bar(data_canada, x='year', y='pop')
    fig.update_layout(
          margin=dict(l=0, r=0, t=0, b=0),
    )

    return fig

```

Thank you.

---

<div class="post-metadata">

**Author:** ![akroma](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/akroma/32/20346_2.png) [@akroma](https://community.plotly.com/u/akroma)\
**Post date:** [August 1, 2022, 10:35am UTC](https://community.plotly.com/t/removing-the-title-and-the-margin-of-the-x-and-y-axis/66597/2 "2022-08-01T10:35:38Z")

</div>

Hey @BeginnerDash ,

I think you can try :

```auto
fig.update_layout(yaxis_title=None)
fig.update_layout(xaxis_title=None)

```

 ![example_out](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/e/c/ec3255c68511b4207483e53a71e74cf08bbd4c28.png)

Have a nice day.
