Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

3D scatterplot Density Matplotlib

To visualize my prediction in my Random Forest Regression I usually plot a scatter plot between the true value and the predicted value which looks like this: enter image description here

My goal would be to visualize this in a 3D scatterplot, where you can see in the 3rd axis the density. Right now I am loosing a lot of information about how often the value 3000 was predicted as 3000. Therefore it would be nice to see the density, which displays how often predicitons are laying over each other.

Right now I am using this code:

#Scatter Plot
predictions_rf = rf.predict(X_test)
plt.figure(figsize=(10,10))
plt.gca().set_aspect('equal', adjustable='box')
plt.scatter(Y_test, predictions_rf)
plt.xlabel("True Values")
plt.ylabel("Predictions")

Is there any way to get the density in the 3rd axis?

Thank you, R

Comments