scatter-plot

matplotlib scatter plot with different markers and colors

浪子不回头ぞ 提交于 2019-12-17 20:05:52
问题 I would like to make a plot with different markers and different colors according to the values of 2 external vectors. Here what I have tried: >>> s = [u'+', u'+', u'o'] >>> col = ['r','r','g'] >>> x = np.array([1,2,3]) >>> y = np.array([4,5,6]) >>> pl.scatter(x,y,marker=s,c=col) Traceback (most recent call last): File "/usr/lib/python3/dist-packages/matplotlib/markers.py", line 233, in set_marker Path(marker) File "/usr/lib/python3/dist-packages/matplotlib/path.py", line 133, in __init__

Using D3 transition method with data for scatter plot

拈花ヽ惹草 提交于 2019-12-17 19:33:57
问题 So I'm new to D3 and have little exp with JavaScript in general. So I have been following some tutorials am currently using source code that creates a basic scatter plot. Now my question is how do I use the transition() method to moves the circles around when I add more datasets? I want to be able to set up buttons and when a user presses them, it activates the transition() method with the corresponding dataset. The tutorial I read on transitions only showed a transition on a single rectangle

Setting a fixed size for points in legend

亡梦爱人 提交于 2019-12-17 18:12:25
问题 I'm making some scatter plots and I want to set the size of the points in the legend to a fixed, equal value. Right now I have this: import matplotlib.pyplot as plt import numpy as np def rand_data(): return np.random.uniform(low=0., high=1., size=(100,)) # Generate data. x1, y1 = [rand_data() for i in range(2)] x2, y2 = [rand_data() for i in range(2)] plt.figure() plt.scatter(x1, y1, marker='o', label='first', s=20., c='b') plt.scatter(x2, y2, marker='o', label='second', s=35., c='r') # Plot

MATLAB - Plot multiple data sets on a scatter plot

♀尐吖头ヾ 提交于 2019-12-17 16:26:07
问题 I have two sets of data, (Ax, Ay; Bx, By). I'd like to plot both of these data sets on a scatter plot with different colors, but I can't seem to get it to work, because it seems scatter() does not work like plot() . Is it possible to do this? I've tried... scatter(Ax, Ay, 'g', Bx, By, 'b') And scatter(Ax, Ay, 'g') scatter(Bx, By, 'b') The first way returns an error. The latter only plots the Bx / By data. 回答1: Try using hold on with the second example. 回答2: plot (ax,ay,'g.') generates a

How can I label points in this scatterplot?

狂风中的少年 提交于 2019-12-17 15:34:13
问题 Can you help me on putting labels on the following graph? The code i use is: valbanks<-scan("banks.txt", what=list(0,0,""), sep="", skip=1, comment.char="#") valbanks valj2007<-valbanks[[1]] valj2009<-valbanks[[2]] namebank<-valbanks[[3]] percent_losses<-(valj2009-valj2007)/valj2007 percent_losses abs_losses<-(valj2007-valj2009) abs_losses plot(abs_losses, percent_losses,main="Absolute Losses vs. Relative Losses(in%)",xlab="Losses (absolute, in miles of millions)",ylab="Losses relative (in %

Get data from plot with matplotlib

£可爱£侵袭症+ 提交于 2019-12-17 10:35:11
问题 I'm using matplotlib in python to build a scatter plot. suppose I have the following 2 data lists. X=[1,2,3,4,5] Y=[6,7,8,9,10] then I use X as the X-axis value and Y as the Y-axis value to make a scatter plot. So I will have a picture with 5 scattering points on it, right? Now the question: is it possible to build connection for these 5 points with the actual data. For example, when I click on one of these 5 points, it can tell me what original data I have used to make this point? thanks in

ggplot: colour points by groups based on user defined colours

烂漫一生 提交于 2019-12-17 09:45:42
问题 I am trying to define the colours of groups of points plotted in ggplot. I adapted code from this post: Color ggplot points based on defined color codes but as soon as I have more than one row defined by the same grouping variable (rather than a separate colour for each row), the code fails, and I can't figure out why. Below is a reproducible example: #create some data zone <- c("E","E","C","C","C","E","E") #grouping variable col <- c(50,100,150,200,250,300,350) #x variable D <- c(.4,.45,.20,

Matplotlib scatter plot legend

白昼怎懂夜的黑 提交于 2019-12-17 02:29:16
问题 I created a 4D scatter plot graph to represent different temperatures in a specific area. When I create the legend, the legend shows the correct symbol and color but adds a line through it. The code I'm using is: colors=['b', 'c', 'y', 'm', 'r'] lo = plt.Line2D(range(10), range(10), marker='x', color=colors[0]) ll = plt.Line2D(range(10), range(10), marker='o', color=colors[0]) l = plt.Line2D(range(10), range(10), marker='o',color=colors[1]) a = plt.Line2D(range(10), range(10), marker='o'

Finding circles in scatter

痞子三分冷 提交于 2019-12-14 03:32:46
问题 I am working with a sensor and I have collected data which represented in two lists: filtered_x = [64, 90, 83, 78, 57, 58....] filtered_y = [26, 17, 63, 21, 62, 86....] Which gives the following scatter plot: This is part of a calibration process. In order to complete this, I have to find the circles in the plot and come up with coordinates of the centers of the circles so the sensor can be calibrated. Which libraries should I use and how do I go about doing this? I have come across nearest K

Create a Scatterplot of Raster Images in R

ぐ巨炮叔叔 提交于 2019-12-13 22:10:06
问题 I am not entirely sure if these kind of questions are allowed at SO, as I have no reproducible data at the moment. My question is in regards to how one might go about creating a scatterplot of raster images in R. I am not familiar with any packages that allow you to do this. This is the only example I have come across so far in my search. Essentially, this is what I would like to do, however, I am wondering if it's possible for R to simply take the input data and plot the image rather than be