ggplotly

Format tooltip in plotly for long text labels

天大地大妈咪最大 提交于 2019-12-11 04:24:18
问题 Consider the simple example below. Is there a way to format the plotly tooltip such that the long text labels are visible in a box, rather than this absurd rectangle that cuts off values? library(ggplot2); library(plotly) df <- data.frame(x = 1:10, y = 1:10, z = rep("the longggggggggggggggggggggggggggggestttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt

Change axis title position in ggplot using plotly

て烟熏妆下的殇ゞ 提交于 2019-12-10 18:23:08
问题 I have an issue when using ggplotly on a ggplot graph. It is basically the exact same issue as here. However, the offered solution does not work if the plot is not facetted, since the object gp[['x']][['layout']][['annotations']] that should be altered does not exist in this case. (Unfortunately, I don't have enough reputation to comment, therefore I have to raise the issue as a new question.) As a result, I cannot find how to adjust the y axis title position in a non-faceted plot. This is

How to Export ggplotly from R shiny app as html file

北慕城南 提交于 2019-12-09 06:10:42
I have a ggplotly object called p2 in my shiny app. I want it to work where if a user presses a downloadButton in the app UI, it will download the ggplotly plot as an html file. But the function doesn't work: output$Export_Graph <- downloadHandler( filename = function() { file <- "Graph" }, content = function(file) { write(p2, file) } Any ideas? An interactive plotly graph can be exported as an "html widget". A minimal sample code is like the following: library(shiny) library(plotly) library(ggplot2) library(htmlwidgets) # to use saveWidget function ui <- fluidPage( titlePanel("Plotly html

Displaying the table details from sankey chart in R shiny

不羁的心 提交于 2019-12-08 14:02:11
问题 The script below works on the patients data from bupaR package,and creates a sankey plot listing the relation between a resource from the "employee" column with the activity he is involved in from the "handling" column in the patients data. Besides the plot there is a data table available from DT which gives details of every sankey plot path when clicked. I want a functionality such that when I click on any path, say path connecting "r1" employee and "Registration" handling activity, I want

generate seasonal plot, but with fiscal year start/end dates

别说谁变了你拦得住时间么 提交于 2019-12-08 07:18:56
问题 Hello! Is there a way to index a chart to start and end at specific points (which may be out of numeric order)? I have data that begins October 1st, and ends September 31st the following year. The series repeats through multiple years past, and i want to build a daily seasonality chart. The challenge is the X axis is not from low to high, it runs 10-11-12-1-2-3-4-5-6-7-8-9. Question 1: Can you order the index by month 10-11-12-1-2-3-4-5-6-7-8-9? while, being compatible with %m-%d formatting,

R: facet_wrap does not render correctly with ggplotly in Shiny app

江枫思渺然 提交于 2019-12-08 05:20:36
问题 When I do a facet_grid in ggplotly() for a Shiny App, with a large number of faceting groups, the plot is messed up. However it works correctly outside Shiny. How can I fix this? I suspect it is linked to the Y scale but I couldn't find the solution. Here's a reproducible example based on diamonds example from plotly. Comparison of Shiny vs non Shiny outputs : Comparison of facet_grid outside and within Shiny Code Outside Shiny: library(ggplot2) data(diamonds, package = "ggplot2") # new

Can't implement ggplotly on a plot with annotation_custom

耗尽温柔 提交于 2019-12-08 04:19:51
问题 I'm plotting a dataset of shot locations on an ice rink. I want to use plotly to enable users to see a description box once they hover over each point. I thought this would be done using the custom tooltip The ice rink is stored in a rink object. rink <- rasterGrob(readJPEG("full-rink.jpg")) Here is full-rink.jpg This is the first 5 rows of the dataset I'm working with: structure(list(game_date = structure(c(17674, 17674, 17674, 17674, 17674), class = "Date"), event_team = c("WSH", "WSH", "T

Setting ranges for a bar chart in R and displaying count of items

陌路散爱 提交于 2019-12-08 01:20:33
问题 I have created a data frame from iris dataset using the following command: new_iris = data.frame(iris$Species,iris$Sepal.Length) range(iris$Sepal.Length) The second command tells me the range of the Sepal.Length. I want to implement a bar plot using plotly or ggplot2 such that the code decides the ranges of Sepal.Length automatically and then each range contains one bar which gives the count of all the Sepal.Length values in that range. So let's say if the ranges decided are "2-4","4-6","6-8"

Disable hover information for a specific layer (geom) of plotly

落花浮王杯 提交于 2019-12-08 01:18:16
问题 library(ggplot2) library(plotly) gg <- ggplot(mtcars, aes(factor(vs), drat)) + geom_violin() + geom_jitter() ggplotly(gg) In example code we use ggplot to plot violin and jitter layers. Plotly displays information for both layers (i.e. when hovered over jitter point it will display specific point information, same thing happens when hovered over the violin plot). However, I want plotly to display information only for geom_jitter . Question: How to disable hovered information for specific

Add vertical line to ggplotly plot

时光毁灭记忆、已成空白 提交于 2019-12-07 05:51:30
问题 I am trying to build a plot combining ggplot2 and plotly . The two vertical lines appear on pure ggplot2, but once I call plotly::ggplotly on it, they go away. How can I make the data also appear on the ggplotly version? If you have a solution using only plot_ly , that would be fine too. The data: df <- structure(list(date = structure(c(17226, 17257, 17287, 17318, 17348, 17379, 17410, 17440, 17471, 17501, 17226, 17257, 17287, 17318, 17348, 17379, 17410, 17440, 17471, 17501, 17226, 17257,