Ticks with a single common exponent at the side
6 ビュー (過去 30 日間)
古いコメントを表示
I would like to combine a single common exponent such as as seen in Plot 1
with a ticks based numerical order as seen in Plot 2
Here, a to n are arbitrary numbers.
I have tried
ax=gca;
ax.XAxis.Exponent=-2;
with Plot 2, but as it did not work I was wondering if there is any other command I can use when using ticks?
0 件のコメント
回答 (1 件)
Ayush
2023 年 10 月 9 日
Hi Filip,
I understand that you want to mark all the elements in your plot on the x-axis.
To do so, you can use the “xticks” function which will mark all the elements in your plot on x-axis.
You can refer to the below code for better understanding:
% Generate the data points
x = (1:14)*10^-2; % X-axis values
y = ones(1,14); % Y-axis values
% Plot the data
figure
plot(x, y, 'o-')
% % Set ticks for every element on the x-axis
xticks(x)
xlim([0 15*10^-2])
ax=gca;
ax.XAxis.Exponent=-2;
yticks([0 0.5 1 1.5 2])
% Add labels and title
xlabel('X-axis')
ylabel('Y-axis')
title('Plot with Ticks for Every Element on X-axis')
For more information on the “xticks” function and its usage, please refer to the following documentation link:
Hope this helps!
Regards,
Ayush.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!