How do I get different symbols for entries plotted in a for loop?

I would like to plot water data by state by region. (So I would have multiple figures, where each figure would have water use data over 10 years for states in that region.)
I am having trouble with getting my code to plot each state with a different symbol and color within each of the regional figures.
I identified a character matrix "Symbols" that has multiple symbols available. I have my loop set up to read the number of regions and for each region plot the states' time series. Instead of getting a regional figure that has different symbols for each region, the code currently "replots" all states with the different symbols and the final figure for the region just uses the last symbol.
Here is my code:
C_location = {'Central', CEb; 'Northeast', NEb; 'Northwest', NWb;...
'Southwest', SWb; 'Southeast', SEb; 'South', Sb;...
'W', Wb; 'Upper Midwest', UMb; 'W.N. Central', WNCb};
% The matrix IDs the location of the different states in the water use matrix, "total_m". It is a 9X2 cell (9regions, 2 columns - name of region and states in region)
total_m = [cell2mat(Ccell(:,1))];
% Matrix = 49X10 (49 states, 10 years)
Symbols = ['+';'o';'*';'.';'x';'s';'d';'p';'h';'<';'>';'^';'v'];
% Find the number of regions
[r_reg c_reg] = size(C_location);
for m = 1:r_reg
% Find the number of states
[r_st c_st] = size(C_location{m,c_reg});
min = C_location{m,c_reg}(1); % IDs location of first state in that region
max = C_location{m,c_reg}(end); % IDs location of last state in that region
for n = 1:r_st
% Plot the figure by region
figure(m)
hold on
Cplot = plot(years(:), total_m(min:max,:), Symbols(n,:),...
'MarkerSize',10);
hold off
end
end
What am I doing wrong?

1 Comment

1. min and max are reserved words. Best not to use them as variables.
2. Is a region comprised of several states or are regions within a state?
3. You want a plot of several lines with different symbols for each line, right?

Sign in to comment.

Answers (0)

Categories

Asked:

on 1 Aug 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!