How to hide representative duration at datetime X-axis plot?

15 visualizaciones (últimos 30 días)
How to remove/hide representative duration at datetime X-axis plot under auto-mode condition(XTickLabelMode)?

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 8 de Oct. de 2020
Editada: Ameer Hamza el 8 de Oct. de 2020
You can do it by running the following statements.
ax = gca;
ax.XTickLabel = ax.XTickLabel;
or
ax = gca;
ax.XTickLabelMode = 'manual';
  4 comentarios
Euigyeong Hong
Euigyeong Hong el 8 de Oct. de 2020
That's too bad. It seems to need an option.
Thank you, Ameer!!
Ameer Hamza
Ameer Hamza el 8 de Oct. de 2020
I think for normal visualization, when you need to zoom on the axes, the date might not be an issue. Just turn it off when printing or saving the image.

Iniciar sesión para comentar.

Más respuestas (2)

Adam Danz
Adam Danz el 20 de Sept. de 2023
Starting in MATLAB R2023b, you can add, remove, or update the secondary labels using
Demo
plot(datetime(2014,6,9)+days(0:9), 0:9)
xsecondarylabel(Visible="off")
  1 comentario
Euigyeong Hong
Euigyeong Hong el 21 de Sept. de 2023
It is good news to me but I am still stuck on 2021b version.
Thank you for caring about this even after 3 years.

Iniciar sesión para comentar.


Seth Furman
Seth Furman el 12 de Oct. de 2020
Editada: Seth Furman el 12 de Oct. de 2020
If you just want the duration data for the time of day on the x-axis, you can use the timeofday method for datetime.
>> x = datetime('today'):hours(1):datetime('today')+hours(10);
>> y = 0:10;
>> plot(timeofday(x),y)
>> xtickformat('hh:mm')
  1 comentario
Euigyeong Hong
Euigyeong Hong el 12 de Oct. de 2020
Editada: Euigyeong Hong el 12 de Oct. de 2020
Thanks, Seth.
But I am finding to see the plot by auto-format mode because when I zoom in to short time it is easy to see "hh:mm:ss.SSS" format by itself. After checking the plot, I copied the figure, but the number of figure was 20~30, so I was unhappy.

Iniciar sesión para comentar.

Categorías

Más información sobre Visual Exploration en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by