rnabioco / ggtrace Goto Github PK
View Code? Open in Web Editor NEWggplot2 geoms to outline groups of data points
Home Page: https://rnabioco.github.io/ggtrace
License: Other
ggplot2 geoms to outline groups of data points
Home Page: https://rnabioco.github.io/ggtrace
License: Other
trace_position
and modifies background_color
background_color
, the name of this entry could be the expression passed to trace_position
to something other than black
consider eliminating glue, rlang, scales, RColorBrewer
will make for easier maintenance down the line
move some from README
for interactive integration with shiny
Currently an expression passed to trace_position
is captured with substitute()
and evaluated strictly within the context of the data. This means the user cannot use environment variables with trace_position
. Ideally the user would be able to include both environment and data variables such as in the example below, which does not work with ggtrace v0.2.0.
To accomplish this, need to include a data mask (with rlang::eval_tidy()
) when evaluating trace_position
create_trace_plot <- function(data, traceVar = "xVar", traceThreshold = -1) {
pl <- ggplot(data = data, aes(xVar, yVar, fill = fill_var), color = "#000000") +
geom_point_trace(
trace_position = !!sym(traceVar) < traceThreshold,
fill = "#FFFFFF",
background_params = list(color = "#000000", fill = "#CC0000")
) +
ggtitle(str_c("Threshold: ", traceThreshold))
pl
}
write tests
filter
and mutate
This should result in line break:
stocks %>%
ggplot(aes(day, value, color = name)) +
geom_line_trace(trace_position = day < 100 | day > 1200)
To fix can add NAs instead of filtering data
geom_line_trace()
trace_position
, default ordering is changedtrace_position
predicate# good ordering
stocks %>%
ggplot(aes(day, value, color = name)) +
geom_line_trace()
# bad ordering
stocks %>%
ggplot(aes(day, value, color = name)) +
geom_line_trace(trace_position = day < 100)
I don't have access to repo settings
Should we be using ggproto
etc to add this layer?
https://ggplot2.tidyverse.org/articles/extending-ggplot2.html
Examples:
https://github.com/const-ae/ggsignif/blob/master/R/geom_signif.R
https://github.com/slowkow/ggrepel/blob/master/R/geom-label-repel.R
Eliminate tidyverse and cowplot because they're not in Import / Suggests
just use
library(ggplot2)
library(ggtrace)
and e.g. theme_minimal()
instead of the cowplot one.
First release:
usethis::use_cran_comments()
Title:
and Description:
@return
and @examples
Authors@R:
includes a copyright holder (role 'cph')Prepare for release:
git pull
devtools::build_readme()
urlchecker::url_check()
devtools::check(remote = TRUE, manual = TRUE)
devtools::check_win_devel()
rhub::check_for_cran()
git push
Submit to CRAN:
usethis::use_version('minor')
devtools::submit_cran()
Wait for CRAN...
git push
usethis::use_github_release()
usethis::use_dev_version()
git push
geom_point()
and geom_line()
since geom_*_trace()
functions draw groups separatelyscale_*_manual()
is used to modify aesthetics# Order should be alphabetical (CAC, DAX, FTSE, SMI)
clrs <- c(
CAC = "#E69F00",
DAX = "#0072B2",
SMI = "#56B4E9",
FTSE = "#009E73"
)
p +
geom_line_trace(stroke = 1) +
scale_color_manual(values = clrs)
geom_line()
needs groups so it knows how to draw each linecolor = variable
)color
are overwritten since the background layer by default is not outlined (color = NA
)geom_point_trace()
since groups are not needed to correctly draw points# works
economics_long %>%
ggplot(aes(date, value01, color = variable)) +
geom_line_trace()
economics_long %>%
ggplot(aes(date, value01, fill = variable)) +
geom_line_trace(trace_position = variable == "pce")
# broken
economics_long %>%
ggplot(aes(date, value01, color = variable)) +
geom_line_trace(trace_position = variable == "pce")
The main comment from CRAN is below. To my knowledge, the package doesn't modify the global environment, the <<-
operator isn't used. Hmm going to look into this more..
Please do not modifiy the .GlobalEnv. This is not allowed by the CRAN policies.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.