i have x column matrix...the plotting is shown...how to change y axis limit between 0 to 1 not changing x values? please help....

 Respuesta aceptada

Image Analyst
Image Analyst el 5 de Abr. de 2015

0 votos

Use the ylim() function to set the limits of the y axis:
y = y / max(y); % Normalize y
bar(x, y);
ylim([0, 1]);

7 comentarios

LUI PAUL
LUI PAUL el 5 de Abr. de 2015
thank you but how can i get y for a column matrix.its giving y=1;
dpb
dpb el 5 de Abr. de 2015
See
doc max
for an array it by default returns the maximum value of columns in a row vector; then
doc bsxfun
to divide each column by its appropriate value.
Image Analyst
Image Analyst el 5 de Abr. de 2015
LUI, I don't understand your question. You must already have x and y values. If not, what did you plot in your bar chart?
LUI PAUL
LUI PAUL el 5 de Abr. de 2015
i have the data like the file i have given. plotting is
hist(P(6:114,5));figure(gcf);
and getting the figure. but y values is 0 to 50...want to replace by 0 to 1.since its a column matrix...y is 1.
Image Analyst
Image Analyst el 5 de Abr. de 2015
[y, x] = hist(P(6:114,5));
y = y / max(y); % Normalize y
bar(x, y);
ylim([0, 1]);
LUI PAUL
LUI PAUL el 5 de Abr. de 2015
thank you Image Analyst.....thank you so much....its working.
Image Analyst
Image Analyst el 5 de Abr. de 2015
You're welcome. Go ahead and officially "Accept this answer" then. Thanks in advance.

Iniciar sesión para comentar.

Más respuestas (1)

dpb
dpb el 4 de Abr. de 2015

0 votos

I presume you mean to normalize the values as simply changing the y-axis limits on the plot would just leave a solid blob across the whole graph...how, precisely, to compute that is dependent upon how you have the data that made the plot which you haven't revealed...

1 comentario

LUI PAUL
LUI PAUL el 5 de Abr. de 2015
Editada: LUI PAUL el 5 de Abr. de 2015
y lim is 0 to 450..and i want to make the limit 0 to 1 with out effecting the x values.that means 450/450=1;0/450=0;actually i want to normalize the data amounts,not the values.

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 4 de Abr. de 2015

Comentada:

el 5 de Abr. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by