Set new position for x label at semilogx diagram

1 Ansicht (letzte 30 Tage)
Dimitris Kokkinos
Dimitris Kokkinos am 26 Jan. 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 Kommentare
Dimitris Kokkinos
Dimitris Kokkinos am 26 Jan. 2015
I would,also, like to get grid lines only at my values position if possible!! Thanks in advance.
Dimitris Kokkinos
Dimitris Kokkinos am 26 Jan. 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')

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Thorsten
Thorsten am 26 Jan. 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')

Kategorien

Mehr zu Labels and Annotations finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by