plotly

R - plotly - hide colorbar

巧了我就是萌 提交于 2021-01-02 05:54:00
问题 How can I hide the colorbar in the following plotly example taken from their website? df <- read.csv('https://raw.githubusercontent.com/plotly/datasets/master/2014_world_gdp_with_codes.csv') # light grey boundaries l <- list(color = toRGB("grey"), width = 0.5) # specify map projection/options g <- list( showframe = FALSE, showcoastlines = FALSE, projection = list(type = 'Mercator') ) plot_ly(df, z = GDP..BILLIONS., text = COUNTRY, locations = CODE, type = 'choropleth', color = GDP..BILLIONS.,

R - plotly - hide colorbar

﹥>﹥吖頭↗ 提交于 2021-01-02 05:53:59
问题 How can I hide the colorbar in the following plotly example taken from their website? df <- read.csv('https://raw.githubusercontent.com/plotly/datasets/master/2014_world_gdp_with_codes.csv') # light grey boundaries l <- list(color = toRGB("grey"), width = 0.5) # specify map projection/options g <- list( showframe = FALSE, showcoastlines = FALSE, projection = list(type = 'Mercator') ) plot_ly(df, z = GDP..BILLIONS., text = COUNTRY, locations = CODE, type = 'choropleth', color = GDP..BILLIONS.,

Plotly-Dash: How to show the same selected area of a figure between callbacks?

落花浮王杯 提交于 2021-01-01 10:59:36
问题 Consider a plotly figure where you can select polynomial features for a line fit using JupyterDash: If you select an area and then choose another number for polynomial features, the figure goes from this: ... and back to this again: So, how can you set things up so that the figure displays the same area of the figure every time you select another number of features and trigger another callback? Complete code: import numpy as np import plotly.express as px import plotly.graph_objects as go

Plotly-Dash: How to show the same selected area of a figure between callbacks?

一曲冷凌霜 提交于 2021-01-01 10:58:52
问题 Consider a plotly figure where you can select polynomial features for a line fit using JupyterDash: If you select an area and then choose another number for polynomial features, the figure goes from this: ... and back to this again: So, how can you set things up so that the figure displays the same area of the figure every time you select another number of features and trigger another callback? Complete code: import numpy as np import plotly.express as px import plotly.graph_objects as go

Combining both grouped bar chart and stacked bar chart using R Plotly

我与影子孤独终老i 提交于 2021-01-01 10:16:24
问题 I am trying to combine both stacked bar and grouped bar chart using plot_ly() . I came across a few questions but couldn't get the perfect solution for this scenario. I came across the solution using ggplot2 . But I need to implement using plot_ly This is the data frame I am trying to plot structure(list(QuarterYear = c("Q4 2019", "Q4 2019", "Q4 2019", "Q4 2019", "Q4 2019", "Q4 2019", "Q4 2019", "Q4 2019", "Q4 2019", "Q4 2019", "Q4 2019", "Q4 2019", "Q1 2020", "Q1 2020", "Q1 2020", "Q1 2020",

combine formula and tidy eval (plotly)

眉间皱痕 提交于 2020-12-31 07:57:03
问题 I'm struggling to understand this. The below lets me filter my data.frame in a "tidy" way, and draw a plot using plotly. In this case, I'm using plotly's formula-based API to say which columns of a data frame to use: library(plotly) tidy_filter = function(data, x) { x = enquo(x) filter(data, !!x > 5) } mtcars %>% tidy_filter(wt) %>% plot_ly(x = ~wt, y = ~wt) I can wrap this in a single function to get the same result: tidy_ply = function(data, x) { x = enquo(x) data = filter(data, !!x > 5)

combine formula and tidy eval (plotly)

本秂侑毒 提交于 2020-12-31 07:53:00
问题 I'm struggling to understand this. The below lets me filter my data.frame in a "tidy" way, and draw a plot using plotly. In this case, I'm using plotly's formula-based API to say which columns of a data frame to use: library(plotly) tidy_filter = function(data, x) { x = enquo(x) filter(data, !!x > 5) } mtcars %>% tidy_filter(wt) %>% plot_ly(x = ~wt, y = ~wt) I can wrap this in a single function to get the same result: tidy_ply = function(data, x) { x = enquo(x) data = filter(data, !!x > 5)

combine formula and tidy eval (plotly)

五迷三道 提交于 2020-12-31 07:49:13
问题 I'm struggling to understand this. The below lets me filter my data.frame in a "tidy" way, and draw a plot using plotly. In this case, I'm using plotly's formula-based API to say which columns of a data frame to use: library(plotly) tidy_filter = function(data, x) { x = enquo(x) filter(data, !!x > 5) } mtcars %>% tidy_filter(wt) %>% plot_ly(x = ~wt, y = ~wt) I can wrap this in a single function to get the same result: tidy_ply = function(data, x) { x = enquo(x) data = filter(data, !!x > 5)

R, How to change color of plotly 3d surface?

↘锁芯ラ 提交于 2020-12-30 09:39:05
问题 How do I change the colorscale from the default of purple to yellow? I tried adding color and colorscale parameters to add_trace(), but it throws up errors. Reproduceable code with default colors: library(plotly); library(reshape2); library(tidyverse) sleep <- read.table("http://www.statsci.org/data/general/sleep.txt", header=T) sleep <- na.omit(sleep) sleep <- mutate(sleep, logTotalSleep = log(TotalSleep)) sleep_mod <- lm(logTotalSleep ~ Gestation + Danger, data=sleep) # Graph Resolution

R, How to change color of plotly 3d surface?

蹲街弑〆低调 提交于 2020-12-30 09:34:04
问题 How do I change the colorscale from the default of purple to yellow? I tried adding color and colorscale parameters to add_trace(), but it throws up errors. Reproduceable code with default colors: library(plotly); library(reshape2); library(tidyverse) sleep <- read.table("http://www.statsci.org/data/general/sleep.txt", header=T) sleep <- na.omit(sleep) sleep <- mutate(sleep, logTotalSleep = log(TotalSleep)) sleep_mod <- lm(logTotalSleep ~ Gestation + Danger, data=sleep) # Graph Resolution