nicolash2 / ggbrace Goto Github PK
View Code? Open in Web Editor NEWcurly braces in ggplot2.
Home Page: https://github.com/Solatar/ggbrace
License: Other
curly braces in ggplot2.
Home Page: https://github.com/Solatar/ggbrace
License: Other
Hello! I combine ggbrace
with the latex2exp
package to have some Latex in the geom_brace
label. This works just fine despite the fact that geom_brace
says it ignores the parameter parse=TRUE
(which it doesn't because when parse=FALSE
the Latex does not render). Seems like that the warning message is misplaced.
Example:
library(ggbrace)
library(ggplot2)
library(latex2exp)
ggplot(mtcars, aes(mpg,drat)) +
geom_point() +
geom_brace(aes(
x=c(1,2),
y=c(1,2),
label=TeX("$\\beta$", output = "character")),
labelsize=10,
inherit.data=FALSE,
parse=TRUE)
Warning message:
In geom_brace(aes(x = c(1, 2), y = c(1, 2), label = TeX("$\\beta$", :
Ignoring unknown parameters: `parse`
Hi @solatar
Thanks for the package! I encounter errors when trying to use it on slightly complex plots with fill/color options. For example:
test = ggplot(mtcars, aes(cyl, mpg, fill = factor(vs))) + geom_bar(stat='identity', position = 'dodge')
test + geom_brace(ystart=-5, pointing="side")
Error in factor(vs) : object 'vs' not found
Any ideas to work around this?
Best,
Shujun
This seems like it ought to work but doesn't, presumably because xstart
and xend
are datetimes:
> df
# A tibble: 3 x 3
status xstart xend
<fct> <dttm> <dttm>
1 projected 2021-05-03 00:00:00 2021-07-26 00:00:00
2 scheduled 2021-04-05 00:00:00 2021-05-02 23:59:59
3 made 2021-01-08 00:00:00 2021-04-04 23:59:59
> geom_brace(
+ data = df,
+ inherit.aes=FALSE,
+ aes(xstart=xstart, xend=xend, label=status), ystart=0, yend=10
+ )
Error in xend - xstart : non-numeric argument to binary operator
I would love to be able to produce braces underneath the axes similar to this: https://rdrr.io/cran/lemon/man/brackets.html
Is this possible?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.