View source: R/geom_rangeframe.R
geom_rangeframe | R Documentation |
Axis lines which extend to the maximum and minimum of the axis breaks. The implementation and documentation is largely adapted from geom_rangeframe
.
geom_rangeframe(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
sides = "bl",
panelInfo = list(t = "x.sec.major", r = "y.sec.major", b = "x.major", l = "y.major"),
na.rm = FALSE,
show.legend = NA,
inherit.aes = FALSE
)
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
The statistical transformation to use on the data for this layer.
When using a
|
position |
A position adjustment to use on the data for this layer. This
can be used in various ways, including to prevent overplotting and
improving the display. The
|
... |
Other arguments passed on to
|
sides |
A string that controls which sides of the plot the frames appear on.
It can be set to a string containing any of |
panelInfo |
A list that specifies what information is drawn from what component of panel_scales.
Usually, |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
colour
size
linetype
alpha
Tufte, Edward R. (2001) The Visual Display of Quantitative Information, Chapter 6.
Jeffrey B. Arnold (2019). ggthemes: Extra Themes, Scales and Geoms for 'ggplot2'. R package version 4.2.0. https://CRAN.R-project.org/package=ggthemes
library(ggplot2)
library(jaspGraphs)
# an example plot
graph <- ggplot(mtcars, aes(wt, mpg)) +
geom_point()
# add bty = 'n' for x and y-axes.
graph +
geom_rangeframe() +
themeJaspRaw()
# automatically done by themeJasp
themeJasp(graph)
# only draw the x-axis line
graph +
geom_rangeframe(sides = "b") +
themeJaspRaw()
# coord_flip does not interact with sides
graph +
coord_flip() +
geom_rangeframe(sides = "b") +
themeJaspRaw()
# add axis lines right and above of plot:
graph +
scale_x_continuous(sec.axis = sec_axis(~ log10(.))) +
scale_y_continuous(sec.axis = sec_axis(~ log10(.))) +
geom_rangeframe(sides = "trbl") +
themeJaspRaw()
# set x-axis to above the plot and draw a line there
graph +
scale_x_continuous(position = "top") +
geom_rangeframe(sides = "tl", panelInfo = list(t = "x.major")) +
themeJaspRaw()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.