I am trying to find the best way to plot some data . Basically I have a data file that has the columns latitude, longitude, depth, sample_ID,Group_ID. I would like to generate a 2-D scatter plot where y is depth and x is distance in km from north to south (or have transect distances calculated relative to the first station sampled in the indicated orientation), similar to an ODV style map like the one below:
UPDATED
I wanted to add a little more information to my initial question. After some more searching and testing I found a possible solution in R using the geosphere package and the distGEO function to convert my coordinates to distance in km which then can be mapped. (https://www.rdocumentation.org/packages/geosphere/versions/1.5-10/topics/distGeo)
If anyone knows a python way to do this though that'd be great!
UPDATED
ODV doesn't allow me to do the customization I need though. I would like to generate a plot like this where I can specify metadata variable to color the dots. To be more specific by the group_ID column in my data file seen in the example of my file below.
Latitude Longitude Depth_m Sample_ID Group_ID
49.7225 -42.4467 10 S1 1
49.7225 -42.4467 50 S2 1
49.7225 -42.4467 75 S3 1
49.7225 -42.4467 101 S4 1
49.7225 -42.4467 152 S5 1
49.7225 -42.4467 199 S6 1
46.312 -39.658 10 S7 2
46.312 -39.658 49 S8 2
46.312 -39.658 73 S9 2
46.312 -39.658 100 S10 2
46.312 -39.658 153 S11 2
46.312 -39.658 198 S12 2
Its been giving me a lot of trouble trying to figure it out though. I have calculated distance between coordinates using the haversine calculation but once I get there I am not sure how to use those distances to incorporate into a scatter plot. This is what I have so far:
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
#import haversine as hs
from math import radians
from sklearn.neighbors import DistanceMetric
df=pd.read_csv("locations.csv",sep="\t",index_col="Sample_ID")
#plt.scatter(df['Latitude'], df['Depth_m'])
#plt.show()
df['Latitude'] = np.radians(df['Latitude'])
df['Longitude'] = np.radians(df['Longitude'])
dist = DistanceMetric.get_metric('haversine')
x = dist.pairwise(np.unique(df[['Latitude','Longitude']].to_numpy(),axis=0))*6373
print(x)
This code lands me with a distance matrix for my coordinates but I honestly can't figure out how to take that and pull it in to a scatter plot that sets the x-axis from north to south. Especially since there are multiple depths with the same coordinate that have to be accounted for. Any help plotting is much appreciated!


