data-visualization

Making a Python Fan Chart / Fan Plot

孤者浪人 提交于 2021-02-17 20:54:13
问题 I'm looking to make a fan chart type line plot in Python which resembles the Bank of England Interest Rate fan charts like this one: I'm quite well practiced with using matplotlib for standard line/bar/scatter plots, however this seems like it would require something of a more custom implementation. I've Google'd about and cannot seem to find any standard libraries for Python that do this sort of thing at all or even any code that describes how this might be done. Any help on how this could

R: Titles on Graphs not Updating

自作多情 提交于 2021-02-17 06:53:26
问题 I am working with the R programming language. I am trying to replicate the following tutorial with some fake data that I generated: https://plotly.com/r/dropdowns/. That is, I generated some fake data and made 4 scatter plots. Using the "plotly" library, I then want to "attach" these 4 plots together and let the user "toggle" (switch, shuffle) between these graphs. I have attached the code below: #load libraries library(plotly) library(MASS) library(dplyr) # create data x <- sample( LETTERS[1

Adding Multiple “sliders” to the same Graph

你。 提交于 2021-02-16 15:25:31
问题 I am using the R programming language. Using the "plotly" library, I was able to make the following interactive graph: library(dplyr) library(ggplot2) library(shiny) library(plotly) library(htmltools) library(dplyr) #generate data set.seed(123) var = rnorm(731, 100,25) date= seq(as.Date("2014/1/1"), as.Date("2016/1/1"),by="day") data = data.frame(var,date) vals <- 90:100 combine <- vector('list', length(vals)) count <- 0 for (i in vals) { data$var_i = i data$new_var_i = ifelse(data$var >i,1,0

R: Switching Between Graphs

不羁的心 提交于 2021-02-15 07:42:54
问题 I am using the R programming language. I am trying to follow the tutorial here on "switching between graphs" : https://plotly.com/r/dropdowns/ (first example). First, I generated some data in R: library(plotly) library(MASS) x <- sample( LETTERS[1:4], 1000, replace=TRUE, prob=c(0.25, 0.25, 0.25, 0.25) ) y <- rnorm(1000,10,10) z <- rnorm(1000,5,5) df <- data.frame(x,y, z) df$x = as.factor(df$x) colnames(df) <- c("x", "y", "z") I tried to modify the code from this tutorial to make the final

seaborn displot() is not plotting within defined subplots

那年仲夏 提交于 2021-02-15 04:57:16
问题 I am trying to plot two displots side by side with this code fig,(ax1,ax2) = plt.subplots(1,2) sns.displot(x =X_train['Age'], hue=y_train, ax=ax1) sns.displot(x =X_train['Fare'], hue=y_train, ax=ax2) It returns the following result (two empty subplots followed by one displot each on two lines)- If I try the same code with violinplot, it returns result as expected fig,(ax1,ax2) = plt.subplots(1,2) sns.violinplot(y_train, X_train['Age'], ax=ax1) sns.violinplot(y_train, X_train['Fare'], ax=ax2)

seaborn displot() is not plotting within defined subplots

我的未来我决定 提交于 2021-02-15 04:55:03
问题 I am trying to plot two displots side by side with this code fig,(ax1,ax2) = plt.subplots(1,2) sns.displot(x =X_train['Age'], hue=y_train, ax=ax1) sns.displot(x =X_train['Fare'], hue=y_train, ax=ax2) It returns the following result (two empty subplots followed by one displot each on two lines)- If I try the same code with violinplot, it returns result as expected fig,(ax1,ax2) = plt.subplots(1,2) sns.violinplot(y_train, X_train['Age'], ax=ax1) sns.violinplot(y_train, X_train['Fare'], ax=ax2)

seaborn displot() is not plotting within defined subplots

余生长醉 提交于 2021-02-15 04:54:11
问题 I am trying to plot two displots side by side with this code fig,(ax1,ax2) = plt.subplots(1,2) sns.displot(x =X_train['Age'], hue=y_train, ax=ax1) sns.displot(x =X_train['Fare'], hue=y_train, ax=ax2) It returns the following result (two empty subplots followed by one displot each on two lines)- If I try the same code with violinplot, it returns result as expected fig,(ax1,ax2) = plt.subplots(1,2) sns.violinplot(y_train, X_train['Age'], ax=ax1) sns.violinplot(y_train, X_train['Fare'], ax=ax2)

Identifying points by color

ぐ巨炮叔叔 提交于 2021-02-12 11:40:21
问题 I am following the tutorial over here : https://www.rpubs.com/loveb/som . This tutorial shows how to use the Kohonen Network (also called SOM, a type of machine learning algorithm) on the iris data. I ran this code from the tutorial: library(kohonen) #fitting SOMs library(ggplot2) #plots library(GGally) #plots library(RColorBrewer) #colors, using predefined palettes iris_complete <-iris[complete.cases(iris),] iris_unique <- unique(iris_complete) # Remove duplicates #scale data iris.sc = scale

Identifying points by color

不想你离开。 提交于 2021-02-12 11:39:41
问题 I am following the tutorial over here : https://www.rpubs.com/loveb/som . This tutorial shows how to use the Kohonen Network (also called SOM, a type of machine learning algorithm) on the iris data. I ran this code from the tutorial: library(kohonen) #fitting SOMs library(ggplot2) #plots library(GGally) #plots library(RColorBrewer) #colors, using predefined palettes iris_complete <-iris[complete.cases(iris),] iris_unique <- unique(iris_complete) # Remove duplicates #scale data iris.sc = scale

R: formatting axis and titles on plotly plots (time series)

青春壹個敷衍的年華 提交于 2021-02-11 14:37:55
问题 I am using the R programming language. Using the following tutorial : https://plotly.com/r/time-series/ and this stackoverflow question : How to plot multiple series/lines in a time series using plotly in R? I was able to make an interactive time series plot: library(xts) library(ggplot2) library(dplyr) library(plotly) library(lubridate) #time series 1 date_decision_made = seq(as.Date("2014/1/1"), as.Date("2016/1/1"),by="day") property_damages_in_dollars <- rnorm(731,100,10) final_data <-