0

Im trying to plot a map with points, with the points being labeled. I created a dataframe with the coordinates and the respective information i want to plot. Plotting the points works fine, but somehow, when I want to plot the labels next to it, they are interpreted differently by the hvplot.labels function. I have the points at the correct position in my map, but the labels are somewhere in the pacific ocean. They both use the same input coordinates. Does hvplot.labels interpret the data differently to hvplot.points? I Was thinking maybe one is interpreting the "." as a decimal and the other a comma? My labels are somewhere close to zero in my map.

heres the code:

Alle = pd.read_csv('Alle.csv', sep=';')
Alle.columns = ['lon', 'lat', 'Bedarf', 'Status', 'name']

map= Alle.hvplot.points(
    'lon', 'lat', 
    size=Alle['Bedarf']/100, 
    color = 'grey', 
    hover_cols=['Bedarf'], 
    alpha= 0.99, 
    geo=True
) * Alle.hvplot.labels(
    'lon', 'lat', 
    text='name', 
    geo=True, 
    alpha=1
).opts(
    active_tools=['pan', 'wheel_zoom']
)

As you can see, both functions take the same input data, so there must be something wrong with the interpretation of the coordinates.

Help is much appreciated. Elias

Elias
  • 51
  • 8
  • I believe this is a bug in hvplot - there is a similar reported [issue](https://github.com/holoviz/hvplot/issues/596) in the hvplot repo relating to issues with plotting labels for geo plots, but the issue hasn't been updated in a while. Here is a workaround: https://stackoverflow.com/questions/67005004/how-can-i-overlay-text-labels-on-a-geographic-hvplot-points-plot –  May 23 '23 at 12:36

0 Answers0