-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
645 additions
and
446 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
^.*\.Rproj$ | ||
^\.Rproj\.user$ | ||
^.gitignore | ||
^.github | ||
^.Rhistory | ||
^readme_files | ||
^vignettes | ||
^ggbrace_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
.Rhistory | ||
.RData | ||
.Ruserdata | ||
inst/doc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
Package: ggbrace | ||
Type: Package | ||
Title: Curly Braces in ggplot | ||
Title: Curly Braces in Ggplot | ||
Depends: | ||
R (>= 3.6.0), | ||
ggplot2 (>= 3.3.1) | ||
Imports: ggplot2 (>= 3.3.1) | ||
Version: 0.1.0 | ||
R (>= 4.3) | ||
Imports: | ||
ggplot2 (>= 3.4.2), | ||
stats (>= 4.3.1) | ||
Version: 0.1.1 | ||
Author: Nicolas Huber | ||
Maintainer: Nicolas Huber <info.huber@aold.de> | ||
Description: Provides three methods to create curly braces in ggplot2 via two functions: geom_brace and stat_brace. | ||
geom_brace in default mode plots a brace based on x and y values manually provided. | ||
geom_brace can plot braces based on the confines of data when the mapping or inherit.aes arguement are given. | ||
Maintainer: Nicolas Huber <info.huber@aol.de> | ||
Description: Provides curly braces in ggplot2 plus matching text. | ||
stat_brace plots braces partially in the confines of data so that the brace is set apart from it. | ||
License: MIT | ||
stat_bracetext plots corresponding text, fitting to the braces from stat_brace. | ||
License: MIT + file LICENSE | ||
Encoding: UTF-8 | ||
LazyData: true | ||
RoxygenNote: 7.1.1 | ||
RoxygenNote: 7.2.3 | ||
Suggests: | ||
knitr, | ||
rmarkdown | ||
VignetteBuilder: knitr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,2 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Nicolas Huber | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
YEAR: 2024 | ||
COPYRIGHT HOLDER: Nicolas Huber |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(geom_brace) | ||
export(stat_brace) | ||
export(stat_bracetext) | ||
import(ggplot2) | ||
import(stats) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,43 @@ | ||
StatBrace <- ggproto(`_class` = "StatBrace", | ||
`_inherit` = Stat, | ||
required_aes = c("x", "y"), | ||
compute_group = function( | ||
data, scales, | ||
rotate, mid, bending, npoints, | ||
distance=NULL, outerstart=NULL, width=NULL, | ||
direction, outside | ||
) { | ||
x=data$x | ||
y=data$y | ||
StatBrace <- ggplot2::ggproto( | ||
`_class` = "StatBrace", | ||
`_inherit` = Stat, | ||
required_aes = c("x", "y"), | ||
compute_group = function( | ||
data, | ||
scales, | ||
rotate = 0, | ||
mid = NULL, | ||
bending = NULL, | ||
npoints = 100, | ||
distance = NULL, | ||
outerstart = NULL, | ||
width = NULL, | ||
outside = TRUE | ||
){ | ||
x = data$x | ||
y = data$y | ||
|
||
#before we feed the .seekBrace function we need to change the x/y values | ||
coords <- .coordCorrection( | ||
x=x, y=y, | ||
rotate=rotate, mid=mid, | ||
distance=distance, outerstart=outerstart, width=width, | ||
direction=direction, outside=outside | ||
)[["dataCoords"]] | ||
#before we feed the .seekBrace function we need to change the x/y values | ||
coords <- .coordCorrection( | ||
x = x, | ||
y = y, | ||
rotate = rotate, | ||
mid = mid, | ||
distance = distance, | ||
outerstart = outerstart, | ||
width = width, | ||
outside = outside | ||
)[["dataCoords"]] | ||
|
||
#provides data.frame with x and y values to draw the brace | ||
brace <- .seekBrace(x=coords$x, y=coords$y, | ||
rotate=rotate, bending=bending, npoints=npoints) | ||
#provides data.frame with x and y values to draw the brace | ||
brace <- .seekBrace( | ||
x = coords$x, | ||
y = coords$y, | ||
rotate = rotate, | ||
bending = bending, | ||
npoints = npoints | ||
) | ||
|
||
return(brace) | ||
} | ||
) | ||
|
||
StatBraceLabel <- ggproto("StatBraceLabel", Stat, | ||
required_aes = c("x", "y"), | ||
compute_group = function( | ||
data, scales, | ||
rotate, mid, bending, npoints, | ||
labeldistance, | ||
distance=NULL, outerstart=NULL, width=NULL, | ||
direction, outside | ||
) { | ||
x=data$x | ||
y=data$y | ||
|
||
#provides data.frame with an x and y value for the label | ||
coords <- .coordCorrection( | ||
x=x, y=y, | ||
rotate=rotate, mid=mid, | ||
labeldistance=labeldistance, | ||
distance=distance, outerstart=outerstart, width=width, | ||
direction=direction, outside=outside | ||
)[["labelCoords"]] | ||
|
||
return(coords) | ||
} | ||
return(brace) | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
StatBraceLabel <- ggplot2::ggproto( | ||
`_class` = "StatBraceLabel", | ||
`_inherit` = Stat, | ||
compute_group = function( | ||
data, | ||
scales, | ||
rotate = 0, | ||
mid = NULL, | ||
textdistance = NULL, | ||
distance = NULL, | ||
outerstart = NULL, | ||
width = NULL, | ||
outside = TRUE | ||
){ | ||
x = data$x | ||
y = data$y | ||
|
||
#provides data.frame with an x and y value for the label | ||
coords <- .coordCorrection( | ||
x = x, | ||
y = y, | ||
rotate = rotate, | ||
mid = mid, | ||
textdistance = textdistance, | ||
distance = distance, | ||
outerstart = outerstart, | ||
width = width, | ||
outside = outside | ||
)[["labelCoords"]] | ||
|
||
return(coords) | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.