Displaying 20 results from an estimated 1000 matches similar to: "Call trellis function in a function (PR#8827)"
2009 Dec 16
2
problem with a densityplot
Hi,
i have a script how i launch lattice to make a densityplot.
in the script:
jpeg(file="XXX.jpg")
densityplot(~f_diametro+m_diametro+n_diametro, plot.points="rug",
auto.key=T)
dev.off()
does'nt work and in R i dont have any output
but if i launch by R row by row, runs correctly.....
any idea?
2007 Jan 03
3
pb in regular expression with the character "-" (PR#9437)
Full_Name: FAN
Version: 2.4.0
OS: Windows
Submission from: (NULL) (159.50.101.9)
These are expected:
> grep("[\-|c]", c("a-a","b"))
[1] 1
> gsub("[\-|c]", "&", c("a-a","b"))
[1] "a&a" "b"
but these are strange:
> grep("[d|\-|c]", c("a-a","b"))
integer(0)
2003 Apr 14
2
cannot create postscript files with trellis graphics inside a function
Dear People,
If I define
foo <-function()
{
x <- rnorm(500)
trellis.device(postscript, file="plot.ps")
densityplot(~x)
dev.off()
}
and call foo() then plot.ps is just a blank plot. However, if I extract
the lines inside foo and run them, ie.
x <- rnorm(500)
trellis.device(postscript, file="plot.ps")
densityplot(~x)
dev.off()
then plot.ps is created
2008 Dec 31
2
Lattice trellis.focus() with pdf
Hi,
I have a the code for a plot that works perfectly running in R and
printing to a Quartz object but which doesn't work when I make the
trellis device a pdf.
The code is as follows:
----
trellis.device(device="pdf", new=TRUE)
trellis.par.set(my.theme())
dotplot(Y ~ X | C, groups=G, data=D, layout=c(2,1), ... )
trellis.focus("panel", 1, 1)
for (y in 1:5) {
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)
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)
2008 Oct 13
1
Trellis, conditioning on more than 2 variables,
hello,
i need help with:
data$f1<-as.factor(data$f1)
data$f2<-as.factor(data$f2)
s3<-equal.count(data$s2,number=3)
densityplot(~y| f1 + f2 + s3,
data=mydata
)
this produces 3 plots, *successively*, one for each value of s3. i was
hoping it would produce one plot. is trellis limited to 2 conditional
variables? if not, what are the appropriate commands?
thanks!
[[alternative HTML
2012 Jan 19
3
Not generating line chart
Hi All,
Can you please help me, why this code in not generating line chart?
library(ggplot2)
par(mfrow=c(1,3))
#qplot(TIME1, BASCHGA, data=Orange1, geom= c("point", "line"), colour= ACTTRT)
unique(Orange1$REFID) -> refid
for (i in refid)
{
Orange2 <- Orange1[i == Orange1$REFID, ]
pdf('PGA.pdf')
qplot(TIME1, BASCHGA, data=Orange2, geom= c("line"),
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
2006 Dec 22
1
Base R: applying min/max functions() to character string vectors (PR#9428)
Full_Name: Xiao Gang FAN
Version: 2.4.0
OS: Windows XP
Submission from: (NULL) (159.50.101.9)
Dear All,
This is not really a bug report, but rather a change wish to the Base R
behaviour
on some functions when applying them to character strings vectors/matrices.
Actually in R, we can do thinks like, the most naturally way in this the world:
> "a" < "b"
[1] TRUE
>
2008 Dec 11
2
call lattice function in a function passing "groups" argument
I'm trying to use a lattice function within a function and have problems
passing the "groups" argument properly. Let's say I have a data frame
d <- data.frame(x = rnorm(100), y = c("a", "b"))
and want to plot variable x in a densityplot, grouped by the variable y, then
I would do something like
densityplot(~ x, d, groups = y)
If however I wanted to
2010 Dec 15
1
Problems drawing a colored 'rug' in the Lattice 'densityplot'
Hi All,
I'm trying to add a 'rug' representation of my data to a plot created
with densityplot(). While I can do this in the simple case, I can't do
it properly when I include the "groups" argument. I have an example
below. I am running a reasonably new version of R.
print(sessionInfo())
R version 2.12.0 Patched (2010-11-07 r53537)
Platform: i686-pc-linux-gnu
2006 Nov 27
2
as.Date: conversion pb from POSIXct (PR#9386)
Full_Name: Xiao Gang FAN
Version: 2.4.0
OS: Windows
Submission from: (NULL) (159.50.101.9)
> library(chron)
> as.Date(as.POSIXct(strptime("1994-01-24","%Y-%m-%d")))
[1] "1994-01-23"
2012 Feb 22
2
Several densityplots in single figure
Hi,
I have created two separate overlapping density plots- see example code
below.
What I wish now to do is combine them into one figure where they sit side
by side.
Any help would be great!
many thanks in advance, josh.
#####################
thedataA <- data.frame(x1=rnorm(100,1,1),x2=rnorm(100,3,1)) #create data
thedataA.m<-melt(thedataA)
densityplot(~value, thedataA.m,
2006 Jun 26
1
How to generate a figure using par( ) with some densityplot( )'s
Hi Dear R users,
For a pair plotting, usaully we use par( ) function. Apparently it does not work anywhere. I want to have 3 plots in a single figure, like this:
par(mfrow=c(3,1))
densityplot( a)
densityplot(b)
densityplot(c)
But it does not work. How is it possible to have such a figure with densityplot( ) in a single figure?
So many thanks for any help.
Amir Safari
2007 Aug 21
1
small issue with densityplot
Hi folks,
This is really minor but to someone not familiar with the various tentacles of the lmer package it could be really annoying. I was trying to plot the posterior density of the fixed effect parameters of a lmer model,
> hr.mcmc = mcmcsamp(hr.lmer, n=50000)
> densityplot(hr.mcmc, plot.points=F)
There is this error,
"Error in densityplot(hr.mcmc, plot.points = F) :
no
2008 Aug 26
2
awkward behavior with densityplot function
Hi,
I have the following script:
---- t.R ---
grafica <- function() {
v <- read.csv('preprocessed/komolongma.ece.uprm.edu.active',sep=',')
x <- as.ts(v$active)
bitmap(file="output.png")
densityplot(~x,col='blue',main='Density Plot')
dev.off()
}
grafica()
---- t.R ---
When I "sourced" it from R prompt, it quietly runs.
2012 Apr 11
1
Lattice densityplot with semitransparent filled regions
Hello,
I'm doing some graphics for a paper and a need customize such with filled
region above the density curve. My attempts I get something very near what
I need, but I don't solve the problem of use semitransparent filled. Below
a minimal reproducible code. Someone has any idea?
require(lattice)
# toy data...
dt <- expand.grid(A=1:2, B=1:3, y=1:50)
dt$y <- rnorm(nrow(dt), dt$B,
2011 Jul 27
1
How to adjust y-axis when using panel.densityplot within histogram function
Hi
I would like to superimpose group-specific densityplots on top of an overall
histogram using panel.histogram and panel.densityplot. Furthermore, I would
like to automatically adjust the range of the y-axis to take into account
the ranges of both histogram and densityplot. This last part is where I have
a problem. I believe using the prepanel argument of histogram is typically
the way to go,
2008 Mar 10
2
Multiple density plots
Hi all,
I'm interested in doing a multiple density plot on a number of columns in a
dataframe.
>DF
lineA.1 lineA.2 lineB.1 lineB.2
r1 5.355354 6.665575 10.288498 11.74750
r2 3.643415 5.427600 11.407112 13.97065
r3 5.813674 6.438502 9.628871 11.57456
r4 5.241340 5.125049 10.456221 12.35381
r5 4.640885 8.635518 8.344704 11.98484
r6 4.559852 6.416171 10.419599 10.89247
r7