Displaying 20 results from an estimated 10000 matches similar to: "Changing the position of the origin"
2010 Mar 24
1
Changing axis origin for plot
Hi all,
I am plotting data using the simple plot function:
plot(data$x, data$y)
which results in a standard plot with the axis origin in the lower left corner.
^
|
|
|
|
| O O
| O O
---------------------------------->
Since my data are screen coordinates I need mirrored axis so that the
origin for both axis is in the upper left corner; like this:
|-------------------------------->
| O
2009 Oct 25
1
rotate levelplot
Hi all,
I have a matrix with 5 rows and 10 columns, which represent the grids
on a rectangular map.
I used the code below to plot, but it gives me the map with the 10
columns as y-axis, and the 5 rows as the x-axis, and the (0,0) point
is at the usual bottom left hand corner. My map starts with the (0,0)
at the top left hand corner.
How can I rotate the map 90 degrees clockwise so the (0,0)
2002 Mar 19
3
plot with the axes at xlim and ylim
I'd like to make a plot with the axes drawn at the values of xlim and
ylim. The default plot draws the axes slightly outside these values. I
have been experimenting with the par(mgp) setting, but specifying
par(mgp=c(2,0,-1)) gives me
"invalid value specified for graphics parameter "mgp".".
A more complicated mathod that almost seems to work is doing the plot
with
2002 May 10
1
barplot()
Hi,
Is it possible to draw barplot with x-axis being shown? I looked up the
help file and I couldn't seem to find it.
For example, I tried to do
x <- 1:9
p <- log10(1 + 1/x)
barplot(p, xlab = "Digit d", ylab = "Probability",
ylim = c(0, 0.35), axes = F,
main = "Benford's Law Probability")
axis(1, 1:9)
axis(2, seq(0, 0.35, by = 0.05),
2011 Sep 30
2
Overlapping plot in lattice
Hi all,
I was wondering if there's an equivalent to par(new=T) of the plot
function in lattice. I'm plotting an xyplot, and I would like to
highlight one point by plotting that one point again using a different
symbol.
For example, where 6 is highlighted:
plot(1:10, xlim=c(0,10), ylim=c(0,10))
par(new=T)
plot(6,6, xlim=c(0,10), ylim=c(0,10), pch=16)
Is there a way to do this in lattice?
2007 Sep 13
1
Origin label in lattice
I would like to make what seems like a simple addition to a display
constructed from a call to levelplot -- I want to add a text label
(which will, in general, depend on the object being plotted, and so
cannot be hardcoded) to the origin, which has special significance in
my problem. The x and y axes always have range (0,1) in my plots, so
by "origin" I always mean the lower left corner
2002 Dec 14
4
scan() with "what"
Hi,
I have a medium-sized (19MB) CSV file that I'd like to read into R. The
read.csv() function seems to be a bit inefficient to deal with it, and I
remember that using scan() with "what" options is better.
However I'm unable to understand how to use it. The first few lines of
the data look like:
2009 Jul 15
3
Axes origins and labeling
I have re-labeled tick marks on the x axis. The problem is that by using
axes=FALSE, the axes disappears and when they are called back using
axis(side=1)..etc. the axis on sides 1 and 2 do not meet at the bottom left
corner of the graph. I would also like to have the 3rd and 4th axes in
there as well, all meeting in their respective corners.
par(mfrow=c(1,2))
gut<-c("Full",
2011 Dec 04
2
Extract last 3 characters from numeric vector
Hi all,
I have a numeric vector with 1 decimal place, and I'd like to extract
the last 3 characters, including the decimal point. The vector ranges
from 0 to 20.
x <- round(runif(100)*20, digits=1)
Some of numbers have 3 characters, and some have 4. I've read up on
the substr() function but that extracts characters based on exact
positions. How can I extract just the last 3
2007 Jun 25
2
changing the position of the y label (ylab)
How can I change the position of the ylab, after
enlarging the margins with par(mar=...)?
Here is the relevant code snippet
----
par(mar=c(5.1,5.1,4.1,2.1))
plot(c(1979,2003),c(40,50),ylim=c(1,73),lab=c(20,10,1),pch=21,col='blue',bg='blue',axes=FALSE,xlab="Years",ylab="Onset/Withdrawl
Date",font.lab=2)
box()
axis(1,las=2)
2003 Sep 01
2
Axis color
Hello, my question is if I have two axes in a graphics as I can put him a
different color al axis and to the number of the scale. ? Thanks. Ruben
2003 Nov 12
2
wishlist item: changing origin of plot (PR#5045)
[This is an edited version of an email that I sent to Paul Murrell.
He was in favour of the idea (although he noted the obstacles that: it
could make par() longer; somebody has to implement it) and
suggested I submit this as a wishlist item.]
Do you think it would be worth adding options to plot commands to
reverse axes?
Here is a simple example:
> x <- 1:12
> plot(x)
Whereas if I
2007 Jun 19
4
plot only x- and y-axis with origin, no box()
hi all,
I'm trying for quite some time to have an x- and y-axis, but no entire box.
>plot(..,axes=F)
>axis(1)
>axis(2)
Gives this, but their axes do not go to the origin.
Quite a number of people find this gap between the two axes disturbing.
Has anyone an idea how to let these axes go to the origin?
thank you in advance
[[alternative HTML version deleted]]
2011 Jan 16
2
xyplot: modify axis tick marks
Hi,
I would like to plot time against rainfall data (data is at the end)
using xyplot.
The basic code looks like this: xyplot(rainfall~time, type="a")
When I do this, the graph looks ok except that the x-axis has too many
values. I would just like to display the years and not the months on
the x-axis. I've been fiddling around with 'scales', and read previous
posts about
2004 Nov 11
1
axis lines crossing at origin
Hi
how do I make my axes cross at the origin?
x <- seq(from=-pi,to=pi,len=30)
plot(x,sin(x))
makes the axes cross at about (-pi,-1).
How do I get my x and y axes to cross in the centre of the graph,
with the sine curve passing through
the intersection?
I couldn't find anything in ?par or ?axis; searching R-FAQ for "axis"
didn't help.
--
Robin Hankin
Uncertainty
2010 May 15
1
Barchart reorder
Hi fellow R users,
I have a dataset that looks something like this.
species class abundance
K 1 592
K 2 288
G 1 254
G 2 239
C 2 173
D 2 123
E 3 89
F 2 87
B 2 86
H 2 82
I 1 79
J 2 76
B 1 73
D 3 72
A 2 62
L 2 58
I want to plot a stacked barchart. species is the x-axis, abundance is
y-axis, and class will appear as the stacks in different colours. I
need the species to be displayed in descending
2002 Jun 08
3
contour plot for non-linear models
Hello all,
I've tried to reproduce the contour plot that appears in the book of
Venables and Ripley, at page 255. Is a F-statistic surface and a
confidence region for the regression parameters of a non-linear model.
It uses the stormer data that are in the MASS package.
I haven't been able to reproduce the plot either in R ( version 1.5 )
and S. It makes the axes and it puts the
2010 May 23
2
Subsetting with a list of vectors
Hi,
I have a dataset that looks like the one below.
data
plot plantno. species
H 31 ABC
D 2 DEF
Y 54 GFE
E 12 ERF
Y 98 FVD
H 4 JKU
J 7 JFG
A 55 EGD
. . .
. . .
.
2003 Mar 03
2
saving a plot to a file
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I'm a new user of R and have managed to make a plot of a histogram. Is there
any way I set the title and axes labels and then save the plot as an image
(png/gif)?
Thanks
- --
- -------------------------------------------------------------------
Rajarshi Guha <rajarshi at presidency.com> <http://jijo.cjb.net>
GPG
2010 May 28
1
Match 2 vectors
Hi,
I have 2 dataframes of unequal length, and I would like to match a
factor to them so that both dataframes will have the same number of
rows.
example:
# create the 2 dataframes with unequal length
data1 <- data.frame(letters, 1:26)[-c(5,10,19:21),]
data2 <- data.frame(letters, 1:26)[-c(6,9,15:18),]
data2a <- match(data1[,1], data2[,1])
data2b <- data2[data2a,]
When I match