Displaying 20 results from an estimated 6000 matches similar to: "Placing of legends"
2008 Sep 30
1
Adding legends to a plot
Hello,
I have a time series plot drawn using 3 different colored lines, each line
corresponds to different category group. I'd like to put legends on the
plot. I am using "legend" to do this, however, I can either specify lty or
col in legend. Will I be able to do the following in the legend box: a solid
black line then g1, a solid red line then g2, a solid blue line then g3?
2006 Mar 10
2
Plot.date and legends
Hi:
I'm trying to plot dates on the x-axis of a code, but the legend is not being
displayed. I receive the following error:
Error in match.arg(x, c("bottomright", "bottom", "bottomleft", "left", :
'arg' should be one of bottomright, bottom, bottomleft, left,
topleft, top, topright, right, center
In addition: Warning message:
longer
2011 Jul 13
1
Smart legend ???
Hi, all:
Is there an automatic smart legend for R?
Since my R code is running in a row, which will produce a bunch of R plots
in a single run, some of the produced plots are really "ridiculous".
Because my legend is fixed to "topleft", sometimes, which occludes the key
parts of the figure/plots, but most of the time, the legend works just fine.
I'm wondering is there a
2007 Sep 02
2
Different behavior of mtext
Dear R Users,
I am quite surprised to see that mtext gives different results when it
is used with 'pairs' and with "plot'. In the two following codes, it
seems that the 'at' argument in mtext doesn't consider the same unit system.
I would appreciate your comments on this issue.
Sebastien
##### Pairs
mydata<-data.frame(x=1:10,y=1:10)
par(cex.main=1,
2007 Jun 08
2
legend + expression
Dear all;
A simple? question.
I'm having a problem with a math expression in the legend of a plot
and I haven't found the way to get this to work, so any help will be
appreciate. Basically I want to include in the plot is the R-squared
and its numerical value, so I tried this:
R2c<-0.82879 # R-squared of calibration model
plot(1:10,1:10)
legend("topleft",
2010 Oct 26
1
lattice key subtitle
Hello everybody,
Is there a way to add a subtitle to a lattice key?
It is important form me that the subtitle must be linked to the key
because those graphs are produced on a daily temporal scale,
and the numbers of rectangles from the key may be different from day to
day.
Thank you,
Alexandru Dumitrescu
[[alternative HTML version deleted]]
2008 Oct 23
3
xy.coords in text
Hello,
I want to add text annotation about correlation on "pairs" plots. I
found that I could pass a function to the "panel" argument of pairs :
panel.annot <- function(x, y, ...) {
points(x, y, ...)
c <- cor.test(x, y)
legend("topleft", legend=substitute(rho == r, list(r=sprintf("%.2f",
c$estimate))), bty="n")
}
And then :
2011 Feb 04
1
Can an xyplot() plus legend be saved as an Enhanced Windows Metafile (EMF)?
I am trying to save some graphical output including a legend in the
Windows Enhanced Metafile (EMF) format.
This fails when xyplot() is used rather than plot().
Here is a simple example:
require(lattice)
a <- c(1:10)
b <- c(2,4,5,2,3,5,7,8,9,5)
# Output can be saved (or copied to the clipboard) as a Windows EMF image
file
# from the Graphics Device output window.
plot(a , b)
2009 Dec 18
2
Legend for two plots
Dear R users,
I am new to R and I couldn't figure out how to solve the following
problem:
I am trying to put a legend below two plots using the code below. The
legend appears in the second plot,
but I want the legend to appear below the two plots in the center of
the total chart. At the moment the
graphic looks like this: http://i48.tinypic.com/2h2fvhf.jpg
[code]
layout(matrix(1:2, nrow=1))
2007 Aug 28
2
Limiting size of pairs plots
Dear R-users,
I would like to add a legend at the bottom of pairs plots (it's my first
use of this function). With the plot function, I usually add some
additional space at the bottom when I define the size of the graphical
device (using mar); grid functions then allows me to draw my legend as I
want.
Unfortunatley, this technique does not seem to work with the pairs
function as 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, and make labels
# smaller with horizontal y-axis labels
2008 Jul 27
1
Color of box frame in Legend (Was: Matrix barplot)
On Sun, 27 Jul 2008, S Ellison wrote:
> Looking at the legend() source the filled box line colour is hardcoded :
> if (mfill) {
> if (plot) {
> fill <- rep(fill, length.out = n.leg)
> rect2(left = xt, top = yt + ybox/2, dx = xbox, dy = ybox,
> col = fill, density = density, angle = angle,
> border =
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
2008 Jul 08
6
Automatic placement of Legends
Dear R-Users,
I am looking for a way to get legends placed automagically in an empty
spot on a graph. Additional complication comes through my useage of
multiple graphs on the same plot through mfrow.
Is there a way to achieve this in R ? I have legends for each of the
sub-plots.
Many thanks in advance,
Tolga
Generally, this communication is for informational purposes only
and it is not
2012 Feb 15
2
assign same legend colors than in the grouped data plot
Dear community,
I've plotted data and coloured depending on the factor variable v3.
In the legend, I'd like to assign properly the same colors than in the
factor (the factor has 5 levels).
I've been trying this but it doesn't work.
plot(var1, var2, xlab = "var1", ylab = "var2", col =var3 , bty='L')
legend(locator(1),c("level 1 var3",
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,
2009 Aug 25
3
math symbol + value of a variable in legend.
Hi R users:
I will like to have a legend with math symbols and also with
the value of a variable.
But I cannot obtain both at the same time (symbol + value of a
variable):
Here is a reproducible example:
m1<-5
m2<-12
plot(1:5,1:5,type="n")
legend("topleft",legend=c(paste(expression(mu),"=",m1),expression(paste(mu,"=",m2))),lty=1:2)
Thank you for
2009 Aug 25
3
math symbol + value of a variable in legend.
Hi R users:
I will like to have a legend with math symbols and also with
the value of a variable.
But I cannot obtain both at the same time (symbol + value of a
variable):
Here is a reproducible example:
m1<-5
m2<-12
plot(1:5,1:5,type="n")
legend("topleft",legend=c(paste(expression(mu),"=",m1),expression(paste(mu,"=",m2))),lty=1:2)
Thank you for
2003 Oct 05
3
Placing legends
I'm trying to automate making a bunch of figures and I need a way to
automate legend position. As I understand it the legend is placed based
on coordinates. I don't know before hand what the coordinates are going
to be. On one graph my y axis might go from -50 to -10. On another it
might go from 0 to 180.
Is there any way to query where the origin is? Or is there another way
to
2006 Nov 09
4
Plotting symbols with two positions?
Thanks a lot to Demitris for a prompt answer some minutes ago on another
tread (see below). To avoid excess mails on the list, I move onto next
question:
I have another small plotting problem that confuses me. I want to plot
results from a field trial series, using the numbers of the trials as
symbols in the plot.
pch = as.character(trial_no)
works fine, but truncates the trial number to the