data-visualization

ggplot use small pie charts as points with geom_point

烂漫一生 提交于 2019-11-30 00:44:40
I would like to make a graph with ggplot as shown below. The idea is to plot "percentage matches" between two categorical variables. It is easy to come close by altering the size of points, but I wondered if it is possible to make these small pie charts... An example code for plotting this with the size of points as a measure of the score. temp <- data.frame(Exercise=c(1, 1, 1, 2, 2, 2), Name=c(1, 2, 3, 1, 2, 3), Score=c(0.2, 0.5, 0.3, 0.9, 1.0, 0.6)) ggplot(temp) + geom_point(aes(Exercise, Name, size=Score)) How can this code be altered to give something close to the figure below? Using a

R YaleToolkit: How to change the font size of tick labels on the sparklines?

筅森魡賤 提交于 2019-11-30 00:23:49
I'm using this function for some quick and easy sparklines with R but I can't seem to work out how to change the font size to avoid ugly overlaps of the y-axis tick labels. Here's my code (see below for a reproducible example): sparklines(gamma.df, sub=c(1:23),outer.margin = unit(c(2, 2, 2, 2), "cm")) and the resulting plot: I seem to be able to completely suppress the y-axis with sparklines(gamma.df, sub=c(1:23),yaxis=FALSE,outer.margin = unit(c(2, 2, 2, 2), "cm")) But what I really want is just shrink the numbers at the tick marks (and add grey fill under the line, but it looks like I'd have

Venn diagram from list of clusters and co-occurring factors

我与影子孤独终老i 提交于 2019-11-29 23:17:35
I've got an input file with a list of ~50000 clusters and presence of a number of factors in each of them (~10 million entries in total), see a smaller example below: set.seed(1) x = paste("cluster-",sample(c(1:100),500,replace=TRUE),sep="") y = c( paste("factor-",sample(c(letters[1:3]),300, replace=TRUE),sep=""), paste("factor-",sample(c(letters[1]),100, replace=TRUE),sep=""), paste("factor-",sample(c(letters[2]),50, replace=TRUE),sep=""), paste("factor-",sample(c(letters[3]),50, replace=TRUE),sep="") ) data = data.frame(cluster=x,factor=y) With a bit of help from another question, I got it

Delaunay Triangulation of points from 2D surface in 3D with python?

瘦欲@ 提交于 2019-11-29 22:24:46
I have a collection of 3D points. These points are sampled at constant levels (z=0,1,...,7). An image should make it clear: These points are in a numpy ndarray of shape (N, 3) called X . The above plot is created using: import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D X = load('points.npy') fig = plt.figure() ax = fig.gca(projection='3d') ax.plot_wireframe(X[:,0], X[:,1], X[:,2]) ax.scatter(X[:,0], X[:,1], X[:,2]) plt.draw() I'd like to instead triangulate only the surface of this object, and plot the surface. I do not want the convex hull of this object, however,

Diagonal labels orientation on x-axis in heatmap(s)

孤街醉人 提交于 2019-11-29 21:27:01
Creating heatmaps in R has been a topic of many posts, discussions and iterations. My main problem is that it's tricky to combine visual flexibility of solutions available in lattice levelplot() or basic graphics image() , with effortless clustering of basic's heatmap() , pheatmap's pheatmap() or gplots' heatmap.2() . It's a tiny detail I want to change - diagonal orientation of labels on x-axis. Let me show you my point in the code. #example data d <- matrix(rnorm(25), 5, 5) colnames(d) = paste("bip", 1:5, sep = "") rownames(d) = paste("blob", 1:5, sep = "") You can change orientation to

3D library recommendations for interactive spatial data visualisation?

£可爱£侵袭症+ 提交于 2019-11-29 21:01:51
Our software produces a lot of data that is georeferenced and recorded over time. We are considering ways to improve the visualisation, and showing the (processed) data in a 3D view, given it's georeferenced, seems a good idea. I am looking for SO's recommendations for what 3D libraries are best to use as a base when building these kind of visualisations in a Delphi- / C++Builder-based Windows application. I'll add a bounty when I can. The data Is recorded over time (hours to days) and is GPS-tagged. So, we have a lot of data following a path over time. Is spatial: it represents real 3D

Alternate control of a sliderInput between a derived value and user selected value

拜拜、爱过 提交于 2019-11-29 17:58:17
I have a very simple Shiny app, wherein I have a set of data on past customers, and a set of data on 3 new customers. All my data consists only of 2 variables: age and score. The purpose is to select one of the 3 new customers, and see how the past customers of similar ages scored. We do this with a simple scatterplot. For example, since new customer #1 is 30 years old, we get to see how all the past customers of ages 25 - 35 scored: (my apologies for the small image) Everything works fine. The trouble begins when I add an age slider with the intentions of allowing the user to override the

Is it possible to have different legend background colors for different data rows in Google bar chart, without breaking the chart?

喜你入骨 提交于 2019-11-29 16:30:55
See the example code: var data = new google.visualization.DataTable(); data.addColumn('string', 'Mac'); data.addColumn('number', 'Score'); data.addColumn({ type: 'string', role: 'style' }); data.addRows([ ['Mac model 12', 200, 'color: #8bba30; opacity: 0.75;'], ['Another Mac Model', 110, 'color: #ffcc33; opacity: 0.75;'], ]); var options = { title: '', width: 500, height: data.getNumberOfRows() * 40 + 100, hAxis: { minValue: 0, maxValue: 255, ticks: [0, 75, 150, 255], textPosition: 'out', side: 'top' }, series: { 0: { axis: 'Mac' }, 1: { axis: 'Score' } }, chartArea: { top: 0, bottom: 50,

X scale function in D3.js keeps returning undefined

霸气de小男生 提交于 2019-11-29 15:48:22
I am new to D3.js and trying to make a bar chart with GDP on Y axis and date on X axis. I am trying to make a xScale with d3.timeScale() but for some reason the code keeps returning undefined when using it. Below is my code, what am I doing wrong? var data = [ [ "2011-01-01", 15238.4 ] , ["2015-07-01", 18064.7 ] ]; var w = 1000; var h = 300; var barPadding = 1; var svg = d3.select("#chart") .append("svg") .attr("height", h); var maxDate = d3.max(data, function(d){ return d[0]; }); var minDate = d3.min(data, function(d){ return d[0]; }); var maxGDP = d3.max(data, function(d){ return d[1]; });

D3 Tree Layout - Custom Vertical Layout when children exceed more than a certain number

廉价感情. 提交于 2019-11-29 14:59:08
问题 I'm trying to use the D3 Tree Layout to create a family tree of sorts and one of the things I noticed is that when I have many children nodes, it would stretch out horizontally across the screen. Ideally I would like a more vertical layout for these nodes so that people don't have to scroll across the screen and can just keep looking down the tree. Here is what I currently see: Now it might not be that bad, but if I had say 20 children, it would span across the whole screen and that is