Displaying 20 results from an estimated 2369 matches for "legend".
2006 May 10
2
Legend titles in log plots broken? (ver. 2.2.1)
Legend titles work in linear plots:
curve(1/x, xlim = c(0, 1))
legend(x = 'topright', inset = 0.04,
legend = '1/x', lty = 1,
title = 'Legend Title')
But when you change to a log plot on either dimension things get screwy:
curve(1/x, xlim = c(0, 1), log = 'y...
2008 Aug 11
2
: bquote inside legend()
Hi,
I have a graph and I would like to write some values inside the legend that were saved in a variable. Please revise the code below in which I've wrote 2 different legends, but I am not happy with either of them. What I want is a legend with tile "Legend" and underneath a line with a name and a value like that: value = 2.
#Code begin:
# -----------------...
2011 Jul 10
3
change legend character size in image.plot
I'm using the image.plot() function (fields package), but I want to enlarge
the characters of the legend (as they are too small to be read in a combined
figure), but there is no way I can find a command to do this. I can enlarge
the legend bar (with legend.witdh), axis character size (cex.axis) or the
total legend size (legend.shrink), but not the character size of the legend
characters itself (and o...
2008 Dec 22
0
Align legend title
Dear R developers,
I needed to align the title of legend for some of my plots. If there is interest to include
this into base R, bellow are the examples and the relevent diffs.
Regards, Gregor
x <- 1:10
y1 <- 1.5 * x
y2 <- 2.0 * x
y <- cbind(y1, y2)
source(file=url("http://gregor.gorjanc.googlepages.com/legend.R"))
matplot(x, y,...
2008 Feb 18
1
Plotting a legend outside the figure - units
Dear R gurus,
I am trying to plot a legend in the margins of a figure. The basic idea is to have two (or more) plots on the same figure, but then to have a common legend at the bottom of the plot. The approach that I have taken is to setup the figures, then do a "dummy" plot of the legend to determine the height of the legend box...
2002 Nov 12
4
trouble positioning legends on barplot written to a file
I'm trying to generate some plots for print publication and I'm having trouble
getting them the way I want. I get a plot with a legend that overlaps the bars
and looks bad. Also, I'm saving this as PDF file (whatever happened to the
"png" function to save as PNG format, in r 1.4.1?)
I've tried a number of things, which produce a number of questions.
1) it seems that the "legend" for a plot must be wit...
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 this?
alternatively, i...
2010 Jul 22
5
legend in R plot
Hi all,
I am have some difficulty with the legend function.
I need to add a legend to describe the different line types in a plot. The
legend box is small.
It did not include sufficient length of each line type to help distinguish
the differnt line types.
Is there a way to fix this.
Thank you
Hannah
[[alternati...
2006 Dec 15
1
xyplot: legend title + legend on 1 line
Does anybody know how in xyplot to put the legend title on one line with the
legend? I can get the legend on one line with columns=... but the title is
always on top. I tried a custom key with key=... and text=... but I can't
put the title text in front of the plotting symbol.
I am looking for the following layout of the legend, on one line:...
2005 Jun 28
2
Producing character "given" i.e. "| " with plotmath
Hello!
Does someone know how to produce
L(y|mu)
with plotmath?
Some code with unsuccessfull results:
plot(dnorm(x = seq(from = -4, to = 4, by = 0.1)), type = "l")
## Not what I want
legend(legend = c(expression(L(y:mu))), x = "topright")
## Strange, is this a bug?
legend(legend = c(expression(L(y|mu))), x = "top")
## Group produces an error
legend(legend = c(expression(group(L(y, "|", mu)))), x = "topleft")
## Paste keeps commas in expressio...
2009 Jan 14
4
How to get legend outside of plot?
I am creating a CDF plot function more user-friendly than any default r
function. Depending upon the bimodality of the data (it is often bimodal),
or any other strange data trends, the points can end up gathering in just
about any corner of the plot. So, when I add a legend, whether I choose to
add it in the bottom right, top left, or wherever, it will sometimes end up
putting the legend right on the data itself. So, I tried to force the
legend to certain data values (e.g., the largest in x & the smallest in y,
to "really" get the bottom right), but the...
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, an...
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, "legend text", pch = 1, xjust = 0.5)
then everything works just fine.
However, if I use ot...
2012 Feb 10
5
how to plot a nice legend?
i'd like to plot a legend in my diagram. The diagram will be included
in a TikZ LaTeX document later.
I tried the legend() function, but
- it can not find a good place it self where the legend fits
and playing around with coordinates and scaling consumes a lot time
- standard settings for the text need adjustment
(...
2003 Feb 24
2
fill prob. in legend
Hi,
I'm trying to construct a legend which has four lines of text and associated
symbols. The first two symbols need to be normal lines which vary only in
colour. The second two symbols should have filled boxes. How do I suppress
the fill boxes in the first two lines?
J.
2013 Dec 02
3
legend position
Hi all.
I'm ploting a raster and I can't find the proper way to move the legend. For example,
r = raster(system.file("external/test.grd", package="raster"))plot(r)
How can I put the legend at the desired position?
Thank in advance,Phil
[[alternative HTML version deleted]]
2004 Mar 25
1
Error in 'legend' help?
Dear all,
maybe I have misunderstood something but to me it seems like a minor error
in the help for
?legend
for the argument 'bg'. There it says:
bg: the background color for the legend box. (Note that this is
only used if 'bty = "n"'.)
I think, however, that it should be changed to:
bg: the background color for the legend box. (Note that this is...
2003 Dec 12
1
legend() graphics output bug (PR#5725)
Full_Name: Daniel Gasser
Version: 1.8.1
OS: Win XP
Submission from: (NULL) (130.60.20.92)
The legend()-Function shows a different behaviour than it did in Version 1.6.1.
It plots a black box left of the legend lines on each legend row. In 1.6.1 there
was just the line in appropriate color for each row in the legend (i was using
exactly the same legend statement and same plot function).
My legend s...
2011 Apr 29
3
Change the text size of the title in a legend of a R plot.
Hello,
Is it possible to change the text size of the title in a legend of a R plot?
I tried to directly change the title.cex argument but it seems not to work.
Trying :
Horizo <- c(1,2,6,10,20)
legtext <- paste(Horizo,sep="")
legend("topleft", legend=legtext,col=col,text.col=col,lwd=lwd,
lty=lty,cex=1.1,ncol=3,title = "Horizons",...
2008 Nov 07
0
barplot can put legend in wrong place, request option to override that (PR#13265)
This in an enhancement requestion, to add the capability to pass
arguments through barplot() to legend(). I've created a version that
does this.
# Run this code; notice that the legend
# is superposed over one bar:
barplot(height =
cbind(x = c(465,91) / 465 * 100,
y = c(840,200) / 840 * 100,
z = c(37,17) / 37 * 100),
beside = FALSE,
width = c...