Skip to content

Commit

Permalink
Improved website appearance + render
Browse files Browse the repository at this point in the history
  • Loading branch information
Knicey committed Aug 22, 2024
1 parent f723ff7 commit 6787377
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 116 deletions.
19 changes: 10 additions & 9 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ output: github_document

<!-- README.md is generated from README.Rmd. Please edit that file -->

```{r, include = FALSE}
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
out.width = "100%",
#echo = FALSE,
warning = FALSE,
message = FALSE
)
```

Expand All @@ -36,23 +39,20 @@ devtools::install_github("Knicey/stglyphs")

This is an example which displays seasonal mins and maxes in temperature from NOAA across the US:

```{r data prep}
```{r}
library(stglpyhs)
library(dplyr)
library(ggplot2)
library(lubridate)
library(dplyr, warn.conflicts = FALSE)
stations_grouped <- stations |>
group_by(month, name, long, lat) |>
summarise(
avgmin = mean(tmin, na.rm = TRUE),
avgmax = mean(tmax, na.rm = TRUE)
) |>
ungroup()
#TODO: Accommodate for xend aesthetic (required in geom_segment)
)
```

```{r example}
```{r}
ggplot(data = stations_grouped) +
geom_sf(data = mainland_us, color = "white") +
ggthemes::theme_map() +
Expand All @@ -76,6 +76,7 @@ ggplot(data = stations_grouped) +
This is another example that shows flight cancellations from the airports that have the most flight cancellations:

```{r}
library(lubridate, warn.conflicts = FALSE)
flights_grouped <- flights |>
mutate(
month = month(FL_DATE),
Expand Down
56 changes: 10 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->

# stglpyhs

<!-- badges: start -->

[![R-CMD-check](https://github.com/Knicey/stglyphs/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/Knicey/stglyphs/actions/workflows/R-CMD-check.yaml)
[![Codecov test
coverage](https://codecov.io/gh/Knicey/stglyphs/branch/master/graph/badge.svg)](https://app.codecov.io/gh/Knicey/stglyphs?branch=master)
[![R-CMD-check](https://github.com/Knicey/stglyphs/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/Knicey/stglyphs/actions/workflows/R-CMD-check.yaml) [![Codecov test coverage](https://codecov.io/gh/Knicey/stglyphs/branch/master/graph/badge.svg)](https://app.codecov.io/gh/Knicey/stglyphs?branch=master)

<!-- badges: end -->

The goal of stglpyhs is to introduce new ways of visualizing
spatio-temporal data and in particular analyzing across multivariate
seasonal data. The existing cubble package implements glyph maps in the
form of line graphs. This project seeks to expand this functionality to
segment plots to visualize multivariable data better and analyze
seasonal trends.
The goal of stglpyhs is to introduce new ways of visualizing spatio-temporal data and in particular analyzing across multivariate seasonal data. The existing cubble package implements glyph maps in the form of line graphs. This project seeks to expand this functionality to segment plots to visualize multivariable data better and analyze seasonal trends.

## Installation

You can install the development version of stglpyhs from
[GitHub](https://github.com/) with:
You can install the development version of stglpyhs from [GitHub](https://github.com/) with:

``` r
# install.packages("devtools")
Expand All @@ -30,38 +21,19 @@ devtools::install_github("Knicey/stglyphs")

## Example

This is an example which displays seasonal mins and maxes in temperature
from NOAA across the US:
This is an example which displays seasonal mins and maxes in temperature from NOAA across the US:

``` r
library(stglpyhs)
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(ggplot2)
library(lubridate)
#>
#> Attaching package: 'lubridate'
#> The following objects are masked from 'package:base':
#>
#> date, intersect, setdiff, union
library(dplyr, warn.conflicts = FALSE)

stations_grouped <- stations |>
group_by(month, name, long, lat) |>
summarise(
avgmin = mean(tmin, na.rm = TRUE),
avgmax = mean(tmax, na.rm = TRUE)
) |>
ungroup()
#> `summarise()` has grouped output by 'month', 'name', 'long'. You can override
#> using the `.groups` argument.
#TODO: Accommodate for xend aesthetic (required in geom_segment)
)
```

``` r
Expand All @@ -82,16 +54,14 @@ ggplot(data = stations_grouped) +
y_minor = avgmin,
yend_minor = avgmax)
)
#> Warning: Unknown or uninitialised column: `linewidth`.
#> Warning: Unknown or uninitialised column: `size`.
```

<img src="man/figures/README-example-1.png" width="100%" />
<img src="man/figures/README-unnamed-chunk-2-1.png" width="100%"/>

This is another example that shows flight cancellations from the
airports that have the most flight cancellations:
This is another example that shows flight cancellations from the airports that have the most flight cancellations:

``` r
library(lubridate, warn.conflicts = FALSE)
flights_grouped <- flights |>
mutate(
month = month(FL_DATE),
Expand All @@ -106,10 +76,6 @@ flights_grouped <- flights |>
max = max(total_flights),
min = min(total_flights),
)
#> `summarise()` has grouped output by 'ORIGIN', 'month', 'year', 'longitude'. You
#> can override using the `.groups` argument.
#> `summarise()` has grouped output by 'ORIGIN', 'month', 'longitude'. You can
#> override using the `.groups` argument.
```

``` r
Expand All @@ -130,8 +96,6 @@ ggplot(data = flights_grouped) +
y_minor = min,
yend_minor = max)
)
#> Warning: Unknown or uninitialised column: `linewidth`.
#> Warning: Unknown or uninitialised column: `size`.
```

<img src="man/figures/README-unnamed-chunk-3-1.png" width="100%" />
<img src="man/figures/README-unnamed-chunk-4-1.png" width="100%"/>
26 changes: 4 additions & 22 deletions docs/articles/GeomSegmentGlyph.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

0 comments on commit 6787377

Please sign in to comment.