Skip to content

Commit

Permalink
improved pat_monitorComparison() legend
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathancallahan committed Oct 13, 2020
1 parent a8932a4 commit 2addbf1
Show file tree
Hide file tree
Showing 150 changed files with 533 additions and 346 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Type: Package
Package: AirSensor
Version: 1.0.2
Version: 1.0.3
Title: Process and Display Data from Air Quality Sensors
Authors@R: c(
person("Jonathan", "Callahan", email="[email protected]", role=c("aut","cre")),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# AirSensor 1.0.3

* Improved legend in `pat_monitorComparision()`.

# AirSensor 1.0.2

* CRAN submission tweaks.
Expand Down
95 changes: 68 additions & 27 deletions R/pat_monitorComparison.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,17 @@ pat_monitorComparison <- function(

# ----- Configurable plot options --------------------------------------------

a_size = 1
a_shape = 15
a_color = "gray80"
b_size = 1
b_shape = 15
b_color = "gray80"
ab_alpha = 0.5
hourly_size = 2
hourly_shape = 1
hourly_stroke = 0.6
pa_color = "purple3"
pwfsl_color = "grey10"
raw_size <- 1
raw_shape <- 15
raw_stroke <- 1.0
raw_alpha <- 0.5
raw_color <- "gray80"
hourly_size <- 2
hourly_shape <- 1
hourly_stroke <- 0.6
hourly_alpha <- 1
pa_color <- "purple2"
pwfsl_color <- "grey10"

# ----- Validate parameters --------------------------------------------------

Expand All @@ -74,6 +73,9 @@ pat_monitorComparison <- function(
pat <- pat_outliers(pat, showPlot = FALSE, replace = TRUE)
}

# Add "source" column to pat$data so it can be used by ggplot2
pat$data$source <- "PA raw"

# Get the hourly aggregated data
paHourly_data <-
pat %>%
Expand Down Expand Up @@ -156,34 +158,73 @@ pat_monitorComparison <- function(
# Labels
yearLabel <- strftime(pat$data$datetime[1], "%Y (%Z)", tz = timezone)

cols <- c(
"PA raw" = raw_color,
"PA hourly" = pa_color,
"PWFSL" = pwfsl_color
)

shapes = c(
"PA raw" = raw_shape,
"PA hourly" = hourly_shape,
"PWFSL" = hourly_shape
)

sizes = c(
"PA raw" = raw_size,
"PA hourly" = hourly_size,
"PWFSL" = hourly_size
)

# ----- ggplot ---------------------------------------------------------------

pm25_plot <-
pat$data %>%
ggplot2::ggplot() +
ggplot2::geom_point(
ggplot2::aes(x = .data$datetime, y = .data$pm25_A),
size = a_size,
shape = a_shape,
color = a_color,
alpha = ab_alpha
ggplot2::aes(
x = .data$datetime,
y = .data$pm25_A,
color = .data$source,
shape = .data$source,
size = .data$source
),
alpha = raw_alpha
) +
ggplot2::geom_point(
ggplot2::aes(x = .data$datetime, y = .data$pm25_B),
size = b_size,
shape = b_shape,
color = b_color,
alpha = ab_alpha
ggplot2::aes(
x = .data$datetime,
y = .data$pm25_B,
color = .data$source,
shape = .data$source,
size = .data$source
),
alpha = raw_alpha
) +
ggplot2::geom_point(
data = tidy_data,
ggplot2::aes(x = .data$datetime, y = .data$pm25, color = source),
size = hourly_size,
shape = hourly_shape,
ggplot2::aes(
x = .data$datetime,
y = .data$pm25,
color = .data$source,
shape = .data$source,
size = .data$source
),
stroke = hourly_stroke,
alpha = 1
alpha = hourly_alpha
) +
ggplot2::scale_color_manual(
values = cols,
breaks = c("PA raw", "PA hourly", "PWFSL")
) +
ggplot2::scale_shape_manual(
values = shapes,
breaks = c("PA raw", "PA hourly", "PWFSL")
) +
ggplot2::scale_size_manual(
values = sizes,
breaks = c("PA raw", "PA hourly", "PWFSL")
) +
ggplot2::scale_color_manual(values = c(pa_color, pwfsl_color)) +
ggplot2::ylim(ylim) +
ggplot2::scale_x_datetime(breaks = '1 day', date_labels = '%b %d') +
ggplot2::xlab(yearLabel) +
Expand Down
4 changes: 2 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ RUN wget -nv http://mazamascience.com/RData/Spatial/CA_AirBasins_01.RData \

WORKDIR /

COPY AirSensor_1.0.2.tar.gz /
COPY AirSensor_1.0.3.tar.gz /

RUN R CMD INSTALL AirSensor_1.0.2.tar.gz
RUN R CMD INSTALL AirSensor_1.0.3.tar.gz

6 changes: 3 additions & 3 deletions docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

AirSensor_tarball:
cd ..; R CMD build --resave-data .
mv ../AirSensor_1.0.2.tar.gz .
mv ../AirSensor_1.0.3.tar.gz .

# PRODUCTION version -----------------------------------------------------------

production_build:
docker build --no-cache -t mazamascience/airsensor:1.0.2 -t mazamascience/airsensor:latest .
docker build --no-cache -t mazamascience/airsensor:1.0.3 -t mazamascience/airsensor:latest .

production_publish:
docker login && docker push mazamascience/airsensor:1.0.2
docker login && docker push mazamascience/airsensor:1.0.3


4 changes: 2 additions & 2 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ You should then be able to see something like the following:
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
...
mazamascience/airsensor 1.0.2 796ae3ba57e5 2 minutes ago 3.74GB
mazamascience/airsensor 1.0.3 796ae3ba57e5 2 minutes ago 3.74GB
mazamascience/airsensor latest 796ae3ba57e5 2 minutes ago 3.74GB
...
```
Expand Down Expand Up @@ -88,6 +88,6 @@ make production_publish
A recent image can also be obtained from DockerHub with:

```
docker pull mazamascience/airsensor:1.0.2
docker pull mazamascience/airsensor:1.0.3
```

2 changes: 1 addition & 1 deletion docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/LICENSE-text.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/AirSensor_Function_Overview.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/Developer_Style_Guide.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions docs/articles/articles/Australia_on_fire.html

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/articles/articles/Custom_QC_Algorithms.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/articles/DataFlowChart.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/articles/SoH_functions.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/articles/Temporal_Aggregation.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/articles/outlier_detection.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions docs/articles/articles/pas_introduction.html

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions docs/articles/articles/pat_introduction.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions docs/articles/articles/purpleair_failure_modes.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/articles/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/authors.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion docs/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2addbf1

Please sign in to comment.