Displaying 20 results from an estimated 10000 matches similar to: "Positioning a legend via X and Y coordinates"
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')
legend(x = 'topright', inset = 0.04,
legend = '1/x', lty = 1,
2012 Feb 16
2
Legend vanishes when placed outside the graph
Hello everyone,
i’ve got a problem with my diagram’s legend. I know i should be able to figure it out by reading the ‘plot’ and ‘legend’ reference. However nothing works so it would be kind if anyone could point me to the necessary parameters.
The problem is that i’m moving the legend using the ‘inset’-parameter so it does not overlap with the graph. However it vanishes outside the graph, so
2011 Nov 24
1
Legend
Hi everyone.
I have a linear regression where I retrieve the R2 like this:
r2 = sprintf('%4.2f %s',(summary(reg1)$r.squared))
In my figure I have a legend where I would like to add that R2 value to the
legend text.
Something like: My text R^2 = r2
legend('topright', inset = .05, title='light ratios', pch = c(21),
c(paste('Green/Red', R^2, '=', r2)),
2008 Dec 05
1
Trouble with gridBase and inset plots
Dear All,
I ma having a trouble in generating a figure containing 3 insets with
the gridBase package.
I always get an error message of the kind:
Error in gridPLT() : Figure region too small and/or viewport too large
No matter which parameters I choose. The plots works nicely with two
insets only, but when I try adding the third one, my troubles begin.
I am probably doing something wrong in the
2012 Feb 24
1
Telling plot() the max y value to expect when plotting one distribution and then using lines() to add more distributions
I am plotting three Pearson Type IV distributions. It looks like I have to plot the distribution with the highest value of y and then use lines() to add the two distributions that are shorter / have lower max values of y. The following code figures out which distribution has the max y value, plots it first and then uses lines for the other two distributions with a series of three if statements.
2011 Mar 22
1
Problem with plot histogram
Hi R-users,
I'm trying to built a plot of two series of data, but thees series
result "superimposed". The R-code is like this:
goal <- c(125, 143, 81, 26, 2, 3)
numgoal <- 0:5
lambda <- sum(goal*numgoal)/sum(goal)
plot(numgoal, goal, type="h")
x <- 0:5
y<-dpois(x, lambda)
att<-y*380
lines(x,att, type="h", col="red")
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
2004 Dec 02
3
Wishlist: simple legend options (PR#7400)
Full_Name: Elizabeth Purdom
Version: 1.9.1
OS: Windows XP
Submission from: (NULL) (171.64.102.199)
It would be nice if legend had the option of some default locations you could
choose instead of entering specific coordinates, like "topleft",
"topright","topcenter", etc. based on par("usr") coordinates. I know I've wanted
it so often I've made my
2007 Aug 12
2
Legend on graph
Hi,
I have a problem when I want to put a legend on the graph.
I do:
legend("topright", names(o), cex=0.9, col=plot_colors,lty=1:5, bty="n")
but the legend is writen into the graph (graphs' top but into the graph),
because I have values on this position. How can I write the legend on top
the graph without the legend writes on graph's values.
Thanks.
[[alternative
2012 May 18
3
colocar subscripts y cursiva
Hola
He estado tratando varias formas de colocar el subíndice para los grados de libertad del F test y la expresión adj; y sencillamente no funciona.
legend("topright",legend=c(expression('r[adj]=0.40'),expression('F[3,23]=15.43'),expression('P < 0.001')),col=black, bty='n',cex=0.9)
Luego al tratar de colocar las cusriva utilizando par(font=3)
2009 Jan 14
1
Histograms: Lines and boxes
Hi folks! I'm trying to get a histogram legend to give me a filled box
and a line. The problem is I keep getting both filled boxes and a line.
How can I get rid of the second box from the code below?
x<-rnorm(1000,mean=0,sd=1)
hist(x, breaks = 50, main="Histogram of x",freq=FALSE,
xlab=" x", ylab="Density",col="lightblue",
2009 Jan 14
1
Histograms: Boxes and lines
Hi folks! I'm trying to get a histogram legend to give me a filled box and
a line. The problem is I keep getting both filled boxes and a line. How
can I get rid of the second box from the code below?
x<-rnorm(1000,mean=0,sd=1)
hist(x, breaks = 50, main="Histogram of x",freq=FALSE,
xlab=" x", ylab="Density",col="lightblue",
2005 Nov 21
1
Howto? plot legend with no line behind the points
Hi R-help,
We are using R 2.2 on Win XP and have a detail question on how the
legend can be optimised.
We use the following;
-> plot(,type="b",...)
The lines in the plot do not cross the points. How can we obtain the
same effect in the legend? (points without a line through them..)
We tried setting the pt.bg to white but this did not help.
See script below.
thanks,
Jan
2007 Jul 31
1
legend()
Hi Sir
How can I use legend() outside th e plot.
Please guid in this regard.
Thanks
--
AMINA SHAHZADI
Department of Statistics
GC University Lahore, Pakistan.
Email:
amnakhan493 at gmail.com
amna_989 at hotmail.com
amna_989 at yahoo.com
2024 Feb 05
2
ggarrange & legend
Dear John Kane
Dear R community
Here my working example
1. Example that is working with legend=?top?. However, as mentioned, the legend is in the middle of the top axis.
mylist<-list(p1, p2)
dev.new(width=28, height=18)
fig1<- ggarrange(plotlist=mylist, common.legend = TRUE, legend="top", labels = c("(A)", "(B)"), font.label = list(size = 18, color =
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
2006 Mar 02
2
'...' passed to both plot() and legend()
Dear R-devels,
I'd like to create a plot method for a class of objects that passes
the '...' argument to both plot() and legend(), e.g.,
x <- list(data = rnorm(1000))
class(x) <- "foo"
plot.foo <- function(x, legend = FALSE, cx = "topright", cy = NULL,
...){
dx <- sort(x$data)
plot(dx, dnorm(dx), type = "l", ...)
if (legend)
2024 Feb 05
1
ggarrange & legend
I'm sorry but that is not a working example.
A working example needs to create the plots being used.
For example, stealing some code from
https://rpkgs.datanovia.com/ggpubr/reference/ggarrange.html
#=================================================================
data <https://rdrr.io/r/utils/data.html>("ToothGrowth")df <-
ToothGrowthdf$dose <- as.factor
2008 Mar 20
4
little subplot in corner
I want to draw a little subplot ("overview") into my detailed plot. It
should be placed in say the top right corner and have the size of some
legend (like legend(x="topright", inset=0.03, ...)
#main plot
plot(rnorm(100))
#give little density in corner
plot(seq(-2,2,length=300),dnorm(seq(-2,2,length=300)),type="l")
I don't want something like par(mfrow=c(1,2)) as
2009 Feb 19
1
modifying legend in scatterplot matrix R
Hello R users,
I have some troubles to modify the "per default" legend in the
scatterplot.matrix using the car package. Here is my code:
--------------------------------------------------------------------
scatterplot.matrix(~ a + b + c,
groups=treatment,
by.groups=F,
data=newfile3,
smooth=T,
pch=c(16,4),
cex=1.3,