Displaying 20 results from an estimated 10000 matches similar to: "XYplot in Lattice Package"
2010 Apr 04
2
One question about saving graph by using xyplot
Hey, folk.
I am trying to get many figures by using the function "xyplot" in the library "lattice". I tried to using the loop to finish it quickly. But I cannot open the saved file after I run the program. But if I use the function "plot" to get other simply figures, it can work. So I want to ask how I can get the saved figures by using "xyplot".
The
2010 Feb 17
2
Problems with xyplot
Hello
I wonder whether someone can tell me what I am doing wrong. Here is the
code (from Bayesian Computation with R - Chapter 2.3.R) that I am trying to
run
####################################
# Section 2.3 Using a Discrete Prior
####################################
graphics.off() # Close all graphics
rm(list=ls()) # Clear all variables
library(LearnBayes)
2009 Apr 14
1
Lattice xyplot: Line and Rectangle in legend.
Hello fellow R users,
I have a problem. I have created a barchart overlayed by an xyplot line,
both of which read off the same Y axis. The problem comes when I try to
generate a key. It seems that I can only create either two lines, or two
rectangles. I would much prefer to have the barchat series depicted by a
rectangle, and the xyplot series by a line. Is there a way to do this?
Your help
2007 Apr 24
2
xyplot source file only work with echo=TRUE
Hi,
I write several xyplot graphics on a source file. When I try to use
source("graphics.R") the source don't work, but if I use
source("graphics.R",echo=T) it work. Generally some commands work without
echo=T, but xyplot dont work. Why it dont work without echo=T? It is possible
to write a source that dont need echo=T on source command?
Thanks
Ronaldo
--
Aluno de
2009 Nov 25
1
lattice: plotting in a loop
Hi,
I'm having trouble seeing graphics output from lattice xyplot() when called
from inside a for loop:
x <- 1:50
for ( i in 1:5 ) {
y <- rnorm(x)
xyplot(y~x) # no graphics when inside for-loop
# plot(x,y) # works fine
# Sys.sleep(0.5) # doesn't seem to help
}
The xyplot() is fine outside the loop. Results are the same to X11 device
and to file
2010 Jan 27
1
Problem with xyplot when creating a .png graphic
Hello,
I have the following problem. I have created a couple of scripts to
create .png graphic files from data plots, using the xyplot (lattice)
command. When I refere to the script with source(""), the script will be
red but there is no output file. The scripts work well with the regular
plot command and produce a nice PNG file.
On the other hand if I entre the single commands
2009 Oct 01
2
Re gression for levels of a factor/xyplot type="r"
Hi,
I'm sure these are basic problems so I apologise in advance for my
ignorance. I have a dataset with X, Y, and a Factor with 4 levels. I am
trying to figure out how to use lm() to find the r2 value, slope and
intercept of an X~Y regression, for each level of the Factor. Is there a
way to do this automatically without having to specify different subsets of
the factor?
my code so far:
2004 Dec 10
1
lattice graphics empty in Sweave
Hello,
I have problems using lattice graphics together with Sweave under
Windows XP and R 2.0.0; 2.0.1 Patched; 2.1.0 devel respectively.
Base graphics are o.k., but for lattice graphics empty files (.eps and
.pdf) are generated.
The only workaround I found was to write and read the respective figures
explicitely using postscript() and includegraphics{}.
Have I missed something to solve this
2007 Feb 14
1
lattice graphics and source()
Hi,
I am trying the lattice graphics in R. Let's say, such a little
experiment in file myprog.r:
f <- function(){
x <- 1:10
y <- x^2
xyplot(y ~ x)
}
f()
Then I run the program:
> source("myprog.r")
but nothing happens. Manully run f() at the command line:
> f()
then the figure is shown. This seems to be a bug only associated with
lattice graphics, the
2009 Oct 15
1
Lattice package - Trellis
Hi,
I was trying to make a graph using trellis, and my code is:
-----------------------------------------------------------------
library(lattice)
makeGraph <- function(){
trellis.device()
tbg <- trellis.par.get("background")
tbg$col <- "white"
trellis.par.set("background",tbg)
# Test Data
mfr <- matrix(sample(1:100,50,replace=T),ncol=2)
2008 Sep 07
2
Corrupted PDF files
I have the following code that when executed from the command line
works properly and produces a proper PDF. When the script is executed,
the PDF produced is considered corrupt. I am using R 2.7.2 on Mac OSX
10.5.4. Thank you in advance for the help!
library(lattice)
pdf(file="CLDiag2.pdf")
xyplot(
CL ~ HT + WT + AGE + CREA + SEX,
data=data2,
outer=TRUE,
2010 Jan 09
1
lattice, add text to xyplot
Hello listers,
Does anybody know how to add text to an xyplot without whipping out
the existing curve?
That's all.
For instance,
Lets say you generate a graph like this
A <- data.frame(x = rnorm(100), y = rnorm(100))
xyplot(y ~ x, data = A)
How would you add 'Hello world'?
I tried 6.02E23 different partial solutions found on the web and
failed. I just need one EXAMPLE that
2008 Jul 01
3
dev.off() inside a function & other glitches
Hi R people
I am using a function to create a pdf device, then send a lot of plots
to it in a loop then a last lattice xyplot (itself within a function)
outside the loop and finally call dev.off() to write to the file.
This works well apart from the fact that the last plot does not get
sent to the file unless I comment out dev.off() and then apply it in
the console afterwards instead:
2009 Feb 05
1
Problem with plotting data from within a function
Dear List,
I try to develop code where plotting functions are embeded in my own
functions. The following is simplified example:
> test <- function() {
> data <- data.frame(x=rep(1:2, each=50), y=rnorm(100))
> library(lattice)
> attach(data)
> xyplot(y~x)
> detach()
>}
>test()
As far as I understand R, when test is called this should create one local
2006 Jun 13
2
levelplot and source() problems
I have been using levelplot but have had trouble calling it inside
functions - something seems to go wrong when it's not called directly from
the R command prompt. Simplest reproducible example:
$ R --vanilla
> library(lattice)
> levelplot(matrix(1:4,2,2))
- This gives a nice plot in soothing pastel colors.
Now, with a file lptest.r containing 2 lines:
library(lattice)
2011 Mar 07
4
png inside loop
hello list! I'm sorry, I just stumbled over this strange behaviour (at
least I am not able to explain the behaviour, therefore I assume it to
be a strange behaviour):
attach(water) # I know, this is not recommended
names(water[3:10])
[1] "temp" "pH" "DO" "BOD" "COD" "no3" "no2" "po4"
for (i in
2008 Dec 10
2
How to Break Axis in Lattice Plot
Dear All,
I have searched the following problem in the R help achives, and there did
not seem to be solutio for it.
The problem is how to break the axis in the xyplot (lattice plot). I read
the posts using the package plotrix, buy it doesn't work with the xyplot,
which is lattice based.
A simple example is attached below:
xyplot(c(1:10,100)~c(1:10,100))
What I would like to do is
2008 Oct 04
1
Number format in log-scaled lattice xyplots
For a non-log-scaled y-axis, I was able to change the appearance of the
y tick labels in an xyplot by using a custom function for
yscale.components. However I couldn't get that approach to work for when
scales=list(y=list(log=TRUE)).
What I'm trying to do is make the y-tick labels show up as something
like (10, 100, 1000, etc.) rather than the default (10^1.0, 10^2.0,
10^3.0, etc.).
2010 Nov 30
2
xyplot : superimposed 2 groups in different panels
Hello,
I would like to plot the following xyplot : for each date of fff (1 date per
panel), bbb=f(aaa) for the two groups (ddd=1 and ddd=2) superimposed.
I can do it by group (see below) but not together.
I looked at http://lmdvr.r-forge.r-project.org/figures/figures.html but I
haven't found what I was looking for (to be honest, I haven't understood all
the examples).
Any help will be
2008 Jan 01
2
Alignment and Labeling of a color key in a xyplot?
Happy New Year to all R users!
I have two short questions concerning a xyplot with a color key:
1) How do I properly place (align) the color key beside the xyplot?
As you can see from the code listed below, the placement of the color
key is not correct. I would like the upper and lower end point of the
color key to be perfectly aligned with the upper and lower line of
the xyplot. Adjusting