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
7
votes
0 answers

keep two legends from ggplot plot using plotly::ggplotly

When I convert a ggplot with two separate legends to plotly (using ggplotly), the two legends merge. Does anyone know how to prevent this? library(tidyverse) library(plotly) df <- data.frame(date = as.Date(c("01/01/1998",…
user63230
  • 4,095
  • 21
  • 43
7
votes
1 answer

Empty Plotly with centered title R

I am trying to create an empty plotly with a message telling why the plot is empty as a title. I would like to center the message both horizontally and vertically. I am missing the vertical center : empty_plot <- function(title = NULL){ p <-…
Clemsang
  • 5,053
  • 3
  • 23
  • 41
7
votes
2 answers

How to interpolate data between sparse points to make a contour plot in R & plotly

I'd like to create a contour plot on th xy plane from concentration data at the following coloured points in the fist figure. I don't have corner points at each height so I need to extrapolate the concentration to the edges of the xy plane…
HCAI
  • 2,213
  • 8
  • 33
  • 65
7
votes
1 answer

How to use plotlyProxy() in shiny app with ggplotly() to make plots render faster

I have been looking for a question that deals with this but I haven't seen any.. I am creating a shiny app which uses ggplotly() to make my graph interactive. The graph is reactive based on a user selectInput() drop down menu. Everything works fine…
NBE
  • 641
  • 2
  • 11
  • 33
7
votes
3 answers

Plotly does not show lines

I am using plotly to visualize a dataset into an interactive plot that can be used in a shiny application in a dashboard. I'm using the plotly package as it seems very suitable for me to do something like this. I want to create a plot with lines and…
Richard
  • 126
  • 1
  • 2
  • 12
7
votes
1 answer

Overlaying line on contour plot using Plotly

I'd like to overlay a line on top a Plotly contour plot, similar to overlaying a line on an image of a matrix in which the intensity represents position in z within R3: # Generate an arbitrary matrix m <- matrix(sin(1:6^2) * 1:6, nrow = 6) # Define…
mduprey
  • 109
  • 8
7
votes
2 answers

Format hover data labels Plotly R

I am trying to format the data labels that appear when I hover over part of a chart I have created using Plotly. The label is currently showing like this. I would like for the label to only show profit. My code for creating the plot…
Mavic
  • 153
  • 2
  • 2
  • 6
7
votes
1 answer

Plotly cutting off X and Y labels

I have a plot which I have created with plotly. When I deploy it to my shiny app the X and Y labels are cut off as you can see here: How can I prevent this from happening? If I use a normal plot the labels do not get cut off but I need the plot to…
Mavic
  • 153
  • 2
  • 2
  • 6
7
votes
2 answers

Plotly: Parallel Coordinates Plot: Axis Styling

I really like the parallel coordinates plot available in Plotly but I just ran into an issue I could use help with. Is it possible to have log10 based axis for some of the coordinates? As you can see in the example below performing a log10 transform…
user14419
  • 160
  • 1
  • 7
7
votes
1 answer

Date format in hover for ggplot2 and plotly

I have a question about date formats in plotly. I made a time series plot in ggplot2 that I'm trying to visualize with plotly but a format issue for date-time appears on the hover (see image). I would like the date format to be YYMMD-hh:mm. How…
pacomet
  • 5,011
  • 12
  • 59
  • 111
7
votes
2 answers

Control which tick marks / labels appear on x-axis in plotly?

I want to have control over which tick marks appear on the x-axis. The following code places tick marks in a sequence of 5 (at 5, 10, 15 ... 30) library(plotly) df <- data.frame(x = 1:30, y = sample(100:300, size = 30, replace =…
BogdanC
  • 1,316
  • 3
  • 16
  • 36
7
votes
2 answers

Exporting PNG files from Plotly in R without internet

In this question, Exporting PNG files from Plotly in R I asked how to export Plotly plots to disk. I used the function plotly_IMAGE, but later discovered that the function uses the Plotly internet servers. The question is, now that Plotly JavaScript…
Murta
  • 2,037
  • 3
  • 25
  • 33
6
votes
3 answers

R plotly separate functional legends

I want to produce a plot via R plotly with independent legends while respecting the colorscale. This is what I have: library(plotly) X <- data.frame(xcoord = 1:6, ycoord = 1:6, score = 1:6, gender =…
mat
  • 2,412
  • 5
  • 31
  • 69
6
votes
2 answers

Avoid legend duplication in plotly conversion from ggplot with facet_wrap

Consider the plot produced by the following reprex. Note that the ggplot has sensible legends, while in plotly, the legend is heavily duplicated, with one entry for each time the same category ("manufacturer") appears in each facet. How do I make…
cboettig
  • 12,377
  • 13
  • 70
  • 113
6
votes
1 answer

Open tab by clicking on a stacked barchart

I'm building a stacked barchart containing retweets using R, ggplot and plotly. If a part of a barchart is clicked on, I want a new browser tab to open and show the tweet from this specific date with the indicated amount of retweets. However, when I…
jjh
  • 61
  • 2
1 2
3
80 81