Python Forum
Plotting 3D Data with Custom Colorbar - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Plotting 3D Data with Custom Colorbar (/thread-28203.html)



Plotting 3D Data with Custom Colorbar - Gates666 - Jul-09-2020

Hello,

I'm new to Python and I require some help. This might be pretty easy for most of you, but not for me. I'm working on my Bachelor's Degree and I have to plot some Data.

My Data looks like this:

WK____WLF____TF_____Rsquared
x_______y______z_________R
x_______y______z_________R
x_______y______z_________R
x_______y______z_________R
......................... 1 Million rows

I want to plot WK on the X Axis, WLF on the Y Axis and TF on the Z Axis. Every point in the plot shall be colored to it's rsquared value. But I just want a colorbar for rsquared > 0.6. All rsquared values below 0.6 should be grey or not visible. Is that possible? This is what I have so far. Sorry if it's completely wrong. I've searched the Internet but I could'nt find help and applying unspecific solutions is kinda difficult for me.

res = pd.read_csv("GP1_parameterization5.csv") 
fig = plt.figure()
ax = fig.gca(projection='3d')

x1=res['WK']                                                                #WK
x2=res['WLF']                                                               #WLF
x3=res['TF']                                                                 #TF


p=ax.scatter(x1,x2,x3,c=res['rsquared'])                                           

fig.colorbar(p,ticks=[0.6,0.7,0.8,0.9,1],extend="min")


I am really grateful for your help.