ggiraph | make 'ggplot' graphics interactive | Data Visualization library
kandi X-RAY | ggiraph Summary
kandi X-RAY | ggiraph Summary
{ggiraph} is a tool that allows you to create dynamic ggplot graphs. This allows you to add tooltips, hover effects and JavaScript actions to the graphics. The package also allows the selection of graphical elements when used in shiny applications.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ggiraph
ggiraph Key Features
ggiraph Examples and Code Snippets
Community Discussions
Trending Discussions on ggiraph
QUESTION
I am using stat_summary to generate a column plot from a dataframe. I would like to report the values to the user via tooltips using geom_col_interactive from ggiraph.
I can get the values from the ggplot using ggplot_build and construct a tooltip as below. However, I cannot work out how to use ggiraph with the plot generated using stat_summary to present tooltips interactively. I could of course use the summary_values tibble and generate a different ggplot using geom_col_interactive, but this would defeat the purpose of using stat_summary (which lends itself nicely to faceting). Is there any way to do this? Or must I use summarySE from Rmisc to generate the tibble to be plotted using geom_col_interactive?
...ANSWER
Answered 2022-Apr-17 at 09:42One approach to achieve your desired result via stat_summary
would be to pass the ggiraph:::GeomInteractiveCol
to the geom
argument. However, be aware that GeomInteractiveCol
is not exported by ggiraph
and so requires to use :::
. Additionally, to have both the mean and the standard error in the tooltip requires to switch to fun.data="mean_se"
. For convenience I make use of a simple custom function to create the tooltip:
QUESTION
ggiraph
package is suitable for generating interactive graphics.
I was trying to execute some examples found online concerning package ggiraph
and I was not able to find anywhere how to export the interactive graph generated, maybe in format svg (or other).
Below the code:
...ANSWER
Answered 2022-Mar-11 at 09:07You can save the interactive plot containing the svg in a HTML file using htmltools::save_html(oggetto, "out.html")
out.html
contains JavaScript e.g. ggiraphjs.min.js
required to run the interactivity. Plain SVG files can display tooltips using the title attribute, but the orange point color on hover on both plots simultaneously seems to require JavaScript.
QUESTION
What: Dynamically set the contents of ggiraph tooltips in rmarkdown knitted to html on page load.
Why: Using embedded png's tooltips can be made to be graphics which is valuable for certain biological structures where text is insufficient. Here is a minimal example of what I'm currently doing:
...ANSWER
Answered 2021-Dec-10 at 16:19There may be several different ways to achieve this goal, in particular I suspect that using the htmlwidgets "onRender" function may be able to achieve this more cleanly but I never got that to work.
What I've found is that any editing of the innerHTML of the htmlwidget or htmlwidget data breaks the mouseover text completely, because it breaks the event listener which powers the mouseover text.
Instead I've found I can edit the resulting svg of the htmlwidget by wrapping my ending script in a $(window).load(function(){ ... }) call. If I find all svg elements (in this case circles!) and edit the title property of those svg objects I can preserve the event listeners and change the title contents (to be an image!).
See complete example below which has 1000 1kb images as tooltips but gives no increase in file size:
QUESTION
When I used guides() specifications to customise legend appearance, I found that the interactive nature of the legend in the plot is lost.
The following code modified from the example in the ggiraph documentation.
...ANSWER
Answered 2021-Nov-14 at 23:37Instead of changing the title position via guides()
you could achieve your desired result without losing the interactivity via the guide
argument of scale_fill_manual_interactive
:
QUESTION
I'm trying to create an app that allows 1) a user to hover over scatter plot points, which displays a label associated with the point, and 2) search for a specific point by label.
Currently, to highlight a point, I re-plot the graph each time the user submits a search term, adding that single point on top of rest of the points that have been plotted.
In order to avoid the server re-plotting before the user finishes typing the label, I require that the "search" button be pressed. However, I'm struggling to get the plot to display BEFORE the user has searched for any labels.
Here's what I have so far:
...ANSWER
Answered 2021-Jul-29 at 07:07Set ignoreNULL = FALSE
in eventReactive
to have a default value at the beginning.
QUESTION
Trying to have a pie (or preferably, donut) chart that displays totals per category and that allows a drilldown to display specifics per category when clicked. Make sense?
I think I might not have every system setting correct, since also copy/paste standard examples render an empty page. Unless that's somehow outdated or something. My system: Ubuntu 20.04, R 4.0.5, packageVersion("shiny") 1.6.0, shiny-server --version 1.5.16.958 Blank examples: https://plotly-r.com/linking-views-with-shiny.html#drill-down and Creating drill down report in R Shiny (amongst others)
My current attempt (not reactive yet because I can't for the life of me figure it out):
...ANSWER
Answered 2021-May-11 at 07:19The key is to use input$donut_selected
, the automatically generated _selected
-suffixed input, see https://davidgohel.github.io/ggiraph/articles/offcran/shiny.html#access-the-selected-values.
Like so:
QUESTION
Using ggiraph
, I'd like to set css
properties differently for each ggplot
geom_
or layer using hover. In the example below, how might I set the stroke for the second geom_rect_interactive
to blue on hover but keep the first layer stroke red on hover (keeping the data_id
the same so both respond to hovering over either layer)?
ANSWER
Answered 2021-Apr-24 at 15:16(I am one of the authors) This is not currently possible, we have not considered this case (we will if we can implement it).
For the moment, it is only possible to specify a CSS per shape type. An example will be more meaningful, it is copied from:
https://davidgohel.github.io/ggiraph/articles/offcran/customizing.html#detailled-control-1
QUESTION
I created the following Rmarkdown file to make a selection based on clicking an interactive ggplot.
In the javascript chunk I would like to use instead of "A" the letter (A or B) obtained from
the onclick event in the interactive ggplot. If the user clicks on polygon B then the "A" should become a "B".
ANSWER
Answered 2021-Apr-06 at 22:30Here's a slightly more useful take on the problem:
QUESTION
This may well be a CSS query rather than a {ggiraph} question, or may be to do with my R or Cairo installation, but here goes:
I'm building a ggiraph interactive plot, but the settings that I apply for tooltip options aren't applied to the printed plot.
This is a reprex:
...ANSWER
Answered 2021-Jan-29 at 09:58You need to put opts_tooltip
in the list for options
(see https://davidgohel.github.io/ggiraph/articles/offcran/customizing.html#tooltip-style):
QUESTION
I am creating an RShiny app that centres around a network drawn in ggiraph. The network is very large and detailed so ideally I'd like it to fill as much of the page as possible.
I've had a lot of problems getting ggiraph to scale properly, and also with margins/padding in RShiny. I've gotten this far with the code but it's still leaving huge amounts of whitespace
...ANSWER
Answered 2020-Dec-12 at 17:35It seems to me you want to stop the rescaling. See https://davidgohel.github.io/ggiraph/articles/offcran/customizing.html#size-options-1
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ggiraph
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page