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

6 Ansichten (letzte 30 Tage)
IMC
IMC am 11 Okt. 2022
Kommentiert: Star Strider am 12 Okt. 2022
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.

Akzeptierte Antwort

Star Strider
Star Strider am 11 Okt. 2022
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 Kommentare
IMC
IMC am 12 Okt. 2022
@Star Strider still didn't work.
I did this:
set(gca, 'XTick',logspace(0,3,4))
hAx.XScale='log';
Star Strider
Star Strider am 12 Okt. 2022
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';
.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Contour Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by