How to display a particular range of log value at x-axis?

2 次查看(过去 30 天)
Hello everyone,
I have a simple question about x-axis display values. Here is my code:
figure
hAx=axes;
hold on
g1 = gscatter(Varaiable1, Variable2, Varaiable.L_Bin, 'm','+',7);
hAx.XScale='log';
grid on
% set(gca, 'YLim', [-38, -18], 'XLim', [0, 580], ...
% 'XScale', 'log');
set(gca, 'YDir', 'reverse');
ylim([-38 -18])
Code works totally fine. All I want is x-axis to display like figure 1 (means with three log values). In below case Variable1 is plotted at X-axis and its minimum value is 0.2.
Using the above code, here is my figure, Here again Variable1 is plotted at X-axis and its minimum value is 1.55. I understand this is causing it to be displayed from 10E1 but I want to add 3 log values like above (means 10E0 should also be dispalyed at x-axis).
Please guide me what can I add to display it like figure 1. Thank you.

采纳的回答

Star Strider
Star Strider 2022-10-11
I am not certain what you want the result to be.
Perhaps using xlim would work (regardless of the axis scaling, however it may be necessary to experiment to get the result you want).
  5 个评论
Star Strider
Star Strider 2022-10-12
I have no idea what the problem is.
It works here —
x = [1:0.5:9 10:1000];
y = sin(2*pi*x/250);
figure
plot(x, y)
grid
xlabel('X')
ylabel('Y')
title('Linear')
figure
plot(x, y)
grid
xlabel('X')
ylabel('Y')
title('Log')
hAx = gca;
hAx.XTick = logspace(0,3,4);
hAx.XScale = 'log';
.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Axis Labels 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by