Questions tagged [r-plotly]

plotly is an R package to create interactive web-based visualizations via 'plotly.js'.

plotly is a plotting package for R used to create interactive data visualizations. For examples and documentation, visit the plotly website here.

Repository

Stable Version on Cran

1205 questions
10
votes
2 answers

How to format data for plotly sunburst diagram

I'm trying to make an sunburst diagram using Plotly via R. I'm struggling with the data model required for the hierarchy, both in terms of conceptualizing how it works, and seeing if there are any easy ways to transform a regular dataframe, with…
mtreg
  • 195
  • 3
  • 11
10
votes
3 answers

Plotly Sankey finetuning; node alignment along x-axis, drop-off

The following diagram is close to what I am looking for, however I would like to know if the following is possible: Left-alignment of nodes rather than justified along the x-axis?, so for e.g., a flow with only 2 nodes would finish half-way across…
user1420372
  • 2,077
  • 3
  • 25
  • 42
10
votes
1 answer

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

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.…
pogibas
  • 27,303
  • 19
  • 84
  • 117
10
votes
2 answers

plotly: Updating data with dropdown selection

I am not sure if this is possible, but here is what I would like to do. I would like to update the data in a plotly plot by selecting from a dropdown menu. As a simple example, let's assume I have a data frame df <- data.frame(x = runif(200), y =…
data_enthusiast
  • 155
  • 1
  • 2
  • 7
9
votes
2 answers

Long facet_wrap labels in ggplotly / plotly overlap facet's strip.background

I've got a plot like the one below, where I need to display a plot title and some long facet labels. In ggplot2, it looks just fine. Reprex: library(ggplot2) library(stringr) library(plotly) iris$Species2 <- paste(iris$Species, "... some text to…
Nova
  • 5,423
  • 2
  • 42
  • 62
9
votes
1 answer

Hover image in plotly r chart in shiny app

Does anyone here have an example of showing an image when hovered on a plot or any package which can do this? I have tried something but it will show url only but not the image.I know this code is just encasing the URL. How can I build a div to show…
SNT
  • 1,283
  • 3
  • 32
  • 78
9
votes
1 answer

What exactly is the z argument in plot_ly?

I have three variables: x,y, and z and I want to produce a surface plot. z<-runif(50,0,1) y<-runif(50,1,2) x<-runif(50,3,6) plot_ly(x = ~x, y = ~y, z= ~z) %>% add_surface() I get the following error Error: `z` must be a numeric matrix What…
gm1991
  • 163
  • 1
  • 7
9
votes
2 answers

spurious warning when mapping marker size in plotly R

The simple scatterplot has a third variable mapped to the marker/point size. The plot looks perfect to me, but it throws a warning about multiple values. Each x & y value has exactly one size value. Other than suppressing the warning, can a…
wibeasley
  • 5,000
  • 3
  • 34
  • 62
9
votes
1 answer

R plotly ignoring text label alignment hjust

I am using plotly 4.8 with ggplot2 3.0.0, and trying to add and align text labels to my scatter plots. However, it seems the hjust parameter is being ignored by plotly in geom_text(aes(....), hjust = "left"). (Also tried hjust = 0.) GGPLOT…
micstr
  • 5,080
  • 8
  • 48
  • 76
9
votes
2 answers

Plotly 3D filling under the line

I would like to plot a 3D-Line Plot with Plotly for time-series and fill under the every line. I have an example code here. library(plotly) dens <- with(diamonds, tapply(price, INDEX = cut, density)) data <- data.frame( x = unlist(lapply(dens,…
plotly_user
  • 111
  • 1
  • 4
9
votes
3 answers

ggplot2 + plotly : Axis title disappear

I've got an issue when using ggplotly() to a ggplot graph: the y axis disappears. Here's a reproducible example using iris dataset (this example is quite dump, but whatever) data(iris) g = ggplot(data = iris, aes(x = Petal.Length, y = Petal.Width,…
prise6
  • 136
  • 1
  • 7
8
votes
2 answers

plotly hoverlabel color transparency

Is it possible to format hoverlabel so that the background color is transparent & it's possible to see the plot through the labels? I can set it to a solid color by e.g. hoverlabel = list(bgcolor = '#fff') but looks like if I try to add…
laxxy
  • 1,148
  • 8
  • 17
8
votes
2 answers

plotly click events from anywhere on the plot

I am new to r-plotly and trying to figure out how to handle clicks which are not on the data. It seems that using event_data("plotly_click") I get events that are on points from the data, but so far have not figured out how to do this for clicks…
user3763801
  • 395
  • 4
  • 10
8
votes
2 answers

How to make scatterplot points open a hyperlink using ggplotly - R

I'd like to make my scatterplot points clickable and have each point's respective hyperlink open when clicked. I am trying to do this using ggplotly. There is a simple way to do this when building the plot using plotly()(see first example below).…
Margo
  • 93
  • 4
8
votes
2 answers

How to customize hover text for plotly boxplots in R

I understand how to customize the hover text for scatter plots in plotly, but box plots do not accept the 'text' attribute. Warning message: 'box' objects don't have these attributes: 'text'. I have over 300 x-axis variables and there are numbered…
andemexoax
  • 323
  • 3
  • 15
1
2
3
80 81