The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
Take a look at the ggpackets project page!
Easily build components of ggplots without sacrificing the ease of ggplot’s layer parameters and construction syntax.
install.packages("ggpackets")
or install the development version
::install_github("dgkf/ggpackets", build_vignettes = TRUE) devtools
There are plenty of ways to help contribute:
File issues!
Found a bug? Think the syntax looks ugly? Don’t like the name? Tell me!
Issues are the
best way to start the conversation.
Write documentation!
More resources always helps. Found a function unintuitive? Example code
and improved function descriptors would be helpful. If you use the
package and would feel comfortable writing about a topic not yet covered
in a vignette, feel free to contribute a new vignette for it.
Write Unit Tests!
There’s some pretty sophisticated manipulations going on under the hood
to make everything as clean as possible, because of that it’s important
to make sure everything stays working the way we expect it to. Unit test
contributions always welcome!
Contribute Code!
Last but not least, code contributors are welcome. Reach out and get in
touch if you’re passionate about the goal of the project.
Define common ggplot layer sets together into a singled object. Connect all your plots with a single plot component definition and debug one central location. Build beautiful templates and save them once, reuse them easily and without having to abandon the ggplot construction framework.
<- ggpacket() +
ggpk_box_and_scatter geom_point(position = position_jitter(width = 0.4), alpha = 0.02) +
geom_boxplot(outlier.shape = NA, fill = NA, color = 'black') +
geom_text(stat = 'summary', vjust = -1, fun.data = function(d) c(
y = quantile(d, 0.75, names = F) + 1.5 * IQR(d),
label = length(d)
+
)) theme_linedraw() +
scale_color_distiller(palette = "Set1")
Now we can use that template repeatedly with a much simpler ggplot call
ggplot(diamonds, aes(x = cut, y = price, color = carat)) +
ggpk_box_and_scatter() +
ggtitle('Diamond price distribution by cut')
In addition to simply wrapping multiple ggplot2
layers,
ggpackets
can streamline a number of complicated plotting
scenarios such as passing arguments to sets of layers, setting default
argument values with scoped overrides, routing aesthetic mappings to be
reused within specific layers for other aesthetics and scoping data
usage over a set of layers.
<- function(...) {
ggpk_labelled_heatmap ggpacket(...) %+%
geom_tile(.id = 'tile', color = NA, ...) %+%
geom_text(.id = c("text", "text1"), color = "black", vjust = -0.3,
fontface = "bold", ...) %+%
geom_text(.id = c("text", "text2"),
aes(label = sprintf("(%.1f)", ..fill..)),
color = "black", vjust = 1.1, ...) %+%
theme_void()
}
In this function we make use of a number of these specialized behaviors.
.id
parameters are set to tag specific layers with an
identifier, which can be used to prefix arguments to route them to a
subset of the ggpacket
layers. Multiple IDs can be used,
and arguments will filter down into that layer if they match any of the
provided IDs.ggpacket(...)
, which will
pass them on as default values to all ggpacket
layers...<aesthetic>..
syntax.%+%
instead of the commonly-used +
to add layers together, which allows ggpackets
to accept
non-standard arguments before ggplot sends us warnings about them.ggplot(as.data.frame(OrchardSprays)) +
aes(x = rowpos, y = colpos, label = treatment, fill = decrease) +
ggpk_labelled_heatmap(text.color = "white", text2.alpha = 0.5) +
ggtitle('Honeybee population decline in repellent trial grid')
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.