---
tags: Aquaponics
title: Some aqua plotting (21-May-2021)
---
[toc]
```r
library(tidyverse)
theme_set(theme_bw())
```
# Plant-height over time
```r
growth_tab <- read.table("all-plant-average-heights.tsv", sep = "\t", header = TRUE, na.strings="")
growth_for_plotting <- growth_tab %>% pivot_longer(!Days, names_to = "Plant", values_to = "Height (cm)")
growth_for_plotting$Plant <- factor(growth_for_plotting$Plant)
```
## Separate plots
```r
ggplot(growth_for_plotting, aes(x = Days, y = `Height (cm)`, color = Plant, group = Plant)) +
geom_point() + geom_smooth(aes(fill = Plant), alpha = 0.1) +
facet_wrap(~Plant, nrow=3, ncol=1, scales = "free_y") +
theme(legend.position = "none") + ggtitle("Height over time")
```
<a href="https://i.imgur.com/1hiMgMl.png"><img src="https://i.imgur.com/1hiMgMl.png"></a>
## Together
```r
ggplot(growth_for_plotting, aes(x = Days, y = `Height (cm)`, color = Plant, group = Plant)) +
geom_point() + geom_smooth(aes(fill = Plant), alpha = 0.1) +
theme(legend.position = "bottom") + ggtitle("Height over time")
```
<a href="https://i.imgur.com/SXAscd5.png"><img src="https://i.imgur.com/SXAscd5.png"></a>
# System measurements
```r
tank_tab <- read.table("all-tanks-measured-data.tsv", sep = "\t", header = TRUE, na.strings = "", stringsAsFactors=FALSE)
tank_tab$Tank <- factor(tank_tab$Tank)
tank_tab$Ammonia <- as.numeric(tank_tab$Ammonia)
tank_tab$Nitrite <- as.numeric(tank_tab$Nitrite)
tank_tab$Nitrate <- as.numeric(tank_tab$Nitrate)
tank_tab$pH <- as.numeric(tank_tab$pH)
tank_tab$pH <- as.numeric(tank_tab$pH)
tank_tab_for_plotting <- tank_tab %>%
pivot_longer(cols = c("Ammonia", "Nitrite", "Nitrate", "pH", "Temp"), names_to = "Measure")
tank_tab_for_plotting$Measure <- factor(tank_tab_for_plotting$Measure)
str(tank_tab_for_plotting)
ggplot(tank_tab_for_plotting, aes(x = Day, y = value, color = Measure)) +
geom_point() + geom_smooth(aes(fill = Measure), alpha = 0.25) +
facet_grid(Measure ~ Tank, scales="free_y") +
guides(color = FALSE, fill = FALSE) +
labs(x = "Days", y = "Value")
```
<a href="https://i.imgur.com/RZchCdv.png"><img src="https://i.imgur.com/RZchCdv.png"></a>