Questions tagged [ggproto]

ggproto is at the heart of the R package ggplot2. It implements a protype based OO system which blurs the lines between classes and instances. It is inspired by the proto package, but it has some important differences. Notably, it cleanly supports cross-package inheritance, and has faster performance. Knowledge of ggproto is essential if you want to add new primitives, like geoms or stats to ggplot2.

Questions tagged with may often involve adding new functionality involved in plotting, such as making new scales, geoms, stats, coords and facet systems, through the ggproto extension mechanism.

The ggplot2 package introduced an official extension mechanism for Stats, Geoms and Positions in other packages in version 2.0.0. Since then, Facets (2.2.0) and Coords (3.0.0) were added. At the core of this mechanism is the prototype based ggproto class that define the parameters and methods with which different structures in ggplot2 are build.

Important introductions to the topic can be found here:

96 questions
0
votes
0 answers

cant get correct mapping when use ggproto to creat a new geom function

I want draw a multisequence align result in a whole view,so i draw a picture with follow code: library(ggmsa) library(Biostrings) aln_data <- system.file("extdata", "seedSample.fa", package ="ggmsa") df <- tidy_msa(aln_data) ###df like this …
lovelyday
  • 1
  • 1
0
votes
2 answers

ggplot2 extension with log xy scales using ggproto

is it possible to make a ggplot2 extension (ex. geom_smooth) that converts the existing xy axes into log10 scales automatically? here's a reprex for example set.seed(11) # generate random data method1 = c(rnorm(19,0,1),2.5) method2 =…
Sam Min
  • 77
  • 5
0
votes
1 answer

Which arguments need to be specified w/i `extra_params` for a new `ggproto`

Out of curiosity, is there any documentation on which parameters need to be defined inside extra_params for a ggplot2::ggproto object? My initial thought was that it could be the parameters defined within the argument params of a ggplot2::layer(),…
moremo
  • 315
  • 2
  • 11
0
votes
1 answer

Access parent within own `ggproto` object

I want to access compute_group() of the parent method within my own ggproto object. Here are two different working approaches, but don't know if any is the "correct" way to go: self$super()$compute_group(...) ggproto_parent(,…
moremo
  • 315
  • 2
  • 11
0
votes
1 answer

extending ggplot to take lists and make them available to custom geoms

I'm trying to make ggplot2 to take lists and make elements of the lists available to other custom geom functions. I have a new ggplot function that accepts lists: ggplot.list <- function(data = NULL, mapping =…
Bruno
  • 115
  • 1
  • 9
0
votes
1 answer

y-axis limits of radar plot

I have used the following example for my question: http://www.cmap.polytechnique.fr/~lepennec/R/Radar/RadarAndParallelPlots.html mtcarsscaled <- as.data.frame(lapply(mtcars, ggplot2:::rescale01)) mtcarsscaled$model <- rownames(mtcars) mtcarsmelted…
Stücke
  • 868
  • 3
  • 14
  • 41
1 2 3 4 5 6
7