简体   繁体   English

如何在 Python 中的单个 map 中显示两个不同的坐标数据框

[英]How to display two different coordinate dataframes in a single map in Python

I am trying to visualise the movements of a fish within my study area.我正在尝试想象研究区域内一条鱼的运动。 I have two different coordinate dataframes: the first Df1 contains the coordinates derived from the location of the fish at a given time, the second Df2 describes the positions of the submerged antennas used in the study necessary to locate the position of the fish.我有两个不同的坐标数据帧:第一个 Df1 包含在给定时间从鱼的位置导出的坐标,第二个 Df2 描述了研究中使用的水下天线的位置,这些天线是定位鱼的 position 所必需的。

Df1 = Df1 =

FishTag       X         Y
32212   43.55154   -63.21155
32212   43.55896   -63.21458
32212   43.55157   -63.21785
32212   43.55452   -63.21154
32212   43.55122   -63.21455

Df2 = Df2 =

Receiver    X         Y
1         47.55154   -68.21155
2         47.58622   -68.26332
3         47.57745   -68.96251
4         48.57455   -68.96521
5         48.57567   -69.94551
6         48.57759   -69.96251
7         48.54145   -69.95950

I created two distinct maps for each dataframe with .seaborn but i would like to overlap such maps to form a single map with all the informations!我为每个 dataframe 和.seaborn创建了两个不同的地图,但我想重叠这些地图以形成一个包含所有信息的 map!

import seaborn as sns导入 seaborn 作为 sns

fig1, ax = plt.subplots()
fig1 = sns.scatterplot(Df1, x="Lat", y="Lon", ax=ax)
fig1.show()

fig2, ax = plt.subplots()
fig2 = sns.scatterplot(Df2, x="Lat", y="Lon", hue="Receiver", ax=ax)
fig2.show()

Both maps have the same coordinates scale!两张地图的坐标比例尺相同!

Here an example of the expected output: the white circles are the receivers locations and the succession of red points are the positions of the animal.这是预期的 output 的示例:白色圆圈是接收器位置,连续的红点是动物的位置。

在此处输入图像描述

Reuse Axes for both plot:为 plot 重复使用Axes

import matplotlib.pyplot as plt

fig, ax = plt.subplots()
sns.scatterplot(data=Df1, x='X', y='Y', ax=ax)
sns.scatterplot(data=Df2, x='X', y='Y', ax=ax)
plt.show()

Output: Output:

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM