![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/195333/image.png)
How create a decreasing axis for a histogram plot?
14 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Dan H
el 10 de Sept. de 2018
Editada: KALYAN ACHARJYA
el 10 de Sept. de 2018
Hello, when creating histograms using the "histogram" command, the x-axis ('bins') are sorted from lower to higher value from left to right, just as is typical for standard plots (0-1, 1-2, 2-3, ...).
However, for a later processing / displaying of the histograms, I need the bins in a decreasing order (..., 3-2, 2-1, 1-0).
To be precise, my bins are rather small: the highest value is 0.1, lowest value 0 (--> only positive data), I would like a constant bin width of 0.01.
I unsuccessfully tried to use the 'BinLimits' as well as the 'BinEdges' command, which would not accept decreasing bin limits.
So any advice on how to create a histogram with decreasing bin limits is appreciated.
Thank you, Dan
0 comentarios
Respuesta aceptada
KALYAN ACHARJYA
el 10 de Sept. de 2018
Editada: KALYAN ACHARJYA
el 10 de Sept. de 2018
i=rgb2gray(imread('1.jpg'));
h=histc(i(:), 0:255);
plot(h)
set(gca, 'XDir','reverse')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/195333/image.png)
0 comentarios
Más respuestas (1)
the cyclist
el 10 de Sept. de 2018
The axis direction is a property of the figures axes themselves, not an input to the histogram command.
x = randn(1000,1);
figure
histogram(x)
set(gca,'XDir','reverse')
0 comentarios
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!