This may be more of a Holoviz Panel question - but I am not quite sure.
When rendering a Plotly map (eg. px.scatter_map
) in Panel , the copyright notice that shows up automatically in maps with tiles sourced from eg. OpenStreetMap is rendered below the actual figure:
import panel as pn
import pandas as pd
import plotly.express as px
pn.extension("plotly")
#
fig = px.scatter_map(
lat=[],
lon=[],
zoom=0,
height=300
)
fig.update_layout(map_style="open-street-map")
fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
plotly_pane = pn.Column(
pn.pane.Plotly(fig),
'# Some Caption',
)
plotly_pane.servable()
It then overlaps with other elements:
Is there a way to define the location of this map element (maplibregl-ctrl-attrib-button
)?
Related issue on the Panel repo.
I have a similar issue, itโs not configured properly.
@TheMichael
Iโm not able to reproduce the issue you reported with the following code:
import plotly.express as px
fig = px.scatter_map(
lat=[],
lon=[],
zoom=0,
height=300
)
fig.update_layout(map_style="open-street-map")
fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
fig.show()
@mayaradaher can you please share the code that you used to see if I can reproduce the error locally?
@adamschroeder, indeed the malformed copyright notice only appears if I render the map through Panel. Is there a way to specify the location etc. of this notice element by passing a parameter to the px.scatter_map
function? Perhaps this would then also solve the Panel-related issue?
Hi @TheMichael
I donโt think px.scatter_map
has an attribute to specify locations of notices. But just in case, hereโs the full list of attributes. Hereโs the px list for scatter_map.
I just cloned your repo, @mayaradaher , and it displayed correctly for me.
1 Like
Iโve noticed this generally in the recent update to 3.0.0 in plotly.js. I am able to reproduce the change in attribution location by switching between plotly.js version 2.35.3 and version 3.0.0 at https://codepen.io/pen?&prefill_data_id=d05d7141-3a9f-4aac-afa0-46cbe1e7d958. Does Plotly rely on Panel under the hood, and the Panel fix will resolve this in Plotly?
1 Like
CodePen link may not be stable, so Iโll just link the parent page I used to get there instead: Tile density heatmap in JavaScript and then clicked โTry It On CodePen.โ