MATLAB Examples

Plot Cars

Create a scatter plot of cars organised by weight, MPG, price and make

Contents

Load data

opts = detectImportOptions( 'imports-85.xlsx' );
t = readtable( 'imports-85.xlsx', opts );

Create scatter plot

scatter( t.curb_weight, t.city_mpg, t.price/100 )
for n = 1:height( t )
    text( t.curb_weight(n), t.city_mpg(n), t.make(n), 'Rotation', 30 );
end
xlabel( 'Curb weight' )
ylabel( 'City MPG' )
title( 'Auto imports 1985' )