3D Plot with Four Variables

1 view (last 30 days)
Yaser Khojah
Yaser Khojah on 24 Sep 2018
Edited: Yaser Khojah on 24 Sep 2018
Hello, I have four variables (Demand, NPV_all, STD_all, STD_In) and I would like to plot them in a 3D plot. I have created the plot but for some reason I can not show the legend. Can anyone help please.
if true
Demand = rand(7,3);
NPV_all = rand(7,3);
STD_all = rand(7,3);
STD_In = [0.25 .5 .75] .* ones(7,3);
Demand_V = Demand(:);
NPV_V = NPV_all(:);
STD_V = STD_All(:);
STD_In_V = STD_In(:);
h = scatter3(Demand_V,STD_V,NPV_V,markerSize,STD_In_V,'filled');
title('Economic Impact of Production Profile')
xlabel('Demand [MMSCFD]')
ylabel('STD [$B]')
zlabel('NPV [$B]')
legend('STD = 0.25', 'STD = 0.50','STD = 0.75');
end

Accepted Answer

KSSV
KSSV on 24 Sep 2018
Demand = rand(7,3);
NPV_all = rand(7,3);
STD_all = rand(7,3);
STD_In = [0.25 .5 .75] .* ones(7,3);
Demand_V = Demand(:);
NPV_V = NPV_all(:);
STD_V = STD_all(:);
STD_In_V = STD_In(:);
markerSize = 10 ;
STD = [0.25 0.50 0.75] ;
figure
hold on
for i = 1:length(STD)
idx = abs(STD_In_V-STD(i))<=10^-3 ;
h = scatter3(Demand_V(idx),STD_V(idx),NPV_V(idx),markerSize,STD_In_V(idx),'filled');
end
title('Economic Impact of Production Profile')
xlabel('Demand [MMSCFD]')
ylabel('STD [$B]')
zlabel('NPV [$B]')
legend('STD = 0.25', 'STD = 0.50','STD = 0.75');
  1 Comment
Yaser Khojah
Yaser Khojah on 24 Sep 2018
Edited: Yaser Khojah on 24 Sep 2018
Thanks so much for your help and that is what I was looking for. Would it be possible to connect these dots? For example all the dots belong to 0.25?

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!