我正在嘗試可視化從GIS導(dǎo)入的數(shù)據(jù)。大約有70個點,每個點都有地名和每年的年份數(shù)據(jù)和值。 name year mean geometry0 Place 1 2008 105816 POINT (253662.995 663270.013)1 Place 1 2009 94381 POINT (253662.995 663270.013)2 Place 1 2010 101280 POINT (253662.995 663270.013)3 Place 1 2011 86664 POINT (253662.995 663270.013)4 Place 1 2012 83828 POINT (253662.995 663270.013)5 Place 1 2013 91433 POINT (253662.995 663270.013)6 Place 1 2014 90971 POINT (253662.995 663270.013)7 Place 1 2015 140151 POINT (253662.995 663270.013)8 Place 1 2016 104499 POINT (253662.995 663270.013)9 Place 1 2017 110172 POINT (253662.995 663270.013)10 Place 1 2018 111700 POINT (253662.995 663270.013)11 Place 2 2008 99176 POINT (262062.995 669070.013)12 Place 2 2009 101865 POINT (262062.995 669070.013)13 Place 2 2010 80560 POINT (262062.995 669070.013)14 Place 2 2011 61915 POINT (262062.995 669070.013)15 Place 2 2012 74723 POINT (262062.995 669070.013)16 Place 2 2013 71550 POINT (262062.995 669070.013)17 Place 2 2014 239955 POINT (262062.995 669070.013)18 Place 2 2015 93824 POINT (262062.995 669070.013)19 Place 2 2016 71751 POINT (262062.995 669070.013)20 Place 2 2017 86586 POINT (262062.995 669070.013)21 Place 2 2018 74684 POINT (262062.995 669070.013)22 Place 3 2008 180296 POINT (251662.995 663270.013)23 Place 3 2009 165689 POINT (251662.995 663270.013)24 Place 3 2010 175376 POINT (251662.995 663270.013)我想使用滑塊可視化數(shù)據(jù),以僅顯示具有所選年份值的點。這就是我正在做的def getPointCoords(row, geom, coord_type): """Calculates coordinates ('x' or 'y') of a Point geometry""" if coord_type == 'x': return row[geom].x elif coord_type == 'y': return row[geom].y就是我得到的結(jié)果
1 回答

UYOU
TA貢獻1878條經(jīng)驗 獲得超4個贊
這最終對我有用
# Define the callback function: update_plot
def update_plot(attr, old, new):
# Set the year name to slider.value and new_data to source.data
year = slider.value
stsource.data = st_df[st_df.year == year]
我意識到,由于我數(shù)據(jù)的性質(zhì),我不需要單獨更新x,y,因為這些總是相同的,而只是一個“平均值”。因此,對我來說,最簡單的方法似乎是根據(jù)年份值更新源數(shù)據(jù)。
添加回答
舉報
0/150
提交
取消