O'Reilly logo

MATLAB Graphics and Data Visualization Cookbook by Swapnonil Banerjee, Nivedita Majumdar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

3D scatter plots

This recipe explores the concept of 3D scatter plots.

Getting ready

In this recipe, the data is contained in a 3D matrix representing the electron hopping probability computed at each point of a 3D lattice structure. Load the data:

load latticeExample

How to do it...

Perform the following steps:

  1. Use 3D scatter plots to construct a basic scatter plot view of the data:
    % unwrap the x,y and z matrices xx = x(:);yy = y(:);zz = z(:); % locate the non-zero points a = find(T~=0); % plot the non-zero points using a scatter plot; use the % values of T to represent both color and size of symbols scatter3(xx(a),yy(a),zz(a),1000*T(a),T(a),'filled'); % set the view view(3); campos([ -7.8874 -217.1200 13.7208]); % add colorbar to read probability ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required