It's easy enough to do this,
the question is "what does it MEAN?"
If you overlay two graphs, what comparisons will
people naturally make, and what do
you want them to make?
What transformations on the x axis would make
two vertically aligned points about the "same" thing?
What transformations on th
Thanks a lot Rui and Jim. Works great !
On Tue, Feb 7, 2023, 1:34 PM Rui Barradas wrote:
> Às 21:18 de 07/02/2023, Jim Lemon escreveu:
> > Hi Bogdan,
> > Try this:
> >
> > A<-data.frame(x=c(1,7,9,20),
> > y=c(39,91,100,3))
> > B<-data.frame(x=c(10,21,67,99,200),
> > y=c(9,89,1000,90,1001)) #
Às 21:18 de 07/02/2023, Jim Lemon escreveu:
Hi Bogdan,
Try this:
A<-data.frame(x=c(1,7,9,20),
y=c(39,91,100,3))
B<-data.frame(x=c(10,21,67,99,200),
y=c(9,89,1000,90,1001)) # one value omitted to equalize the rows
xrange<-range(c(unlist(A$x),unlist(B$x)))
yrange<-range(c(unlist(A$y),unlist(B$
Hi Bogdan,
Try this:
A<-data.frame(x=c(1,7,9,20),
y=c(39,91,100,3))
B<-data.frame(x=c(10,21,67,99,200),
y=c(9,89,1000,90,1001)) # one value omitted to equalize the rows
xrange<-range(c(unlist(A$x),unlist(B$x)))
yrange<-range(c(unlist(A$y),unlist(B$y)))
plot(A,type="l",xlim=xrange,ylim=yrange,col
Dear Rui, and Petr,
many many thanks for your time and advice ! 'm still exploring the R code
that you have suggested !
On Thu, Feb 25, 2021 at 2:59 AM Rui Barradas wrote:
> Hello,
>
> First of all, I believe you want argument fill, not colour. In ggplot2
> colour is about the border and fill a
Hello,
First of all, I believe you want argument fill, not colour. In ggplot2
colour is about the border and fill about the interior.
As for the question,
1. Create a basic plot with the common aesthetics.
library(ggplot2)
pp_ALL <- iris[c(1, 5)]
names(pp_ALL) <- c("VALUE", "EXP")
p <- gg
: PIKAL Petr
Cc: r-help
Subject: Re: [R] overlaying frequency histograms or density plots in R
Thanks a lot Petr !
shall i uses "dodge" also for the RELATIVE FREQUENCY HISTOGRAMS :
p <- ggplot(iris, aes(x=Sepal.Length, y=..count../sum(..count..)*100,
colour=Species))
p+g
Thanks a lot Petr !
shall i uses "dodge" also for the RELATIVE FREQUENCY HISTOGRAMS :
p <- ggplot(iris, aes(x=Sepal.Length, y=..count../sum(..count..)*100,
colour=Species))
p+geom_histogram(position="dodge")
or is there any other way to display the RELATIVE FREQUENCY HISTOGRAMS ?
thanks again !
Hi
You should use position dodge.
p <- ggplot(iris, aes(x=Sepal.Length, colour=Species))
p+geom_density()
p <- ggplot(iris, aes(x=Sepal.Length, y=..density.., colour=Species))
p+geom_histogram(position="dodge")
Cheers
Petr
> -Original Message-
> From: R-help On Behalf Of Bogdan Tanasa
>
On 4/22/20 7:31 AM, Cade, Brian S via R-help wrote:
Hi All. I am trying to construct a graph using the xYplot() function in Hmisc
package (thank you Frank Harrell) taking advantage of the Cbind() argument for
plotting the median, 10th, and 90th quantiles and also the cbind() argument for
in
Reproducible example with data via dput?
Code that you used that 'didn't work'?
Error messages or output and why it was not satisfactory?
Following the posting guide by providing such information is more
likely to generate useful answers and save both you and those who try
to help a lot of wasted
Hi R-users,
I think that I have figured out what I should do. But I would welcome any
comments clarifying any of the questions that I have raised. (I am showing
my revised code below). The questions which are still unresolved for me are
the following :
1. With the points3d or the plot3D function,
Dear Kristi,
You could do something like this.
ggplot(dat1, aes(x = factor(site), y = Present)) +
geom_boxplot(aes(colour = layer)) +
geom_line(data = dat2, aes(group = 1, y = present)) +
geom_point(data = dat2, aes(y = present))
Note that
- ggplot provides no second axis
- the boxplots di
Hi Kristi
Jim has given you 1 non ggplot2 solution here is one from lattice
panel.average is a line so added a line for points
# convert site to a factor
dat1$Site = factor(dat1$Site)
datav <- aggregate(Present ~ Site, dat1,mean)
datav
diff(datav[,2]) # test
bw1 <-
bwplot(Present~Site,dat
On Jan 27, 2014, at 3:13 AM, Kristi Glover wrote:
> Hi R Users,
> I was struggling to overlay two graphs created from the two different dataset
> using ggplot2. Furthermore, I could not join means of the box plots.
>
> I tried this way but did not work. Any suggestions?
> dat1<-structure(list(s
How about this?
require(FNN)
#FOR DEMONSTRATION PURPOSES, GENERATE 2D DATA
set.seed(3242)
X <- matrix(runif(50),ncol=2)
plot(X,pch=16,cex=1.5, asp=1)
#PLOT GRID
grid <- as.matrix(expand.grid(seq(0,1,by=.1),seq(0,1,by=.1)) )
abline(v=unique(grid[,1]),col="#FF30")
abline(h=unique(grid[,2]),co
Gonçalo,
Interesting question. You can use the optim() function to optimize a
function over two dimensions. Here's an example.
# some clumpy "cloud" data
myx <- c(0.3 + rnorm(50, 0, 0.05), 0.7 + rnorm(50, 0, 0.05))
myy <- c(0.45 + rnorm(50, 0, 0.05), 0.65 + rnorm(50, 0, 0.05))
# size of the fi
str(x) ; str(y) reveals
#zoo series ...
# ..$ : chr [1:3] "a" "c" "b" ## HERE
# Index: Date[1:100], format: "2010-01-01" "2010-01-02" "2010-01-03"
"2010-01-04" ...
#'data.frame':99 obs. of 3 variables:
# $ ID : Factor w/ 3 levels "a","b","c": ## HERE
# ..
Try this:
# define the locations on the x axis for each cell in the image
nxcells <- dim(m)[2]
xlocs <- (seq(nxcells)-1)/(nxcells-1)
# define the groupings
group <- rep(1:3, c(10, 20, 25))
# calculate the range of locations on the xaxis for each group
group.ranges <- sapply(split(xlocs, group),
ealth, Medicine, and Life Sciences
Maastricht University, P.O. Box 616 (VIJV1)
6200 MD Maastricht, The Netherlands
+31 (43) 368-5248 | http://www.wvbauer.com
> -----Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of Michael D
From: Michael Dewey
To: "Frank Peter" , r-help@r-project.org
Subject: Re: [R] Overlaying density plot on forest plot
Date: Sun, 11 Dec 2011 14:20:13 +
> At 07:16 10/12/2011, Frank Peter wrote:
> >Dear R User,
> >
> >Please, I am new to R. I want to overlay density
At 07:16 10/12/2011, Frank Peter wrote:
Dear R User,
Please, I am new to R. I want to overlay density plot for predictive
interval pooled result in meta-analysis.
http://addictedtor.free.fr/graphiques/graphcode.php?graph=114
It is hard to be sure from your rather brief question but does the
Frank,
Have you tried the R function overlay(), it is exactly applying to your
question.
Jeff
--
View this message in context:
http://r.789695.n4.nabble.com/Overlaying-density-plot-on-forest-plot-tp4179654p4180430.html
Sent from the R help mailing list archive at Nabble.com.
__
Using my mind-reading skills, plot.Map(), while deprecated, does provide an
add= option.
If this doesn't help, you'll need to read the posting guide and provide (a lot)
more
information.
Ray Brownrigg
On Thu, 19 May 2011, michael.laviole...@dhhs.state.nh.us wrote:
> I'm having difficulty over
A couple of possibilities:
The rasterImage function (in the graphics package)
The my.symbols and ms.image functions in the TeachingDemos package.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
> -Original Message-
> Fr
--- On Sun, 3/27/11, Bulent Arikan wrote:
> From: Bulent Arikan
> Subject: [R] overlaying
> To: r-help@r-project.org
> Received: Sunday, March 27, 2011, 5:45 PM
> Dear List,
> I am working with a small (3 columns and 9 rows) data
> table, which contains
> 9 observations, their mean values and
Tena koe
There are many ways. I tend to use the arrows() function. See
?arrows
HTH
Peter Alspach
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Bulent Arikan
> Sent: Monday, 28 March 2011 10:45 a.m.
> To: r-help@r-p
On Oct 13, 2010, at 11:44 AM, Jeremy Olson wrote:
Dear All,
I have 4 or 5 contour plots that I need to overlay. Currently they
are maps showing hot and cold areas for specific elements.
Providing paste-able examples is the standard way to present such
problems.
I would like to combine
Thanks so much for that elegant solution... it works extremely well.
I'm now trying to add lines, points and polygons to show transects,
locations of the original data points and the bounding polygon of the study
area. Presumably I can use panel.polygonsplot, panel.pointsplot for this?
--
Vie
You are plotting the entire lattice plot (including axes, margins etc)
in the grid viewport. What you want to do is to call the panel
function, panel.levelplot(), instead.
However, why not just
mm <- map('worldHires', plot = FALSE)
levelplot(z~x+y,xyz, mm = mm, panel = function(..., mm) {
pan
You don't have to use map() to draw the map.
m <- map(..., plot = FALSE)
xyplot(y ~ x, m, type = "l", aspect = "iso",
par.settings = list(axis.line = list(col = "transparent")))
or inside a panel function, assuming appropriate scales:
panel.xyplot(m$x, m$y, ...)
On 23 April 2010 04:38, David
Thanks for those pointers making some progress now
The following will put the levelplot on to the map, but the not with the
co-ordinates aligned...
The level plot appears on a slightly larger scale compared to the underlying
map.
In both the map and levelplot, the coordinates are in lon, lat
On Apr 22, 2010, at 2:24 PM, Kevin Wright wrote:
Mixing base/lattice graphics can be tricky, but is possible.
http://www.bioconductor.org/CRAN/web/packages/gridBase/vignettes/gridBase.pdf
That could be quite useful in the future. Thanks for that.
Also, did you look at Chapter 13 of the la
Mixing base/lattice graphics can be tricky, but is possible.
http://www.bioconductor.org/CRAN/web/packages/gridBase/vignettes/gridBase.pdf
Also, did you look at Chapter 13 of the lattice book?
http://lmdvr.r-forge.r-project.org/figures/figures.html
Kevin
On Wed, Apr 21, 2010 at 2:08 PM, David
On Apr 22, 2010, at 5:33 AM, Simon Goodman wrote:
Thanks for the suggestions Unfortunately contour won't in this
case as it
expects the x,y values to be in an ascending sequence.
?order
David Winsemius, MD
West Hartford, CT
__
R-help@r
Thanks for the suggestions Unfortunately contour won't in this case as it
expects the x,y values to be in an ascending sequence.
--
View this message in context:
http://r.789695.n4.nabble.com/overlaying-a-levelplot-on-a-map-plot-tp2019419p2020292.html
Sent from the R help mailing list ar
Try using contour() instead of levelplot. See the examples
in help('contour') for how to add contour lines to an
existing plot.
-Peter Ehlers
On 2010-04-21 13:08, David Winsemius wrote:
On Apr 21, 2010, at 2:27 PM, Simon Goodman wrote:
I've generated a levelplot showing the density distrib
On Apr 21, 2010, at 2:27 PM, Simon Goodman wrote:
I've generated a levelplot showing the density distribution of a
species
derived from survey transects, with lon, lat co-ordinates.
I'd like to overlay this on a map of the study region specified by:
map('worldHires', xlim = range(mlon), y
Try using the subplot function from the TeachingDemos package.
Hope this helps,
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> projec
On Thu, Apr 30, 2009 at 2:03 PM, MUHC-Research
wrote:
>
> Dear R-users,
>
> I recently began using the ggplot2 package and I am still in the process of
> getting used to it.
>
> My goal would be to plot on the same grid a number of curves derived from
> two distinct datasets. The first dataset (ca
Dear Marion,
Take a look at the first example in ?pairs.
HTH,
Jorge
On Thu, Apr 30, 2009 at 7:21 AM, Marion Dumas wrote:
> Hello
> I have a multivariate data frame giving various responses for several
> treatments. I would like to plot the relationship in the responses in a
> pairs plot with
Another option,
library(ggplot2)
qplot(year, value, data=melt(foo), color= L1)
which can also be achieved "by hand",
test<- do.call(rbind,foo) # combines all data.sets
test$name <- do.call(rep, list(x=names(foo), times =
unlist(lapply(foo,nrow # append the name of the original dataset
Create a zoo object z and plot it:
library(zoo)
f <- function(x) zoo(x$data, levels(x$year)[x$year])
z <- do.call(merge, lapply(foo, f))
plot(z, screen = 1, col = 1:6, pch = 1:6, type = "o",
ylab = "data", xlab = "year")
legend("topright", legend = 1:6, lty = 1, pch = 1:6, col = 1:6)
See
On 1/6/09, Assaf oron wrote:
> Hi all,
>
> I want to create a rather standard overlaid qqnorm plot on a single
> variable, with different subgroups of the same dataset plotted using
> different colors/symbols/etc. (I don't want side-by-side, rather
> different-colored curves on the same graph)
Suppose if I modify the question as:
> x
A B C D E
a 0 0 0 0 1
b 0 1 0 2 1
c 1 2 0 1 2
d 0 0 0 2 0
e 0 1 2 0 2
> y
D E F
b 2 1 2
a 4 0 1
f 1 4 1
I need to get a matrix, which has the dimension being the union of the
row names and column names of both x and y such that the new matrix 'xx'
sho
try this:
x1 <- matrix(NA, 6, 6,
dimnames = list(letters[1:6], LETTERS[1:6]))
x2 <- matrix(rpois(9, 1), 3, 3,
dimnames = list(c("b","a","f"), c("D","E","F")))
x1[rownames(x2), colnames(x2)] <- x2
x1
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Biostatistical Centre
School o
Perhaps somethink like about this:
x1[rownames(x2),colnames(x2)] <- x2
x1
On Mon, Jun 9, 2008 at 8:26 AM, Shubha Vishwanath Karanth <
[EMAIL PROTECTED]> wrote:
> Hi R,
>
>
>
> I have a matrix,
>
>
>
> > x1=matrix(NA,6,6,dimnames=list(letters[1:6],LETTERS[1:6]))
>
> > x1
>
> A B C D E F
>
Deepayan:
Very nice, thanks for introducing me to a new resource. I will include the
entire, functioning example in the event others may find it useful.
--Seth
## Sample code for overlaying data points on a contour graph, using
xyplot and contourplot ##
library(lattice)
mo
Hi Seth,
An alternative would be to use ggplot2, http://had.co.nz/ggplot2:
model <- function(a,b,c,X1,X2) {
(exp(a + b*X1 + c*X2)) / (1 + exp(a + b*X1 + c*X2))
}
g <- expand.grid(X1 = seq(0.40, 0.8,0.01), X2 = seq(0.03,0.99,0.03))
a <- -37.61
b <- 34.88
c <- 28.44
g$z<- model(a, b, c, g$X1,g$
On 12/13/07, Seth W Bigelow <[EMAIL PROTECTED]> wrote:
>
> Friends: I wish to overlay data points on a contour graph. The following
> example produces a nice contour plot, but I have not mastered the concept
> of using panel functions to modify plots. Can someone show me how to
> overlay the data
50 matches
Mail list logo