similar to: See what is inside a matrix

Displaying 20 results from an estimated 7000 matches similar to: "See what is inside a matrix"

2011 Dec 09
3
ggplot with geom_tile
Dear R-users, I am trying to make a plot with ggplot-geom_tile(), but cannot remove some unwanted (white) lines through my plot. Below a reproducible example: ##### library(ggplot2) tot=as.data.frame(rep(seq(-50,50,5),each=21)) names(tot)="precip" temp=rep(seq(-5,5,0.5),21) tot$temp=temp disc=array(dim=c(21,21)) for(i in 1:21){ for(y in 1:21){ temp<-
2011 Jun 13
1
Heatmap in R and/or ggplot2
I have a dataframe df with columns x, y, and height. I want to create a heatmap-like plot that creates a grid of x by y, and then color codes the grid depending on the value of height. Is there a ggplot2 object to do this? I'm able to easily do this in Excel with pivot tables and conditional formatting so I'm including an image that is close to the output I want. I want to be able to
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 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) ,
2011 Jul 15
2
plot a vertical column of colored rectangles
Hi, I've been really struggling with this. If I have a vector like dat <- c(0,0,0,0,1,1,1,0,0,0,1,1,0,0,0,1,0,0,0) I want to plot each element as a colored rectangle (red=1, blue=1) in the right order, so they all stack up forming a vertical column on the graph. Sort of like a building, with each floor in the appropriate color. Any ideas? I've tried using ggplot and geom_tile, but my
2010 Oct 28
1
Heatmap construction problems
I am very new to R and don't have any computer program experience whatsoever. I am trying to generate a heatmap of the following data: Phylum,AI,AJT,BY,GA,Grt,Sm Acidobacteria,0.5,0.7,2.7,0.1,2.6,1.0 Actinobacteria,33.7,65.1,9.7,2.0,3.9,2.1 Bacteroidetes,9.7,5.6,0.7,13.2,41.1,21.6 CCM11b,0.0,0.0,0.0,0.0,0.0,0.1 Chlamydiae,0.1,0.1,0.0,0.0,1.0,0.2
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),
2013 Feb 21
2
ggplot2, geomtile fill assignment
Dear R help, I have some readings in three dimensions (x, y, z) and an amplitude for each. I'd like to visualize the data using ggplot, using tile plots, as I have some additional point data I would like to eventually overlay on the tile plots. I would like to subset the data by sections, slices if you will, in the z dimension, and plot the data for that slice. I can do all of this, but am
2011 May 10
1
ggplot2 and add circle
Dear all, today I have writted the following code, to plot the contents of some matrices I have plot_shad_f function(f){ library(ggplot2) dev.new() plotdata<-melt(f) names(plotdata)<-c('x','y','z') v<-ggplot(plotdata, aes(x, y, z = z)) print(v + geom_tile(aes(fill=z))) } I would like to ask your help add a small circle in this plotting. What would be
2010 Sep 29
4
matrix plot
Hi, Fairly new to R - have done basic plots but now faced with plotting a matrix/table of results -I know what I want but cannot find out how to do it. Basically have individual questions ( x) to which an organization can rate themselves 1-10 (y) what I want to show is a matrix/density type plot (like the matrix corrolation plots I have seen on R graph site) showing for eac question (x) a
2011 Apr 27
6
Assignments inside lapply
Dear all I would like to ask you if an assignment can be done inside a lapply statement. For example I would like to covert a double nested for loop for (i in c(1:dimx)){ for (j in c(1:dimy)){ Powermap[i,j] <- Pr(c(i,j),c(PRX,PRY),f) } } to something like that: ij<-expand.grid(i=seq(1:dimx),j=(1:dimy)) unlist(lapply(1:nrow(ij),function(rowId) { return
2010 Sep 08
2
Matrixes inside matrixes
Hello everyone, Could you please help me find out if R supports matrixes inside matrixes? This is what I would like to do I have an area map of humidity per km. I would like at every cell to keep also information about the height of this area, the current temperature etc. Is something like that supported? I would like to thank you in advance for your help Best Regards Alex
2011 Feb 28
3
re-arranging data to create an image (or heatmap)
Let me start by introducing myself as a biologist with only a little knowledge about programming in matlab and R. In the past I have succesfully created my figures in matlab using the hist3d command, but I have not access to matlab right now and would like to switch to R. I have used the plot command to create a figure of my data and it does almost what I want it to do. My data matrix looks like
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
2010 Oct 04
2
print-show-display a matrix
Hello. I want to print the value a matrix has. The matrix's size is not too big (100*100 cells). I tried print(matrixname) but as it does not fit very well on my screen R splits it into several small matrixes that do overflow my screen. IS it possible somehow to display this matrix as one (even if this needs to go fullscreen) . There might be some function for that like plot cells or
2008 Feb 26
3
R package to perform Horn's parallel analysis
I am seeking information on whether anyone has written code to perform Horn's parallel analysis (a procedure that informs the selection of the proper number of components in PCA) in R. Thank you in advance for any help you can provide. Please respond off-list at the email address below. Karen Douglas ******************************************************************* Karen Douglas,
2008 Feb 05
2
using image to show RGB image data ?
Hello all, I'm now using image() to show image data (in my case dumps of SOM weights) but would like to show RGB colour data, not just single "z" colour values. I've currently been using seq() to skip 4 values, so I can show the R, G or B channels separately as "z". But is there a way I can show all three channels simultaneously as a proper colour image? Thanks, B.
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.
2011 Dec 21
2
Search a string inside a data.frame
Dear all, I have a string and I want to search for its existance inside a data.frame (or in a column of the data.frame). One way is for me to do this manually: Make a for loop for the number of elements and compare one by one element. Is there though any more improved way to do that? B.R Alex [[alternative HTML version deleted]]
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()