Plot a time series with the whole number not 10^(n)

15 visualizaciones (últimos 30 días)
Jessica
Jessica el 7 de Feb. de 2012
Editada: Matt J el 3 de Oct. de 2013
Hi
I would like to plot one time series which is able to show the whole number in y axis not 10^(n)
The following is my code.
y = yahoo;
Dataset = fetch(y, '^HSI','Close','2012-01-01','2012-02-01');
hsiobj = fints (Dataset(:,1),Dataset(:,2));
plot(hsiobj); legend('HSI');xlabel('Date'); ylabel('HSI');
I want to y axis showing 21000 instead of 2.1*10^4 etc.
Thanks so much Jessica

Respuesta aceptada

Patrick Kalita
Patrick Kalita el 7 de Feb. de 2012
This page describes how to apply any kind of numeric fomatting to your axes tick labels.

Más respuestas (2)

Kevin Holst
Kevin Holst el 7 de Feb. de 2012
Yeah I deleted my answer after I realized that num2str doesn't work properly, but found that num2cell does. Glad it worked for ya! :)
  2 comentarios
Jessica
Jessica el 7 de Feb. de 2012
I want to accept your answer too . But mathwork just allows me to accept one....
Anyway thanks so much!
Great help=)
Kevin Holst
Kevin Holst el 7 de Feb. de 2012
haha no worries ;)

Iniciar sesión para comentar.


Jessica
Jessica el 7 de Feb. de 2012
Using num2cell instead of num2str.
My answer is the following
y = yahoo;
Dataset = fetch(y, '^HSI','Close','2012-01-01','2012-02-01');
hsiobj = fints (Dataset(:,1),Dataset(:,2));
plot(hsiobj); legend('HSI');xlabel('Date'); ylabel('HSI');
set(gca, 'YTickLabel', num2cell(get(gca, 'YTick')))
Many Thanks=)

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by