visualization

Can Google Charts support dual y-axis (v-axis)?

风格不统一 提交于 2019-12-17 10:21:10
问题 The Flot chart api supports dual v-axis scales, as shown by this example. I'm using Google Charts - is this possible also with Google? I've had a look through the examples and docs, but can't find any examples / references to indicate it does support dual axis charts. 回答1: It took me a while, to figure this out, but Google Charts does support dual Y-axis (v-axis). I want to use the Javascript API and not the HTML interface. This example can be tested here: http://code.google.com/apis/ajax

track C++ memory allocations

被刻印的时光 ゝ 提交于 2019-12-17 06:27:34
问题 I am looking for a way to track memory allocations in a C++ program. I am not interested in memory leaks, which seem to be what most tools are trying to find, but rather creating a memory usage profile for the application. Ideal output would be either a big list of function names plus number of maximum allocated bytes over time or better yet, a graphical representation of the heap over time. Horizontal axis is time, vertical axis heap space. Every function would get it's own color and draw

ggplot2 : Plot mean with geom_bar

£可爱£侵袭症+ 提交于 2019-12-17 06:09:09
问题 I have the following data frame: test2 <- data.frame(groups = c(rep("group1",4), rep("group2",4)), X2 = c(rnorm(4), rnorm(4)) , label = c(rep(1,2),rep(2,2),rep(1,2),rep(2,2))) and I am plotting the bar graphs for each label per group using: ggplot(test2, aes(label, X2, fill=as.factor(groups))) + geom_bar(position="dodge", stat="identity") However, I am cannot seem to be able to find a stat="mean" so I can plot the means on each bar graph instead of the identity. Thanks for any help. 回答1:

How can I create a correlation matrix in R?

北城以北 提交于 2019-12-17 04:41:26
问题 I have 92 set of data of same type. I want to make a correlation matrix for any two combination possible. i.e. I want a matrix of 92 x92. such that element (ci,cj) should be correlation between ci and cj. How do I do that? 回答1: An example, d &lt- data.frame(x1=rnorm(10), x2=rnorm(10), x3=rnorm(10)) cor(d) # get correlations (returns matrix) 回答2: You could use 'corrplot' package. d <- data.frame(x1=rnorm(10), x2=rnorm(10), x3=rnorm(10)) M <- cor(d) # get correlations library('corrplot')

Sankey Diagrams in R?

断了今生、忘了曾经 提交于 2019-12-17 02:54:30
问题 I am trying to visualize my data flow with a Sankey Diagram in R. I found this blog post linking to an R script that produces a Sankey Diagram, unfortunately it's quite raw and somewhat limited (see below for sample code and data). Does anyone know of other scripts—or maybe even a package—that is more developed? My end goal is to visualize both data flow and percentages by relative size of diagram components, like in these examples of Sankey Diagrams. I posted a somewhat similar question on

ggplot, facet, piechart: placing text in the middle of pie chart slices

本小妞迷上赌 提交于 2019-12-17 02:12:09
问题 I'm trying to produce a facetted pie-chart with ggplot and facing problems with placing text in the middle of each slice: dat = read.table(text = "Channel Volume Cnt AGENT high 8344 AGENT medium 5448 AGENT low 23823 KIOSK high 19275 KIOSK medium 13554 KIOSK low 38293", header=TRUE) vis = ggplot(data=dat, aes(x=factor(1), y=Cnt, fill=Volume)) + geom_bar(stat="identity", position="fill") + coord_polar(theta="y") + facet_grid(Channel~.) + geom_text(aes(x=factor(1), y=Cnt, label=Cnt, ymax=Cnt),

R ggplot2 aes argument

◇◆丶佛笑我妖孽 提交于 2019-12-14 03:05:12
问题 I have a function: vis = function(df, x){ p1 <- ggplot(df, aes(x)) + geom_line(aes(y = v2)) p1 } I have a data frame: df = data.frame(v0 = c(1,2,3), v1 = c(2,3,4), v2 = c(3,4,5)) I want to generate plot: (1) v2 v.s. v0, (2) v2 v.s. v1. So I tried: vis(df, v0) // not work vis(df, v1) // not work vis(df, "v0") // not work vis(df, "v1") // not work Much appreciated any idea! 回答1: If we are passing an unquoted string, then convert it to quosure and then evaluate ( !! ) library(rlang) library

Why am I getting a “ValueError: feature_names mismatch” when specifying the feature-name list in XGBoost for visualization?

孤人 提交于 2019-12-14 02:11:45
问题 When I mention the feature names while defining the data matrix in an internal data structure used by XGBoost, I get this error: d_train = xgboost.DMatrix(X_train, label=y_train, feature_names=list(X)) d_test = xgboost.DMatrix(X_test, label=y_test, feature_names=list(X)) ... ... ... shap_values = shap.TreeExplainer(model).shap_values(X_train) shap.summary_plot(shap_values, X_train) ValueError Traceback (most recent call last) <ipython-input-59-4635c450279d> in <module>() ----> 1 shap_values =

How to change the size of dots in beeswarm plots in D3.js

送分小仙女□ 提交于 2019-12-14 01:48:52
问题 I've been looking at this example of a beeswarm plot in d3.js and I'm trying to figure out how to change the size of the dots and without getting the circles to overlap. It seems if the radius of the dots change, it doesn't take this into account when running the calculations of where to place the dots. 回答1: This is a cool visualization. I've made a plunk of it here: https://plnkr.co/edit/VwyXfbc94oXp6kXQ7JFx?p=preview and modified it to work a bit more like you're looking for (I think). The

Pandas- stacked bar chart with independent/unrelated partitions of bars

纵然是瞬间 提交于 2019-12-13 19:56:31
问题 I would like to create a stacked bar chart, where the partitions of the bars are independent from another. For example, let's say I have 2 boxes of balls. (Making up numbers...) Box 1 has 3 red, 5 blue, and 8 yellow balls. Box 2 has 2 orange, 6 green, 9 purple, and 10 black balls. Now, I would like to create a stacked bar chart with a bar for each box, and within each bar, I can show the number of balls for a particular color. The colors of the balls are different depending on the box, so I