scatter

Adding a plane to scatterplot3d

别说谁变了你拦得住时间么 提交于 2019-12-11 19:24:52
问题 x <-rnorm(500,50,2) y <-rnorm(500,5,1) z <-rnorm(500,6,1) s3d <- scatterplot3d(x[z<6], y[z<6], z[z<6], zlim=range(z), color="darkgrey", col.axis="blue",col.grid="lightblue", main="scatterplot3d - 1", pch=20) s3d$plane3d(6,0,0) s3d$points3d(x[z>=6], y[z>=6], z[z>=6], pch=20) The above code tells me how to add a plane 'z=6' to the 3d scatter plot. The first question is: I'm wondering how to add a plane such as 'x=3' or 'y=2'. R help file explains that plane3d(Intercept, x.coef = NULL, y.coef =

matplotlib Plot multiple scatter plots, each colored by different thrid variable

↘锁芯ラ 提交于 2019-12-11 12:23:25
问题 I'm trying to plot multiple pairs of data on a single scatter plot, each colored by a different third variable array. The coloring seems to work for the first plot, then fails for the second and third. Any help would be appreciated import matplotlib.pyplot as plt jet=plt.get_cmap('jet') x = [1,2,3,4] y = [1,2,3,4] z = [1,1,1,1] a = [2,3,4,5] b = [1,2,3,4] c = [2,2,2,2] d = [3,4,5,6] e = [1,2,3,4] f = [3,3,3,3] plt.scatter(x, y, s=100, c=z, cmap=jet) plt.scatter(a, b, s=100, c=c, cmap=jet) plt

C MPI Array Search (MPI_Scatter segmentation fault)

只谈情不闲聊 提交于 2019-12-11 12:04:00
问题 My MPI code keeps running into a segmentation fault for all non-master tasks. #include "mpi.h" #include <stdio.h> #include <string.h> int main(int argc, char* argv[]) { int list_size = 1000 int threads; int th_nums; int slice; int index; char* the_array[list_size]; char* temp_array[list_size]; char str_to_search[10]; FILE *in = fopen("inputfile", "r"); char parse[10]; MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &threads); MPI_Comm_size(MPI_COMM_WORLD, &th_nums); if (threads == 0) {

scatter plot with loess line, loess to not show line in a given region

独自空忆成欢 提交于 2019-12-11 10:43:52
问题 I plot here values over length for a chromosome The middle region without points contains no data and should not get a loess line. How can I modify my code to stop the loess line over this region? The data is continuous but I could add lines to mark the blank region with some special value or add a column with a label?? but how to use this in the command? my current command: library(IDPmisc) # plot settings (edit here) spanv<-0.05 pointcol1="#E69F00" pointcol2="#56B4E9" pointcol3="#009E73"

How to set_gid() for each bubble in matplot scatter chart?

♀尐吖头ヾ 提交于 2019-12-11 10:09:48
问题 I draw a scatter chart by below codes: import matplotlib.pyplot as plt x = [2,4,6] y = [1,3,7] r = [650,890,320] clr = ['r','b','g'] bubble_id = ['C0','C1','C2'] H0 = plt.scatter(x,y,s=r,c=clr) Then I want to 'set_gid()' to the three bubbles as 'C0', 'C1' ,'C2' respectively. How to do that ? As H0 is a single object <matplotlib.collections.PathCollection object at 0x0ADA6D30> , I don't know how to break down H0 and find the three 'bubble son' of H0 . Thanks for your tips. 回答1: So, I know that

Color on a scatter graph Python Matplotlib

ぐ巨炮叔叔 提交于 2019-12-11 06:39:55
问题 I have two variables I want to plot on a scatter graph. I want one variable to be displayed in blue and the other in red. I only just started using Python, and I am rather confused. 回答1: scatter takes an argument color which allows you to set the point color (hard to guess). x = linspace(0,10) y1 = randn(50) y2 = randn(50)+10 scatter(x, y1, color='red') scatter(x, y2, color='blue') 回答2: import numpy as np import matplotlib.pyplot as plt x = np.arange(10) y = x z = x*2 plt.scatter(x,y,c="r")

How to add legend to scatter plot that has colour assignment

梦想与她 提交于 2019-12-11 06:39:07
问题 I have an a list of x and y values and list of colour assignments for each point ('green', 'blue', 'red', etc). All of the examples I have found produce a legend based on separate plt.scatter() commands which later a simple plt.legend() suffices. making matplotlib scatter plots from dataframes in Python's pandas. My scatter does not have separate scatters for each coloured group. So how do I produce a legend that shows the colours of each group? import matplotlib.pyplot as plt colors = ["red"

Add colorbar as legend to matplotlib scatterplot (multiple subplots, multiple scatters)

本秂侑毒 提交于 2019-12-11 04:59:35
问题 I have several subplots to which I want to add a single colorbar. Each subplot consists of 7 scatters. I found advise on how to add colorbars, but they are mostly related to the value of each scatter-point and not to the row itself. Representative sample code: import numpy as np from matplotlib import pyplot as plt x = range(50) scales = np.linspace(0, 2, 7) locs = range(4) cmap = plt.get_cmap("Spectral") for s_plot in range(4): plt.subplot(2, 2, s_plot+1) color = iter(cmap(np.linspace(0, 1,

Scatter plot with coloured groups and different markers within a group

本秂侑毒 提交于 2019-12-11 03:45:58
问题 I am trying to make kind of a scatter plot with different groups. In addition to this I would like to have 2 different markers and one color for each set of 2 points, which are also connected with a line. But see below for details I have 4 matrices Db = [0.4745 0.3886 0.3316 0.2742; 0.5195 0.3825 0.3341 0.2846; 0.4929 0.3951 0.3161 0.2918; 0.4905 0.4052 0.3240 0.2882]; Dw = [0.4814 0.3905 0.3418 0.2922; 0.5258 0.3952 0.3420 0.2974; 0.4945 0.4012 0.3386 0.3001; 0.4885 0.4076 0.3382 0.3056]; Sb

Adding color to Polar Scatter plot data points

老子叫甜甜 提交于 2019-12-11 02:56:13
问题 I'm trying to make a polar plot with Python, of which I've been somewhat successful so far polar scatter plot example I did have a few questions for which I was hoping to get some ideas/suggestions: is it possible set the color of the circles to a specific value (e.g.: "n" in the sample code below)? If so, can I set specific color ranges? E.g: 0-30: red color, 31-40: yellow; 41-60: green Note: following the examples from Plot with conditional colors based on values in R, I tried ax.scatter(ra