Displaying 20 results from an estimated 40000 matches similar to: "Different type of legend?"
2012 Jan 21
2
Legend that is big?
I can put a legend on a plot with something like:
legend('bottom', leg.txt, horiz = TRUE, fill = colors)
But what if the arrays leg.txt and colors are too big? I would still like to
provide a legend but to save space I would like to just show small boxes
with the color filled in so it will still fit on the plot. If I could adjust
the size of the boxes (at least in one dimension)
2011 Nov 08
3
window?
Can someone enlighten me on why the following doesn't work?
setwd('C:/Temp/R')
d <- rep(1:53,2)
(s <- ts(d, frequency=53, start=c(2000,10)))
n <- length(s)
k <- n%/%3
for(i in (n-k):n)
{
st <- c(start(s)[1] + (start(s)[2] + i)%/%frequency(s), (start(s)[2] +
i) %% frequency(s))
ed <- c(start(s)[1] +
2009 Oct 10
1
auto.key legend color different from actual plot
Dear All,
I have created a barchart, but the legend created by auto.key does not match
the actual graph. Can someone give me some hint here?
For example, my coding are:
Library(lattice)
dataset.table <-
table(data.frame(id=c("a","b","c","a","c","b","a"),colour=c("blue","green","
2012 Jun 13
2
adjust space between horizontal legend text in a barplot
Hi All,
I produced a barplot and made a horizontal legend below the graph.
Because the results are from a survey, there are three levels, namely
strongly disagree/disagree, neutral and strongly agree/agree.
> rownames(survey)[1] "Strongly disagree/disagree" "Neutral" "Strongly agree/agree"
As in the output above, there is a large space
2013 Jan 19
1
Is it possible to create color ramp legend in spplot for discontinuous data ?
Hello All,
I have a discontinuous dataset and I used spplot to plot the points.
I was wondering whether it is possible to show the legend of the plot as
color ramp. I saw that on continuous data. If anyone could tell me that
would be great.
Another thing I would like to know is how can we create the horizontal
legend. By default, the legend is vertical.
I was able to shift the legend inside
2010 Dec 01
3
Question regarding legend look
Hi everyone.
I have a quick question regarding the look of my legend in my plot. As you
can see in the next figure, I have 3 series.
http://r.789695.n4.nabble.com/file/n3067466/legend.png
However, I find rather difficult to differentiate the series 1 and 3
according to their line type (lty). I would like to know if it was possible
to make the line type in the legend to appear more clearly.
2013 May 12
1
How to center a horizontal legend with specified 'text.width'
Hello dear list,
I just cannot figure out how to do this and didn't find a solution for my specific problem.
I want to place a centered horizontal legend between 4 plots. That's no problem.
The problem is: As soon as I specify the "text.width" parameter to separate the two legend entries, the legend is not centered anymore. I thought the 'xjust' parameter would do what
2007 Feb 28
4
legend question
Hi to all,
I'm sorry for posting this question, I am sure I am missing something
important but after reading the documentation I cannot find where the
problem is.
I want to add a legend to a figure. If I use a simple example drawn
from the R Reference Manual such as, for instance:
x <- seq(-pi, pi, len = 65)
plot(x, sin(x), type="l", col = 2)
legend(x = -3, y = .9,
2005 Apr 18
3
Barplot and colors for legend
Hi all!
One quick question: How do I get the standard colors
used by barplot? I have
some stacked bars and would like to add a horizontal
legend via legend() but I
don't know how to find the colors for the fills of the
legend points.
Thanks!
Werner
2005 Jul 04
1
Rotate legends or other approaches to nice legend placement?
I'm sure this general sort of question has been asked many times before
- I would _like_ automatic and sensible legend placement in barplots so
data is not overwritten... but since there doesn't seem to be one, one
of the following would be useful:
One approach for this would be to place the legend to the right of the
graph, and rotate it by 90 degrees.
Is there a sensible way to do
2010 Aug 30
3
Putting legend *outside* plotting area
Is there a simple way to put a legend outside the plot area for a simple
plot?
I found... (at http://www.harding.edu/fmccown/R/)
# Expand right side of clipping rect to make room for the legend
*par(xpd=T, mar=par()$mar+c(0,0,0,4))*
# Graph autos (transposing the matrix) using heat colors,
# put 10% of the space between each bar, and make labels
# smaller with horizontal y-axis labels
2001 May 06
1
legend/text in time series plot
hi,
i need help on placing legend/text in a time series plot. here is what
i am doing (i am using rw1022 on windoze 2000):
#read data file
gdpn <- scan("jngdpsa.dat", list(year=0, qtr=0, gdp=0));
gdpr <- scan("jrgdpsa.dat", list(year=0, qtr=0, gdp=0));
#convert to time series object
gdpn <- ts(gdpn$gdp, frequency=4, start=c(1955,2));
gdpr <- ts(gdpr$gdp,
2008 Jul 02
2
position legend below x-axis title
Dear helpers,
I'm using a R script on several different datasets, which makes that
axis scales may vary quite a lot from dataset to dataset. So what I'm
looking for now, is how to automagically find out how to position the
legend (horizontal) in the space below the x-axis title, and how to
make sure that the legend is within the limits of the lower inner or
outer margin?
I'm aware of
2008 Jun 16
1
ggplot2: How to remove legend component for geom_errorbar() ?
Dear list (probably Hadley),
I'm trying to do a plot like the following, composed of bars and error
bars:
df <- data.frame(factor1=gl(2,5), factor2=gl(5,1), y=rnorm(10),
err=0.1)
ggplot(df, aes(x=factor1, y=y, fill=factor2)) +
geom_bar(position="dodge", stat="identity") +
geom_errorbar(aes(min=y-err, max=y+err), position="dodge",
width=0.1)
The
2006 Apr 10
2
Legend in the outer margin
Dear Rs
I have a 3x3 multiple plot. I would like to have a overall legend in
the outer right margin.
From the help archive, I found that it can be done by setting
par(xpd=NA). However, I couldn't find the correct values
for x and y co-ordinates for the legend. Please find the code snippet below:
par(mfrow=c(3,3), mar=c(4,4,0.9,0.5), oma=c(1,2,2,4),cex.main=1.1)
2011 Feb 10
1
Add different types of legend: line and points
Hello,
I plot box plot, and add a point to the box indicating mean. I also add some
range to the box width. I want to add legend for both the range (line) and
mean (point). However, I cannot add line legend and point legend together.
The code looks like the following.
(1) First, I tried the following code, however, it plot a line across the
point legend("*").
boxplot(count ~ spray,
2003 Oct 30
1
legend over-prints barplot bar
When I create a bar plot, the legend is obscuring the rightmost bar.
I haven't found a setting that appears to affect the positioning of the legend - any tips re moving the legend would be most appreciated.
paul sorenson
2005 Aug 16
1
Overall Legend
Hello. I am using R version 2.1.1 on Windows 2000.
I am using a par(mfrow=c(2,2)) statement to produce 4 plots on one screen. I want a single horizontal legend to appear at the top of the four plots. My code is something like this:
par(mfrow=c(2,2))
plot(x,y1)
lines(x,y2)
lines(x,y3)
plot(x,z1)
lines(x,z2)
lines(x,z3)
plot(x,t1)
lines(x,t2)
lines(x,t3)
plot(x,w1)
lines(x,w2)
lines(x,w3)
2011 Aug 17
2
Lattice: problem with setting space between plot and legend
Dear R Users,
I am writing code to present my output data (I'm using Lattice Package).
However, it's essential for me to control space between barchart and legend.
I've read the package's specification, but unfortunately I haven't spot the
information how to do this. Here's the code I've written:
barchart(mymatrix[,1:ncol(mymatrix)],horizontal=FALSE,
2011 Oct 22
7
"Plotting" text?
I noticed that the text() command adds text to a plot. Is there a way to
either make the plot blank or add text to a "blank sheet". I would like
to "plot" a page that contains just text, no plot lines, labels, etc.
Suggestions?
Kevin
[[alternative HTML version deleted]]