Displaying 20 results from an estimated 5000 matches similar to: "Legend vanishes when placed outside the graph"
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 Mar 21
2
list of matrices
Hello dear R-users,
I am currently trying to fill some datasatructure (array, list, hash...)
with matrices that are calculated by a function and do vary in size:
mylist = list()
for(i in 1:n)
mylist[i] = function(...) # returns a matrix
print(mylist[1]) # prints only the first element of the matrix
How can I store and afterwards access the matrices that are calculated
by my function?
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)),
2009 May 06
1
Positioning a legend via X and Y coordinates
Dear R Users,
I'm able to display a legend using the following code:
> legend("topright", c("Simulation", "Observation"), fill=2:3, bty="n")
However, this causes the legend to be positioned too close to the bars in my barplot. I'd like to move the legend up slightly. I have been trying to determine the necessary values by trial and error to do
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
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")
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
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 (ie from the value returned by the legend() command). I
2010 Aug 15
2
legend outside plot area
Hi, please can you help me. When I add a legend to a boxplot it appears inside the plot area, how do you get it into the margins? I have already changed the parameters so there is space for it on the margin on the right hand side of the graph.
Thanks, Emily
[[alternative HTML version deleted]]
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.
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
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",
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",
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
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
2012 Feb 16
2
Multiple line-plot
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt.
Name: nicht verf?gbar
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120216/6192b6e7/attachment.pl>
2018 Apr 06
1
Fast tau-estimator line does not appear on the plot
R-experts,
I have fitted many different lines. The fast-tau estimator (yellow line) seems strange to me?because this yellow line is not at all in agreement with the other lines (reverse slope, I mean the yellow line has a positive slope and the other ones have negative slope).
Is there something wrong in my R code ? Is it because the Y variable is 1 vector and should be a matrix ?
Here is the
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
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
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