Python 绘制排序值Seaborn

Python 绘制排序值Seaborn,python,pandas,plot,seaborn,Python,Pandas,Plot,Seaborn,我试图通过对特定列进行排序来绘制线条图,但是在使用seaborn进行排序和绘制时,这会出现问题。我一直在按真实专栏排序,但有以下情节 normalized_evaluation_table = get_evaluation_table(normalized_prediction_intervals, normalized_interval_size, y_test) #normalized_evaluation_table normalized_sorted_table = normalized

我试图通过对特定列进行排序来绘制线条图,但是在使用seaborn进行排序和绘制时,这会出现问题。我一直在按真实专栏排序,但有以下情节

normalized_evaluation_table = get_evaluation_table(normalized_prediction_intervals, normalized_interval_size, y_test)
#normalized_evaluation_table
normalized_sorted_table = normalized_evaluation_table.sort_values("true", ignore_index = True).reset_index()
normalized_sorted_table
sorted_data_long = normalized_sorted_table.melt(value_vars=['min', 'true', 'max']).reset_index()
sorted_data_long
ax = sns.lineplot(x="index", y="value", data=sorted_data_long, hue = "variable")
数据集排序

当前绘图

通过接受答案获得的输出:

您可以使用
matplotlib
在列中绘制数据。这样,您将拥有更大的灵活性。如果喜欢情节的seaborn样式,可以导入其样式

import matplotlib.pyplot as plt
plt.style.use("seaborn")

fig, ax = plt.subplots(figsize=(10,6))
ax.plot(sorted_data_long['index'], sorted_data_long['min'], 'b-')
ax.plot(sorted_data_long['index'], sorted_data_long['max'], 'g-')
ax.plot(sorted_data_long['index'], sorted_data_long['true'], 'r-')
plt.show()

谢谢,这就成功了:)我用你的答案更新了问题我很高兴它起作用了!您可以使用其他几种样式,如ggplot等。请参见此处: