Displaying 20 results from an estimated 40000 matches similar to: "plotting with same axes"
2005 May 31
2
simple predict question
Excuse the simple question...
I'm not sure what I'm doing wrong with predict, but let me use this example:
Suppose I do:
dat<-matrix(c(0,0,10,20),2,byrow=T)
lm1<-lm(dat[,2]~dat[,1])
Suppose I want to generate the linearly-interpolated y-values between the
point (0,0) and (0,20) at every unit interval.
I thought I just do:
predict(lm1, data.frame(seq(0,10,1))) to get
2005 May 24
3
obtaining first and last record for rows with same identifier
I have a dataframe that contains fields such as patid, labdate, labvalue.
The same patid may show up in multiple rows because of lab measurements on
multiple days. Is there a simple way to obtain just the first and last
record for each patient, or do I need to write some code that performs that.
Thanks,
Steven
2007 Jun 14
1
scatterplots: (equal axes and overlay)
Hi,
I am doing lots of scatterplots for my dissertation and to make the
comparable, I would like to have equal x- amd - y axis. Can I specify
their scale?
Another question adresses overlay scatterplots. Having prae and post
measures for each case, is it possible to have them in one graph with
symbols or colors for prae and post.
So
scatterplot(bdiprae,mocoprae) and
scatterplot(bdipost,mocopost) in
2011 Jan 26
2
plot with 2 y axes
Dear R users,
apologies for the total beginner's question. I would like to create a
barchart for some temperature values with the y axis on the right hand
side of the plot. On this plot would like to overlay some time series
data (in the form of a line) for some other variable called Index.
The y axis for this latter variable should be on the left hand side of
the plot.
An example of what I
2003 Oct 12
1
plot/ layout/ overlay problem
System info:
Red Hat 9.0
R Version 1.7.0
ESS 5.1.21
Emacs 21.2.1
-------------------
Colleagues
I have a small problem with positioning overlays using layout.
## Purpose: to plot temperature and salinity profiles
## as a multipanel figure, and
## overlay the the mixed
## layer depths.
Here is the code skeleton:
--------------------
nf <-
2010 Sep 13
2
Overlay of two graphs of different axes
Though I have read quite a bit, and tried quite a bit, I have yet to
find a nice way to overlay 2 or more curves in the same plot, with
different ranges.
Here is simplified sample code to demonstrate the question:
> plot(2*(seq(1,5)), type="l", axes=FALSE)
> curve(2*(seq(1,5)), type="b", add=TRUE)
Error in curve(2 * (seq(1, 5)), type = "b", add = TRUE) :
2005 May 06
2
2 simple questions
Please excuse what I'm sure are very easy questions but I'm relatively new
to the R environment.
How can I view a range of list elements, but not all. e.g., I had a matrix
of patients and then split them out by patient id. I know I can do
patlist[[1]] to see the first one, but how can I view, say, the first ten
patients?
My other question is how to count how many patients have a
2008 Jan 18
2
plotting other axes for PCA
Hi R-community,
I am doing a PCA and I need plots for different combinations of axes (e.g.,
PC1 vs PC3, and PC2 vs PC3) with the arrows indicating the loadings of each
variables. What I need is exactly what I get using biplot (pca.object) but
for other axes.
I have plotted PC2 and 3 using the scores of the cases, but I don't get the
arrows proportional to the loadings of each variables on
2009 May 13
1
Overlaying two plots
Hi useR's,
I want to overlay an image plot over a world map and I can do it, but just
not the way I need to do it. Here is the code I am using (with data file
attached) to create my baseline map:
library(sp)
load("TM_WORLD_BORDERS_SIMPL-0.2.RData")
par(bty="l")
plot(wrld_simpl, axes = TRUE, ylim = c(-90, 90), xlim=c(-180, 180), asp=1.5)
lim <- par("usr")
2017 Oct 19
1
overlaying points and lines on a surface3d rgl plot with axes
Hi R users and experts,
I am interested in learning more about the use of 3D plots. Specifically, I
want to add points and lines to a surface plot. And get the axes and labels
plotted also. Here is what I have tried with an example data set :
library(rgl)
vol2 <- 2*volcano # Exaggerate the relief
library(reshape)
mvol2 <- melt(vol2)
str(mvol2)
# First, persp and persp3d plots do not succeed
2005 Jun 09
2
Weibull survival modeling with covariate
I was wondering if someone familiar
with survival analysis can help me with
the following.
I would like to fit a Weibull curve,
that may be dependent on a covariate,
my dataframe "labdata" that has the
fields "cov", "time", and "censor". Do
I do the following?
wieb<-survreg(Surv(labdata$time,
labadata$censor)~labdata$cov,
2010 Apr 21
1
overlaying a levelplot on a map plot
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), ylim = range(mlat)), where mlon, mlat
specifies the study region.
I've tried plotting the map first, then using the options: 'add=TRUE,
2013 Jun 10
1
Using Lattice, LatticeExtra - Hide right and top axes in multipanel plots
Dear Rxperts,
How do I hide the top and right axes in multiple panel plots? A couple of
examples are provided below.. Would highly appreciate appreciate your
assistance..
#Example 1
library(latticeExtra)
xyplot((1:200)/20 ~ (1:200)/20, type = c("p", "g"),
scales = list(x = list(log = 2,alternating=0), y = list(log =
10,alternating=0)),
xscale.components =
2007 Oct 13
1
Plotting with 2 y axes
My data is the following:
Time
Resistance
Temperature
5
2000
4
10
2200
8
15
2500
14
20
2900
20
25
3000
29
30
3100
38
35
3500
46
40
3800
47
45
3900
50
50
4000
51
I would like to create a scatter plot with Time on the x axis, Resistance on
the y axis and Temperature on a second y axis.
I have tried
Plot(Time,Resistance,ylim=range(0,4500)
2005 Feb 16
5
scaling axes when plotting multiple data sets
1) When adding additional data sets to a plot using "plot" followed by "lines",
is there a way to automate the scaling of the axes to allow for all data sets
to fit within the plot area?
2) I attempted to solve this by setting
xlim=c(min(c(data1,data2,data3)),max(c(data1,data2,data3)))
however, there are some NAs and Infs in these data sets, and min(data1) and
max(data1) both
2011 Mar 27
2
overlaying
Dear List,
I am working with a small (3 columns and 9 rows) data table, which contains
9 observations, their mean values and standard deviations (I extracted these
data from a huge set and I cannot use the original data). I plotted means
(y-axis) and the observations (x-axis) using the " plot() " command.
However, I am not sure how to plot the standard deviation data on top of
this. This
2009 Jan 08
1
Alignment of image plot overlay
I'm having trouble with alignment of a trend line overlayed onto an image
plot. The two should be plotted on the same x-axis (time-series). However,
the trend line begins about an inch into the image plot x-axis and ends
about an inch off of end of the image plot. Once I have the alignment
sorted, I need to put a secondary y-axis on the image plot which is scaled
for the trend line. An
2012 Sep 27
3
Comparing density plots using same axes or same axes scale
Good Evening-
I have a set of nine scenarios I want to plot to see how the distribution
is changing, if one tail is getting larger in certain scenario, currently I
am using this code
colnames<-dimnames(sag_pdfs)[[2]]
par(mfrow=c(3,3))
for(i in 1:9) {
d<-density(sag[,i])
plot(d,type="n", main=colnames[i])
polygon(d,col="red",border="grey")}
where sag is
2005 Jan 14
2
Help in Overlaying of 2 Plots on the same Device.
I'm trying to overlay a density plot on a previously plotted histogram. However, i need to use the same axis as of the 1st(histogram) plot to plot the second. My second plot is creating its own axis and causing my plot to extend the entire histogram instead of getting a subplot on a portion of the histogram. I tried 'fig' and 'new' parameters with no luck.
Thanks in advance.
2004 Dec 01
1
Manipulating contour plots
Dear R users,
I would like to create a filled.contour plot with colour bar and overlay
a map.
I need to create several of these representing variables with different
spatial extents for comparison. When I try to fix the plot area size and
axes limits as follows:
par(fig=c(0,1.0,0.3125,1.0)
filled.contour(x=seq((320/2)-180.5,(480/2)-180.5,len=nrow(oct94)),