Borrar filtros
Borrar filtros

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

8 visualizaciones (últimos 30 días)
IMC
IMC el 11 de Oct. de 2022
Comentada: Star Strider el 12 de Oct. de 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.

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by