Displaying 20 results from an estimated 30000 matches similar to: "Automating Plot Commands using a Loop"
2011 Jan 11
1
Alphabetic labels on multi-plot graphics
Is there a way to achieve
lbl=c("a", "b", "c", "d")
par(mfrow=c(2,2), ann=FALSE)
for (t in 1:4){
plot(seq(from=1,to=2*pi,length=100),
sin(t*seq(from=1,to=2*pi,length=100)), type="l")
title(main=paste("(", lbl[t], ")", sep=""))
}
without having to use an object like 'lbl'?
More generally: is it possible
2017 Jun 20
2
Help with the plot function
Dear friends,
I have the following dataframe:
YEAR <- c(1996 , 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 )
T_MAR <- c(2.8, 6.5, 5.4,2.4, 4, 4.1, 3, 4.4, 4.5)
T_APR <- c(5.7, 7.8, 7.7, 4.6, 4.7, 6.2,5.7, 5.9, 7)
T_MAY <- c(7, 8.8, 10, 6, 5.5, 7.6, 8.5, 7.3, 10.2)
BUD <- c(87, 98, 93, 85, 89, 91, 87, 92, 92)
BUD_SE <- c(3.6, 2, 2.4, 4, 2.4, 2.4, 4, 2.4, 3)
g1 <-
2017 Jun 20
2
Help with the plot function
I'm trying to recreate a graph similar to the last one found on this link:
https://sites.ualberta.ca/~lkgray/uploads/7/3/6/2/7362679/6c_-_line_plots_with_error_bars.pdf
The difference is that I want budbreak on the top, and the temperatures at
the bottom.
I tried to set par before each graph and include lines, with no avail.
Thanks, Bert.
Andre
On Mon, Jun 19, 2017 at 7:41 PM, Bert Gunter
2017 Jun 20
1
Help with the plot function
Dear all,
I found the last example of this link (
https://sites.ualberta.ca/~lkgray/uploads/7/3/6/2/7362679/6c_-_line_plots_with_error_bars.pdf)
very similar to the one I need to make for my paper, and I think I got what
I wanted by applying some of the suggestions of this mail list.
Here it is the code I devised (maybe there will be further improvements
from the list):
YEAR <- c(1996 ,
2017 Jun 20
0
Help with the plot function
See
?layout
?split.screen
?par (the mfrow and mfcol values)
depending exactly on what you want to do and how you want to do it.
Essentially, these all allow you to make separate plots at different
regions of the device.
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in
2017 Jun 20
0
Help with the plot function
Hi
You are quite close. With slight modification of your code:
par(mfrow = c(2, 1))
par(cex = 0.6)
par(mar = c(0, 0, 0, 0), oma = c(4, 4, 0.5, 0.5))
par(tcl = -0.25)
par(mgp = c(2, 0.6, 0))
plot(BUD~YEAR, type="o", ann=F, axes=F, pch=19, ylim=c(60,100),data=g1)
axis(4, las=2)
mtext("Bud Break (Julian Day)", side=4, padj=4)
arrows(g1$YEAR,g1$BUD, g1$YEAR,g1$BUD + g1$BUD_SE,
2017 Jun 20
0
Help with the plot function
1. Did you study the functions (esp. ?layout) to which I referred you?
2. Show us your code! -- "to no avail" is meaningless!
-- Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Mon, Jun 19, 2017 at 7:01 PM, Andr? Luis Neves
2007 Mar 06
1
Obtaining figures with exactly placed points
Dear list,
I have to plot some geometrical shape given as list of points. My need
is the following: let's say my shape is a 1 inch large square; how can
I plot it with R in a graphic format that gives me an image *exactly*
1 inch large? I tried to set oma, mar and fin parameters, but with no
success.
I'm currently using the xfig driver for the final images are to be
included in latex
2010 Feb 19
1
color graph in multiple plots
Hi,
I would like to distinguish my plots using colors but I got error message. How do I correct that?
plot(ecdf(z), main ="CDF for observed and simulated weighted sum",type="l",lwd=2,col="blue",
xlab="Weighted sum (mm)", ylab="Cumulative Percent", xlim=c(0,15), xaxs ='i', yaxs ='i',ylim=c(0,1))
par(new=TRUE)
2017 Jun 20
2
Help with the plot function
Hi, Bert:
Yes, I studied the functions you suggested, but I didn't get to adapt it to
my example whose reproducible code I sent in my first email.
Here it is the code of the functions I studies:
## par
par(mfrow = c(2, 3))
par(cex = 0.6)
par(mar = c(3, 3, 0, 0), oma = c(1, 1, 1, 1))
for (i in 1:6) {
plot(1, 1, type = "n")
mtext(letters[i], side = 3, line = -1, adj = 0.1, cex =
2009 Nov 02
1
Sorting NA's and Graphing a histogram
Let's say I have a dataset
Dataset<-read.csv("Dataset.txt", header=T, row.names=1)
Dataset
Alpha Beta Gamma Delta
A 1 2 3 4
B NA 2 4 5
C NA 3 NA NA
D 8 9 10 11
E 5 NA 7 13
F NA NA NA 4
I want to remove all rows with more than one NA
So I want it to look like
Alpha
2011 Nov 16
2
strange behavior from cex="*"
Someone inquired on StackOverflow about apparently non-deterministic
graphics behaviour in R. I noticed that they were using cex="*" and
discovered some potentially weird behavior.
On repeated runs of the same code I can get different PNGs. If I set
the number of runs high enough, I seem to be able to get R to hang.
If I do a single version plotting to an interactive graphics
2011 Jun 07
2
Line Graphs
Hello,
I want to plot 6 line graphs. I have 10 points 0.1, 0.2, 0.3, 0.4, 0.5, 0.6,
0.7, 0.8, 0.9 and 1.0.
At each point say 0.1, I have 6 variables A, B, C, D, E and F. The variables
all have values between 0 and 1 (and including 0 and 1). I also want to
label the x axis from 0.1 to 1.0 and the y axis from 0.1 to 1.0.
My goal is to plot a line graph representing the mean of the variables at
each
2008 Dec 30
1
How to set plot resolution
Hi
I'm want to obtain a plot of 1200dpi tiff format, but I met some difficulty.
Could anybody show me some examples about it?
my code:
##############################################
tiff(file="shaw.tiff",width=8.6,height=8.6,units="cm",res=1200,pointsize=10)
plot(bal100,type="l",pch=20,col="red",lwd=1.5,axes=F,xlim=c(1,5),ylim=c(0,0.3),ann=F)
2003 Mar 30
1
Suggestion: add log argument to stripchart
Hello,
I frequently use stripchart to summarise data. Recently I wished to
plot a stripchart on a log scale, so modified stripchart locally. The
change is small, just adding log="" to the function call and
then changing line 42 of src/library/base/R/stripchart.R from:
plot(xlim, ylim, type="n", ann=FALSE, axes=FALSE)
to:
plot(xlim, ylim, type="n",
2008 Sep 04
2
Adding a legend to R graph device with several plots (no to individual plots!)
Dear Users, I already posted this question: it either went unnoticed,
or it is to basic (if this is so, please sent me a hint).
I would like to know if there is a way to add a common
legend to an arrangement of plots. In the example below, I get four
plots in my device. each one has a density for 1995 and one for 2006.
I have found that using legend or smartlegend I can add a legend to
each plot,
2005 Apr 29
2
Automating plot labelling in custom function in lapply() ?
Dear List,
Consider the following example:
dat <- data.frame(var1 = rnorm(100), var2 = rnorm(100),
var3 = rnorm(100), var4 = rnorm(100))
oldpar <- par(mfrow = c(2,2), no.readonly = TRUE)
invisible(lapply(dat,
function(x) {
plot(density(x),
main = deparse(substitute(x))) }
)
)
2009 Jun 03
2
Problems with plot and Quartz device (PR#13744)
Full_Name: Thomas Richardson
Version: R 2.9.0 GUI 1.28 Tiger build 32-bit (5395)
OS: 10.4.11
Submission from: (NULL) (216.254.15.72)
I have encountered a problem with points in scatterplots disappearing in a
quartz window when it is re-sized (to make it larger).
I am constructing an 8x12 matrix of scatterplots each containing approx 600
points.
In order to get them in the window I remove the
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
2009 Jul 09
2
X-axis labels not displayed when changing ylim
Dear R users,
I am encountering a x axis labeling problem on quite basic plots...
I use the following code which displays the labels on the x-axis with a
45 degrees angle:
p <- plot(myobject1, type="b", col="red",cex=1, lwd=2, axes=FALSE,
ann=FALSE, ylim=c(0,70))
title(main="title", font.main=4)
axis(side=1, lab=F)
text(axTicks(1), par("usr")[3] - 2,