tight_subplot not showing tick marks
Mostrar comentarios más antiguos
Hi,
I'm using tight_subplot from the file exchange to plot 4 similar graphs. I'm finding that, when I run my script, the x and y tick marks (i.e. 1,2,3...12) are disappearing for all 4 subplots. I'm not doing anything intentional to suppress them, but I am using a for loop to generate the four plots, which makes me wonder whether some information is being lost each time I end a loop.
Is there any sort of set command that I could use to bring these back up? Something like... set(ha(1:2),'XTickLabel','on')? (That doesn't work... ) I'd prefer not to have to actually assign the tick marks explicitly, but to get them from the metadata associated with the figures.
Thanks, Jonathan
Respuesta aceptada
Más respuestas (2)
Andreas
el 8 de En. de 2014
4 votos
Once tick labels have been removed, I don't think they can be automatically regenerated: you have to add them explicitly using set(gca,'XTickLabel',[...]).
The better option, of course, is to prevent them from disappearing in the first place: tight_subplot contains the lines 'XTickLabel','', ... 'YTickLabel',''... Remove them and you're golden!
Peter Attia
el 6 de Sept. de 2017
I know this question is old, but this had stumped me too for some time. It turns out calling "hold on" before a plot is generated causes the x and y tick marks to disappear.
My original for loop looked like this:
hold on, box on
for j = 1:5
plot(x,y)
end
The working for loop looks like this:
for j = 1:5
plot(x,y)
hold on
end
box on
Hope this helps! -Peter
4 comentarios
Walter Roberson
el 6 de Sept. de 2017
The behavior of "hold on" changed around R2014b; which release are you using?
Peter Attia
el 12 de Sept. de 2017
R2017a
Marc
el 31 de Mzo. de 2023
Thanks for your comment Peter, its never too late for a solution. Even years later this is the problem, bringing the hold function inside the loop fixed it.
IFEOLUWA
el 20 de Sept. de 2023
Thanks Peter. Works perfectly
Categorías
Más información sobre Axes Appearance en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!