Displaying 20 results from an estimated 44 matches for "geom_til".
Did you mean:
geom_tile
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...
2010 Nov 20
2
Merge two ggplots
...-20,-30,-40,-50,-60,-70,-80)), label=round(sr,3)),vjust=1,legend=FALSE)+labs(colour="CRagents[[i]]$sr")
}
plot_shad_f<-function(f){
library(ggplot2)
plotdata<-melt(f)
names(plotdata)<-c('x','y','z')
v<-ggplot(plotdata, aes(x, y, z = z))
v + geom_tile(aes(fill=z))
}
The first plot puts points and texts below the points... in an area
while the second function in the same are fills the background using geom_tiles... Is it possible somehow to merge these two plots into one?
So far I have tried to merge the two functions as one but I fail as gg...
2007 Dec 13
2
use ggplot in a function to which a column name is given
...les ggplot but could be shorter)
B = A[A$y<=5,c("x","y",uv)]
names(B)[3] = "value"
# rem: cannot use rename since rename(B,c(uv="value")) would not work
qplot(x, y, fill=value, data=B, geom="tile")
# or
# ggplot(B,aes(x=x,y=y,fill=value)) + geom_tile()
}
foo3 <- function(uv="u")
{
# solution 3: use the data argument and perform the extraction
directly in it
# (elegant and powerful but can't make it work)
ggplot(A[A$y<=5,c("x","y",uv)],aes(x=x,y=y,fill=???)) + geom_tile()
# or
ggplot(A[A$y<=5,]...
2011 Oct 21
0
geom_tile rendering problems
...raphical map with a heat map by following the
directions on
http://pages.stern.nyu.edu/~achinco/programming_examples/Example__PlotGeographicDensity.html.
However, the smaller my zoom level (the farther I zoom out), the more white
horizontal lines I have interspersed in the tiled data after calling
geom_tile. Is there any way around this? I tried setting the image to
panel.background, but found it impossible to scale back to the original heat
map matrix.
--
View this message in context: http://r.789695.n4.nabble.com/geom-tile-rendering-problems-tp3924100p3924100.html
Sent from the R help mailing li...
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(...
2010 Apr 27
1
ggplot2 - help with intervals in geom plot
Hi;
I have created a geom_tile plot which does roughly what I want but I
have a small tweak I cannot sort out.
I have a dataframe binL, binR, HCount, HProbCount where HCount and
HProbCount have values ranging from 1-150. I plot binL and binR on the
axes respectively and create two charts with the fill being represented
by H...
2007 Jul 13
1
Choosing the number of colour breaks in ggplot2
...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()
---------------------------------------------
The image shows many (61) colours, but only 5 of them are shown in the
legend. How do I change the legend to show, say, 10 colours?
--
Karl Ove Hufthammer
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.
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 100, 100, 3 in
size. What approach would you suggest?
TIA,
DrX
2011 Jul 15
2
plot a vertical column of colored rectangles
...(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 data has a million elements
and the plots take forever to generate.
I've also tried using a heatmap, but I need 2 columns at least, and I only
have 1.
[[alternative HTML version deleted]]
2009 Mar 05
1
Using vectors of names in calls for functions
...en exhanged but I cannot understand what is the good way to
handle this and not to use this vectors of names ...
below is the idea of what I would like to have:
? ? ? ? ? ?V1_P2_plot<-function(df, x, y, z) {
? ? ? ? ? ? ? ?pp<-ggplot(df, aes(x = x, y= y , z = z ))
? ? ? ? ? ? ? ?pp<-pp + geom_tile(aes(fill= z))
? ? ? ? ? ? ? ?return(pp)
? ? ? ? ? ?}
that would allow this type of call :
j<-c("k", "l")
i<-"m"
m<-rnorm(25)
vsim<-cbind(expand.grid(k=1:5, l=1:5*10), m)
V1_P2_plot(df=vsim, x=j[1], y=j[2], z=i)
This is obviously not working, and I under...
2017 Dec 20
2
outlining (highlighting) pixels in ggplot2
...')
# Set up an example matrix with binary code for which results (pixels) are
significant
set.seed(4004)
sig <- matrix(round(abs(rnorm(15*12)/3)), nrow = 15, ncol = 12)
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",
midpoint = 0)
[[alternative HTML version deleted]]
2010 Feb 04
2
ggplot2 / time series with different scales
I am trying to plot this dataset using ggplot2:
df <- data.frame(
sid = c(rep('11',30),rep('22',30)),
time = rep(ISOdate(year = 2010, month = 1, day = 1:30),2),
sales = c(rnorm(30, 1000, 20),rnorm(30, 900, 10)),
price = c(rnorm(30, 2, 0.5),rnorm(30, 3,0.5))
)
Plotting just the sales can be done easily:
ggplot(data=df, aes(x=time, y=sales, group=sid, color=sid)) +
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 the easiest way to do that in ggplot2?
Best Regards
Alex
2011 Nov 08
3
ggplot2 reorder factors for faceting
...))
infType <- c(rep('M', 24), rep('D',24), rep('M', 24), rep('D', 24))
# data is long format for ggplot2
plotData <- as.data.frame(cbind(genes, as.numeric(fcData), as.numeric(times), infection, infType))
hp2 <- ggplot(plotData, aes(factor(times), genes)) + geom_tile(aes(fill = scale(as.numeric(fcData)))) + facet_wrap(~infection, ncol=4)
# set scale
hp2 <- hp2 + scale_fill_gradient2(name=NULL, low="#0571B0", mid="#F7F7F7", high="#CA0020", midpoint=0, breaks=NULL, labels=NULL, limits=NULL, trans="identity")
# set up...
2008 May 12
1
Converting qqplot2 qplot() to grammar?
...tity() +
coord_cartesian() +
opts(aspect.ratio = .75) +
facet_grid(unitX ~ unitY,margins=FALSE)
The result is a plot where all tiles are filled with grey50, and not the
data values. I've also tried this variation with the same results:
ggplot(data = somdf, mapping = aes(x = pixX, y = pixY)) +
geom_tile(data = somdf, fill=rgb) +
scale_y_continuous(name=" ",breaks=" ") +
scale_x_continuous(name=" ",breaks=" ") +
scale_fill_identity() +
coord_cartesian() +
opts(aspect.ratio = .75) +
facet_grid(unitX ~ unitY,margins=FALSE)
The other issue I'm having is th...
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",
midpoint = 0)
+annotate("rect",ymin=ind[,"row"]-.5,ymax=.5+ind[,"row"],
x...
2011 Aug 02
3
Clean up a scatterplot with too much data
I'm working with a lot of data right now, but I'm new to R, and not very good
with it, hence my request for help. What type of graph could I use to
straighten out things like...
http://r.789695.n4.nabble.com/file/n3711389/Untitled.png
...this?
I want to see general frequencies. Should I use something like a 3D
histogram, or is there an easier way like, say, shading? I'm sure these
2010 Jul 10
3
a very particular plot
Hi all,
Thanks for the really great help I've received on this board in the past.
I have a very particular graph that I'm trying to plot, and I'm not really
sure how to do it. I think I should be able to use ggplot for this, but I'm
not really sure how.
I have a data.frame which contains fifty sub frames containing one hundred
data points each.
I can do a histogram of each of
2017 Jun 18
3
R_using non linear regression with constraints
...)
, lower = c( 1000, 0 )
, upper = c( 3000, 1 )
)
a <- as.vector( coef( myfit )[ "a" ] )
b <- as.vector( coef( myfit )[ "b" ] )
brks <- c( 500, 1e7, 2e7, 3e7, 4e7 )
ggplot( objdtass, aes( x=a, y=b, z = x, fill=x ) ) +
geom_tile() +
geom_contour( breaks= brks ) +
geom_point( x=a, y=b, colour="red" ) +
geom_point( x=objdtassmin$a
, y=objdtassmin$b
, colour="green" ) +
scale_fill_continuous( name="SumSq", breaks = brks )
# Green point is brute-f...