I'm trying to add wind vectors to my Plotly map. This is a simplified version of the code:
import plotly.graph_objects as go
import plotly.figure_factory as ff
fig = go.Figure(go.Scattermapbox(
mode = "markers",
lon = df['lon'],
lat = df['lat'],
marker = {'size': 5, 'color':'black'},
x, y = np.meshgrid(np.arange(0,2,.2), np.arange(0,2,.2))
u = np.cos(x) * y
v = np.sin(x) * y
vec_field = ff.create_quiver(x, y, u, v)
fig.add_traces(data = vec_field.data[0])
fig.update_layout(
margin={"l": 0, "r": 0, "t": 15, "b": 0},
mapbox={
"style": "carto-positron",
"zoom": 5,
"center": {
"lon": df['lon'].mean(),
"lat": df['lat'].mean(),
},
},
)
However, the plot generated is not what I'm looking for. The map ends up overlaying the quiver plot, so I can't see the arrows at all. Is there any way to rectify this, such that the arrows are shown clearly above the map?
