SNL-WaterPower / WecOptTool-MATLAB

WEC Design Optimization Toolbox
GNU General Public License v3.0
12 stars 9 forks source link

Make flashy rotating plots #184

Closed ryancoe closed 3 years ago

ryancoe commented 3 years ago

While not helpful for papers (unless the publisher allows uploading videos) it is often handy to rotate a 3D plot to comprehend the data.

ryancoe commented 3 years ago

I used the following code to do this for WaveBot_caseC using the CaptureFigVid function from the MATLAB FileExchange.

knee_idx = 36; % a potential single solution on the Pareto front

figure('color','white')
hold on
grid on     

scatter3(-pBar, vol, zmax, 75, zmax, 'filled','LineWidth',0.5,...
    'MarkerEdgeColor','k','MarkerFaceAlpha',0.5);
scatter3(-pBar(knee_idx), vol(knee_idx), zmax(knee_idx),150,...
    'marker','+','MarkerEdgeColor','k','LineWidth',2);

view([13, 18])

cb = colorbar;
cb.Label.Interpreter = 'latex';
cb.Label.String = ('Max. PTO stroke, $z^{\textrm{max}}$ [m]');

% these kind of get in the way, let's leave them out
% xlabel('Neg. avg. power, $ - \bar{P}$ [W]', 'interpreter','latex')
% ylabel('Vol. fun, $(r_0 + r)^3$ [m$^3$]', 'interpreter','latex')
% zlabel('Max. PTO stroke, $z^{\textrm{max}}$ [m]', 'interpreter','latex')

axis vis3d
vidOpts.FrameRate=25;
vidOpts.Duration=10;
vidOpts.Periodic=true;
CaptureFigVid([160,10;360+160,10],...
    'WecOptTool_WaveBot_caseC',vidOpts)

and then produced a .gif with ffmpeg and the instructions here.

WecOptTool_WaveBot_caseC mp4