Plotting HSP in Matlab

8 次查看(过去 30 天)
Peter
Peter 2023-9-22
I am trying to recreate a Hansen solubility sphere using Matlab. I can plot the solute sphere using:
[x,y,z] = sphere;
radius = 7.1;
x = x * radius;
y = y * radius;
z = z * radius;
x_offset = 17.0;
y_offset = 9.8;
z_offset = 9.4;
surf(x+x_offset,y+y_offset,z+z_offset)
surf(x,y,z,'FaceAlpha',0.3)
shading("interp")
colormap("summer")
xlabel('\delta_{d}', 'FontSize', 20);
ylabel('\delta_{p}', 'FontSize', 20);
zlabel('\delta_{h}', 'FontSize', 20);
axis equal;
However, I now need to be able to superimpose a 3D scatter plot on the same plot as the sphere. Any suggestions?

回答(1 个)

Star Strider
Star Strider 2023-9-22
Use the hold function —
[x,y,z] = sphere;
radius = 7.1;
x = x * radius;
y = y * radius;
z = z * radius;
x_offset = 17.0;
y_offset = 9.8;
z_offset = 9.4;
figure
surf(x+x_offset,y+y_offset,z+z_offset)
hold on
surf(x,y,z,'FaceAlpha',0.3)
hold off
shading("interp")
colormap("summer")
xlabel('\delta_{d}', 'FontSize', 20);
ylabel('\delta_{p}', 'FontSize', 20);
zlabel('\delta_{h}', 'FontSize', 20);
axis equal;
.
  4 个评论
Peter
Peter 2023-9-26
Thanks - et voilla. Some tinkering to do with marker colour/shape, but it's not a bad approximation of what we get with bespoke sofware.
Star Strider
Star Strider 2023-9-26
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Scatter Plots 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by