ggside-scales-continuous | R Documentation |
The xside and yside variants of scale_x_continuous/scale_y_continuous. scale_xsidey_continuous enables better control on how the y-axis is rendered on the xside panel and scale_ysidex_continuous enables better control on how the x-axis is rendered on the yside panel.
name |
The name of the scale. Used as the axis or legend title. If
|
breaks |
One of:
|
minor_breaks |
One of:
|
n.breaks |
An integer guiding the number of major breaks. The algorithm
may choose a slightly different number to ensure nice break labels. Will
only have an effect if |
labels |
One of:
|
limits |
One of:
|
expand |
For position scales, a vector of range expansion constants used to add some
padding around the data to ensure that they are placed some distance
away from the axes. Use the convenience function |
oob |
One of:
|
na.value |
Missing values will be replaced with this value. |
trans |
For continuous scales, the name of a transformation object or the object itself. Built-in transformations include "asn", "atanh", "boxcox", "date", "exp", "hms", "identity", "log", "log10", "log1p", "log2", "logit", "modulus", "probability", "probit", "pseudo_log", "reciprocal", "reverse", "sqrt" and "time". A transformation object bundles together a transform, its inverse,
and methods for generating breaks and labels. Transformation objects
are defined in the scales package, and are called |
guide |
A function used to create a guide or its name. See
|
position |
For position scales, The position of the axis.
|
sec.axis |
|
ggside_scale object inheriting from ggplot2::ScaleContinuousPosition
library(ggside) library(ggplot2) # adding continuous y-scale to the x-side panel, when main panel mapped to discrete data ggplot(mpg, aes(hwy, class, colour = class)) + geom_boxplot() + geom_xsidedensity(position = "stack") + theme(ggside.panel.scale = .3) + scale_xsidey_continuous(minor_breaks = NULL, limits = c(NA,1)) #If you need to specify the main scale, but need to prevent this from #affecting the side scale. Simply add the appropriate `scale_*side*_*()` function. ggplot(mtcars, aes(wt, mpg)) + geom_point() + geom_xsidehistogram() + geom_ysidehistogram() + scale_x_continuous( breaks = seq(1, 6, 1), #would otherwise remove the histogram #as they have a lower value of 0. limits = (c(1, 6)) ) + scale_ysidex_continuous() #ensures the x-axis of the y-side panel has its own scale.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.