Reputation: 164
I am trying to plot a lineplot and have custom xticks in the plot. This is the code I have used:
sns.set_style("darkgrid")
sns.lineplot(y = mean_train_score, x = alpha, label = "Train")
sns.scatterplot(y = mean_train_score, x = alpha, label = "Train")
sns.lineplot(y = mean_val_score, x = alpha, label = "Validation")
sns.scatterplot(y = mean_val_score, x = alpha, label = "Validation")
plt.title("Hyperparameter vs AUC plot")
plt.xlabel("Alpha")
plt.ylabel("AUC")
plt.xticks(np.arange(100), np.arange(0,100,10))
plt.legend()
plt.show()
This is the plot it generates:
This is the original plot
I think it is a problem with the plt.xticks part. Please Help :).
Upvotes: 0
Views: 49
Reputation: 96
The way your code is running now, all of the x-ticks are being positioned at (0,0) because the arrays are of different length. I was able to get the xticks to work by doing this
plt.xticks(np.arange(100), [x if x%10==0 else None for x in np.arange(100)]
Upvotes: 1