Learn how to use Dash Bio for next-gen sequencing & quality control. 🧬Register for the Oct 27 webinar.

Awesome MATLAB surf Charts with Plotly

surf is a MATLAB function that allows us to plot surfaces. With this function we can create impressive three-dimensional Charts in MATLAB. However, using fig2plotly we can enhance these Charts taking advantage of the elegance that Plotly has.

To handle surf with fig2plotly it is necessary to set the optional parameter 'TreatAs' to 'surf'. Let’s see an example below

[X,Y,Z] = peaks(25);
CO(:,:,1) = zeros(25); % red
CO(:,:,2) = ones(25).*linspace(0.5,0.6,25); % green
CO(:,:,3) = ones(25).*linspace(0,1,25); % blue
surf(X,Y,Z,CO);

fig2plotly(gcf, 'offline', false, 'TreatAs', 'surf');

If we execute the previous code, the result that we will obtain is the following

On the left we find the surface generated by MATLAB, while on the right we can delight in the elegance created by fig2plotly. Amazing and easy! Right? :raised_hands:

Here you can find Plotly’s Chart in Chart-Studio. Please follow that link so you can experience the beauty of Plotly.

Following this link you can find more examples using surf, which you can recreate using fig2plotly. Please try to do it! I did it and was fascinated! :laughing: I attach below screenshots with results I got