mikabr / ggpirate Goto Github PK
View Code? Open in Web Editor NEWpirate plots for ggplot2
pirate plots for ggplot2
Thanks very much for this! I'd love the ability to control point size (or any individual element size).
Running the following:
options(lifecycle_verbosity = "error")
sleep |>
ggplot2::ggplot(ggplot2::aes(x = extra, y = group)) +
ggpirate::geom_pirate(
ggplot2::aes(colour = group, fill = group),
points = TRUE,
bars = FALSE,
lines = TRUE,
cis = FALSE,
violins = TRUE
) +
ggplot2::theme_minimal()
...leads to the following error:
Error:
! Using `size` aesthetic for lines was
deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` instead.
Congrats on the package.
It would be nice if the transparency of the different elements could be controlled separately (alpha.violin, alpha.ci, alpha.dots?).
Thanks
Previously, I was able to run the following code to produce greyscale plots:
ggplot(mpg, aes(x = class, y = cty)) + geom_pirate()
However, since updating a number of packages (including ggplot2) I get the error message:
position_jitterdodge()
requires at least one aesthetic to dodge by
I'd be grateful of a way to make default plots as before without the need for manually defining a colour aesthetic in the ggplot()
or geom_pirate()
calls. If this is currently possible and this error reflects a problem with my setup, I'd be happy to explore this further.
Thanks for this great package!
Thanks for this excellent function! just a minor feature request. Can you allow dodge width (for position_dodge) to be a settable param? I forked and tested on my end, so something like the following should work:
geom_pirate <- function(mapping = NULL, data = NULL,
...,
points = TRUE,
bars = TRUE,
lines = TRUE,
cis = TRUE,
violins = TRUE,
points_params = list(shape = 1, size = 1),
bars_params = list(alpha = 0.3, width = 0.9),
lines_params = list(size = 0.5, width = 0.9),
cis_params = list(fill = "white", size = 0.5,
alpha = 0.5, width = 0.8),
violins_params = list(fill = "white", size = 0.5,
alpha = 0, width = 0.7),
dodge_width = 0.9, #this (along with changing it in the subfunctions) should do it.
jitter_width = 0.2,
na.rm = FALSE,
show.legend = FALSE,
inherit.aes = TRUE)
I am running into a problem where my aes(x = ...)
value is an int
.
The error is:
Error in eval(substitute(list(...)), `_data`, parent.frame()) :
object 'x' not found
I did find out that after converting the field to str
(with data$n <- as.character(data$n)
) it suddenly works, but now my axis is sorted by the string values instead of the ints.
Is there any way to solve this?
Is there a way to make the dots and lines to be presented in black and the violins to be coloured?
I've tried this code:
ggplot(mpg, aes(x = class, y = cty)) + geom_pirate(aes(colour = class),bars = FALSE, violins_params = list(fill = class, size = 0.5, alpha = 0, width = 0.7))
But I get the following error:
_
Error in rep(value[[k]], length.out = n) :
attempt to replicate an object of type 'builtin'
_
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.