Displaying 20 results from an estimated 2000 matches similar to: "ggplot-How to define fill colours?"
2008 Mar 23
2
ggplot2 - legend for fill coulours
Dear All,
I am trying to build a stacked bar plot, where I define the colours to use.
I have asked this before, and I was using a solution in
http://thread.gmane.org/gmane.comp.lang.r.general/100649/focus=100673
(thanks, Thierry).
However, it looks this works only when the data are in the sequence
of the levels in the factor defining the fill colours. When the
sequence is different, the
2008 Mar 25
2
ggplot2 - facetting
Dear All,
After having overcome the issue of legends (thanks, Thierry, once
more), I am trying to use facetting, but here also I can not find how
to do this. I do not want to use qplot, but rather the more flexible
options. However, it seems I am doing still something pretty stupid,
because I always get an error, even if it seems I am doing everything
like the examples.
My code is below.
2007 May 31
4
Aggregate to find majority level of a factor
I want to use the aggregate function to summarize data by a factor (my
field plots), but I want the summary to be the majority level of another
factor.
For example, given the dataframe:
Plot1 big
Plot1 big
Plot1 small
Plot2 big
Plot2 small
Plot2 small
Plot3 small
Plot3 small
Plot3 small
My desired result would be:
Plot1 big
Plot2 small
Plot3 small
I
2012 Oct 31
2
how can xyplot word when with for control flow
Hi everybody,
I recently used xyplot, but I found that for control flow can't work in the
xyplot. The program code and some of my data file are shown as follow.
Would someone please tell me where my code is wrong and how can make the
code right?
Thanks.
Best regards
Yuanzhen Lin
Code:
library("lattice")
plot.data$Fam<-as.numeric(plot.data$Fam)
#### xyplot can work if one
2005 Dec 26
4
lme X lmer results
Hi,
this is not a new doubt, but is a doubt that I cant find a good response.
Look this output:
> m.lme <- lme(Yvar~Xvar,random=~1|Plot1/Plot2/Plot3)
> anova(m.lme)
numDF denDF F-value p-value
(Intercept) 1 860 210.2457 <.0001
Xvar 1 2 1.2352 0.3821
> summary(m.lme)
Linear mixed-effects model fit by REML
Data: NULL
AIC BIC
2008 Nov 24
3
multiple plots in R
Hi, I just try to draw multiple plots in one page using R, I used par
command. For example I have 7 plots, but instead of arranging them in
the default way
plot1 plot2 plot3
plot4 plot5 plot6
plot7
I want them in this order
plot1 plot2 plot3
plot4 plot5 plot6
plot7
Could somebody tell me how to do this, please? Thanks so many.
Suyan
2012 Dec 13
3
Repeat elements of matrix based on vector counts
I have two dataframes (df) that share a column header ("plot.id"). In the
1st df, "plot.id" records are repeated a variable number of times based on
the number of trees monitored within each plot. The 2nd df only has a
single record for each "plot.id", and contains a variable named "load" that
is collected at the plot-level and is only listed once per plot
2009 Apr 14
2
subset dataframe by rows using character vector?
Dear List,
I'm stuck on what seems like a simple indexing problem, I'd be very grateful to anyone willing to help me out.
I queried a dataframe which returns a character vector called "plot". I have another dataframe from which I want to subset or select only those rows that match "plot". I've tried subset, and also the "which" command.
plot
2011 Mar 08
4
beamer overlays with Sweave?
This may be asking too much, but I'm wondering if anyone has a
solution (even a hack) for creating multiple (overlay) plots in an
Sweave file and post-processing the overlays in beamer appropriately.
For example, suppose I have a series of figure blocks in my .Rnw file:
<<plot1,fig=TRUE>>=
[stuff]
@
<<plot2,fig=TRUE>>=
[stuff]
@
<<plot3,fig=TRUE>>=
2010 Aug 20
3
if-else function
Hi R people!
I am looking for some suggestions writing an if-else function.
The idea is to characterize different plots containing counts of
variables (here parasites). If a plot has a count equal or higher than
4 for any parasite the function should return a 1 else a 0. Later I
can loop the function over all plots.
Here I have a little subset of my data:
VariablePAR Plot1
2012 May 10
6
averaging two tables (rows with columns)
Hi R user,I am struggling to figure out on how I can calculate the average from the two tables in R. Any one can help me? really your help would be grateful- I am spending so much time to figure it out. It should not be so hard, I think.
I have very big data but I have created a hypothetical data for simplification.
for example
I have : table 1
table 1: species occurance data
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?
2013 Jun 23
1
Fault geology xyz to raster
Hi,
I have a 3-d geology problem. I have an xyz fault data set. I am able to
view the data set in R using plot3-d but cannot create a raster from it. I
need to create a raster and export so that it can be read in arcscene. Can
anybody help?
Thanks
--
Shane
[[alternative HTML version deleted]]
2011 Jul 19
5
multiple plots in single frame: 2 upper, 1 lower
Hi,
par(mfrow = c(2,2))
will create a 2x2 window that I can use to plot 4 diferent figures in:
[plot1 plot2]
[plot3 plot4]
But how can do 3 so that the bottom spans the width of the upper two:
[plot1 plot1]
[p l o t 3]
Is this possible in R?
--
View this message in context: http://r.789695.n4.nabble.com/multiple-plots-in-single-frame-2-upper-1-lower-tp3679574p3679574.html
Sent from the R
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)
>
2010 Dec 17
1
ggplot missing fill colours in boxplot legend
Hello,
I am trying to create a series of boxplots with the following data, three
columns, "Day" (1 or 2), "Site" (1-4), and "VO2" (some values missing for
some Sites or Days)
> CorbulaMR3
Day Site VO2
1 1 1 88.92223
2 1 1 86.17873
3 1 1 61.08950
4 1 1 190.47922
5 1 1 98.65930
6 1 1 121.03549
7 1 1 67.88404
8
2009 Jul 27
1
Cross-validating two matrices
Hello,
I am trying to help a colleague with an R problem (see below) to whit
I can only generate a very inelegant solution. Any advice would be
welcome.
Thanks,
Brian
If you have two matrices, say a species by trait matrix (Matrix 1
below) and a plot by species matrix (Matrix 2 below), is there a
straightforward way to prune one matrix so that the species list
matches those in a
2006 Oct 04
1
Some questions about plotting with R
Greetings list,
I'm currently in the process of migrating some Matlab code to R. It's
going well, but I'm running into trouble with plotting. There are a
few questions I have.
1) Is there any way to do a 3D line plot in R? This would be what the
Matlab function plot3 does.
2) I would like to create 3 separate plots. With Matlab, this is done
by doing ...
figure;
plot...
2007 Dec 09
1
Saving lattice plot as a PDF
Hi there,
I need to save a series of lattice plots as a PDF,
this is my code so far:
windows(height=8,width=6)
plot.new()
library('grid')
lattice.options(layout.heights=list(top.padding=list(x=0.15,
units="inches")))
print(plot1, split=c(1,1,2,3), more=TRUE)
print(plot2, split=c(1,2,2,3), more=TRUE)
print(plot3, split=c(1,3,2,3), more=TRUE)
print(plot4, split=c(2,1,2,3),
2012 Nov 27
1
Plot from a jpeg
Hi all,
I know that I can for instance draw to plots in one using
nf<-layout(matrix(c(1,2),1,2,byrow=FALSE))
Imagine I have 3 files:
plot1.jpeg
plot2.jpeg
plot3.jpeg
Anyone knows if I can read them and put on one colum and three rows reading
directly from the jpeg file?
Many Thanks
[[alternative HTML version deleted]]