Giter VIP home page Giter VIP logo

g2r's People

Contributors

johncoene avatar lgnbhl avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

g2r's Issues

Fix image size for {shinyMobile}

Describe the bug

Hi @JohnCoene excited to use {g2r} for a Shiny Application I'm designing for displaying data from OMIM.

I noticed the width of the g2Output() objects is almost perfect with {shinyMobile}... almost.

shinyMobile-g2r
image_size_error

Reproducible Example

library(shiny)
library(shinyMobile)
library(g2r)
library(dplyr)

.make_data <- function(){
  dplyr::tibble(
    x = 1:20,
    y = runif(20)
  )
}

shinyApp(
  ui = f7Page(
    title = "Shiny g2r",
    preloader = FALSE,
    loading_duration = 3,
    options = list(
      theme = c("ios", "md", "auto", "aurora"),
      dark = FALSE,
      filled = TRUE,
      color = "#1C4E80",
      touch = list(tapHold = TRUE, tapHoldDelay = 750, iosTouchRipple = FALSE),
      iosTranslucentBars = TRUE,
      navbar = list(iosCenterTitle = TRUE, hideNavOnPageScroll = TRUE),
      toolbar = list(hideNavOnPageScroll = FALSE),
      pullToRefresh = FALSE
    ),
    allowPWA = FALSE,
    f7TabLayout(
      panels = tagList(
        f7Panel(title = "Left Panel", side = "left", theme = "light", "Blabla", effect = "cover"),
        f7Panel(title = "Right Panel", side = "right", theme = "dark", "Blabla", effect = "cover")
      ),
      navbar = f7Navbar(
        title = "Tabs",
        hairline = TRUE,
        shadow = TRUE,
        leftPanel = TRUE,
        rightPanel = TRUE
      ),
      f7Tabs(
        animated = FALSE,
        swipeable = FALSE,
        f7Tab(
          tabName = "",
          icon = f7Icon(""),
          active = TRUE,
          f7Shadow(
            intensity = 10,
            hover = TRUE,
            f7Card(
              title = "",
              image = "https://www.colorhexa.com/1c4e80.png",
              br(),
              g2Output("chart")
            )
          ),
          f7ExpandableCard(
            id = "card4",
            title = "About the App",
            fullBackground = TRUE,
            image = "https://www.colorhexa.com/1c4e80.png",
            "An interactive web-based tool built with {shinyMobile} on top of the latest Framework7 template <https://framework7.io>"
          ),
        )
      )
    )
  ),
  server = function(input, output, session) {
    
    output$chart <- renderG2({
      g2(.make_data(), asp(x, y)) %>%
        fig_point()
    })
    
    observeEvent(input$chg, {
      g2Proxy("chart") %>%
        change_data(.make_data(), x, y)
    })
  }
)

Save this as app.R and then run the following to get the preview of the app on iPhoneX:

preview_mobile(appPath = "app.R", device = "iphoneX")

Would appreciate if you could look into this

Using a slider for more than one fig_ together

When using a slider, how can make the slider for fig_area, fig_line and fig_point together. It seems to me that only works for the last fig_

g2(blockchain, asp(date, blockchain)) %>% 
  fig_area() %>%
  fig_point() %>%
  fig_line() %>%
  slider(start = 0, end = 1)

Several legends in symmetrical plot

Hello,

I was wondering if it was possible to use symmetric intervals to create something like this plot: https://i.imgur.com/AnPoNdm.png

Here is my attempt:

library(forcats)
library(dplyr)
library(g2r)

data("gss_cat")

gss_cat %>%
  filter(marital %in% c("Married", "Divorced"),
         relig %in% c("Catholic", "Jewish")) %>%  
  group_by(marital, relig, rincome) %>%
  summarise(total = sum(tvhours, na.rm = TRUE)) %>%
  g2(asp(y = total, x = relig, color = rincome)) %>%
  fig_interval(adjust(type = "dodge", margin = 0)) %>%
  planes(~marital, type = "mirror")

This kinda works, but there is no way of knowing what marital status the first half of the graph is. It is likely "Divorced", as per alphabetical order. Would there be a way of solving this issue? Maybe have a different shade of colors for each half of the graph?

planes()

Description
Hi John,

Trying to get a facet that appears vertically opposed to horizontally--and wanted to see if that was possible.

Thanks for your time!

Example

library(g2r)

g2(iris, asp(Sepal.Width, color = Species)) |>
  fig_density() |>
  planes(
    ~Species,
    type = "matrix",
    cols = 1,
    rows = 3
  )

[Issue] With g2(), subject() is pushing down the plot and hiding the x axis

When using subject() with g2(), my plots are being pushed down by the title and my axis is then being hidden (as well as the bottom of the plot). I am just starting out with the g2r package and could possibly be doing something incorrectly. Below is a simple plot with subject() being used. I have attached two pictures showing my output of the below code. One is with subject("Plot Title"), and the other is without subject() being used.

dat <- mtcars %>%
  mutate(car = rownames(mtcars)) %>%
  head(6)

g2(dat, asp(x = car, y = mpg)) %>%
  fig_interval() %>%
  subject("Plot Title")

with_subject
without_subject

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.