One dataframe contains the percentage change of several nerve amplitudes at the corresponding measurement points and a second their respective diameters.
>>> amp.head()
Timepoint 1 Timepoint 2 Timepoint 3 Timepoint 4 Timepoint 5 Timepoint 6
0 1.277778 0.944444 0.444444 0.0 0.0 0.0
1 0.941176 0.705882 0.352941 0.0 0.0 0.0
2 0.818182 0.490909 0.309091 0.0 0.0 0.0
3 1.000000 0.658537 0.414634 0.0 0.0 0.0
4 0.588235 0.455882 0.323529 0.0 0.0 0.0
>>> dia.head()
0 1.3
1 1.1
2 1.2
3 1.5
4 1.6
I would like to plot the amplitudes in relation to their diameter, as hue='insert column here' does in many Seaborn plots.
def plot_rows(df, color="xkcd:red"):
# Reference: https://stackoverflow.com/questions/32105817/plot-entire-row-on-pandas
number = df.shape[0]
rows = range(number)
fig, ax = plt.subplots(figsize=(8, 8))
plt.show()
Although this function does plot the amplitudes row by row, it doesn't show their diameter. Is it possible to do so any other way?
I thought about combining both datasets, sort them according to the diameter, divide the diameter in let's say 3 groups and then plot them all on the same graph with different colors, but I just can't figure out how.
Something like this was my first take
new_df = pd.concat([amp, dia], axis=1)
# sort the values into categories and exclude "Diameter [mm]" from the plot
small = new_df[(new_df["Diameter [mm]"] < max(new_df["Diameter [mm]"]) / 2)][:-1]
plot_rows(small[[small.columns.values]])

