plotly

How to disable the zoom of a plotly chart in R?

吃可爱长大的小学妹 提交于 2021-01-28 19:54:42
问题 I didn't find an argument to disable the zoom mode of the mouse cursor on a plotly graph. This is bad because when you drag your fingers across your phone, the zoom increases. Taking advantage of the question, I would like to remove all the buttons from the plotly and leave only the button to download the image. 回答1: There is a lot you can do! The button line in plotly is called "modebar" and you can remove it completely, or remove specific buttons from it: plot_ly() %>% config

plotly custom buttons: is it possible to set the same scale for multiple subplots?

岁酱吖の 提交于 2021-01-28 14:09:26
问题 I plot some data in subplots. Each subplot is autoscaled by default. For easy comparison, I sometimes want to have the same scale in all subplots. Is it possible to do this with a button, in the style of https://plotly.com/python/custom-buttons/ Sample code with buttons: import plotly.graph_objects as go from plotly.subplots import make_subplots import pandas as pd # Load dataset df = pd.read_csv( "https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv") df.columns

Saving images from plotly

。_饼干妹妹 提交于 2021-01-28 11:15:16
问题 How can I save images generated with plotly in different formats? Only "Download as PNG" is possible from the generated HTML figure. I would need to interact with the figure (change rotation, choose which data to plot) and save an .eps figure for each online modified plot. Thanks a lot! 回答1: Plotly supports exporting to EPS (the docs mention that you need the poppler library) and the Figure object has a write_image method that saves a figure to a file. You can specify the format through the

define color scheme when plotting line plot with plotly

爱⌒轻易说出口 提交于 2021-01-28 07:41:27
问题 I have the following data table (which is not always the same, and has always a different number of columns) and code for plotting a line chart: dt <- data.table(date = seq(as.Date('2020-01-01'), by = '1 day', length.out = 365), Germany = rnorm(365, 2, 1), Austria = rnorm(365, 3, 4), Czechia = rnorm(365, 2, 3), check.names = FALSE) colNames <- names(dt)[-1] ## assuming date is the first column p <- plotly::plot_ly() for(trace in colNames){ p <- p %>% plotly::add_trace(data = dt, x = ~date, y

Use QWebEngineView to Display Something Larger Than 2MB?

时光总嘲笑我的痴心妄想 提交于 2021-01-28 06:51:40
问题 I'm trying to display some Plot.ly or Plot.ly Dash plots ( I haven't settled on using one or the other, so I'm experimenting with both right now) in a PyQt5 GUI using QWebEngineView. This doesn't work for any plots larger than 2MB due to some Chromium-level hardcoded restriction. I found one similar question that is pretty much identical in terms of our needs. It looks like the OP actually found an answer, but unfortunately for me, they didn't post an example of working code or explain what

How to get the count from a dataframe from a Dash Callback

此生再无相见时 提交于 2021-01-28 06:47:45
问题 I'd like to display the count of certain criteria inside a div in my dash layout based off callback selection from dropdown. I'm able to get the dropdown for the values in a pandas dataframe column, but I'm having trouble figuring out how to display the total count of the a selected element of the column. For example, I've written a function in Jupyter notebook to get a count def getCount(df, selected_org): totCount = df[df['ORGANIZATIONS'] == selected_org].AGENCY.count() return count

Assign a color to each path in NetworkX

南楼画角 提交于 2021-01-28 05:16:56
问题 I have cars,cities and routes. Every city is a node. Every route is a path generated by a car. Different cars will have different path, sometimes paths could be intersected (which means differents cars have found the same city in they path), sometimes not. I would rappresent a graph with all the cities and all the different path and plot the graph with plotly. Example: List of cities: CityA -CityB -CityD -CityZ -CityK List of cars: Car1, Car2 Routes: Car1 will have a path through cityA -

Multiple lines/traces for each button in a Plotly drop down menu in R

耗尽温柔 提交于 2021-01-28 05:10:55
问题 I am trying to generate multiple graphs in Plotly for 30 different sales offices. Each graph would have 3 lines: sales, COGS, and inventory. I would like to keep this on one graph with 30 buttons for the different offices. This is the closest solution I could find on SO: ## Create random data. cols holds the parameter that should be switched l <- lapply(1:100, function(i) rnorm(100)) df <- as.data.frame(l) cols <- paste0(letters, 1:100) colnames(df) <- cols df[["c"]] <- 1:100 ## Add trace

Plotly: How to add multiple y-axes?

五迷三道 提交于 2021-01-28 03:20:54
问题 I have data with 5 different columns and their value varies from each other. Actual gen Storage Solar Gen Total Gen Frequency 1464 1838 1804 18266 51 2330 2262 518 4900 51 2195 923 919 8732 49 2036 1249 1316 3438 48 2910 534 1212 4271 47 857 2452 1272 6466 50 2331 990 2729 14083 51 2604 767 2730 19037 47 993 2606 705 17314 51 2542 213 548 10584 52 2030 942 304 11578 52 562 414 2870 840 52 1111 1323 337 19612 49 1863 2498 1992 18941 48 1575 2262 1576 3322 48 1223 657 661 10292 47 1850 1920

Python_DF ordering and customdata in Plotly

穿精又带淫゛_ 提交于 2021-01-28 01:52:02
问题 I have issue with wrong reflection data in hovers in the code below. See code with comments for each block. I have issue with wrong reflection data in hovers in the code below. See code with comments for each block. import plotly.express as px import pandas as pd import plotly.graph_objects as go rows=[['501-600','15','122.58333','45.36667','Name1'], ['till 500','4','12.5','27.5','Name2'], ['more 601','41','-115.53333','38.08','Name3'], ['till 500', '26', '65.5', '29.5','Name4'], ['501-600',