Plotting an RSSI heatmap with seaborn

I’m trying to plot an interpolated heatmap of RSSI (received signal strength indication) point values on a static map with Python and Seaborn.
The data is in a local InfluxDB but for the sake of this question, I exported them as CSV. The CSV file and the additionally used shape file are available here: https://cloud.gofferje.net/s/BT7bJaS7ybtP8zn

This is my code:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>import requests as r
import io
import matplotlib.pyplot as plt
import pandas as pd
import geopandas as gpd
import seaborn as sns
import tilemapbase as tm
df=pd.read_csv('rangemap.csv')
gdf = gpd.GeoDataFrame(df,
geometry = gpd.points_from_xy(df['lon'], df['lat']),
crs = 'EPSG:4326')
gdf = gdf.to_crs("EPSG:3857")
vlk = gpd.read_file("Valkeakoski.shp")
vlk = vlk.to_crs("EPSG:3857")
tm.init(create=True)
extent = tm.extent_from_frame(vlk)
fig, ax = plt.subplots(figsize=(12,10),layout="constrained")
ax.xaxis.set_visible(False)
ax.yaxis.set_visible(False)
plotter = tm.Plotter(extent, tm.tiles.build_OSM(), width=1000)
plotter.plot(ax)
sns.kdeplot(data=gdf,x=gdf['geometry'].x,y=gdf['geometry'].y,fill=True,cmap='turbo',alpha=0.3,levels=20,weights=gdf['rssi'],cbar=True,ax=ax,zorder=3)
vlk.plot(color=(1,1,1,0),edgecolor="black",linewidth=0.5,ax=ax)
</code>
<code>import requests as r import io import matplotlib.pyplot as plt import pandas as pd import geopandas as gpd import seaborn as sns import tilemapbase as tm df=pd.read_csv('rangemap.csv') gdf = gpd.GeoDataFrame(df, geometry = gpd.points_from_xy(df['lon'], df['lat']), crs = 'EPSG:4326') gdf = gdf.to_crs("EPSG:3857") vlk = gpd.read_file("Valkeakoski.shp") vlk = vlk.to_crs("EPSG:3857") tm.init(create=True) extent = tm.extent_from_frame(vlk) fig, ax = plt.subplots(figsize=(12,10),layout="constrained") ax.xaxis.set_visible(False) ax.yaxis.set_visible(False) plotter = tm.Plotter(extent, tm.tiles.build_OSM(), width=1000) plotter.plot(ax) sns.kdeplot(data=gdf,x=gdf['geometry'].x,y=gdf['geometry'].y,fill=True,cmap='turbo',alpha=0.3,levels=20,weights=gdf['rssi'],cbar=True,ax=ax,zorder=3) vlk.plot(color=(1,1,1,0),edgecolor="black",linewidth=0.5,ax=ax) </code>
import requests as r
import io
import matplotlib.pyplot as plt
import pandas as pd
import geopandas as gpd
import seaborn as sns
import tilemapbase as tm

df=pd.read_csv('rangemap.csv')
gdf = gpd.GeoDataFrame(df, 
    geometry = gpd.points_from_xy(df['lon'], df['lat']), 
    crs = 'EPSG:4326')
gdf = gdf.to_crs("EPSG:3857")

vlk = gpd.read_file("Valkeakoski.shp")
vlk = vlk.to_crs("EPSG:3857")

tm.init(create=True)
extent = tm.extent_from_frame(vlk)
fig, ax = plt.subplots(figsize=(12,10),layout="constrained")
ax.xaxis.set_visible(False)
ax.yaxis.set_visible(False)
plotter = tm.Plotter(extent, tm.tiles.build_OSM(), width=1000)
plotter.plot(ax)
sns.kdeplot(data=gdf,x=gdf['geometry'].x,y=gdf['geometry'].y,fill=True,cmap='turbo',alpha=0.3,levels=20,weights=gdf['rssi'],cbar=True,ax=ax,zorder=3)
vlk.plot(color=(1,1,1,0),edgecolor="black",linewidth=0.5,ax=ax)

So far, I have achieved a plot which looks about right:

What is confusing me a bit are the values in the color bar. The RSSI values in the CSV file go from -55 to -145. What I would like to see in the color bar are the actual RSSI values. I assume what the color bar is showing are the results of the KDE math based on the RSSI as weights?

I also tried to use hue=gdf['rssi'] instead of weights=gdf['rssi'] but that doesn’t create a map at all, however, the color bar looks right…

How would I get an interpolated map of the RSSI values with the “right” color bar, i.e. the color bar showing the RSSI values?

6

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật