GithubHelp home page GithubHelp logo

nicolash2 / ggbrace Goto Github PK

View Code? Open in Web Editor NEW
12.0 1.0 5.0 1.29 MB

curly braces in ggplot2.

Home Page: https://github.com/Solatar/ggbrace

License: Other

R 100.00%
braces bracket ggplot graphs plot graph r ggplot2 brace

ggbrace's People

Contributors

nicolash2 avatar olivroy avatar royalts avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ggbrace's Issues

Warning that "parse" is ignored

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`

Not recognizing fill/color aes

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

geom_brace fails on datetimes

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.