Coder Social home page Coder Social logo

ggpirate's Issues

Change colours of violins

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'

_

Deprecated usage of `size` aesthetic

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.

Support for no colour aesthetics

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!

Allow `int` field on `aes(x = ...)`

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?

Make dodge_width an adjustable param

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)

facet_grid issue

I was very excited to see this, and immediately tried on a dataset that we are about to submit to a journal, but run into an issue. I hope it will be pretty easy for you to reproduce. Thanks for the lovely tool.

(the same data) with geom_pirate:

image

With geom_boxplot + geom_jitter:

image

Thanks,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.