MATLAB Answers

How could i displace the values of X axis under X axis (Y negative) ?

4 views (last 30 days)
Oreste Russo
Oreste Russo on 13 Feb 2019
Edited: Yair Altman on 16 Feb 2019


Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 13 Feb 2019
Use the equation (or values) for the line, and plot the numbers just as you have plotted them under the circles. If you do not have an equation for the line that gives you the values for it at every ‘x’ value, use the interp1 function to calculate them.


Show 1 older comment
Star Strider
Star Strider on 15 Feb 2019
Apparently the numbers are not x-tick values, or you could possibly use 'XTick' and 'XTickLabel'.
I have no idea how you are currently writing them, or what relation they have to the x-tick values. (It would help to know.) To put them under the x-axis, you can use the text function:
x_vals = x_values_corresponding_to_the_XTick_locations_you_want_the_numbers;
text(x_vals, zeros(size(x_vals)), compose('%d', 2:2:16), 'VerticalAlignment','top', 'HorizontalAlignment','center')
If you do not have the compose funciton, use sprintfc (undocumented). The arguments are the same:
text(x_vals, zeros(size(x_vals)), sprintfc('%d', 2:2:16), 'VerticalAlignment','top', 'HorizontalAlignment','center')
Oreste Russo
Oreste Russo on 15 Feb 2019
this is my script for the plot
grid on
xlabel('\alpha [°]')
axis([-6 19 -0.8 0.8])
hold on
title('POLO X=0.265 Y=0 63A412 Re=3e6','LineWidth',1)
legend ('XFOIL non viscoso','XFOIL ascissa forzata','XFOIL ascissa libera')
hold off
Star Strider
Star Strider on 15 Feb 2019
I don‘t have your data, so I can’t run your script.
I also have no idea what you want to do.
I gave you valid code. If it doesn’t work for you, I need to know the reason. Your posted code — especially without necessary data — gives me no useful information.

Sign in to comment.

More Answers (1)

Yair Altman
Yair Altman on 16 Feb 2019
Edited: Yair Altman on 16 Feb 2019
A peculiarity of AxisLocation='origin' is that the X and Y tick labels automatically switch location (from below the X axis to above-it, and from left of the Y axis to right-of-it, respectively) depending on where the axes origin (0,0) is located. You can easily see this behavior by dragging (panning) the axes up/down and left/right, respectively.
If you want to ensure that the labels appear beneath the X axes, then make the YLimit above the axes larger than the one beneath it. For example:
ax.YLim = [-.80001,.8];
axis([-6 19 -0.80001 0.8]); % alternative

Sign in to answer this question.