scatter-plot

Matplotlib scatter marker size

白昼怎懂夜的黑 提交于 2019-12-08 17:32:02
问题 I'm trying to plot a 3D scatter with matplotlib The problem is that I can't change the marker's size I have this scat = plt.scatter([boid_.pos[0] for boid_ in flock], [boid_.pos[1] for boid_ in flock], [boid_.pos[2] for boid_ in flock], marker='o', s=5) But I get the error TypeError: scatter() got multiple values for keyword argument 's' Without that, the plot works fine. Where is the problem? Or is there another way to change the size? 回答1: This function takes in two args before the keyword

add x=y line to scatterplot

最后都变了- 提交于 2019-12-08 15:27:16
问题 I am using the scatterplot function from the car package to generate a scatterplot. I want to be able to generate a reference line in the plot that should be x=y. I tried using abline and it does add a line but it is not the x=y line. Can someone help? My code is as follows: scatterplot(phenos$P1~pheno$P0, data=pheno,spread=FALSE,ylab="6 month timepoint", xlab="Baseline Timepoint", jitter=list(x=1, y=1)) abline(0,1) Thanks. 回答1: This is actually fairly difficult/hackish, because scatterplot()

Plotly x-axis hover text issue

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 13:07:14
问题 When using a Scatter plot with Plotly i am unable to get hover text when i have more than 1 marker with the same x-axis value. Can anyone please help me fix this? Or is this a bug with plotly? Check the marker that is closest to the line. Code is here https://jsfiddle.net/qjdt92h2/ var trace1 = { x: [13.5, 12, 13, 14,13], y: [15, 17, 13.6, 17,18], text: ['4.17 below the mean', '4.17 below the mean', '0.17 below the mean', '0.17 below the mean', '0.83 above the mean', '7.83 above the mean'],

Problems with markevery - AttributeError: Unknown property markevery

时光毁灭记忆、已成空白 提交于 2019-12-08 11:55:49
问题 I am trying to specify the frequency a marker is placed for the series in my scatter plot. Searching the web I found out about markevery, but despite the documentation and other examples I can't figure it out. Can someone give me some insight on how to use markevery with a scatter plot? This is what I have [updated]: import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as colors import matplotlib.lines as lines from matplotlib import cm import csv import itertools

Matplotlib: scatter plot - symbol size based on pixel distance

℡╲_俬逩灬. 提交于 2019-12-08 11:02:27
问题 Suppose I wanted to automatically select the size for square symbols in a scatter plot to make the borders align (a question like that has been asked). In my answer to that question, I suggested that the distance between two data points measured in pixel could be used to set the size of the symbols in a scatter plot. This is my approach (it was inspired by this answer): fig = plt.figure() ax = fig.add_subplot(111, aspect='equal') # initialize a plot to determine the distance between the data

Is there any way to draw a boundary around a group of points in R? [duplicate]

安稳与你 提交于 2019-12-08 10:37:57
问题 This question already has answers here : plotting a curve around a set of points (4 answers) Closed 2 years ago . So I have plotted three groups of data in R using the following command plot(1, 1, xlim = c(min(al_comm$PC1),max(al_comm$PC1)), ylim = c(min(al_comm$PC2),max(al_comm$PC2)), type = 'n', xlab = '', ylab = '') points(DW_PC1,DW_PC2,pch = 0, col = "red", cex = 1.1) points(WW_PC1,WW_PC2,pch = 10, col = "blue", cex = 1.1) points(DS_PC1,DS_PC2,pch = 5, col = "magenta", cex = 1.1) Now I

Python: 3D scatter losing colormap

最后都变了- 提交于 2019-12-08 09:39:10
问题 I'm creating a 3D scatter plot with multiple sets of data and using a colormap for the whole figure. The code looks like this: import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D fig = plt.figure() ax = fig.add_subplot(111, projection='3d') for R in [range(0,10), range(5,15), range(10,20)]: data = [np.array(R), np.array(range(10)), np.array(range(10))] AX = ax.scatter(*data, c=data[0], vmin=0, vmax=20, cmap=plt.cm.jet) def forceUpdate(event): AX.changed() fig.canvas.mpl

nvd3.js - unable to change color of symbol in scatter plot

老子叫甜甜 提交于 2019-12-08 09:33:34
问题 I am trying to change the colors of different groups of the nvd3 scatter chart here but am unable to understand how to do so. I would like to change the colors of the 4 series in the example to orange, green, yellow, red. nv.addGraph(function() { chart = nv.models.scatterChart() .showDistX(true) .showDistY(true) .color( d3.scale.category10().range() ); // tried to change to green, orange here but it did not work }; I tried .color( d3.rgb("green"), d3.rgb("orange") ); but then the plot did not

Scatter plot with infinitesimal point size in Python

∥☆過路亽.° 提交于 2019-12-08 07:33:46
问题 Is it possible to do scatter plot in python, having points have minimal size of 1 pixel at given scale? I.e. points should not scale as I scale the plot and have size of 1 pixel always. In pyplot plt.scatter(d3_transformed[:,0], d3_transformed[:,1], s=1) I still get fat point like this 回答1: You can change the marker to a point by setting marker='.' , and then further reduce its size by removing the outline using linewidths=0 . Note that markeredgewidth does not work with scatter . Consider

How to color points in a different color if a data attribute is not null

限于喜欢 提交于 2019-12-08 06:52:58
问题 I have a scatter plot in R (with ggplot2). The data has a numeric column (let's call it bin ) which can contain various integer values or null. I would like to colour the points with non-null bin values differently from the others. I do not want to one colour per value of bin, that would be too noisy. Just simply, say, red for those with a non-null bin and black for the others. qplot has a colour attribute, but I don't know how to express a condition like colour = bin != null ? "red" : "black