scatter

Write using mouse on R plot?

我们两清 提交于 2019-12-07 08:39:26
问题 I created scattergram using the plot() function in R. Is there any possibility to draw on this graph? I would like to add a straight line and get parameters of it, but in my opinion abline() can be inconvenient (I would like to draw many lines and choose one which will be most proper). How can I accomplish this task? 回答1: Take a look at RStudio and this example: library(manipulate) data = matrix(rnorm(20), ncol = 2) example <- function(data, a, b){ plot(data[,1],data[,2]) abline(a = a, b = b)

Saving scatterplot animations with matplotlib produces blank video file

六眼飞鱼酱① 提交于 2019-12-07 06:47:09
问题 I am having a very similar problem to this question but the suggested solution doesn't work for me. I have set up an animated scatter plot using the matplotlib animation module. This works fine when it is displaying live. I would like to save it to an avi file or something similar. The code I have written to do this does not error out but the video it produces just shows a blank set of axes or a black screen. I've done several checks and the data is being run and figure updated it's just not

Find volume of 3d peaks in matlab

一笑奈何 提交于 2019-12-06 13:22:21
right now I have a 3d scatter plot with peaks that I need to find the volumes for. My data is from an image, so the x- and y- values indicate the pixel positions on the xy-plane, and the z value is the pixel value for each pixel. Here's my scatter plot: scatter3(x,y,z,20,z,'filled') I am trying to find the "volume" of the peaks of the data, like drawn below: I've tried findpeaks() but it gives me many local maxima without the the two prominent peaks that I'm looking for. In addition, I'm really stuck on how to establish the "base" of my peaks, because my data is from a scatter plot. I've also

add segments to scatter-plot

大兔子大兔子 提交于 2019-12-06 07:08:17
问题 (this follows ggplot2 loess Q for which I got a nice answer) -- leading to this plot: My R knowledge is quite limited (sorry!) I plot a scatter using data from a table data1. data1<-NaRV.omit(data[,c(2,3,7,10)]) #(2=start, 3=end, 7=value, 10=type) ylabs='E / A - ratio' p1<-ggplot(data1, aes(x=start, y=value)) + ylim(0,5) + geom_point(shape=points, col=pointcol1, na.rm=T) + geom_hline(aes(yintercept=1, col=linecol)) + geom_smooth(method="loess", span=spanv, fullrange=F, se=T, na.rm=T) + # xlab

Matplotlib: add twin y axis without using its values in the plots

帅比萌擦擦* 提交于 2019-12-06 04:08:00
This is to clarify the question title. Say you have four lists of integers, with which you want to produce a scatter plot: a=[3,7,2,8,12,17] b=[9,4,11,7,6,3] c=[9,3,17,13,10,5] d=[5,1,1,14,5,8] You also have a function, for simplicity f(x)=1/x , that applies to all lists, so that: from __future__ import division a1=[1/i for i in a] b1=[1/i for i in b] c1=[1/i for i in c] d1=[1/i for i in d] My question: how to add a second y axis, knowing that the values returned by the function range from 0.06 to 1.0 , without using any of the a1, b1, c1, d1 lists in the scatter plots? What I am saying is: if

Specify color of each point in scatter plot (matplotlib)

我与影子孤独终老i 提交于 2019-12-06 01:25:14
问题 I have a 3D Plot that I created using matplotlib, and I have a list of rbg values that correspond to each point. I have the X, Y, and Z data, and then I have a "color list" of the form: [ (r,g,b), (r,g,b), ... , (r,g,b) ] to match each (x, y, z) point. Right now, I have fig = plt.figure() ax = fig.add_subplot(111, projection = '3d') ax.scatter(X, Y, Z) plt.show() What's the appropriate way to incorporate those rgb tuples so that each point will be assigned a specific color? 回答1: I used a for

matplotlib: how can I convert a XYZ scatter to a pixel image?

℡╲_俬逩灬. 提交于 2019-12-05 20:35:14
I'm looking for some way in to convert a scatter plot (X vs Y, color normalized by Z) into a 2D "pixel" image. I.e. how can I plot a pixelized image where the pixels are colored according to a third variable? In my case, I have a list of galaxies, each a with sky coordinate (X,Y) and a distance (Z). I want to make a pixelized image of X vs Y, with the pixels color normalized according to Z (e.g. the median Z value for the galaxies in that pixel). I know I could do something like this with hexbin, but I would like to have square pixels, not hexagons. (Something more like what imshow produces).

Write using mouse on R plot?

*爱你&永不变心* 提交于 2019-12-05 12:48:21
I created scattergram using the plot() function in R. Is there any possibility to draw on this graph? I would like to add a straight line and get parameters of it, but in my opinion abline() can be inconvenient (I would like to draw many lines and choose one which will be most proper). How can I accomplish this task? Take a look at RStudio and this example: library(manipulate) data = matrix(rnorm(20), ncol = 2) example <- function(data, a, b){ plot(data[,1],data[,2]) abline(a = a, b = b) } manipulate( example(data, a, b), a = slider(-5,5), b = slider(-5,5) ) This will put a new line on the

How do I create a scatter plot with graduated marker colours in MATLAB?

风流意气都作罢 提交于 2019-12-05 00:37:15
问题 I would like to plot a simple scatter graph in MATLAB, with marker colours varying from one end of the spectrum to the other (e.g. red, orange, yellow....blue, purple). My data compares the amount of water in a river with the quality of the water, over time (3 simple columns: time, amount, quality). I would like to plot the x,y scatter plot of amount vs quality, but with the colour progressing over time, so that it is possible to see the progression of the quality over time. I will need to

Beeswarm boxplot (scatterplot for categorical data) in MATLAB

风格不统一 提交于 2019-12-04 18:15:31
I am looking for a function to create a so called Beeswarm boxplot. This is very popular plots used in medicine and biology and I was surprised not to find it for MATLAB. Basically the numerical data for each group are splitted to bins and jitter of points depends on number of points in a particular bin. Here is an example done with R using BEESWARM function: Different colors for additional group is very nice feature but it not needed for me now. There is a function on the file exchange called plotSpread that can do these plots: plotSpread({rand(100,1),randn(100,1)}) data = [randn(50,1);randn