Hello,
this is hopefully the last question I have for now.
The function "LPplotfun" will plot the matrices LPmatx/LPmaty row for row against each other. I want each plotted line to have a different color, so that they're distinguishable. However, I don't want it to be random. Instead, the first function is supposed to be red, second blue, third green, etc. If no colors are left it is supposed to roll over to red again.
The reason is that the function "LPerrorbarfun" (if it is activated) will plot the errorbars for the data points of each plot iteration. In that case, the errorbars and respective graphs should have the same color. So I have to somehow controll which color the "LPplotfun" and "LPerrorbarfun" grab use at each iteration of the for-loop.
I tried experimenting with the "colororder"-command, but couldn't figure out how it works/how I could implement it.
Is there a way to achieve this?
Thank you.
Below is the code for both functions
%% The plotting function
function LPplotfun(LPmatx,LPmaty,LPFits,LPNumRows,LPErrorbar_Flag) %LPplotfun plots all LPfit set up by LPfitfun
hold onfor k=1:1:LPNumRows hold on axis([-500 500 -500 500]) plot(LPFits{1,k},'') hold on if LPErrorbar_Flag == 0 plot(LPmatx(k,:),LPmaty(k,:),'o') hold on else hold on end% LPfits=LPfitfun(LPmatx,LPmaty,LPNumRows) %"LPfits" is the name of the cell in which all LPfits are stored.
pause(0.75) hold onendend%% The errorbar function
function LPerrorbars(LPmatx,LPmaty,LPmaterrorx,LPmaterrory,LPNumRows) %LPerrorbars plots all errorbars for the different data points
hold onfor k=1:1:LPNumRows hold on errorbar(LPmatx(k,:),LPmaty(k,:),LPmaterrory(k,:),LPmaterrory(k,:),LPmaterrorx(k,:),LPmaterrorx(k,:),'o')endhold onend
Best Answer