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
6
votes
2 answers

Shiny doesn't display R plotly plot

I'm fairly new to shiny and trying to push over a pie chart made in plotly. Upon clicking runapp the html rendered only contains the Title i.e. "Plotly" The code is as under UI library(shiny) shinyUI <- fluidPage( titlePanel("Plotly"), …
Dollar Vora
  • 197
  • 1
  • 10
6
votes
2 answers

Change Plotly Colorbar Title

I am trying to change the title of the colorbar in a plotly scatter plot. Looking at the documentation, it seems this should be trivial. However, I've tried inserting colorbar = list(title = "Typing Rate") into both the main plotly() code, as well…
Adam_G
  • 7,337
  • 20
  • 86
  • 148
6
votes
3 answers

How to draw ellipsoid with plotly

Are there any way to plot a surface like ellipsoid with plotly 3D? Currently only surfaces of the form z=f(x,y) are discussed in the docs. There is also Mesh 3D, but I found no examples for it. It seem to be possible to make a triangulation of…
Ilya V. Schurov
  • 7,687
  • 2
  • 40
  • 78
5
votes
3 answers

User inputs for R ggplot or plotly without shiny

I have an Rmarkdown with a simple scatter plot (a map for instance), and I would like users to be able to provide some arbitrary x and y coordinates via an input and have those plotted on the graph (in red in the example below). The problem is, I…
mat
  • 2,412
  • 5
  • 31
  • 69
5
votes
1 answer

how to dynamically change plotly axis based on crosstalk conditions

This question has been asked before, but didn't get an answer since it didn't have a reprex, so let me give it a go. Lets say I have two datasets that span different date ranges. I want to control the visualization of each using a slider. The…
Amit Kohli
  • 2,860
  • 2
  • 24
  • 44
5
votes
3 answers

How to change legend position in ggplotly in R

The below code generates two plots using ggplot and ggplotly. Despite of using the layout() to ggplotly the legend is still at the right side. The legend is required to be at the bottom. Could anyone help to move the legend to bottom in the…
chas
  • 1,565
  • 5
  • 26
  • 54
5
votes
3 answers

Switch displayed traces via plotly dropdown menu

I am working with the R programming language. I am trying to replicate this tutorial over here for my own data: https://plotly.com/r/dropdowns/ I created some fake data and made 4 plots: #load libraries…
stats_noob
  • 5,401
  • 4
  • 27
  • 83
5
votes
0 answers

Why can't I install Plotly package in RStudio? What does the error say?

install.packages('plotly') I try to install the plotly package by running the code above in RStudio. However, it fails and returns the below. I'm a newbie and I can't read this properly. What should I do to fix this? I also try to install curl,…
Paw in Data
  • 1,262
  • 2
  • 14
  • 32
5
votes
1 answer

How to apply subplot to a list of plots with secondary y axis

I want to prepare a subplot where each facet is a separate dual y-axis plot of one variable against the others. So I make a base plot p and add secondary y-axis variable in a loop: library(rlang) library(plotly) library(tibble) dual_axis_lines <-…
Xaume
  • 293
  • 2
  • 16
5
votes
2 answers

Plotly: How to add a median line on a box plot

I would like to add trace of a median line on my box plot. like this Here are my plots so far: library(plotly) p <- plot_ly(y = ~rnorm(50), type = "box") %>% add_trace(y = ~rnorm(50, 1)) p
Sup'A
  • 109
  • 2
  • 11
5
votes
1 answer

R - plotly - remove map stretching

I am trying to use plotly to make interactive ggplot2 maps. In the code below I create a map of France with a different color for each departement : library(tidyverse) library(stringr) library(stringi) library(maps) library(ggplot2) map <-…
Lucas Morin
  • 373
  • 2
  • 11
  • 35
5
votes
1 answer

Connect bars with lines in R plotly

I am trying to connect the stacked bars with lines. Expectation : However I am unable to draw the lines between the bars. Have tried with the following script however it is not adding the line. Using add_trace instead of 'add_lines' is not…
Soumya Boral
  • 1,191
  • 14
  • 28
5
votes
2 answers

R Plotly: aspectmode='cube' not making axes equal in 3D scatter plot

I am making a 3D scatterplot (image attached) of principal components. Although I'm using aspectmode='cube', the axes are not equal in size. I created an MRE to test, and in that test, the axes to come out equal. So, I'm very confused. axx <-…
abalter
  • 9,663
  • 17
  • 90
  • 145
5
votes
0 answers

Change position of plotly hover box R

I would like to change the position of the hover box in a plotly bar chart. Rather than have it popup on the left or right, I would like it to popup above the bar. Is this possible? I've been googling this and staring at the Plotly R reference page…
hmhensen
  • 2,974
  • 3
  • 22
  • 43
5
votes
1 answer

Make tooltip appear on corresponding points in different ggplot2 facets in a plotly object

I am using ggplot2 and the plotly R packages to generate a volcano plot to visualize protein differential abundance data. library(ggplot2) library(plotly) nVals <- 80 nFacets <- 2 #example dataset proteins <- rep(paste0('protein_', c(1:(nVals /…
aaronj
  • 53
  • 5