How can I make my 3D plot show clearer surface dynamics?

7 views (last 30 days)
I am trying to graph medical data about organ failure over time. I used the "3D graph" feature to graph my data (in table format) on MATLAB, but the surface plot I created isn't very clear. It looks like it still needs smoothing and a better heatmap to visualize subtle changes in the surface over the z-axis, which is time in days.
function createfigure1(xdata1, ydata1, zdata1, trigger) %CREATEFIGURE1(XDATA1, YDATA1, ZDATA1, CDATA1) % XDATA1: sensitivities (table) % YDATA1: ICU day % ZDATA1: specifities (table)
% Create figure figure1 = figure;
% Create axes axes1 = axes('Parent',figure1,... 'YTickLabel',{'1 (n=871)','3 (n=871)','5 (n=488)','7 (n=316)'},... 'YTick',[1 2 3 4],... 'Position',[0.0596875000000002 0.104727592267135 0.775 0.815]); view(axes1,[31.5 16]); grid(axes1,'on'); hold(axes1,'on');
% Create surf mesh(xdata1,ydata1,zdata1,'Parent',axes1)
if trigger==1, % Create xlabel xlabel('Specificity');
% Create ylabel
ylabel('ICU day');
% Create zlabel
elseif trigger==2,
% Create xlabel
xlabel('Negative likelihood ratio');
% Create ylabel
ylabel('ICU day');
% Create zlabel
zlabel('Positive likelihood ratio');
% Create title title('Relationship between cumulative ICU organ failure data and predictive accuracy');
% Create colorbar colorbar('peer',axes1,'Position',... [0.902573195764909 0.10531929036514 0.0288101411696917 0.815]);
set(gca,'XGrid', 'on');
Any help would be greatly appreciated! Thx!

Answers (1)

Div Tiwari
Div Tiwari on 8 Aug 2016
The ideal approach is this scenario depends on the underlying cause of the plot not being clear.
Smoothing is typically helpful when data is sufficient or 'excessive' and somewhat noisy. The 'smooth3' function can be used to smoothen 3-dimensional data:
If, instead, the data size is small and results in a jagged-looking mesh plot, you can perform 2-D interpolation on the data using 'interp2' and plot the resulting finer grid. The following link describes such a workflow:
Using the 'griddedInterpolant' class to perform the interpolation can offer some additional benefits, such as improved performance and greater control over interpolation methods. This link describes how it can be used to interpolate in two dimensions:
Finally, you may use the 'colormap' function to specify a custom colormap. If there are small regions with extreme values that affect the coloring across a majority of the surface, you may use 'caxis' to change color limits, as shown here:

Community Treasure Hunt

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

Start Hunting!