How to subset the ylables to be displayed only on certain rows?
    3 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Armando MAROZZI
 el 8 de Nov. de 2020
  
    
    
    
    
    Comentada: Armando MAROZZI
 el 8 de Nov. de 2020
            I have 24 series to plot but I would like to have the y-label displayed only on the rows 1,7,13,19.
I tried this solution but it is not successful:
x = randn(30, 24) % data
y_label_names = {'%', '%','%','%','%','%','%','%','%','%','%','%','%','%','%','%','%','%','%','%','%','%','%','%'};
for j = 1:24
    subplot(4, 6, j);
    plot(x(:,j));   
    hold on
if (j > 18)
      xlabel('months');
end
  if (mod(j,3)==1) % here I would only have y-lables for rows 1,7,13 and 19
ylabel(y_label_names{j})
  end 
yline(0, '-')
end
Can anyone help me?
Thanks!
0 comentarios
Respuesta aceptada
  Mathieu NOE
      
 el 8 de Nov. de 2020
        hello 
my suggestion 
x = randn(30, 24); % data
y_label_names = {'§', '%','%','%','%','%','§','%','%','%','%','%','§','%','%','%','%','%','§','%','%','%','%','%'};
for j = 1:24
    subplot(4, 6, j);
    plot(x(:,j));   
    hold on
    if (j > 18)
          xlabel('months');
    end
%   if (mod(j,3)==1) % here I would only have y-lables for rows 1,7,13 and 19
    if any((j - [1 7 13 19]) == 0)
        ylabel(y_label_names{j})
    end 
yline
Más respuestas (0)
Ver también
Categorías
				Más información sobre Annotations en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!