Skip to content

Instantly share code, notes, and snippets.

@emmanueltouzery
Last active August 13, 2017 19:35
Show Gist options
  • Save emmanueltouzery/adcb53853f9d9fcfb625b8ad4ff118c9 to your computer and use it in GitHub Desktop.
Save emmanueltouzery/adcb53853f9d9fcfb625b8ad4ff118c9 to your computer and use it in GitHub Desktop.
little R script to plot the most comonly used focal lengths (the **/* globbing requires zsh)
# exiftool -T -TAG -FocalLength -TAG -Model **/*.jpg > ~/all_focals2.txt
library(readr)
library(ggplot2)
library(dplyr)
focals <-
read_delim('~/all_focals2.txt', delim='\t',
col_names=c("1", "focal", "2", "model"),
col_types=cols_only(focal = col_character(), model = col_character())) %>%
filter(!is.na(focal) && !is.na(model)) %>%
filter(model == "NEX-3N")
focals$focal <- as.double(gsub(" mm$", "", focals$focal))
# focals$focal <- focals$focal - (focals$focal %% 10) # <--- for grouping focal lengths in intervals of 10
focals <- focals %>% filter(!is.na(focal))
ggplot(focals, aes(x=focal)) +
geom_bar(width=0.7,aes(y=(..count..)/sum(..count..))) +
scale_x_continuous(breaks = seq(0, 250, by = 10)) +
scale_y_continuous(labels = scales::percent) +
labs(y="percent")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment