Displaying 20 results from an estimated 30000 matches similar to: "Lattice graphs and legend"
2005 Dec 09
1
lattice legend colors recycling sooner than expected
dear r-helpers,
it seems the colors in an automatically generated lattice legend
recycle after the 8th color, even when the user has set e.g.
superpose.symbol$col to be longer than 8. the following example will
illustrate what i mean:
z <- data.frame(x=rep(letters[1:15], each=4), y=rnorm(60),
groups=rep(LETTERS[1:3], 20))
library(nlme)
library(lattice)
plot(groupedData(y ~ x |
2003 Jan 31
1
Question about trellis graphs
Dear List Members
I'm using R to create a trellis plot using the library of Pinheiro & Bates
(trellis graph for grouped data). Here is my question: How can I change the
format of the axis (x or y) in terms of the number decimal points that
should appear on the plot? In other words, I have that for a set of plots in
the y-axis the values appear as 0.2,0.3, etc and for another set they
2004 Jun 07
0
RE: [R] Printing Lattice Graphs from Windows (PR#6952)
Hi folks. It looks like it's stirred some discussion ultimately
resulting/concluding that this phenomena is a possible bug either in the
lattice package or in R 1.9.0/1.9.1 itself. So, I'll stay tuned, so to
speak, for either an update in the lattice package or R as it seems that
that's where the bug may lie. FYI, the resulting plot, (e.g., plot(1~1)),
worked as it should either
2010 Apr 12
1
lattice garphs: combining multiple scatterplots and adding legend
Dear List members,
its me again, fighting with lattice graphics. I am trying to plot a world map, add some points on different locations with different colors and add a legend, but did not succeed yet with the legend. Here is my code:
library(fields)
# Data for demonstration
data_x = c(0,50,60)
data_y = c(0,0,0)
cols???= c(1,2,3)
data(world.dat)
#print map
all=xyplot(world.dat$y? ~
2004 Jul 27
1
re: help with lattice plot
Dear List,
I have been using R to create an xyplot using the panel function within
lattice libraries. This plot is based on the data supplied in R named
'Oats'. The graph represents oat yield by nitro level with an overlay of
each variety of oats for each nitro level.
I have three questions regarding this graph:
1) I cannot seem to specify the type of symbol used by the plot, even
though
2006 Aug 24
1
Lattice symbol size and legend margins
Hi:
I am using the following command:
xyplot(dat6$CO3*1e6 ~ dat6$irradiance, data=dat6, group=ref,
xlab=list(label=expression(paste("Irradiance (", mu, "mol photons",
m^"-2", " ", s^"-1", ")")), cex=1.3),
ylab=list(label=expression(paste("Carbonate concentration (x ", 10^"6",
" ", kg^"-1",
2013 Feb 27
0
Bordered legend icons and Text in plots
Hello,
My colleagues and I use lattice for a variety of different purposes, and we came across a couple issues involving legend.R and update.trellis.R:
1. When using xyplot, the shapes in the plots are able to have borders and fill colours, but not so in the legend. I created a short script to isolate the problem (see legend-icons.R and Nofill.png).
After some tracing through the source code,
2013 Jan 26
2
different legends in lattice panels
Hi listers,
I want to make lattice plots xyplots with the indication of legends
inside each panel with only the points and the lines actually ploted
inside each given panel according to the group(ing) factor.
The code below shows what I have achieved so far and I hope will make
clear what I want to have.
It seems to me that my solution is a very "dirty hack" and there
certainly is
2010 Dec 14
1
lattice fun: multiple themes in panels with spplot()
I have some geospatial data where two layers are thematic and the third is a
percentage, so the maps need to have different themes.
thumbDf <- as( stack( thumb), "SpatialGridDataFrame")
names(thumbDf at data) <- c("pri", "sec", "pct")
thumbDf at data$pri <- factor(thumbDf at data$pri, levels=c(0:8), labels= names(
peelClasses))
thumbDf at
Barchart in lattice - wrong order of groups, data labels on top of each other, and a legend question
2009 May 18
1
Barchart in lattice - wrong order of groups, data labels on top of each other, and a legend question
Hello!
I have a question about my lattice barchart that I am trying to build
in Section 3 below. I can't figure out a couple of things:
1. When I look at the dataframe "test" that I am trying to plot, it
looks right to me (the group "Total" is always the first out of 5).
However, in the chart it is the last. Why?
2. How can I make sure the value labels (on y) are not
2008 Feb 05
2
dynamically add items to key of lattice xyplot
Hi all,
is it possible to dynamically add key items to an already existing key,
belonging to a lattice xyplot?
This is what I do: I make an xyplot with an initial key. Later on, I
want to extend this key with more items, as more lines are added to the
plot (lines are added using trellis.focus("panel")).
I guess I need some function to access the key panel in order to extend
it,
2003 Sep 11
1
Customised legend in lattice
Hi List,
Am trying to customize a legend in trellis: Draws 2x5 lines in 5 colors and
2 linetypes. I would like to add two more items to the legend showing the
key for the line types above the colored legend.
Any suggestions welcome - thanks Herry
#############################
#Following example code:
library(gregmisc)
trellis.device(bg="white")
i1=0
i2=-1.89767506
i3=-1.17087085
2008 Jun 13
1
Switching the order of legend boxes in a lattice bar graph
I suspect there is a simple solution to this problem, but have been
unable to find it. Below is some code that I have run to create 3
lattice graphs. I have been asked to change the legend so that the
'No' and dark blue are above "Y" and light blue in the legend to
mirror the stacked bars in the graph which feature dark blue above light blue.
I have tried changing the data
2007 May 18
1
How can we add a legend to a set of graphs?
Hi,
I have a set of 4 graphs and I need to add a legend
that is shared by those 4 graphs. This is what I
tried:
>locator(1) # I placed the cursor in the center of the
4 graphs
$x
[1] 9.299001
$y
[1] 226.3201
>legend(9.3,226.3,"and the rest of the legend
arguments")# but the legend didn't show.
The legend only appears when I place in inside any
of the for plots. How
2008 Aug 01
0
standardize ggplot and lattice themes
Dear list,
I'm writing a long document (thesis) and as much as I would like to
use only ggplot2 for the graphics, some features are still a bit
undocumented so I often end up choosing either ggplot2, lattice, or
base plots (which i know better) depending on the particular graph to
produce. With the default settings, this does not make for a
consistent look I would like to see
2004 Nov 19
0
Legend
I have recently converted from S-Plus (Dec Alpha) to R (Mandrake 10.0). The
differences are subtle but in some cases not easily converted. My Splus
Command plotting deck was over 1200 lines and R has simplified this down to
900 lines so far. I do a lot of mapping with polygons and I am trying to
figure out how to increase the default size of the fill boxes in the legend
call. Splus had a
2006 Aug 09
1
legend on trellis plot
Dear all
I have two questions regarding trellis plots - which I hope you may be able to help me with.
Is it possible to place the key in a trellis plot on the panel (instead of beside the panel)? This will cause the same key to be reproduced on each panel. Please see the plot below - here I placed the legend below the plot. I tried moving the key to the function statement, but it did not really
2011 Mar 15
1
Bug in lattice auto.key argument
The Lattice auto.key argument has a bug in R.12.2.
R version 2.12.2 (2011-02-25)
Platform: i386-pc-mingw32/i386 (32-bit)
....
other attached packages:
[1] lattice_0.19-17
loaded via a namespace (and not attached):
[1] grid_2.12.2
If I set up my plot parameters as
require(lattice)
superpose.line.settings <- trellis.par.get("superpose.line")
str(superpose.line.settings)
2010 Jun 22
2
Lattice legend
I have a moderately complex graph with three panels. There are data points
plotted, and fitted lines are added using a panel function, which includes
"with(alt.data[[which.packet()[1]]]" statements. It all graphs out
beautifully, but none of the usual tricks to get the proper legend to plot
are working, i.e., using auto.key, key, etc.
One message I keep getting is
Error in
2008 Sep 02
2
two lattice graphs in one object
When I create a lattice/Trellis type graph, I typically write a function that returns the graph, as in
do.graph <- function(x, y, ...)
{
require(lattice)
return(xyplot(y~x, ...))
}
My question today is this:
If I want two graphs on one page, one way of achieving it is to print the objects into defined areas, as in
gr1 <- xyplot(rnorm(111) ~ runif(111))
gr2 <-