devopifex / g2r Goto Github PK
View Code? Open in Web Editor NEW:chart_with_downwards_trend: Grammar of graphics for interactive visualisation using G2.js
Home Page: https://g2r.opifex.org
License: Other
:chart_with_downwards_trend: Grammar of graphics for interactive visualisation using G2.js
Home Page: https://g2r.opifex.org
License: Other
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)
I would like to change the size or rotate the axis text, but I don't see any example to see how can I do it. I really appreciate the help with that.
Is it possible to do a sunburst plot in g2r?
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.
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
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")
How can I insett an image in a 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?
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
)
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.