data-visualization

d3 — Progressively draw a large dataset

放肆的年华 提交于 2019-12-01 10:39:11
I'm using d3.js to plot the contents of an 80,000 row .tsv onto a chart. The problem I'm having is that since there is so much data, the page becomes unresponsive for aprox 5 seconds while the entire dataset is churned through at once. Is there an easy way to process the data progressively if it's spread over a longer period of time? Ideally the page would remain responsive, and the data would be plotted as it became available, instead of in one big hit at the end I think you'll have to chunk your data and display it in groups using setInterval or setTimeout. This will give the UI some

How to produce scatterplot with a factor as y in highcharter?

霸气de小男生 提交于 2019-12-01 08:13:32
问题 Problem: I would like to produce a scatter plot with highcharter::hchart , where y is a factor , and x is a date . Apparently, highcharter::hchart "scatter" does not accept factor variables as y. Is there any workaround? Or is "scatter" just the wrong charttype? (Comment: I know ggplotly would be a good alternative, but I actually need a highcharter solution) Example: Let's suppose I want to produce a timeline of publications by type . I want a scatterplot with d$type (=y-axis) and d$date (=x

How to create d3.js Collapsible force layout with non tree data?

夙愿已清 提交于 2019-12-01 08:00:37
I have a d3 force directed layout with data in a similar structure below. Is it possible to apply collapsible force layout such as http://bl.ocks.org/mbostock/1062288 to it? I want a node to be collapsed /expanded on click. { "nodes": [ {"x": 469, "y": 410}, {"x": 493, "y": 364}, {"x": 442, "y": 365}, {"x": 467, "y": 314}, ], "links": [ {"source": 0, "target": 1}, {"source": 1, "target": 2}, {"source": 2, "target": 0}, {"source": 1, "target": 3}, {"source": 3, "target": 2}, ] } If I understand correctly, perhaps this is what you are looking for. I edited the demo you linked to. Now when a

How to plot heatmap for high-dimensional dataset?

微笑、不失礼 提交于 2019-12-01 07:54:20
I would greatly appreciate if you could let me know how to plot high-resolution heatmap for a large dataset with approximately 150 features. My code is as follows: XX = pd.read_csv('Financial Distress.csv') y = np.array(XX['Financial Distress'].values.tolist()) y = np.array([0 if i > -0.50 else 1 for i in y]) XX = XX.iloc[:, 3:87] df=XX df["target_var"]=y.tolist() target_var=["target_var"] fig, ax = plt.subplots(figsize=(8, 6)) correlation = df.select_dtypes(include=['float64', 'int64']).iloc[:, 1:].corr() sns.heatmap(correlation, ax=ax, vmax=1, square=True) plt.xticks(rotation=90) plt.yticks

Data points and ticks in the scaleBand axis are not aligned

穿精又带淫゛_ 提交于 2019-12-01 07:33:01
My data points and the values in the scaleBand y axis are not aligned. I am not able to align them properly, when I read the documentation, saw that by default the alignment is 0.5 and that's why my data points are plotted between the two points in the axis. But I tried to override the alignment my giving the alignment as 0, but there seems to be no change. The following is my code. <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"/> <title>D3 v4 - linechart</title> <style> #graph { width: 900px; height: 500px; } .tick line { stroke

D3 - Large GeoJSON File does not show draw map properly using projections

我是研究僧i 提交于 2019-12-01 07:31:14
问题 I am having an issue with drawing this GeoJSON file I picked up from data.seattle.gov. Specifically, I'm using the Shape file which can be found here. I converted it to a GeoJSON file where I provided a small sample below. By using D3, I was hoping to draw out what should be the different precincts in Seattle (actually I'm not entirely sure what it should be which is why I'm drawing it... ha...) but for some reason it isn't showing it correctly despite the fact that the paths are correctly

How to create d3.js Collapsible force layout with non tree data?

元气小坏坏 提交于 2019-12-01 06:53:34
问题 I have a d3 force directed layout with data in a similar structure below. Is it possible to apply collapsible force layout such as http://bl.ocks.org/mbostock/1062288 to it? I want a node to be collapsed /expanded on click. { "nodes": [ {"x": 469, "y": 410}, {"x": 493, "y": 364}, {"x": 442, "y": 365}, {"x": 467, "y": 314}, ], "links": [ {"source": 0, "target": 1}, {"source": 1, "target": 2}, {"source": 2, "target": 0}, {"source": 1, "target": 3}, {"source": 3, "target": 2}, ] } 回答1: If I

XHR / Post Request using D3

纵饮孤独 提交于 2019-12-01 06:42:34
I was doing a research on how to make POST requests using the amazingly powerful D3 (which I can fully fully recommend for data visualization) and found the xhr2 branch where the authors of D3 are currently working on xhr POST request (and other request types) support. Seems like it is a brand new feature as the merge request is from yesterday (18 September 2012) :) And as curious I am I already wanted to try it out, using the following code sequence (which I have from this location ) d3.text("localhost/test",function(d) { console.log(d)}) .method("POST") .setRequestHeader("Content-type",

How to fill colors correctly using geom_polygon in ggtern?

萝らか妹 提交于 2019-12-01 06:34:03
Here is the code which I am using to create boundaries in my ternary diagram: library(ggtern) DATA <- data.frame(x = c(0,0,0.04), y = c(1,0.6,0.575), z = c(0,0.4,0.385), xend = c(0.4,0.21,0.1), yend = c(0.0,0.475,0), zend = c(0.6,0.315,0.9), Series = c("yz","xz","xy")) ggtern(data=DATA,aes(x,y,z,xend=xend,yend=yend,zend=zend)) + geom_segment(aes(color=Series),size=1) + scale_color_manual(values=c("darkgreen","darkblue","darkred")) + theme_bw() + theme_nogrid() + theme(legend.position=c(0,1),legend.justification=c(0,1)) + labs(title = "Sample Midpoint Segments") And this code produces the

How to plot heatmap for high-dimensional dataset?

一笑奈何 提交于 2019-12-01 05:32:17
问题 I would greatly appreciate if you could let me know how to plot high-resolution heatmap for a large dataset with approximately 150 features. My code is as follows: XX = pd.read_csv('Financial Distress.csv') y = np.array(XX['Financial Distress'].values.tolist()) y = np.array([0 if i > -0.50 else 1 for i in y]) XX = XX.iloc[:, 3:87] df=XX df["target_var"]=y.tolist() target_var=["target_var"] fig, ax = plt.subplots(figsize=(8, 6)) correlation = df.select_dtypes(include=['float64', 'int64']).iloc