-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from selkamand/joss
Joss
- Loading branch information
Showing
37 changed files
with
20,101 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
--- | ||
title: "PaperFigures" | ||
format: html | ||
editor: visual | ||
--- | ||
|
||
## Figures for Paper | ||
|
||
```{r} | ||
library(gg1d) | ||
library(here) | ||
``` | ||
|
||
## Figure 1 | ||
|
||
```{r, fig.height=5, fig.width=10} | ||
figure1a <- gg1d( | ||
iris, show_legend = TRUE, | ||
fontsize_y_text = 24, | ||
fontsize_barplot_y_numbers = 0, | ||
legend_text_size = 24, | ||
legend_position = "bottom", | ||
legend_key_size = 1.2, | ||
relative_height_numeric = 2, | ||
legend_nrow = 1, | ||
na_marker_size = 14, | ||
interactive_svg_height = 5, interactive_svg_width = 10, | ||
) | ||
figure1a | ||
# ggsaves::ggisaves(figure1a, prefix = "figure1a", outfolder = here("paper/"), dpi = 300, title = "Iris") | ||
``` | ||
|
||
```{r, fig.height=5, fig.width=8} | ||
library(datarium) | ||
# Change Columns Order to choose which features appear first | ||
titanic.raw <- titanic.raw[c("Survived", "Sex", "Age", "Class")] | ||
# Resort columns in the way (replace with multipl args to col_sort at one point | ||
titanic.raw <- titanic.raw |> | ||
dplyr::arrange(Survived, Sex, Age, Class) | ||
figure1b <- gg1d( | ||
titanic.raw, | ||
palettes = list( | ||
Sex = c(Male = "#0072B2", Female = "#CC79A7"), | ||
Survived = c(Yes = "#32A02D", No ="#E31A1C"), | ||
# Class = c("Crew" = "#F9F7EAFF", "1st" ="#006E37FF", "2nd" = "#8DB580FF", "3rd" = "#D9E5BDFF"), | ||
# Class = c("Crew" = "#F9F7EAFF", "1st" = "#005A2FFF", "2nd" = "#719A63FF", "3rd" = "#C0D6A8FF"), | ||
Class = c("Crew" = "#F9F7EAFF", "1st" = "#004826FF", "2nd" = "#5D7C50FF", "3rd" = "#A8BE93FF"), | ||
Age = c(Child = "#35B779FF", Adult = "#440154FF") | ||
), | ||
show_legend = TRUE, | ||
fontsize_y_text = 24, | ||
fontsize_barplot_y_numbers = 0, | ||
legend_nrow = 2, | ||
legend_text_size = 24, | ||
interactive_svg_height = 5, interactive_svg_width = 8 | ||
) | ||
figure1b | ||
ggsaves::ggisaves(figure1b, prefix = "figure1b", outfolder = here("paper/"), dpi = 300, title = "Titanic") | ||
``` | ||
|
||
```{r, fig.height = 4, fig.width = 16} | ||
# Drop Year Column | ||
library(palmerpenguins) | ||
penguins$year <- NULL | ||
# Subsample | ||
# penguins2 <- penguins[sample(seq_len(nrow(penguins)), size = 200),] | ||
figure1c <- gg1d( | ||
penguins, | ||
show_legend = TRUE, | ||
fontsize_y_text = 24, | ||
fontsize_barplot_y_numbers = 0, | ||
legend_text_size = 24, | ||
legend_key_size = 1.2, | ||
relative_height_numeric = 1,col_sort = "species", | ||
legend_nrow = 1, | ||
na_marker_size = 14, | ||
interactive_svg_height = 4, | ||
interactive_svg_width = 16, | ||
na_marker_colour = "red", | ||
palettes = list( | ||
species = c(Chinstrap = "#C55BCC", Adelie = "#FF7F02", Gentoo = "#047476"), | ||
sex = c(male = "#0072B2", female = "#CC79A7"), | ||
island = c(Biscoe = "#E69F00", Dream = "#56B4E9", Torgersen = "#009E73") | ||
) | ||
) | ||
figure1c | ||
ggsaves::ggisaves(figure1c, prefix = "figure1c", outfolder = here("paper/"), dpi = 300, title = "PalmerPenguins") | ||
``` | ||
|
||
## Figure 2 | ||
|
||
```{r, fig.height = 4, fig.width = 16} | ||
figure2a <- gg1d( | ||
lazy_birdwatcher, | ||
col_sort = "Magpies", | ||
show_legend = TRUE, | ||
fontsize_y_text = 24, | ||
fontsize_barplot_y_numbers = 20, | ||
legend_text_size = 24, | ||
legend_key_size = 1.2, | ||
legend_nrow = 1, | ||
na_marker_size = 14, | ||
palettes = list( | ||
Birdwatcher = c(Robert = "#E69F00", Catherine = "#999999"), | ||
Day = c(Weekday = "#999999" ,Weekend = "#009E73") | ||
), interactive_svg_height = 4, interactive_svg_width = 16 | ||
) | ||
figure2a | ||
ggsaves::ggisaves(figure2a, prefix = "figure2a", outfolder = here("paper/"), dpi = 300, title = "Lazy Birdwatcher") | ||
``` | ||
|
||
```{r, fig.height=4, fig.width=5} | ||
library(GGally) | ||
figure2b <- ggpairs(lazy_birdwatcher, mapping = aes(color=Day)) + ggplot2::theme_bw() + scale_fill_manual(values = c(Weekday = "#999999" ,Weekend = "#009E73")) | ||
figure2b | ||
ggsaves::ggsaves( | ||
figure2b, | ||
prefix = "figure2b", outfolder = here("paper/"), | ||
dpi = 300, height = 4, width = 5 | ||
) | ||
``` | ||
|
||
```{r, fig.height=4, fig.width=5} | ||
library(skimr) | ||
figure2c <- skim(lazy_birdwatcher) | ||
figure2c | ||
# ggsaves::ggsaves( | ||
# figure2b, | ||
# prefix = "figure2c", outfolder = here("paper/"), | ||
# dpi = 300, height = 4, width = 5 | ||
# ) | ||
``` | ||
|
||
## Table 1 | ||
|
||
```{r} | ||
library(DataExplorer) | ||
create_report(lazy_birdwatcher) | ||
``` | ||
|
||
## Figure 3 | ||
|
||
UMAP + Iris | ||
|
||
```{r} | ||
library(uwot) | ||
umap(iris[1:4]) | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
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.
Oops, something went wrong.