Skip to content

Commit

Permalink
add plot for type-advantage function
Browse files Browse the repository at this point in the history
  • Loading branch information
j99thoms committed Feb 5, 2023
1 parent 8e4d876 commit 9002f2e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions plot/type_advantage_plot.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
library(tidyverse)
library(latex2exp)

alpha <- 3/4
beta <- 3/2

dat = tibble(
delta = seq(-8, 8),
y_pos = delta^alpha,
y_neg = -(-delta)^beta
)
head(dat, 20)

type_advantage_plot <- ggplot(dat, aes(x = delta)) +
geom_point(aes(y = y_neg), color = 'blue', size = 2.5) +
geom_line(aes(y = y_neg), lwd = 0.8) +
geom_point(aes(y = y_pos), color = 'red', size = 2.5) +
geom_line(aes(y = y_pos), lwd = 0.8) +
geom_vline(xintercept = 0) +
geom_hline(yintercept = 0) +
scale_x_continuous(n.breaks = 18) +
scale_y_continuous(n.breaks = 18) +
ggtitle("Type-Advantage Function") +
labs(
x = TeX(r"($ \overset{\delta_{type}}{(\phantom{.}_{=\ resistance_{type}\ -\ weakness_{type}\ })} $)"),
y = "Type-Advantage"
) +
theme_bw(base_size = 14) +
theme(
plot.title = element_text(size = 16, face = "bold"),
axis.title = element_text(size = 15),
axis.text.x = element_text(size = 13),
axis.text.y = element_text(size = 13)
)

type_advantage_plot

Binary file added plot/type_advantage_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9002f2e

Please sign in to comment.