plotly

Manipulating legend text in R plotly

守給你的承諾、 提交于 2020-02-01 19:02:07
问题 I have a data.frame I'd like to scatter plot using R 's plotly with two factors which I'd like to color and shape by. Here's my data: set.seed(1) df <- data.frame(x=rnorm(12),y=rnorm(12), group=c(rep(1,3),rep(2,3),rep(3,3),rep(4,3)), treatment=c(rep("A",6),rep("B",6)), stringsAsFactors=F) df$group <- factor(df$group,levels=1:4) df$treatment <- factor(df$treatment,levels=c("A","B")) Here's how I'm trying to plot: require(plotly) plot_ly(marker=list(size=10),type='scatter',mode="markers",x=~df

Python - What is the process to create pdf reports with charts from a DB?

北战南征 提交于 2020-01-30 18:39:18
问题 I have a database generated by a survey to evaluate university professors. What I want is a python script that takes the information from that database, generates a graphing table for each user, creates graphs for each user, and then renders it in a template to export it to a pdf. What does the database look like? User Professor_evaluated Category Question Answer _________________________________________________________________ Mike Professor Criss respect 1 3 Mike Professor Criss respect 2 4

Error plotting chart with facet_wrap and scales = “free” in plotly

我的梦境 提交于 2020-01-30 01:24:52
问题 I have a time series with various categories (facets), and I am trying to create a chart using the facet_wrap feature from ggplot2 and upload it on plotly . If I set scales = "fixed" , I have no problem: the graph looks fine on my computer and on plotly . But if I set scales = "free" , as in the code below, then the ggplot2 on my computer looks fine, but the plotly version is not showing up properly (either on my computer or the web). Here is some sample code; I create some random values for

How to trigger zoom in and zoom out in plotly chart using user created on click buttons?

南楼画角 提交于 2020-01-25 10:13:28
问题 I am building an angular application. In which we need to create on click buttons for zooming in and zooming out for plotly chart. We can zoom in zoom out in plotly chart using buttons on hoverable mode bar but this is not required for our application. We want to zoom in and zoom out the chart using user created on click buttons. Is there a way to trigger actions of hoverable mode bar zoom in and out using on click buttons? if not then what are the other ways to do? any suggestion is

Merging Legends for both geom Line and Point

ε祈祈猫儿з 提交于 2020-01-25 09:01:08
问题 I was very new to R Script. If you are able to help my problem that would be really great... Here is my problem... I am able to create custom visual using R Script and make hover over work in that visual by using this below link Link I think It is displaying legend for both line and point as well. This is how it’s showing me in the graph Both Legends But I would like to show up something like this…. Which represents both the line and point in the same legend name Same legend. Please find the

python plotly date axis as string not dates

南笙酒味 提交于 2020-01-25 00:12:20
问题 I want to create a bar chart using python plotly, with on the x-axis dates as strings/categories. For some reason, plotly keeps transforming strings to dates. My x-axis is continuous "timeline" of dates, rather than categories as I would expect. My question: how can I construct a bar chart where my dates are handled as categories, rather than dates? Minimal example: d = {'date': ['2018-08-04', '2018-08-02','2018-08-03', '2018-08-11','2018-08-11'], 'score': [3, 4, 6, 2,8]} df = pd.DataFrame

Plotly: What color cycle does plotly express follow?

你说的曾经没有我的故事 提交于 2020-01-24 20:26:06
问题 I would think that the default color cycle would be (some variants of) ['blue', 'red', 'green', 'purple', 'orange'] like in the plot below: Plot 1: Code 1: import plotly import plotly.express as px gapminder = px.data.gapminder() gapminder2007=gapminder.query("year==2007") px.scatter(gapminder2007, x='gdpPercap', y='lifeExp', color="continent") At least that seems to be the order of the cycle since omitting Oceania from the continents will give you this: Now the order of the remaining colors

Adding second Y axis on ggplotly

旧街凉风 提交于 2020-01-24 09:42:06
问题 I have created the following dataframe object and graph using plotly and ggplot library(ggplot2) library(plotly) rdate <- function(x, min = paste0(format(Sys.Date(), '%Y'), '-01-01'), max = paste0(format(Sys.Date(), '%Y'), '-12-31'), sort = TRUE) { dates <- sample(seq(as.Date(min), as.Date(max), by = "day"), x, replace=TRUE) if (sort == TRUE) { sort(dates) } else { dates } } DF<-data.frame(Date = rdate(100)) DF$variable<-LETTERS[seq( from = 1, to = 10 )] DF$Value<-round(runif(1:nrow(DF),min =

ggplotly removing data from single facet

时间秒杀一切 提交于 2020-01-24 04:14:07
问题 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 when there are 6 facets in a 3x2 grid, with the bottom left again being dropped. The examples on the plotly ggplot examples page show several examples with a 2x2 grid and the data being displayed. I

ggplotly not working properly when number are facets are more

南楼画角 提交于 2020-01-24 01:05:05
问题 I am trying to create a Shiny Dashboard which contains Plots also. Plotly is such a great a package that it provides great visualization and interactivity to the users. But when i use ggplotly to convert my ggplot plots to interactive graphs, i am not getting the expected output and the issues get multiplied when the number of facets in the output are more. for example kindly find the code below. Source_Data_dupli <- data.frame( key = c(1, 1, 1, 2, 2, 2, 3, 3, 3,4,4,5,5,6,7), Product_Name = c