I cannot for the life of me find a similar question to this, and I have been pulling my hair out trying to figure out how to do this. It seems like it should be a simple thing!
The setup: I have some X vs Y data grouped into bins, and each bin contains X and Y data points. For each bin, I would like to plot the mean of X vs mean of Y along with their respective stdevs, and most importantly: color code each bin using the Seaborn "colorblind" palette (this is mandatory).
What I've tried: Everything under the sun. Lineplot, scatterplot, catplot, plotpoints. And when none of those were working, I tried to use matplotlib's "errorbars" but I apparently can't seem to export Seaborn's "colorblind" palette to matplotlib so that was a bust too.
Some dummy code:
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
some_data = pd.DataFrame({'X':[9,10,11,12,39,40,41,42], 'Y':[99,100,110,111,499,500,510,511], 'Bin':[1,1,1,1,2,2,2,2]})
Results of some tries:
sns.pointplot(x="X", y="Y", data=some_data, legend='full', hue='Bin')
Scatterplot completely screws up the x-axis scale, so that's another issue that I haven't been able to work around.
sns.lineplot(x="X", y="Y", data=some_data, legend='full', hue='Bin', err_style="band", estimator="mean", ci='sd')
Better but it's just drawing a line between the points instead of calculating the mean and stdev, which, I thought it would do when I specify an estimator and confidence interval method!!!!!.
sns.scatterplot(x="X", y="Y", data=some_data, legend='full', hue='Bin')
Scatterplot is fine, but it doesn't possess estimator functionality so I'm literally just plotting the raw data.
I'm just completely lost on what to do. I've been at this all night. It's 4:30 AM and I've barely slept for the past few nights. Any help would be appreciated!



