File:City of Ottawa tree inventory trunk diameter histogram.svg

From OpenStreetMap Wiki
Jump to navigation Jump to search

Original file(SVG file, nominally 600 × 800 pixels, file size: 105 KB)

Distribution of tree breast height diameters for the City of Ottawa obtained from http://data.ottawa.ca/dataset/tree-inventory-street-trees. Ran: cat tree-inventory.csv | cut -d, -f11 | sed 's/None/-1/g' | sort -g > tree-inventory-dbh to get sorted list of tree diameters in centimetres with any with "None" represented as -1, then plotted the histogram using gnuplot.

  • total count: 157833 cat tree-inventory-dbh | wc -l
  • number of trees with diameter="None": 212 (0.1%) cat tree-inventory-dbh | grep -x "\-1" | wc -l
  • number of trees with diameter=0: 605 (0.4%) cat tree-inventory-dbh | grep -x "0" | wc -l

Note: the spikes appear to be artifacts of the histogram function. Zooming on the x scale seems to cause them to settle. Function likely needs to be improved.

reset
n=100 #number of intervals
max=120. #max value
min=0. #min value
width=(max-min)/n #interval width
#function used to map a value to the intervals
hist(x,width)=width*floor(x/width)+width/2.0
set terminal svg font "Bitstream Vera Sans, 10" linewidth 1 size 600 400 #set term png #output terminal and file
set output "|cat >./dbh_histogram.svg" #set output "plot.png"
set xrange [min:max]
set yrange [-1:]
set xtics min,10,max
set boxwidth width*0.9
set style fill solid 0.5 #fillstyle
set tics out nomirror
set xlabel "Breast height diameter (cm)"
set ylabel "Frequency"
set title "Distribution of Tree Trunk Diameters"
#count and plot
plot "tree-inventory-dbh" u (hist($1,width)):(1.0) smooth freq w boxes lc rgb"black" notitle

For plotting the outliers: Note there was one tree with diameter of 5565cm that was left out of the plot.

reset
n=100 #number of intervals
max=120. #max value
min=0. #min value
width=(max-min)/n #interval width
#function used to map a value to the intervals
hist(x,width)=width*floor(x/width)+width/2.0
set terminal svg font "Bitstream Vera Sans, 10" linewidth 1 size 600 400 #set term png #output terminal and file
set output "|cat >./dbh_histogram_outliers.svg" #set output "plot.png"
set xrange [min:max]
set yrange [0:50]
set xtics min,100,max
set boxwidth width*0.9
set style fill solid 0.5 #fillstyle
set tics out nomirror
set xlabel "Breast height diameter (cm)"
set ylabel "Frequency"
set title "Distribution of Tree Trunk Diameters: The Outliers"
#count and plot
plot "tree-inventory-dbh" u (hist($1,width)):(1.0) smooth freq w boxes lc rgb"black" notitle

resources:

Note: this is embedded in the SVG file.

Public domain icon

This image or logo only consists of typefaces, individual words, slogans, or simple geometric shapes. These are not eligible for copyright alone because they are not original enough, and thus the image is considered to be in the public domain.
See  Public domain or Restricted materials on Wikipedia for more information.
Please note: The public domain status of this work is only in regards to its copyright status. There may be other intellectual property restrictions protecting this image, such as trademarks or design patents if it is a logo.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current21:16, 12 July 2017Thumbnail for version as of 21:16, 12 July 2017600 × 800 (105 KB)DFyson (talk | contribs)Distribution of tree breast height diameters for the City of Ottawa obtained from http://data.ottawa.ca/dataset/tree-inventory-street-trees. Ran: cat tree-inventory.csv | cut -d, -f11 | sed 's/None/-1/g' | sort -g > tree-inventory-dbh to get sorted l...

The following page uses this file:

Metadata