Friday, November 02, 2007

More Data Display

A blog called "Urban Spoon" came up with what it calls the Steak/Sushi Index.

The finding is not that surprising: In U.S. Cities where the ratio of steakhouses to sushi joints is higher tend to vote Republican.

This is the accompanying plot :

People often make this kind of plot to show a correlation. It is natural, because this is the kind of plots that programs like Excel encourage you to make.

This makes the point, but there is the inherent problem of how the data is ordered. A scatter plot might be more "impartial", but some information would be lost (the names of the cities).

My approach is to plot the data in a matrix

It is simple to do this in MATLAB:

Enter data into an Excel spreadsheet and save it as a .csv (comma delimited) datafile, which imports easily into MATLAB.

By default the data is imported into a matrix named data and the text is imported into a matrix called textdata.

This bit of code does the plotting

for i=1:N
text(data(i,1),data(i,2),char(textdata(i)));
hold on;
end;

Then it's simply a matter of setting the axes and making it look nice.

Update:
Looking at my plot I realized that the x quantity is not linear.

A city that has 2:1 steak:sushi will have a score of 2.00, but a place with the opposite ratio will have a score of 0.5. This is not right !

The proper scaling should be steak-sushi percentage. So I re-plot here it with that scaling.

Labels: ,

0 Comments:

Post a Comment

<< Home