Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drafted logo #18

Merged
merged 1 commit into from
Apr 25, 2021
Merged

drafted logo #18

merged 1 commit into from
Apr 25, 2021

Conversation

mayer79
Copy link
Contributor

@mayer79 mayer79 commented Apr 24, 2021

I tried to draft a logo for the package, see logo" branch on my fork (screenshot below).

image

Its just a draft, no obligation to go with this! Maybe you absolutely hate the colors :-)

The logo was created by the following code:

library(hexSticker)
library(ggplot2)
library(dplyr)  
library(SHAPforxgboost)
library(xgboost)
library(viridis)

X <- data.matrix(iris[, -1])
dtrain <- xgb.DMatrix(X, label = iris[[1]])

fit <- xgb.train(
  params = list(
    objective = "reg:squarederror",
    learning_rate = 0.1
  ), data = dtrain, nrounds = 50)

shap <- shap.prep(fit, X_train = X)

# Dependence plot
x <- shap.importance(shap, names_only = TRUE)[2]
p <- shap.plot.dependence(
  shap, x = x, color_feature = "auto", 
  smooth = FALSE, jitter_width = 0.01, alpha = 0.8, show.legend=FALSE) +
  theme_void() + 
  theme_transparent() +
  scale_fill_manual(values = c("black", "lightgray")) +
  coord_cartesian(xlim = c(2.2, 4.2))

s <- sticker(p, package = pkg, p_y = 1.33,
             p_size = 17, p_color = "#420A68FF",
             h_fill = "#E3DCE3",
             h_color = "#420A68FF",
             s_x = 1.15, s_y = 0.7, s_height = 0.9, s_width = 1.1,
             filename = "logo.png")
s

Then, I copied the resulting png into the package main directory and ran usethis::use_logo("logo.png"). This command moved the logo to the right place (man/figures) and optimized the format.

@liuyanguu
Copy link
Owner

Woo that's cool! I like it.
Just curious, what is pkg in the sticker part

s <- sticker(p, package = pkg, p_y = 1.33,
             p_size = 17, p_color = "#420A68FF",
             h_fill = "#E3DCE3",
             h_color = "#420A68FF",
             s_x = 1.15, s_y = 0.7, s_height = 0.9, s_width = 1.1,
             filename = "logo.png")

@liuyanguu liuyanguu merged commit ecbd541 into liuyanguu:master Apr 25, 2021
@mayer79
Copy link
Contributor Author

mayer79 commented Apr 25, 2021

Woo that's cool! I like it.
Just curious, what is pkg in the sticker part

s <- sticker(p, package = pkg, p_y = 1.33,
             p_size = 17, p_color = "#420A68FF",
             h_fill = "#E3DCE3",
             h_color = "#420A68FF",
             s_x = 1.15, s_y = 0.7, s_height = 0.9, s_width = 1.1,
             filename = "logo.png")

@liuyanguu : My bad: pkg = "SHAPforxgboost". This is the text appearing in the logo.

@liuyanguu
Copy link
Owner

liuyanguu commented Apr 25, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants