GLG410 Matlab electron density plot diary

These are the commands that I gave to make this plot.

>> pwd

ans =


>> ls

ans =


>> load na
>> load naorg
>> na_sort = sort(na);
>> help subplot

 SUBPLOT Create axes in tiled positions.
    H = SUBPLOT(m,n,p), or SUBPLOT(mnp), breaks the Figure window
    into an m-by-n matrix of small axes, selects the p-th axes for 
    for the current plot, and returns the axis handle.  The axes 
    are counted along the top row of the Figure window, then the
    second row, etc.  For example,
        SUBPLOT(2,1,1), PLOT(income)
        SUBPLOT(2,1,2), PLOT(outgo)
    plots income on the top half of the window and outgo on the
    bottom half.
    SUBPLOT(m,n,p), if the axis already exists, makes it current.
    SUBPLOT(H), where H is an axis handle, is another way of making
    an axis current for subsequent plotting commands.
    SUBPLOT('position',[left bottom width height]) creates an
    axis at the specified position in normalized coordinates (in 
    in the range from 0.0 to 1.0).
    If a SUBPLOT specification causes a new axis to overlap an
    existing axis, the existing axis is deleted.  For example,
    the statement SUBPLOT(1,2,1) deletes all existing axes overlapping
    the left side of the Figure window and creates a new axis on that
    SUBPLOT(111) is an exception to the rules above, and is not
    identical in behavior to SUBPLOT(1,1,1).  For reasons of backwards
    compatibility, it is a special case of subplot which does not
    immediately create an axes, but instead sets up the figure so that
    the next graphics command executes CLF RESET in the figure
    (deleting all children of the figure), and creates a new axes in
    the default position.  This syntax does not return a handle, so it
    is an error to specify a return argument.  The delayed CLF RESET
    is accomplished by setting the figure's NextPlot to 'replace'.

>> subplot(3,2,1)
>> plot(na_sort);
>> title('Electron density sorted')
>> xlabel('Observation#')
>> ylabel('Electrons/angstrom^3')

>> subplot(3,2,2)
>> plot(na)
>> title('Electron density')
>> xlabel('Observation#')
>> ylabel('Electrons/angstrom^3')

>> subplot(3,2,3)
>> size(naorg)

ans =

        4900           4

>> naorg_sq = reshape(naorg',140,140);
>> xstep = (4.75- -4.75)/139

xstep =


>> x = [-4.75:xstep:4.75];
>> length(x)

ans =


>> y = x;
>> contour(x,y,naorg_sq);
>> title('A few equal spaced contours')
>> xlabel('distance, angstroms')
>> ylabel('distance, angstroms')

>> subplot(3,2,4)
>> v=[0:0.01:0.5];
>> contour(x,y,naorg_sq, v);
>> title('50 lower contours')
>> xlabel('distance, angstroms')
>> ylabel('distance, angstroms')

>> subplot(3,2,5)
>> surfl(x,y,naorg_sq)
>> shading interp
>> title('Surface plot of electron density')
>> xlabel('distance, angstroms'),ylabel('distance,angstroms'),zlabel('electrons/angstrom^3')

>> subplot(3,2,6)
>> tf = naorg_sq<0.5;
>> surf(tf)
>> clip = tf.*naorg_sq;
>> surf(clip)
>> tf = tf-1;
>> tf = tf.*-0.5;
>> clip_n_clean = clip+tf;
>> surfl(x,y,clip_n_clean)
>> shading interp
>> colormap pink
>> view(285,45)
>> title('Surface plot of electron density < 0.5 e-/ang^3')
>> xlabel('distance,angstroms'),ylabel('distance,angstroms'),zlabel('electrons/angstrom^3')

>> diary off

Pages maintained by
Prof. Ramón Arrowsmith

Last modified November 15, 1999