scatter-plot

ScatterChart in NVD3 – Reading the data from csv file

假如想象 提交于 2019-12-19 11:34:40
问题 I am trying to read in data from csv file and want to visualise this data with a scatterChart in NVD3. I would have linked to a JSfiddle or something similar but I don't know how to include a csv file in these online JavaScript IDEs. Is that possible? The csv file has the following format: country,y,x Algeria,91.8,15.7 Bahrain,98.2,49.3 Jordan,99.1,55.0 Kuwait,98.6,57.4 Lebanon,98.7,58.6 My best guess for the code to read the csv file with is: var scatterdata = [ { key : "Group1", values : []

Matplotlib: scatter plot with colormaps for edgecolor but no facecolor

拟墨画扇 提交于 2019-12-19 02:52:24
问题 I want to have a scatter plot with colormap for edgecolors but no facecolors. When I use facecolor='None' , it does not work. import numpy as np import matplotlib.pyplot as plt N = 50 x = np.random.rand(N) y = np.random.rand(N) colors = np.random.rand(N) area = np.pi * (15 * np.random.rand(N))**2 # 0 to 15 point radii plt.scatter(x, y, s=area,c=colors,facecolors='None',cmap="gist_rainbow", alpha=0.5) plt.show() Any solution? 回答1: The c argument will affect facecolor and edgecolor

Adding y=x to a matplotlib scatter plot if I haven't kept track of all the data points that went in

做~自己de王妃 提交于 2019-12-18 11:49:38
问题 Here's some code that does scatter plot of a number of different series using matplotlib and then adds the line y=x: import numpy as np, matplotlib.pyplot as plt, matplotlib.cm as cm, pylab nseries = 10 colors = cm.rainbow(np.linspace(0, 1, nseries)) all_x = [] all_y = [] for i in range(nseries): x = np.random.random(12)+i/10.0 y = np.random.random(12)+i/5.0 plt.scatter(x, y, color=colors[i]) all_x.extend(x) all_y.extend(y) # Could I somehow do the next part (add identity_line) if I haven't

Adding line of identity to correlation plots using pairs() command in R

╄→尐↘猪︶ㄣ 提交于 2019-12-18 09:04:59
问题 Similar to a prevous post, I'd like to modify the following code (from example in the R documentation for pairs() command): ## put (absolute) correlations on the upper panels, ## with size proportional to the correlations. panel.cor <- function(x, y, digits = 2, prefix = "", cex.cor, ...) { usr <- par("usr"); on.exit(par(usr)) par(usr = c(0, 1, 0, 1)) r <- abs(cor(x, y)) txt <- format(c(r, 0.123456789), digits = digits)[1] txt <- paste0(prefix, txt) if(missing(cex.cor)) cex.cor <- 0.8

Plotting multiple scatter plots pandas

萝らか妹 提交于 2019-12-18 07:38:05
问题 I think there are many questions on plotting multiple graphs but not specifically for this case as shown below. The pandas documentation says to 'repeat plot method' to plot multiple column groups in a single axes. However, how would this work for 3 or more column groups? For example if we define a third column: bx = df.plot(kind='scatter', x='a',y='f',color = 'Green',label ='f') Where would this bx be passed into? Also, if the plot is the same graph, shouldn't the x-axis be consistently

Plotting multiple scatter plots pandas

点点圈 提交于 2019-12-18 07:37:29
问题 I think there are many questions on plotting multiple graphs but not specifically for this case as shown below. The pandas documentation says to 'repeat plot method' to plot multiple column groups in a single axes. However, how would this work for 3 or more column groups? For example if we define a third column: bx = df.plot(kind='scatter', x='a',y='f',color = 'Green',label ='f') Where would this bx be passed into? Also, if the plot is the same graph, shouldn't the x-axis be consistently

Matplotlib scatter plot - Remove white padding

情到浓时终转凉″ 提交于 2019-12-18 05:16:12
问题 I'm working with matplotlib to plot a variable in latitude longitude coordinates. The problem is that this image cannot include axes or borders. I have been able to remove axis, but the white padding around my image has to be completely removed (see example images from code below here: http://imgur.com/a/W0vy9) . I have tried several methods from Google searches, including these StackOverflow methodologies: Remove padding from matplotlib plotting How to remove padding/border in a matplotlib

Highcharts: how to change line color when hovering a scatterplot series

喜欢而已 提交于 2019-12-18 04:27:10
问题 I have a Highcharts scatterplot. Some details of the chart object are below: plotOptions: { scatter: { lineWidth:1, marker: { radius: 1, symbol:'circle', fillColor: '#800000', states: { hover: { enabled: true, radius:0, radiusPlus:2, lineColor: '#ff0000', fillColor: '#ff0000' } } }, states: { hover: { halo:false, lineWidthPlus:2, } } } } and the full working example is here. I need to change the line color when hovering the series, but I am unable to do it. Is this possible? 回答1: This can be

matplotlib: update position of patches (or: set_xy for circles)

ⅰ亾dé卋堺 提交于 2019-12-18 03:15:14
问题 Inspired by this example I'm trying to write a little matplotlib program that allows the user to drag and drop datapoints in a scatter plot dynamically. In contrast to the example which uses a bar plot (and thus allows dragging of rectangles) my goal was to achieve the same with other patches, like for instance a circle (any patch that is more scatter-plot-compatible than a rectangle would do). However I'm stuck at the point of updating the position of my patch. While a Rectangle provides a

Any easy way to plot a 3d scatter in Python that I can rotate around?

会有一股神秘感。 提交于 2019-12-17 22:32:28
问题 Currently I'm using matplotlib to plot a 3d scatter and while it gets the job done, I can't seem to find a way to rotate it to see my data better. Here's an example: import pylab as p import mpl_toolkits.mplot3d.axes3d as p3 #data is an ndarray with the necessary data and colors is an ndarray with #'b', 'g' and 'r' to paint each point according to its class ... fig=p.figure() ax = p3.Axes3D(fig) ax.scatter(data[:,0], data[:,2], data[:,3], c=colors) ax.set_xlabel('X') ax.set_ylabel('Y') ax.set