Borrar filtros
Borrar filtros

Set new position for x label at semilogx diagram

2 visualizaciones (últimos 30 días)
Dimitris Kokkinos
Dimitris Kokkinos el 26 de En. de 2015
Comentada: Dimitris Kokkinos el 26 de En. de 2015
  • I have a semilogx diagram and I need to change the name and the position of the x labels as shown in the two pictures attached below.My data are pairs of values. *
X_values=> Tr=[0;2;5;10;25;50;100;200;500];
Y_values1=> SSa=[0.377;0.4050;0.422;0.44;0.452;0.461;0.469;0.478];
Y_values1=> SSb=[0.378;0.421;0.451;0.488;0.514;0.539;0.562;0.59];
Y_values1=> SSc=[0.348;0.384;0.41;0.439;0.46;0.478;0.495;0.515];
  • and my code *
figure('Name','ExtremeValues','NumberTitle','off')
semilogx(Tr,SSa,'g*-')
hold all
semilogx(Tr,SSb,'b*-')
semilogx(Tr,SSc,'r*-')
set(gca,'linewidth',1.5,'fontsize',11);
xlabel('ReturnPeriod','FontSize',12,'FontWeight','bold')
ylabel('StormSurge (m)','FontSize',12,'FontWeight','bold')
set(gca,'XTickLabel',sprintf('%3.4f|',Tr))
grid on
  2 comentarios
Dimitris Kokkinos
Dimitris Kokkinos el 26 de En. de 2015
I would,also, like to get grid lines only at my values position if possible!! Thanks in advance.
Dimitris Kokkinos
Dimitris Kokkinos el 26 de En. de 2015
Well I found solution to my problem.Thanks for your time. set(gca,'XTickLabel',sprintf('%3.0f|',Tr),'XTick',... [2,5,10,25,50,100,200,500],'XGrid','on','XMinorGrid','off')

Iniciar sesión para comentar.

Respuestas (1)

Thorsten
Thorsten el 26 de En. de 2015
semilogx(Tr(2:end),SSa,'g*-')
hold on
semilogx(Tr(2:end),SSb,'b*-')
semilogx(Tr(2:end),SSc,'r*-')
set(gca, 'XTick', [2 5 10 25 50 100 200 500])
grid on
set(gca, 'XMinorTick', 'off')
set(gca, 'XMinorGrid', 'off')

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by