Change the units in the Y axis of an histogram
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dear colleagues, i have an ascii table formed by 3 columns: the first and the second are the X and Y coordinates (in UTM or meter scale) and a third column that is the height, as you note this ascii table in fact is a raster.
OK I'm trying to create an histogram only for the third column (the height) and i already do it but i not what i want to plot.
I know that maybe is a very stupid question. My problem is, the output histogram indicates in the Y axis the number of pixels (the number of elements) and i need to create an histogram with the area (surface) instead of number of pixels. The pixel size is 10 (meters) how can i do it to change the units in the Y axis of the histogram????
This is the formula that i wrote in matlab (PNW is the ascii table name) but only plots the number of pixels:
PNW(:,3)=Z1; %height 10m/pixel
PNW(:,2)=Y1;
PNW(:,1)=X1;
PNW(isnan(PNW(:,3)),:)=[];%eliminate NaN's
nimP=numel(PNW(:,1)); %number of elements in G
figure(1)
hist (PNW(:,3),(sqrt(nimP))); % this hist produces a pixel number histogram
This is an example of my ascii table :
618866,115700000 5923166,64340000 13,4838800000000
618876,115700000 5923166,64340000 18,1434500000000
618876,115700000 5923176,64340000 16,5425300000000
618886,115700000 5923156,64340000 19,6435200000000
618886,115700000 5923166,64340000 19,4740400000000
618886,115700000 5923176,64340000 18,5963100000000
618896,115700000 5923156,64340000 13,1067100000000
618896,115700000 5923166,64340000 16,3054000000000
618896,115700000 5923176,64340000 18,5107300000000
618896,115700000 5923186,64340000 17,0748700000000
618906,115700000 5923156,64340000 9,99815500000000
618906,115700000 5923166,64340000 13,6792500000000
618906,115700000 5923176,64340000 17,8453100000000
618906,115700000 5923186,64340000 17,0600900000000
618906,115700000 5923196,64340000 14,9117300000000
618916,115700000 5923146,64340000 9,24547200000000
618916,115700000 5923156,64340000 10,1376000000000
618916,115700000 5923166,64340000 12,6473500000000
618916,115700000 5923176,64340000 16,7022300000000
618916,115700000 5923186,64340000 18,1907000000000
618916,115700000 5923196,64340000 16,8683700000000
Thanks in advance.
0 commentaires
Réponse acceptée
Image Analyst
le 7 Déc 2012
Do you mean the pixel size is 10 square meters? If so, just multiply the counts by 10 before you plot it:
counts = hist(PNW(:,3),(sqrt(nimP)));
bar(counts*10, 'BarWidth', 1);
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Histograms dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!