# Removing one of two legends in two maps in Plotly

**URL:** <https://community.plotly.com/t/removing-one-of-two-legends-in-two-maps-in-plotly/39507>\
**Category:** 📊 Plotly Python\
**Created:** [May 15, 2020, 4:08pm UTC](https://community.plotly.com/t/removing-one-of-two-legends-in-two-maps-in-plotly/39507 "2020-05-15T16:08:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jubeen](https://avatars.discourse-cdn.com/v4/letter/j/c2a13f/32.png) [@Jubeen](https://community.plotly.com/u/Jubeen)\
**Post date:** [May 15, 2020, 4:08pm UTC](https://community.plotly.com/t/removing-one-of-two-legends-in-two-maps-in-plotly/39507/1 "2020-05-15T16:08:02Z")

</div>

I am trying to remove the legend of trace0 in this code (last line), but it’s not happening. Any ideas?  
Thank you!

```auto
import plotly.express as px
import plotly.graph_objects as go
import pandas as pd

df1 = pd.read_csv(...)
df2 = pd.read_csv(...)

fig = px.scatter_geo(df2, lon="Longitude",
                     lat="Latitude",
                     size="Pop2050",
                     color="Growth rate 2020-50",
                     color_continuous_scale=[
                         [0.0, "rgb(12,51,131)"], [0.21, "rgb(242,211,56)"], [1.0, "rgb(217,30,30)"]],
                     range_color=(-.35, 1.35),
                     color_continuous_midpoint=0,
                     projection="natural earth",
                     )

trace0 = px.choropleth(df1, color="Region",
                       locations="Code",
                       color_discrete_sequence=px.colors.qualitative.Pastel2,
                       projection="natural earth",
                       # marker=dict(opacity=0.1)
                       )

for x in range(9):
    fig.add_trace(trace0.data[x])
trace0.layout.update(showlegend=False)

fig.show()

```

 ![Screen Shot 2020-05-15 at 7.05.13 PM](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/f/f12b37c4f763bb90dcfd9381749a2de9efa6ee92.jpeg)

---

<div class="post-metadata">

**Author:** ![Jubeen](https://avatars.discourse-cdn.com/v4/letter/j/c2a13f/32.png) [@Jubeen](https://community.plotly.com/u/Jubeen)\
**Post date:** [May 18, 2020, 2:35pm UTC](https://community.plotly.com/t/removing-one-of-two-legends-in-two-maps-in-plotly/39507/2 "2020-05-18T14:35:49Z")

</div>

I finally figured it out:

```auto
fig.add_trace(go.Choropleth(locations=df1["Code"],
                            showlegend=False,
                            showscale=False,
                            marker={"opacity": 0.45},
                            z=df1["z"]))

```

Note: If you are a beginner, there is no escape from going through at least [this page](https://plotly.com/python/creating-and-updating-figures), and using [the reference](https://plotly.com/python/reference).
