Displaying 20 results from an estimated 2000 matches similar to: "Different labels by panel in barchart"
2007 Feb 24
2
barchart (lattice) with text labels
I would like to place the value for each bar in barchart (lattice) at
the top of each bar. Something like the following code produces.
library(lattice)
mypanelfunc <- function(x, y, ...)
{
panel.barchart(x, y, ...)
panel.text(x, y, labels=as.character(round(x,2)), ...)
}
myprepanelfunc <- function(x, y, ...) list(xlim=c(0, max(x)+.1))
mydata <- expand.grid(a=factor(1:5),
2011 Oct 19
1
help with x axis on lattice barchart--R-Beginner
Hi all,
I am trying to compare catch vs day over a ten year period, and the graph
looks great except for the individual dates. there are so many that my x
axis labels have become one giant black line. Can I only label some of the
days or will I be unable to fix this using a barchart?
data is called chipps
2010 Feb 20
3
Error Bars in lattice- barcharts
Hello,
I am attempting to write a script that adds error bars to a barchart. I
basing my attempt heavily on the following thread:
http://tolstoy.newcastle.edu.au/R/e2/help/06/10/2791.html
I can't seem to get around the problem that was discussed in the thread. The
following example should illustrate my problem. Sorry about the messy
example but I am 1) trying to make it as close as possible
2010 Jul 19
1
pcaMethods and Lattice help.
I've been using the pcaMethods to develop a scores matrix
=======================================
data(iris)
pcIr <- pca(iris[,1:4], method="nipals", nPcs=3, cv="q2")
test <- scores(pcIr)
========================================
What I'm looking to do is to use lattice's barchart to plot the scores
something like below, but expanded to all the scores
2008 Sep 16
2
Setting user colors in barchart
Dear R Users,
I have a basis question regarding the use of color in the lattice package. I
read the ?barchart help page and searched the R archives but could not
understand how to do it.
I just need to plot a barchart using specific colors for my groups, e.g.
green and red instead of the default lattice colors. How do I do that?
If I say:
barchart(x ~ a_factor, groups=my_groups,
2010 Nov 30
2
Error bars in lattice barchart with groups
Dear R-users,
i want to plot gene regulation data in a lattice barchart. To illustrate
the problem i encounter, the following code uses the "barley"dataset:
library(lattice)
barley[["SD"]] <- 5
PLOT <- barchart(data=barley, yield~variety|site, groups=year,origin=0,
as.table=TRUE,
scales=list(x=list(relation="same",
rot=30),
y=list(alternating=3,tck=-1)),
2006 Mar 01
2
lattice-Internal
Hi,
The functions prepanel.default.bwplot() and lpretty() are not running in Deepayan's
barley example concerning vertical bars with the lattice function barchart().
Why, is there a restricted use for the package lattice-Internal?
Urs Simmen
mailto:usimmen at dtc.ch
2009 Sep 16
3
apply function across two variables by mult factors
Greetings,
I am attempting to run a function, which produces a vector and
requires two input variables, across two nested factor levels. I can
do this using by(X, list(factor1, factor2), function), however I
haven't found a simple way to extract the list output into an
organized vector form. I can do this using nested loops but it isn't
exactly an optimal approach.
Thank you
2010 Feb 14
2
lattice/ylim: how to fix ylim[1], but have ylim[2] dynamically calculated?
Hello,
When drawing "barcharts", I find it not helpful if ylim[1] != 0 - bars for a
quantity of 0, that do not show a length of 0 are quite non-intuitive.
I have tried to study
> library(lattice)
> panel.barchart
but am unable to figure out where ylim is taken care of and how one might
fix ylim[1] to 0 for barcharts ...
Can anyone point out how to tackle this?
Thanks, Joh
2009 Mar 20
4
how to make aggregation in R ?
Hi,
I am trying to aggregate the sum of my test data.frame as follow:
testDF <- data.frame(v1 = c("a", "a", "a", "a", "a", "b", "b", "b", "b",
"b", "c", "c", "c", "c", "c", "d", "d", "d", "d",
2006 Dec 08
1
missing factor levels in a lattice barchart panel cause unexpected failure
Hi all - I'm trying to generate lattice barchart graphs with missing
values, and came across the following:
This does not run. I would expect it to:
library(lattice)
D = data.frame(X=1, Y=factor(letters[2], letters[1:2]))
barchart(~ X, D, groups=Y)
Error in grid.Call.graphics("L_rect", x$x, x$y, x$width, x$height,
resolveHJust(x$just, :
invalid line type
which is simply
2011 Mar 09
2
SQLDF - Submitting Queries with R Objects as Columns
Fellow R programmers,
I'd like to submit SQLDF statements with R objects as column names.
For example, I want to assign "X" to "var1" (var1<-"X") and then refer to
"var1" in the SQLDF statement. SQLDF needs to understand that when I
reference "var1", it should look for "X" in the dataframe.
This is necessary because my SQLDF
2008 Feb 26
1
wrapper for save function
Hello -
I would like to create a wrapper to the 'save' function in the base
package, but have a small problem with the name of the object that is
getting saved in the file. Below is a simple example illustrating my
problem.
## BEGIN SAMPLE R CODE
##################################################
## Here is the wrapper for the save function
2010 Jan 24
2
different x-axes in Lattice
I use lattice package and 'barchart' to build a chart. I have a
problem with setting different x-axes. Some x categories are missing
but they are display and I don't want. I use scales = list(y =
"free",x="free") but it works only for y-axes. Simple example:
package(lattice)
barchart(yield ~ variety | site, data = barley,
groups = year, layout = c(1,6),
2007 Nov 09
2
wrapper for coxph with a subset argument
Dear R-help -
Thanks to those who replied yesterday (Christos H. and Thomas L.)
regarding my question on coxph and model formula, the answers worked
perfectly.
My new question involves the following.
I want to run several coxph models (package survival) with the same
dataset, but different subsets of that dataset.
I have found a way to do this, described below in functions subwrap1 and
2011 Jan 01
3
Retrieving Factors with Levels Ordered
Hello (and Happy New Year),
When I create a factor with labels in the order I want, write the data as a text file, and then retrieve them, the factor levels are no longer in the proper order.
Here is what I do (I tried many variations):
# educ is a numeric vector with 1,001 observations.
# There is one NA
# Use educ to create a factor
feducord <- factor(educ, labels = c('Elem',
2002 Mar 27
0
Re: RE Vertical bars with barchart()
Hi,
[I'mm cc-ing r-help on this, since some others might be interested (Tony
Rossini is, at least)]
Yes, I saw your mail and was wondering about what would be the best approach
to do it. It's definitely not trivial, mainly because Trellis is not designed
to handle factors on the x-axis (chiefly for convenience, as factors typically
have long names which are difficult to write on the
2003 May 08
2
border of bars in lattice barchart
Hello!
How to change a color (or linewidth) of
border in lattice 'barchart'?
I am trying
barchart(
(......) - my arguments
panel=function(x,y,color,subscripts,groups,...)
{
panel.barchart(x=x,y=y,box.ratio=2,col=color,border=FALSE)
}))
or
...
panel.barchart(x=x,y=y,box.ratio=2,col=color,border='transparent')
...
or
2009 Feb 08
2
Using panel.grid in barchart
Hi all,
I'm trying to do an example in Deepayan Sarkar's Lattice book. It
involves making a barchart based on the Titanic dataset. I can get
the barchart to plot fine; however, when I try to edit panel.grid, I
get an error:
> titan<-barchart(Class ~ Freq | Age + Sex, data =
as.data.frame(Titanic), groups=Survived, stack=TRUE, layout=c(4,1),
2010 Nov 10
0
error bars in lattice barchart
Hi all,
I've read the emails of Dan, Deepayan and Sundar about adding error bars to
the lattice plots (
https://stat.ethz.ch/pipermail/r-help/2006-October/114883.html), but I still
have the problem when I want to adding error bars to barchart. I tried both
the solution of Deepayan and Sundar but without luck. Here is my code (I
changed prepanel.ci and panel.ci a little to plot bars