Same color marker for each pair of dataset
Show older comments
I have 3 excel files with systematical naming convention (eg. ABC_676_L_134.xlsx, ABC_676_L_135.xlsx, and ABC_676_L_136.xlsx). I am plotting 2 set of data from each files, one is scatter plot with x marker and other is plot function with default line marker.
Is it possible to have same colour for each pair of data set (from same excel file)? Here is function script I have for now.
cheers, dewio
function [] = plottingsubroutine(filename,num)
n = strcat(filename(5:7),'-',filename(14:end-5));
scatter(num(6:end,9:9),num(6:end,7:7),'x','DisplayName',num2str(n))
hold on
plot(num(6:end,9:9),num(6:end,11:11),'DisplayName',strcat(num2str(n),' Fit'))
xlabel('Tonnes w/o Controller')
ylabel('Tonnes removed')
title(strcat(filename(9),'-',filename(11:12)))
hold all
% % Plot for Perfect Controller
x = 123: 144;
y = x-123;
r = round(max(num(6:end,7:7))+0.7);
plot(x,y,'r','DisplayName','Perfect Controller')
ylim([0 r])
xlim([100 130])
Answers (1)
Geoff Hayes
on 17 May 2015
0 votes
dewio - since you are using the scatter and plot functions only, then you can define the colour that you want to use for each by setting the correct properties. For the scatter function, see MarkerEdgeColor and MarkerFaceColor, and for the plot function see Color.
Categories
Find more on Scatter Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!