Displaying 20 results from an estimated 10000 matches similar to: "Putting legend *outside* plotting area"
2010 Jun 16
5
t-test problem
I have two pairs of related vectors
x1,y1
and
x2,y2
I wish to do a test for differences in means of x1 and y1, ditto x2 and y2.
I am getting odd results. I am not sure I am using 'pt' properly...
I have not included the raw vectors as they are long. I am interested if I
am using R properly...
> c(length(x1), length(y1), length(x2), length(y2))
[1] 3436 1619 2677 2378
First
2010 Mar 07
3
barplot with factors problem
http://www.harding.edu/fmccown/R/#autosdatafile
http://www.harding.edu/fmccown/R/#autosdatafile
I am tring to get a barchat by factors,
following the example in that link above.
===========================
x=c(145,40,40,120,180,
140,155,90,160,95,
195,150,205,110,160,
45,40,195,65,145,
195,230,115,235,225,
120,55,50,80,45
)
y2=c(
rep(as.character(1),5),
rep(as.character(2),5),
2008 Aug 01
1
Legend outside plot => grid not limited to plot
Hi dear R users,
i would like to have:
1. the legend outside of the plot and
2. add a grid to the plot.
For 1. I found a example in the R mailinglist archive [1].
1: http://tolstoy.newcastle.edu.au/R/help/06/01/19423.html
The total example code would be:
> ?par
> par(xpd=T, mar=par()$mar+c(0,0,0,4))
> plot(1,1)
> legend(1.5,1,"point",pch=1)
> grid(NULL,NULL,lwd=1)
But
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]]
2017 Jul 24
2
axis() after image.plot() does not work except if points() is inserted between
Thanks for the proposition. As you see bellow, par("usr") is the same
before and after the points() (the full code is bellow):
....
> par("usr")
[1] -0.2500000 1.2500000 -0.1666667 1.1666667
> # if you remove this points() function, axis will show nothing.
>
> points(1.5, 1.5, type="p")
> p2 <- par(no.readonly=TRUE)
> par("usr")
2010 Jan 12
1
barplot: border color when stacked
Dear R-users,
I am using R version 2.10.1 under windows.
In a barplot, I want to mark one of the bars with a special border color.
For example:
barplot(c(3, 7, 11), border = c(NA, "red", NA))
But how to do this when the bars are stacked?
for example:
barplot(matrix(1:6, ncol=3)) # border of second bar (i.e. the one with total height = 7) should be red again, I try:
barplot(matrix(1:6,
2008 Feb 22
1
Clipping using par(plt=..., xpd=FALSE) inconsistencies
Here is a demonstration of behaviour that is probably an optimization by
someone far smarter than me that did not anticipate anyone wanting to do
this, but for my purposes it looks more like a bug than a feature.
I have tested this with R2.6.2 on Windows, no additional packages loaded
(beyond the default), I have tested using the default graphics object,
pdf, jpeg, and cairoDevice (ok I loaded a
2012 Dec 12
1
Multiple palettes on single plot don't get rendered when I use dev.copy2pdf
Hi All,
I'm having trouble with the colors on my screen getting translated to
the colors in the outputted .pdf document.
Here is a caricature of my problem:
par(mfrow=c(1,1))
x1 = rnorm(1000)
x2 = rnorm(1000)+10
y1 = rnorm(1000)+10
y2 = rnorm(1000)+10
palette(rainbow(6))
plot(x=x1,y=y1,col=y1,xlim=c(-10,20))
palette(heat.colors(6))
points(x=x2,y=y2,col=y2)
dev.copy2pdf(file =
2017 Jul 25
0
axis() after image.plot() does not work except if points() is inserted between
>>>>> Marc Girondot via R-help <r-help at r-project.org>
>>>>> on Mon, 24 Jul 2017 09:35:06 +0200 writes:
> Thanks for the proposition. As you see bellow, par("usr") is the same
> before and after the points() (the full code is bellow):
> ....
>> par("usr")
> [1] -0.2500000 1.2500000 -0.1666667
2006 May 24
3
Regression line limited by the rage of values
Hi
In R, using plot(x,y) followed by abline(lm(y~x)) produces a graph
with a regression line spanning the whole plot . This means that the
line extends beyond the swarm of data points to the defined of default
plot region. With par(xpd=T) it will span the entire figure region. But
how can I limit a regression line to the data range, i.e between
(xmin,ymin) and (xmax,ymax)?
Sorry for
2012 Oct 19
5
RColorBrewer
Hi there everyone! So I'm a student in college, taking a very basic
Statistics course. We're using R for most of our assignments. I've hit a
pretty big wall here. I'm attempting to create a heat map of the entire
united states which corresponds to a set of percentages I have for each
state. My teacher suggested that I simply create a color palette with
RColorBrewer that is in the
2007 Mar 22
1
Labelling a second y-axis
Hi,
I am using the following code as an example function to create
multiple y-axes on one plot. I have it working fine however, I can't
seem to add a label on the second (right) axis. I have tried adding
ylab="y2" in the axis call but, that didn't work; any ideas?
Thanks,
Jesse
Code:
function() {
par(las=1,xaxs="r",mai=c(1,0.75,1,1))
x<-1:10
y1<-x
2001 Mar 05
1
breaking an axis (skipping part of it)
Hello,
Is it possible to skip part of an axis in order to adapt the axis to the
"normal" values and not to an outlier, but still have the outlier in the
graph ? I.e. have my axis go from 1 to 100, then break the axis in some
way, and continue with 500 to 600 ?
Moritz
P.S. Please cc the answer to my address since I'm not in the mailing
list.
2010 Oct 04
1
adding a legend to the plot (but outside of it)
Hello!
My code below creates a data frame and a plot for it.
However, I can't figure out how to add a legend that is not ON the
plot itself, but outside of it (e.g., to the right of my graph or
below it). I tried something: I put a line par(xpd=T,
mar=par()$mar+c(0,0,0,4)) right before my plot command), but that
screwed up all my gridlines - they covered all graph and do not
coincide with
2017 Jul 26
2
axis() after image.plot() does not work except if points() is inserted between
Thanks... I agree that the problem was explained in the documentation
but I can't find a way to have axis() working even manipulating
par("plt") or with graphics.reset = TRUE:
- adding graphics.reset=TRUE does not allow axis() to be shown;
- I see that par()$plt is involved but it is the not sufficient to
explain why axis() works because if it is changed by hand, axes are not
2006 Oct 09
2
lines at margin?
Hi list,
I want to add some lines at margin area of one figure. mtext could add text
to these margins, can I add lines with different lty parameters? Thanks,
mike
[[alternative HTML version deleted]]
How to plot 2 continous variables on double y-axis with 2 factors: ggplot2, gplot, lattice, sciplot?
2013 Feb 25
3
How to plot 2 continous variables on double y-axis with 2 factors: ggplot2, gplot, lattice, sciplot?
Hi,
I have a data set with two continous variables that I want to plot MEANS (I
am not intrerested in median values) on a double-y graph. I also have 2
factors. I want the factor combinations plotted in different panes.
Dummy dataset:
mydata <- data.frame(factor1 = factor(rep(LETTERS[1:3], each = 40)),
factor2 = factor(rep(c(1:4), each = 10)),
y1 =
2006 Jan 19
2
Legend Outside Plot Dimension
Dear All,
I'm trying to attach a legend outside the plot (Inside plot OK), but failed. Any help is very much appreciated.
Thanks.
Abd. Rahman Kassim, PhD
Forest Management & Ecology Program
Forestry & Conservation Division
Forest Research Institute Malaysia
Kepong 52109 Selangor
MALAYSIA
*****************************************
Checked by TrendMicro Interscan Messaging Security.
2013 Mar 26
6
How do I show real values on a log10 histogram
Hi,
I have a histogram with values logged to the base 10
hist(log10(x),breaks=60)
How do I show the log values on the x-axis and a second x-axis showing the
real values?
Thanks
--
Shane
[[alternative HTML version deleted]]
2017 Jul 21
2
axis() after image.plot() does not work except if points() is inserted between
It is known (several discussions on internet) that axis() cannot be used
after fields:::image.plot() (axis() shows nothing).
However, if points(1.5, 1.5, type="p") is inserted before the axis()
finctions, it works.
I have investigated what points(1.5, 1.5, type="p") is doing to allow
axis to work and I don't find a solution. par() options are identical
(p1 and p2 are