data-visualization

Streaming two line graphs using bokeh

梦想与她 提交于 2019-11-27 16:48:14
问题 I would like to create a visualization where there are two line graphs which are updated with one new point per line graph per second. The result will be something like this. I have recently read about bokeh and found out that it can be used in visualizing streams of data in real time. However don't know how to code in it yet. I would appreciate it if someone can show me how this task can be done using bokeh. thanks! 回答1: For bokeh-0.11.1 : Basically, you need to run you python app in the

Plot correlation matrix using pandas

本小妞迷上赌 提交于 2019-11-27 16:37:35
I have a data set with huge number of features, so analysing the correlation matrix has become very difficult. I want to plot a correlation matrix which we get using dataframe.corr() function from pandas library. Is there any built-in function provided by the pandas library to plot this matrix? jrjc You can use pyplot.matshow() from matplotlib : import matplotlib.pyplot as plt plt.matshow(dataframe.corr()) plt.show() Edit: In the comments was a request for how to change the axis tick labels. Here's a deluxe version that is drawn on a bigger figure size, has axis labels to match the dataframe,

making an arc in d3.js

徘徊边缘 提交于 2019-11-27 16:13:20
问题 I am using the javascript library d3.js (http://d3js.org/) to create canvas data visualizations. I'm trying to make an arc, but it's not accepting the data parameters from my array. Does anyone know what I'm doing wrong? This is my code: var chartConfig = { "canvasSize" : 800 } var radius = chartConfig.canvasSize / 2; var pi = Math.PI; var vis = d3.select("#chart").append("svg") .attr("width", radius * 2) .attr("height", radius * 2) .append("g") .attr("transform", "translate(" + radius + ","

Visualize distance matrix as a graph

若如初见. 提交于 2019-11-27 14:16:49
问题 I am doing a clustering task and I have a distance matrix. I wish to visualize this distance matrix as a 2D graph. Please let me know if there is any way to do it online or in programming languages like R or python. My distance matrix is as follows, I used the classical Multidimensional scaling functionality (in R) and obtained a 2D plot that looks like: But What I am looking for is a graph with nodes and weighted edges running between them. 回答1: Possibility 1 I assume, that you want a

Visual Studio 2013 C++: STL container's elements display in debugger

允我心安 提交于 2019-11-27 13:13:29
问题 MSVS 2013 during C++ debugging (Autos and Watch windows) shows only size of STL container's: MSVS 2010: "[9](9,8,7,6,5,4,3,2,1)" MSVS 2013: "{ size=9 }" Line expand is required to see element's value in MSVS 2013. Is there any way to make MSVS 2013 show STL containers like MSVS 2010 in debugger? I tried to remove stl.natvis (it is used in 2013), but it doesn't help: autoexp.dat is still not used. Is possible to force MSVS 2013 use autoexp.dat ? Is it possible to modify stl.natvis scripts

creating tree diagram for showing case count using R

寵の児 提交于 2019-11-27 11:34:30
问题 I need to create a "tree diagram"-like graph to present the number of cases for different scenarios, like the one shown below: The picture is quoted from : Pediatrics. 2005 Dec;116(6):1317-22. Electronic surveillance system for monitoring surgical antimicrobial prophylaxis. Voit SB, Todd JK, Nelson B, Nyquist AC. I can get the numbers easily from R using the table command, but it is not a very good way to present it. The chart can be made without any fancy colors or stuff, I just want to use

How to access the DOM element that correlates to a D3 SVG object?

こ雲淡風輕ζ 提交于 2019-11-27 11:25:19
问题 I'm trying to learn D3 by experimenting with one of their basic bubblecharts. First task: figure out how to drag an bubble and have it become the topmost object while it's being dragged. (The problem is getting D3's object model to map onto the DOM, but I'll get there...) To drag it, we can simply invoke d3's drag behavior using the code they provide: var drag = d3.behavior.drag() .on("dragstart", dragstart) .on("drag", dragmove) .on("dragend", dragend); Works great. Drags well. Now, how do

ggplot2 plot area margins?

不想你离开。 提交于 2019-11-27 10:59:54
Is there an easy way to increase the space between the plot title and the plot area below it (the box with the data). Similarly, I'd prefer to have some space between the axis title and axis labels. In other words, is there a way to "move the title a bit up, the y axis title a bit left, and the x axis title a bit down"? juba You can adjust the plot margins with plot.margin in theme() and then move your axis labels and title with the vjust argument of element_text() . For example : library(ggplot2) library(grid) qplot(rnorm(100)) + ggtitle("Title") + theme(axis.title.x=element_text(vjust=-2)) +

Constrain aspect ratio in WindowsForms DataVisualization Chart

早过忘川 提交于 2019-11-27 09:45:55
Using the charting control from System.Windows.Forms.DataVisualization.Charting.Chart , I am making a scatter plot. How can I constrain it so that the scale of the X axis is the same as the scale of the Y axis? Simply setting the control itself to be square is insufficient, because it has internal margins for drawing and labeling the axes which are not equal. I could pick a specific size and tweak it to be square, but it needs to be both square and resizable. I've searched high and low in the documentation and in the property browser, but I can't find anything or think of any ways to do it in

Matplotlib: cancelling the offset of axis introduced in matplotlib 2.0 [duplicate]

醉酒当歌 提交于 2019-11-27 09:36:19
This question already has an answer here: How can I change the x axis in matplotlib so there is no white space? 1 answer Just noticed this nuance when I editing my works. Previously, the matplotlib would look like this: x=[1,2,3,4,5] y=[4,5,5,2,1] plot(x,y,'-') But after recent upgrade I believe, the there are offset, which would return like this It's a little bit unncessary from what I seen now. I want to know If this offset is a good practice in data visualization? If so, I'll leave it as it is. How to cancel out this offset? I can manually restore the limit by plt.gca().set_xlim([1, 5]) ,