Efficient generation of high-density graphics

4 views (last 30 days)
I have a two large arrays that I wish to graph (for each interation of a loop within a function, so there will be alot of these pairs). In order to minimize the time the overall function takes to execute, I would like to know how to implement the following best practices:
  1. How can I stop MatLab from plotting occluded elements/lines in a 2x1 surface plot?
  2. How might I go about reducing the data that is fed into the surface plot so that I avoid "creating straight lines with mutiple data points"? Is this practice even relevant to surface plots?
  3. For my specific use case, I'm trying to create 4 views of the 2x1 surface object. How do (and/or should I) prevent MatLab from drawing the object (which I assume takes the most time) until all 4 views are setup?
  4. As an addendum to (3), which of subplot and tiledlayout do you think is better for this task?
Finally, can someone explain why this
SurfaceFigure = figure()
SurfaceLayout - tiledlayout(SurfaceFigure,2,2,'Padding','compact');
axesTop = nextile(1);
xlabel(axesTop,'Data Label 1'); ylabel(axesTop,'Data Label 2'); zlabel(axesTop,'Data Label 3');
axis(axesTop,'tight'); view(axesTop,0,90)
surface(XData,YData,ZData1,'FaceColor','k','EdgeColor','none');
surface(XData,YData,ZData2,'FaceColor','y','EdgeColor','none');
axesIso = nextile(2);
xlabel(axesIso,'Data Label 1'); ylabel(axesIso,'Data Label 2'); zlabel(axesIso,'Data Label 3');
axis(axesIso,'tight'); view(axesIso,-45,45)
surface(XData,YData,ZData1,'FaceColor','k','EdgeColor','none');
surface(XData,YData,ZData2,'FaceColor','y','EdgeColor','none');
axesFront = nextile(3);
xlabel(axesFront,'Data Label 1'); ylabel(axesFront,'Data Label 2'); zlabel(axesFront,'Data Label 3');
axis(axesFront,'tight'); view(axesFront,90,0)
surface(XData,YData,ZData1,'FaceColor','k','EdgeColor','none');
surface(XData,YData,ZData2,'FaceColor','y','EdgeColor','none');
axesRight = nextile(4);
xlabel(axesRight,'Data Label 1'); ylabel(axesRight,'Data Label 2'); zlabel(axesRight,'Data Label 3');
axis(axesRight,'tight'); view(axesRight,0,0)
surface(XData,YData,ZData1,'FaceColor','k','EdgeColor','none');
surface(XData,YData,ZData2,'FaceColor','y','EdgeColor','none');
is taking a shade under a minute while this
SurfaceFigure = figure()
SurfaceLayout - tiledlayout(SurfaceFigure,2,2,'Padding','compact');
axesTop = nextile(1);
xlabel('Data Label 1'); ylabel('Data Label 2'); zlabel('Data Label 3'); axis tight; view(0,90)
Surface1 = surface(XData,YData,ZData1,'FaceColor','k','EdgeColor','none');
Surface2 = surface(XData,YData,ZData2,'FaceColor','y','EdgeColor','none');
Surfaces = [Surface1,Surface2];
tic
axesIso = nextile(2);
copyobj(Surfaces,axesIso);
toc
is taking ~612 seconds?
Once I have the visuals figured out, I will set the initial figure visibility to off and use getframe if possible, otherwise saveas or print to export the figure to a png.

Answers (0)

Categories

Find more on Printing and Saving in Help Center and File Exchange

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!