similar to: ggplot2 and add circle

Displaying 20 results from an estimated 5000 matches similar to: "ggplot2 and add circle"

2010 Nov 20
2
Merge two ggplots
Hello everyone. I am using ggplot and I need some help to merge these two plots into one. plot_CR<-function(x,y,agentid,CRagent){   library(ggplot2)     agent<-CRagent[[agentid]] # To make following expression shorter   ggplot((data.frame(x=CRX,y=CRY,sr=agent$sr)))+   geom_point(aes(x,y,colour=cut(sr,c(0,-10,-20,-30,-40,-50,-60,-70,-80))))+   geom_text(aes(x,y,color=cut(sr,
2011 Nov 08
3
ggplot2 reorder factors for faceting
Dear List I am trying to draw a heatmap using ggplot2. In this heatmap I have faceted my data by 'infection' of which I have four. These four infections break down into two types and I would like to reorder the 'infection' column of my data to reflect this. Toy example below: library(ggplot2) # test data for ggplot reordering genes <- (rep (c(rep('a',4),
2011 Aug 31
2
ggplot2 to create a "square" plot
Dear all, I am using ggplot with geom_tile to print as an image a matrix  I have. My matrix is a squared one of 512*512 cells.  The code that does that is written below > print(v + geom_tile(aes(fill=dB))+ opts(axis.text.x=theme_text(size=20),axis.text.y=theme_text(size=20), axis.title.x=theme_text(size=25) , axis.title.y=theme_text(size=25), legend.title=theme_text(size=25,hjust=-0.4) ,
2010 Nov 22
1
plot inside function does not work
Hello everyone, when I commit a plot using console(command line?) plot works fine. I have created a function that plots based on the input. This function is called plot_shad. When I call this function alone in the command line I get my plot. Then I tried to use another function as depicted_below to do some calculation before calling the function that does the plotting.
2007 Nov 01
1
ggplot2 - expand range?
Dear UserRs, I am trying to use systematically ggplot2 for most of my plots, but I am fighting some lack of documentation, which I try to overcome. I want to build a scatterplot where the axes cross exactly at (0,0). I tried using scale_y_continuous(limits=c(0,10)), but I always get an extra space at the bottom of the axes. The code I used is below. > plotdata<-data.frame(x=1:10,
2017 Dec 20
2
outlining (highlighting) pixels in ggplot2
Using the small reproducible example below, I'd like to know if one can somehow use the matrix "sig" (defined below) to add a black outline (with lwd=2) to all pixels with a corresponding value of 1 in the matrix 'sig'? So for example, in the ggplot2 plot below, the pixel located at [1,3] would be outlined by a black square since the value at sig[1,3] == 1. This is my first
2010 Jul 08
1
xyplot help
Hi, I am learning xyplot. I have an example dataset attached. plotdata<-read.table("plotdata.txt",sep='\t',header=T,row.names=1) head(plotdata,n=4) y x type 1 -4.309601 -0.7448405 A 2 -4.715421 0.7875994 A 3 -2.310638 0.5455310 A 4 -2.685803 10.4116868 A xyplot(y~x,groups=type,plotdata, auto.key=T) This shows different colors for different
2008 Nov 04
1
How to create margin area around a graphic made by xyplot
Hi list, Does any body know how I can create a margin area around the graphic created by xyplot (the same thing we do using par in plot function)? I tried viewport, but does not work. Here is the code: ============================================== require(grid) vp<- viewport(x=.1,y=.1,width=.6,height=.6,just=c("left", "bottom")) pushViewport(vp)
2000 Jul 07
2
Question of programming style
This is really a question of how to program this *BETTER*. It works as I have done it, but is quite ugly. I want to do a 3d scatterplot of the upper triangle of a matrix, where the z-values are the values in the matrix, and the row and column indices are the y- and x-values. The complete (11 by 11) matrix is mmtop94.2. Here is my awkward code: mmtop94.2[lower.tri(mmtop94.2)] <- NA # Here i
2007 Jul 13
1
Choosing the number of colour breaks in ggplot2
A seemingly simple problem has me stumped. Is it possible to choose the number of colour breaks for a gradient scale in the current version of ggplot2? Here is a simple example: --------------------------------------------- x=-10:10 y=-10:10 dat=expand.grid(x=x,y=y) dat$z=dat$x^2+dat$y^2-100 ggplot(dat, mapping=aes(x=x, y=y, fill=z)) + geom_tile() + scale_fill_gradient2()
2011 Jul 28
1
ggplot2 help/suggestions needed
Hello, I have written a version of the Kohenen Self Organizing Map (in R) and wish to use ggplot2 for the visualization. My results are RGB values in a matrix [x,y,1:3] where x and y comprise the first two dimensions and the third dimension is the RGB vector. I am not sure whether to use geom_tile or geom_hex as there really is no binning at the finest granularity. For testing, the matrix is
2008 Oct 30
2
xyplot, the first tick mark starts from 2 rather than 1, and also there is a NA as the final tick mark.
I am trying to plot some data, but have got some difficulties with labels on the tick marks on the x-axes. There are 20 data points. All I want to do is to plot the Loss versus Lines. When I use xyplot, the first tick mark starts from 2 rather than 1, and also there is a NA as the final tick mark. Here is the R code you code give it a try: Would any body be able to fix this, please?
2010 Sep 09
2
See what is inside a matrix
Hello everyone.. Is there any graphical tool to help me see what is inside a matrix? I have 100x100 dimensions matrix and as you already know as it does not fit on my screen R splits it into pieces. I would like to thank you in advance for your help Best Regards Alex [[alternative HTML version deleted]]
2007 Oct 31
1
reversing the scale on ggplot
Dear All, I am trying to build a simple ggplot, but where the scale is reversed, i.e. the largest numbers are on the bottom. An example of the code I am using is > plotdata<-data.frame(x=1:10, y=runif(10)) > plot<-ggplot() > plot<-plot+layer(data=plotdata, mapping=aes_string(x='x',y='y'), geom='point', stat='identity', size=4) >
2009 Aug 20
1
lattice xyplot strip colors and location
Hi all, I've been trying (unsuccessfully) to modify an xyplot I created using the lattice package. I would like to change default strip colors and locations. I started with numeric data in 4 columns, which look like this: 0.25 2 1 32 0.25 2 2 30 0.25 2 3 27 0.25 2 4 23 0.25 2 5 17 0.25 3 1 30 0.25
2004 Sep 26
1
(no subject)
Hello R help mailing list, I'm having difficulty saving a series of figures in an analysis. I have attempted to save them in a for loop with the following code: for(i in 1:20){ sF<-paste("fig",i,".jpeg",sep="") jpeg(file=sF,width=600,height=500,quality=100,pointsize=12) attach(plotData) xyplot(CHC~1:13), detach(plotData) graphics.off() } If I break
2007 Dec 11
2
ggplot - Setting the y-scale in a bar plot
Dear All (probably Hadley), I am now trying to customise some plots using a bar geom. I do not want to use the default binning statistic, but rather calculate the bar heigths separately. I do manage this, but for comparison purposes I would like to have a set of plots all with the same y-axis height. But I do not seem to find out how to fix the scale of the y-axis in this case. Any tips?
2012 Aug 13
4
write.dbf error: invalid subscript type 'list'
Dear all, I am basically a GIS user and am new to R. I am trying to write a data frame to a dbf file. *n.simulations <- 999 binomial <- kulldorff(geo, cases, population, NULL, pop.upper.bound, n.simulations, alpha.level, plot) cluster <- binomial$most.likely.cluster$location.IDs.included df <- data.frame(ID=seq(1,n.simulations,by=1), simloglkhd=binomial$simulated.log.lkhd)
2007 Dec 13
2
use ggplot in a function to which a column name is given
Hi everyone, Hi ggplot users in particular, ggplot makes it very easy to plot things given their names when you use it interactively (and therefore can provide the names of the columns). qplot(x,foo,data=A) where A has columns (x,y,foo,bar) for example but I would like to use this from inside a function to which the name of the column is given. I cannot find an elegant way to make this
2017 Dec 20
0
outlining (highlighting) pixels in ggplot2
Hi Eric, you can use an annotate-layer, eg ind<-which(sig>0,arr.ind = T) ggplot(m1.melted, aes(x = Month, y = Site, fill = Concentration), autoscale = FALSE, zmin = -1 * zmax1, zmax = zmax1) + geom_tile() + coord_equal() + scale_fill_gradient2(low = "darkred", mid = "white", high = "darkblue",