I have four 5x5 matrices that I want to compare to one "original"-matrix. I calculated the error of each matrix which results in a new 5x5 matrix that has the percentage error for each entry.
e.g.: Matrix_W
Ac Bc Cc Dc Ec
Ar 0.04 0.03 0.02 0.05 0.06
Br 0.01 0.02 0.04 0.02 0.01
Cr 0.03 0.05 0.09 0.08 0.01
Dr 0.07 0.09 0.05 0.03 0.01
Er 0.01 0.03 0.05 0.05 0.08
(r for row, c for column)
I stored four of these matrices in a pandas DataFrame:
Ac Bc Cc Dc Ec rowValue mType
0.04 0.03 0.02 0.05 0.06 Ar W
0.01 0.02 0.04 0.02 0.01 Br W
0.03 0.05 0.09 0.08 0.01 Cr W
0.07 0.09 0.05 0.03 0.01 Dr W
0.01 0.03 0.05 0.05 0.08 Er W
0.04 0.04 0.03 0.01 0.02 Ar X
0.09 0.07 0.05 0.04 0.01 Br X
0.01 0.02 0.06 0.05 0.07 Cr X
……
0.06 0.08 0.04 0.03 0.09 Er Z
Now, I want to create a 5x5 scatterplot matrix using seaborn to plot the error for each of the four matrices. Similar to this one, just with a 5 columns and rows:
So cell 0,0 (upper left corner) of the scatterplot matrix should show a plot of the error in position Ac, Ar of the four matrices. The x and y axis of the scatter plot matrix are independent: x_vars = Ac up to Ec; y_vars= Ar up to Er. The hue should depend on the mType variable.
The following code did not lead to the desired output:
Import Seaborn as sns
g = sns.PairGrid(df, x_vars=df.columns[:-2], y_vars=df[‚rowValue‘], hue=df[‚mType‘])
g.map(sns.scatterplot)
The result I get is a 20x5 matrix which does not seem to have an independent x and y-axis. I am not sure if the issue is how I store the data in the DataFrame, or if there are other things that I have to do beforehand to achieve the desired result. Any help is much appreciated!
