Questions tagged [ggplotly]

ggplotly is a function which converts a ggplot object into an interactive plotly object. It enables the usage of functions like zoom, hover, playing with the axis, appearing/disappearing group of points.

For more information and examples, please visit the website.

799 questions
3
votes
1 answer

How to add_trace to a plotly object created from ggplotly in R

I want to be able to add a new line/trace to a plotly object. This plotly object will be created from a ggplot object using ggplotly. I tried 1. creating the plotly object and 2. using add_trace to the plotly object, but I am unable to generate the…
K.RAC
  • 233
  • 1
  • 8
3
votes
1 answer

Can you get rid of the trace labels in the annotations when using ggplotly (ggplot2 with plotly)?

is it possible to remove the trace labels in the annotations when using ggplotly? For example: library(ggplot2) library(plotly) g <- ggplot(iris, aes(Sepal.Width, Sepal.Length)) + geom_point() + annotate("rect", xmin = 4, xmax = 5, ymin = 4,…
william3031
  • 1,653
  • 1
  • 18
  • 39
3
votes
0 answers

How to have the panel name fit on one line when using facet_wrap in ggplotly?

When I facet the plots using plotly, it causes the panel names to overlap with the next plot below it. I want the panel names to fit in the box and not overlap with the other plots below it. I have tried to change the spacing between panels but that…
QMan5
  • 713
  • 1
  • 4
  • 20
3
votes
1 answer

How to eliminate ggplotly duplicate legend entries when using more than one geom

I'm trying to make a faceted plotly line graph in R that generates a plot no matter how many groups are available to facet. When running the following code, I get a desirable plotly graph, shown in the following picture # R 3.6.0 # most of these…
Ben
  • 45
  • 4
3
votes
1 answer

Area under curve ggplotly R not rendering as per expectation

I have created a plot with the following dataset and ggplot2 I downloaded the dataset in CSV from the below link https://www.kaggle.com/dataset/e392d3cfbb5749653d5c82f4bec1daa03628fb06d374fad84eac319f1b3f982422 The code I have used is as follows …
Raghavan vmvs
  • 1,213
  • 1
  • 10
  • 29
3
votes
2 answers

Plotly way to add layers to map instead of GGplotly

I am trying to create a choropleth with a color variable for the area, and a point variable that will vary in size depending on numerical value. The variables used here are not the final data but purely for illustration. I have used the package…
monkeyshines
  • 1,058
  • 2
  • 8
  • 25
3
votes
1 answer

Annotations varying by subplot with plotly-express?

Suppose I want to make a subplot like this in which each facet has its own y scale: import plotly.express as px fig = px.scatter(px.data.iris(), x='sepal_length', y='sepal_width', facet_col='species') def update(y): y.update(matches=None) …
pteehan
  • 807
  • 9
  • 19
3
votes
2 answers

ggplotly is breaking my geom_smooth element

I'm building an NBA R Shiny Application and I'm running into a small problem trying to make interactive plots. My Geom smooth element works in the first set of code I've provided which shows a smoothing average of the margin of victory for the…
jyablonski
  • 711
  • 1
  • 7
  • 17
3
votes
1 answer

How to add scroll bar to ggplot2 bar chart?

When there are many bars in the plot, the x-axis is too crowded, is it possible to add scroll bar to the plot? The example below is simple, only 26 bars, I need to plot more than 100 bars. Thanks. library(ggplot2) library(plotly) tdf <- data.frame(c…
IanJay
  • 373
  • 4
  • 14
3
votes
1 answer

Logarithmic scale in plotly boxplot on logged data

I want to create a boxplot (and potentially other plots) with logarithmic scale AND statistics calculated on logged data. The following example shows the logic. The data looks like: d1 <- data.frame(x = rchisq(1000, 2), mod = c(rep('a', 500),…
Kirill K.
  • 43
  • 3
3
votes
1 answer

Problem with ggplot geom-tile convert to plotly chartusing ggplotly

I tried to convert the ggplot geom-tile chart to plotly by using ggplotly function. However, I realized that the outcomes are different. Please refer for the link below to view the difference. Besides that, ggplotly chart also missing colorbar.…
Yo Tee
  • 33
  • 4
3
votes
0 answers

shinyDashboard with plotly & ggplot2 - Warning: Error in order: argument 1 is not a vector

Can one of you kind folk please help me out here - I've been tearing my hair out for a few days now!! The below code is meant to produce an interactive plotly line chart, using ggplot formatting (no other reason than because it's relatively familiar…
theRealPK
  • 31
  • 3
3
votes
1 answer

zoom in R - plotly using the dynamicTicks

How could I set the ggplotly(dynamicTicks = TRUE) just for y axis ?! In the following, by zooming in, both x and y axis ticks will change : ggiris <- qplot(Petal.Width, Sepal.Length, data = iris, color = Species) ggplotly(ggiris,dynamicTicks =…
Haribo
  • 2,071
  • 17
  • 37
3
votes
1 answer

ggplotly with long names in the labels

I have data with long names which i would like to plot using ggplotly. That's my code: library(ggplot2) library(plotly) temp<-data.frame(x=c("longgggggggggggggggggggggggg_nameeeeeeeeeeeeeee1", "longggggggggggggggggggggggggg_nameeeeeeeeeeeeeee2"), …
Basel.D
  • 349
  • 1
  • 18
3
votes
1 answer

Create plotly chart in R to toggle between count and percentage

The general idea is to create a plotly chart that can toggled between showing a count and a percentage. I am able to change which traces are shown using updatemenu, and the axis ticks can change dynamically, but when I toggle to "%" in the example…
mfherman
  • 392
  • 4
  • 16