scatter-plot

Scatterplot - multiple colours for “if”, “and” conditions

一笑奈何 提交于 2019-12-13 03:36:44
问题 I need to attribute color in a scatterplot where I have multiple conditions. The file is df below. I am plotting Tissue1 vs Tissue2 values. I would like to colour as follows: pvalue1 AND pvalue2 < 0.1 = "yellow" pvalue1 ≤ 0.1 = "green" (if pvalue2 >0.1 or NA) pvalue2 ≤ 0.1 = "red" (if pvalue1 >0.1 or NA) (all other = "grey") df: rowname Tissue1 pvalue1 Tissue2 pvalue2 gene1 1.3 0.7 1.6 0.09 gene2 -0.9 0.07 -0.7 0.065 gene3 2 0.9 1.65 0.9 gene4 1.7 0.07 1.6 0.09 I am plotting Tissue1 vs

Add lines to Scatterplot in R

淺唱寂寞╮ 提交于 2019-12-13 02:31:56
问题 How to add lines to the chart? I did following dat <- data.frame(xvar = 1:20 - rnorm(20,sd=10), yvar = 1:20 - rnorm(20,sd=10), zvar = 1:20 - rnorm(20,sd=10)) plot(dat[,1:3]) But I need horizontal and vertical lines at the value zero of all variables, like this 回答1: Something like this might work: ##define a function to use in pairs plotfun <- function(x,y,...){ points(x,y,...) #plot them abline(h = 0) #horizontal line abline(v = 0) #vertical line } pairs(dat, upper.panel = plotfun) Note that

Misplaced points in ggplot

孤人 提交于 2019-12-13 02:25:05
问题 I'm reading in a file like so: genes<-read.table("goi.txt",header=TRUE, row.names=1) control<-log2(1+(genes[,1])) experiment<-log2(1+(genes[,2])) And plotting them as a simple scatter in ggplot : ggplot(genes, aes(control, experiment)) + xlim(0, 20) + ylim(0, 20) + geom_text(aes(control, experiment, label=row.names(genes)),size=3) However the points are incorrectly placed on my plot (see attached image) This is my data: control expt gfi1 0.189634 3.16574 Ripply3 13.752000 34.40630 atonal 2

Real Time line graph with Core Plot not updating plot range

£可爱£侵袭症+ 提交于 2019-12-13 02:24:49
问题 I just found core-plot the other day and have been trying to implement it in our current app (ARC is used) for a real-time line graph with multiple data lines. However, I can't seem to get the graph to scroll to the right as new data points are found and added. Instead, I see the data lines travel off the right side of the graph. I've tried to follow the Plot Gallery app (Real Time Plot); to no avail. I've looked at the other questions here that resemble my problem, but none of the answers

Combine key and mouse button events in wxpython panel using matplotlib

对着背影说爱祢 提交于 2019-12-13 01:06:16
问题 In a wxPython panel I want to use matplotlib's Lasso widget. In my implementation Lasso is used in three different functionalities. Nevertheless, in order to accomplish these functionalities I must combine key events with mouse button events. By default, the initial Lasso function can be used by pressing the left mouse button. So, for my first functionality I press the left mouse button, select a region of interest and do something with the points included. For the second functionality, I

I am trying to plot clusters with unique color but getting error

╄→гoц情女王★ 提交于 2019-12-13 00:55:09
问题 I am just trying to plot x, y and then color them with clusters. Each cluster should have unique color. But i am getting error. I tried without using numpy array but still getting error. " c of shape (5113,) not acceptable as a color sequence for x with size 5113, y with size 5113"" x = np.array(df['ip_indexed']) print(x.shape) y = np.array(df['geohash_indexed']) print(y.shape) labels = np.array(df['clusters']) print(labels.shape) ''' output. (5113,) (5113,) (5113,) ''' LABEL_COLOR_MAP =

Plot vertical arrows for my points

浪子不回头ぞ 提交于 2019-12-13 00:43:14
问题 I am trying to figure out a way to add a vertical arrow pointing up for each of my data points. I have scatter plot and code below. I need the vertical arrows to start from the points going upwards to a length of about 0.2 in th graph scale. import matplotlib.pyplot as plt fig = plt.figure() a1 = fig.add_subplot(111) simbh = np.array([5.3, 5.3, 5.5, 5.6, 5.6, 5.8, 5.9, 6.0, 6.2, 6.3, 6.3]) simstel =np.array([10.02, 10.08, 9.64, 9.53, 9.78, 9.65, 10.05, 10.09, 10.08, 10.22, 10.42]) sca2=a1

Dynamically repaint ScatterPlot in jfreechart

与世无争的帅哥 提交于 2019-12-13 00:26:41
问题 I have a scatterplot which plots positions of agents. These positions change. I was wondering how can I repaint/redraw the scatterplot with the new positions my drawing method. I need to redraw in the updatePositions function. Is there any way to implement any listener for ScatterPlot? private ChartPanel createPanel() { JFreeChart jfreechart = ChartFactory.createScatterPlot( title, "", "", initPositions(),PlotOrientation.VERTICAL, true, true, false); XYPlot xyPlot = (XYPlot) jfreechart

plotly.figure_factory.create_scatterplot stopped working?

可紊 提交于 2019-12-13 00:19:54
问题 I was using plotly to try some things and then found that create_scatterplot is the only package that doesn't work. I mean, it clearly is in the module, as it appears when you call the help command: NAME plotly.figure_factory FILE /usr/lib/python2.7/site-packages/plotly/figure_factory/__init__.py PACKAGE CONTENTS _2d_density _annotated_heatmap _bullet _candlestick _county_choropleth _dendrogram _distplot _facet_grid _gantt _ohlc _quiver _scatterplot _streamline _table : And in the plotly.py

Side by side plots using scatterplot from car package

天大地大妈咪最大 提交于 2019-12-12 15:25:28
问题 Is there some reason you cannot lay two scatterplot (from car package) figures side by side? library(car) str(UN) par(mfrow=c(1,2)) scatterplot(infant.mortality~gdp,data=UN, xlab="GDP per capita", ylab="Infant Morality Rate (per 1000 births)", main="(a)", boxplot=FALSE) scatterplot(infant.mortality~gdp,data=UN, xlab="GDP per capita", ylab="Infant Morality Rate (per 1000 births)", main="(b)", log='xy', boxplot=FALSE,id.n=4) par(mfrow=c(1,1)) The above code produces both images, but not as one