Questions tagged [ggplotly]

0

votes
0

answer
3

Views

plot different columns in one graph R

My sample data : structure(list(year = c(2018, 2018, 2018, 2018, 2019, 2019), month = c(9, 10, 11, 12, 1, 2), pred1 = c(-6.63356483810535, -6.50968293287978, -1.54767782423655, -1.47812226859267, -1.36788275407234, -1.28168637109063), pred2 = c(-1.42361872090391, -1.3982815502715, -1.14092414754...
Lalitha
1

votes
2

answer
482

Views

Shiny R - ggplotly - Show custom message instead of empty plot when the dataset does not return any information

The shiny application I'm working on is displaying graphs using ggplotly. In an instance when the resulting dataset is empty, a blank plot is being displayed, as below. Is it possible to show a custom message such as 'No data exists with the selected inputs' instead of an empty plot With the help o...
Prashanth kumar
1

votes
1

answer
551

Views

Change axis title position in ggplot using plotly

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...
Bart VdW
1

votes
2

answer
354

Views

Converting ggplot object to plotly object creates axis title that overlaps tick values

I had the same issue described in this question: R: ggplot and plotly axis margin won't change but when I implemented the solution, I got the following error: Warning: Ignoring unknown aesthetics: text We recommend that you use the dev version of ggplot2 with ggplotly() Install it with: devtools::in...
Michael Szczepaniak
1

votes
1

answer
230

Views

Add slider to plotly heatmap colorbar - R

I am new to plotly. I'm wondering how I could add a slider control to a heat map colour bar that allows the user to only show tiles that are of a specific value/colour? Any tips would be appreciated. Thank you. library(plotly) p
J.Con
1

votes
1

answer
178

Views

ggplotly on geom_bar and coord_flip seems to fail

I am able to plot a geom_bar as I want but when I try to wrap it with the ggplotly function it does not work. Anyone know a trick to make it work? library(ggplot2) library(plotly) # My df dataset a=runif(10, min = 0, max = 1) b=runif(10, min = -1, max = 0) df=data.frame('p'=c(a,b), 'g'=rep(c('a','b'...
hans glick
1

votes
1

answer
9

Views

colored geom bar - plotly

How do you resolve the double labels when you hover over the filled geom_bar? This doesn't occur in the unfilled geom_bar # no fill library(plotly) dat
Sheila Chelimo
1

votes
2

answer
35

Views

R aggregate data.frame having dates and hours in one column misformatted

I have a data frame like the following: kWh Equipment date 1 1.53 aquecedor01 2015-01-01 00:00:00 2 5.29 aquecedor01 2015-01-01 01:00:00 3 5.73 aquecedor01 2015-01-01 02:00:00 but when I aggregate data by the Equipment variable to find the maximum value from kWh, the date column is...
3

votes
1

answer
21

Views

Add plotly traces dynamically on shiny

I am building an app that allows a user to dynamically add and remove traces on a plotly graph using selectInput. I have tried to play around with plotlyProxy () and plotlyProxyInvoke () from plotly package to no avail. Below is my rudimental code : library(shiny) library(shinydashboard) library(plo...
R noob
2

votes
1

answer
35

Views

ggplot2 fill not converting ggplotly color mapping correctly

I'm trying to convert a ggplot2 image using ggplotly(), but it's not converting correctly. My ggplot image takes in two lines all of the time, and has a color variable for the geom_line component and a fill variable for the geom_point component. Here is my code for the strictly the basic ggplot part...
Agrosel
1

votes
2

answer
9.9k

Views

ggplot2 remove axis label

I have the following dataset: dput(head(active_clients)) structure(list(Date = structure(c(1422662400, 1425081600, 1427760000, 1430352000, 1433030400, 1435622400), class = c('POSIXct', 'POSIXt' ), tzone = 'UTC'), value = c(65139, 66615, 66669, 67081, 67277, 67366), month = 1:6, year = c(2015L, 201...
Prometheus
5

votes
2

answer
472

Views

How to use plotly to return the same event_data information for selected points even after modifying the data

I'm trying to do something seemingly simple: when the user clicks on a data point or select multiple points with lasso selection, I want to draw these points in a different colour. In order to do that, I look at what points are selected, and add a col variable to the dataframe, and I tell the ggplot...
Dean Attali
5

votes
1

answer
118

Views

ggplotly removing data from single facet

I am trying to create a plotly graph for a shiny app. I am running into an issue with certain layouts of faceted plots. Whenever there are four facets and they are in a 2x2 grid, the bottom left facet does not display any data even though the data is there in the ggplot figure. This also happens whe...
tbradley
4

votes
1

answer
296

Views

In plotly, how do I retain the information about both the lasso selection and the clicked point?

I'm using plotly::ggplotly() and I need the user to be able to both select a single point and to select multiple points with brushing. I want both selection options to exist in parallel. The user should be able to click on a point and to lasso select several points, and both of those pieces of infor...
Dean Attali
4

votes
1

answer
168

Views

scale_fill in ggplot2 - Make a gradient color for every plot in a list of ggplots

I make a list of ggplots stored in an object called g.a, Here's the code to reproduce the plots (data is provided at the bottom). Worth to note that I am probably missing something simple and over-complicated the problem. RCfitter
Masoud
22

votes
1

answer
349

Views

Highlight all values from a group on hover

Assume data library(ggplot2) library(plotly) set.seed(357) xy
Roman Luštrik
2

votes
2

answer
76

Views

Map using ggplotly not showing correctly (R)

I have made a map using ggplot and plotted it using ggplotly. When it is in ggplot it looks like this: But when it is displayed using ggplotly, it looks like this: As you can kind of see, the individual regions are sort of splurging all over the place, without clear borders, and the fill is kind of...
Megan
2

votes
2

answer
395

Views

Remove column name from hover text

How can I remove the cyl: in the hovertext of the plot below? library(plotly) ggplotly(ggplot(mtcars, aes(mpg, hp, colour = cyl)) + geom_point(), tooltip = c('colour'))
mlegge
6

votes
0

answer
137

Views

Linked plots without using Shiny

I have created a shiny app to show a correlation heatmap for a large dataset. When the heatmap tiles are pressed, the corresponding scatterplots are displayed. However, I need to make several of these apps and this exceeds my limit of publishing on shinyapps.io. My company is unwilling to upgrade to...
J.Con
1

votes
2

answer
39

Views

Graph for user login time in r

So I have three columns, ID, When user logged on, and for how long he was logged on (in seconds). here is a sample from it (total user are more than 4000): structure( list( id = c( 'id_1', 'id_2', 'id_3', 'id_4', 'id_5', 'id_6', 'id_7', 'id_8', 'id_9', 'id_10', 'id_11', 'id_12', 'id_13', 'id_14', 'i...
Atius
3

votes
0

answer
73

Views

ggplotly - mismatching when using color aesthetics

I'm using ggplotly to convert a ggplot object to interactive plotly. The problem I'm encountering is when the ggplot object is using an associated color aesthetic. For example, using the following dummy example: library(ggplot2) library(plotly) datetime.data = seq.POSIXt(from = ISOdatetime(2017, 10...
zek
3

votes
1

answer
180

Views

Tooltip removes regression line ggplotly

I have the following code in server.R: library(shiny) library(plotly) art.data
Charles
3

votes
0

answer
98

Views

Python ggplot and ggplotly

Former R user, I used to combine extensively ggplot and plot_ly libraries via the ggplotly() function to display data. Newly arrived in Python, I see that the ggplot library is available, but cant find anything on a simple combination with plotly for graphical reactive displays. What I would look f...
GKerv
3

votes
0

answer
26

Views

Dates not showing properly on plotly online

The dates of the following plot are not showing correctly when the plot is posted online with plotly. library(plotly) library(ggplot2) # Create data mydata
Nick_Z0
1

votes
1

answer
422

Views

Shiny: How to change the shape and/or size of the clicked point?

I would like to change the shape and size of the clicked point in the below plot. How to achieve it? For this toy plot, I have reduced the number of points from original 100k to 2k. So, the expected solution should be highly scalable and do not deviate from the original plot i.e., all the colors bef...
Prradep
2

votes
1

answer
383

Views

plotly giving incorrect text on hover in stacked bar charts

I'm using plotly with RStudio. plotly is giving incorrect text on hover for stacked bars in the chart except for the top most bar. Reproducible example df packageVersion('plotly') [1] ‘4.5.6’ >
user3206440
2

votes
1

answer
209

Views
2

votes
1

answer
230

Views

Arranging bars of a bar plot with “null” in Descending order in R

I want to create a bar plot with Descending bars, In the plot below, due to NA being present at 2nd spot in 'a1' vector, it is pushed at the last when the plot is created. However, I want the NA bar to be present at the 2nd spot only, kindly help me here as I want to achieve this without modifying m...
Robert J
2

votes
1

answer
840

Views

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 be interactive. Here is my code for creating the pl...
Mavic
2

votes
0

answer
55

Views

Difficulty understanding the ggplotly interface for custom geoms

I've had some success extending ggflags to use SVGs, and now I'm trying to make this extension play nice with ggplotly(). The Plotly documentation has a nice section on translating custom geoms, and it essentially comes down to either providing a to_basic method for your geom or a geom2trace method....
rensa
2

votes
1

answer
559

Views

R chart convert to html format without other files

My sample dataset: library(plotly) library(htmlwidgets) d
hahakwok
2

votes
2

answer
578

Views

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 is: output$monthlyProfits
Mavic
2

votes
0

answer
329

Views

Creating Process Map Diagrams using different packages in R

the given script simply creates a process map diagram showing the flow of events in R. This field of study is called event log mining or process mining. I wish to know any other packages or functionality in R using which I can create similar maps and also make them interactive like ggplotly. Please...
Ashmin Kaul
0

votes
0

answer
4

Views

Plotly can't show on shiny (I have downloaded the patched file. But the problem is the same as usual.)

library(shiny) library(plotly) library(dplyr) library(scales) library(reticulate) source_python('cems_api.py') ui
Karen
2

votes
0

answer
260

Views

ggplotly with facet_wrap(scales = 'free_y') creates uneven panel widths

The following code creates a faceted Plotly plot using ggplotly, where each facet has the same height and width: library(ggplot2) library(plotly) data
MDe
2

votes
1

answer
107

Views

Ggplotly with tooltip has problems using geom_rect()

I am trying to plot some data in a ggplotly plot. The x-axis contains dates. Ggplotly doesn't work well with dates as when I hover over a point, the date is displayed as a number. I solved this by setting a tooltip like below. Some sample data: x
Stan Zutt
2

votes
1

answer
59

Views

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). However, when running it on ggplotly, an empty webpag...
Margo
3

votes
1

answer
255

Views

Use a custom icon in plotly's pie chart in R

I was wondering if there's a way to have a custom icon for plotly's pie chart instead of the usual pie division As of now I'm displaying the gender information using a pie chart which looks as below: I'm trying to make it look like the gender plot in the link below: https://app.displayr.com/Dashboar...
Dollar Vora
2

votes
1

answer
49

Views

Reduce file size of a plot (R) (plotly)

I've created a map in R using ggplotly. To create a link, it needs to be 524kb or under, but it currently is 1.2Mb. Are there any good ways of reducing file size so I can export it? Or is this totally unrealistic?
Megan

View additional questions