% plotExample.m
%
% Examples of several plotting options
% Written Summer 2011 by John Bell for CS 109

load R48.txt

lat = R48( :, 1 );
long = R48( :, 2 );
depth = R48( :, 3 );
speed = R48( :, 6 );
heading = R48( :, 7 );

subplot( 2, 3, 1 );
    plot( long,lat, 'ro' );
    title( 'Boat Path' );
    xlabel( 'Longitude' );
    ylabel( 'Latitude' ); 
    figure( gcf );
    
subplot( 2, 3, 2 );
    plot3( long, lat, -depth, 'b' );
    title( 'Boat Path in 3D ' );
    xlabel( 'Longitude' );
    ylabel( 'Latitude' ); 
    zlabel( 'Depth' );
    grid on;
    figure( gcf );

subplot( 2, 3, 3 );
    colormaps;
    p = peaks( 25 );
    surfc( peaks );
    shading interp;
    colorbar;
    colormap( rwb );
    title( 'Custom Colormap( rwb )' );
    figure( gcf );

subplot( 2, 3, 4 );
    head = ( 450 - heading ) * 2 * pi / 360;
    xVector = speed .* cos( head );
    yVector = speed .* sin( head );
    quiver( long, lat, xVector, yVector );
    title( 'Quiver Plot' );
    figure( gcf );
    
subplot( 2, 3, 5:6 );
    errorbar( long, lat, 0.001 * rand( size( lat ) ), ...
        0.0002 * rand( size( lat )));
    title( 'Error bar plot - Spanning two cells' );
    figure( gcf );