Borrar filtros
Borrar filtros

How to create an empty plotting area, with log X axis?

12 visualizaciones (últimos 30 días)
Housam Mohammad
Housam Mohammad el 11 de Jun. de 2023
Comentada: Housam Mohammad el 12 de Jun. de 2023
This is the code:
xlim([0.01,100000]);
ylim([0,1]);
grid on
grid minor
axes('XLim',[0.01,100000], 'YLim',[0,2], 'XGrid','on', 'YGrid','on')
yline(1)
set(gca, 'XScale', 'log')
set(gca, 'YTicklabel',[])
yticks([0 1 2])
yticklabels({'0' '1' '2'});
I just want to get rid of the numbers [0 1 2 3 ... 10] on the x axis, and [0.1 0.2 ...1] on the y axis.
Thanks in advance.
  1 comentario
Diwakar Diwakar
Diwakar Diwakar el 11 de Jun. de 2023
xlim([0.01, 100000]);
ylim([0, 1]);
grid on;
grid minor;
axes('XLim',[0.01, 100000], 'YLim',[0, 2], 'XGrid','on', 'YGrid','on');
yline(1);
set(gca, 'XScale', 'log');
set(gca, 'XTick', []); % Remove X tick labels
set(gca, 'YTick', []); % Remove Y tick labels
yticks([0 1 2]);
yticklabels({'0', '1', '2'});

Iniciar sesión para comentar.

Respuesta aceptada

VBBV
VBBV el 11 de Jun. de 2023
Editada: VBBV el 11 de Jun. de 2023
If you use xlim & ylim it creates an empty plot with axes information having that range specified. Make them empty
xlim([0.01,100000]);
ylim([0,1]);
% call the axes information corresponding to xlim and ylim,
ax = gca;
% set them to empty
set(gca,'YTicklabel',[],'XTicklabel',[])
grid on
grid minor
axes('XLim',[0.01,100000], 'YLim',[0,2], 'XGrid','on', 'YGrid','on')
yline(1)
set(gca, 'XScale', 'log')
set(gca, 'YTicklabel',[])
yticks([0 1 2])
yticklabels({'0' '1' '2'});
  4 comentarios
Dyuman Joshi
Dyuman Joshi el 11 de Jun. de 2023
@Housam Mohammad, In case you also want to remove the ticks corresponding to the numbers you mentioned -
xlim([0.01,100000]);
ylim([0,1]);
% call the axes information corresponding to xlim and ylim,
ax = gca;
% set them to empty
set(gca,'YTicklabel',[],'XTicklabel',[])
grid on
grid minor
axes('XLim',[0.01,100000], 'YLim',[0,2], 'XGrid','on', 'YGrid','on')
yline(1)
set(gca, 'XScale', 'log')
set(gca, 'YTicklabel',[])
yticks([0 1 2])
yticklabels({'0' '1' '2'});
set(gca,'XMinorTick','off')
set(gca,'YMinorTick','off')
Housam Mohammad
Housam Mohammad el 12 de Jun. de 2023
Thank you @Dyuman Joshi, that's helpful too.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by