Changing colors for findpeaks function
    8 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
I wanted to graph male and female find peaks graphs together and have the graphs be blue and pink. Is there any way for me to change the colors in the code itself?
[numRows,~] = size(male_data);
x = numRows;
[pk,loc] = findpeaks(male_data,x);
plot(x, y, '-', pk, loc, 'Color', [0.9414, 0.5664, 0.6055]); % is there any way to control color?
That was as close as I got but it is giving me an error. Male_data is an array. 
0 comentarios
Respuestas (1)
  dpb
      
      
 el 8 de Sept. de 2022
        Sure, but not with the triplet form  of plot to use anything except the named colors...
hL=plot(x,y,'-', pk,loc,'*');               % plot the two, default color first, save line handles
set(hL,'Color',[0.9414, 0.5664, 0.6055])    % now set the color triplet
2 comentarios
  Pushti Shah
 el 10 de Sept. de 2022
				
      Editada: Pushti Shah
 el 10 de Sept. de 2022
  
			
		
  dpb
      
      
 el 10 de Sept. de 2022
				Well, yes,..when you wrote
[numRows,~] = size(male_trans);
x = numRows;
y = (mean(male_trans(x)));
numRows is a single value and so, then, will be male_trans(x)) and even if you wrote male_trans(x,:)) to take the whole row, then  mean(male_trans(x)) would turn it back into a single value anyway.  Can't find a peak with only one point...
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

