# Line\_mapbox as subplot

**URL:** <https://community.plotly.com/t/line-mapbox-as-subplot/67715>\
**Category:** 📊 Plotly Python\
**Tags:** question\
**Created:** [September 6, 2022, 6:56pm UTC](https://community.plotly.com/t/line-mapbox-as-subplot/67715 "2022-09-06T18:56:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MinePro120](https://avatars.discourse-cdn.com/v4/letter/m/7feea3/32.png) [@MinePro120](https://community.plotly.com/u/MinePro120)\
**Post date:** [September 6, 2022, 6:56pm UTC](https://community.plotly.com/t/line-mapbox-as-subplot/67715/1 "2022-09-06T18:56:18Z")

</div>

Hello! I recently tried creating a subplot so I could position all my plots the way I wanted. The only thing that’s giving me trouble is the line\_mapbox plot, which, given the following code, complains “Invalid element(s) received for the ‘data’ property”:

```auto
csv = pd.read_csv ("trajectory.csv")
map = px.line_mapbox (csv, lat = "lat", lon = "lon", zoom = 3, height = 500,
                          hover_data = ["time", "speed"],
                          color_discrete_sequence = ["crimson"])
token = open (".mapbox_token").read ()
map.update_layout (mapbox_style = "satellite-streets",
                       mapbox_accesstoken = token,
                       mapbox_zoom = 4, mapbox_center_lat = 41,
                       margin = {"r":0,"t":0,"l":0,"b":0},
                       uirevision = 1)
fig.add_trace(map, row=1, col=2)

```

The type of the subplot is set to “mapbox” as the documentation suggests. I don’t understand the error or how to solve it, nor can I find any examples of line\_mapbox being used as a subplot. The closest I found is [this post](https://stackoverflow.com/questions/72581544/plotly-express-choropleth-side-by-side-with-different-colors). I tried replacing the line “fig.add\_trace(map, row=1, col=2)” with “fig.add\_trace(map[‘data’][0], row=1, col=2)” and while the errors were gone, the mapbox didn’t display at all. I’ve used the exact same mapbox on its own (without being a part of a subplot) and it works fine. Any idea what might I be missing? Thanks!

---

<div class="post-metadata">

**Author:** ![MinePro120](https://avatars.discourse-cdn.com/v4/letter/m/7feea3/32.png) [@MinePro120](https://community.plotly.com/u/MinePro120)\
**Post date:** [September 7, 2022, 11:43am UTC](https://community.plotly.com/t/line-mapbox-as-subplot/67715/2 "2022-09-07T11:43:37Z")

</div>

According to [this](https://plotly.com/python/mixed-subplots/), plotly express only supports facet and marginal distribution plots to be used as subplots. So the best solution I found is the one proposed [in this post](https://community.plotly.com/t/two-graphs-side-by-side/5312/2), using custom CSS.
