Displaying 20 results from an estimated 10000 matches similar to: "How Plot, Axis and Rect work together?"
2000 Nov 27
4
Margin question
I am trying to produce a postscript plot consisting of rectangles and text
labels in R. It is going very well, but I have been unable to get small
margins on the page. I read the documentation on the 'mar' and 'oma'
options, but they claim that the margins should default to being 0.25in
wide, in fact on my plot they are more like 1in each! Here is the
smallest R script that
2013 Mar 08
3
2D filled.contour plot with 1D histograms by axes
Hi everyone,
I hope this question is beyond "read the manual". My task is simple, just
to plot the following, but the plot in the middle should be a
filled.contour plot:
http://gallery.r-enthusiasts.com/graph/Scatterplot_with_marginal_histograms_78
Background: I prefer filled.contour rather than hist2d. Because, I could
use kernel smooth, so the plot for discrete data won't be too
2013 Feb 14
1
fill colour in grid
Dear all r-users,
I have this code below to draw two squares, small and big square. I would like to colour the small square with red and the big square with blue for example. I tried using polygon but fail. Thank you so much for your help.
par(mar=c(4,4,2,1.2),oma=c(0,0,0,0),xaxs="i", yaxs="i")
plot.new()
plot.window(xlim= c(0,8),
2002 Nov 19
1
Another plot question
Here is another, perhaps trivial, plotting question.
I am making a filled contour plot and have almost everything dialed in
the way I want it. The last hurdle (that I can foresee) is adjusting the
look of the key. I'm plotting the 25%, 50%, 75%, and 95% quantiles and I
want the key to be evenly spaced, e.g., the width of the 25% and the 95%
should look the same on the key. They are labeled
2012 Jan 08
2
need help with axis ticks
hi,
i am using par(mrow=c(6,6)) function to get 6x6 plots on one screen. the
problem that i am having is that the axis tick labels are far away from the
ticks and going into previous plots (see attached figure). i need to know
how can i reduce the distance between the ticks and their values (y axis
values).the part of the code that i am using (after reading in the data) to
create the top row is:
2007 Mar 06
1
Obtaining figures with exactly placed points
Dear list,
I have to plot some geometrical shape given as list of points. My need
is the following: let's say my shape is a 1 inch large square; how can
I plot it with R in a graphic format that gives me an image *exactly*
1 inch large? I tried to set oma, mar and fin parameters, but with no
success.
I'm currently using the xfig driver for the final images are to be
included in latex
2008 Feb 21
1
linebreaks in mathplot
Dear HelpeRs,
I would like to do sg similar to:
plot(c(0,100), c(0,100), xaxs="i", yaxs="i", type="n")
txt <- paste("a =", a, "%\n b =", b, " km2", sep="")
text(95, 95, txt, adj=c(1,1))
just with the "km2" formatted with 2 in a superscript.
I thought
txt <- substitute("a = "*a*" %\n b
2007 Feb 22
3
several Filled.contour plots on the same device...
hello -
a question about filled.contour plots, for which i haven't found a
response in previous posts - sorry if already treated.
i'd like to draw several filled.contour plots (that is, maps) on the same
device (a postscript file, actually). I know about layout(matrix) ,
split.screen or par(mfrow) : it works well for simple plots, but with
filled.contour plots, i get several pages
2002 Aug 06
1
polygon() draws non-transparent border, erase.screen draws non-transparent border (PR#1881)
# polygon ignores requests to have its border transparent, look at
par(bg="transparent")
plot(c(0, 3), 0:1)
polygon(c(0, 1, 1, 0), c(0, 0, 1, 1), border=NA, col = 0)
polygon(c(1, 2, 2, 1), c(0, 0, 1, 1), border="transparent", col = 0)
polygon(c(2, 3, 3, 2), c(0, 0, 1, 1), border=0, col = 0)
# a quick fix for erase.screen() is the following
erase.screen <-
function (n =
2012 Sep 20
3
Line over Boxplot
Very much a rookie at R, and have only recently started using it again so
pardon the simple question. I am trying to produce a box plot from one data
set and then overlay a line plot from another data set. The box plot data
set is made up of 20 sets of 30 data points, or 600 total data points. The
line has only 30 total data points. The box plot is plotting fine, but for
some reason, the line plot
2006 Dec 27
4
axis and times() problem
Dear R-Group,
the first example is working as expected, but I need the plot without
the box,
normally no problem, but I am not able to get the x-axis formatted as
times with the axis, command.
I tried a lot of things, nothing was working so I used the most easy
axis command in the second example here ....
# working
library(chron) # for times()
library(graphics)# for axis
2006 Dec 27
4
axis and times() problem
Dear R-Group,
the first example is working as expected, but I need the plot without
the box,
normally no problem, but I am not able to get the x-axis formatted as
times with the axis, command.
I tried a lot of things, nothing was working so I used the most easy
axis command in the second example here ....
# working
library(chron) # for times()
library(graphics)# for axis
2004 Mar 15
4
setting x-y axis at origin
Hello -
I'm just getting into 'R' and am having trouble setting up the x-y axis
to share (0,0). In the example posted here:
http://geocities.com/chris_ciotti/Images/part1.pdf, each axis has a 0
which I do not want.
Any help on getting a graph starting at (0,0) would be greatly
appreciated.
--
chris ciotti (chris_ciotti at yahoo.com)
PGP ID: 0xE94BB3B7
2006 Jan 24
1
Basic graphics question
I have a toy example given here:
par(fig=c(0,1,0,0.05))
par(mar=c(0,0,0,0))
par(plt=c(0,1,0,1))
par(oma=c(0,0,0,0))
par(ann=F)
plot(c(0,1),c(0,1),type='n',xlab='',ylab='',main='')
rect(0,0,1,1,col='gray75')
What parameter am I missing to make the gray rectangle use the entire figure
region? I am trying to build a plot from
2011 Jan 28
1
Adding image to plotting area
Hello,
I've drawn a black rectangle over the plotting area, and when I add an image() heatmap, it doesn't take up all the area, but is set inward from the black rectangle. Can anyone suggest how to make it stretch out to the entire area ?
Minimal example :
y <- matrix(runif(2000*20), nrow = 2000)
y[100:200, 10] = NA
plot.new()
usr <- par('usr')
rect(usr[1], usr[3], usr[2],
2007 Jan 01
4
Help with filled.contour()
The following plot is a first approximation to what I need:
***********************************
mu1 <- 0
mu2 <- 5
s <- 1
x <- seq(-2.5, 7.5, length = 41)
y <- seq(-2.5, 2.5, length = 41)
f <- function(x,y){
term1 <- 1/(2*pi*sqrt(s*s))
term2 <- -1/2
term3 <- (x - mu1)^2/s
term4 <- (y - mu1)^2/s
term5 <- (x - mu2)^2/s
term1*(.5 * exp(term2*(term3 + term4)) + .5 *
2004 Mar 19
5
asp=1 and aspect ratio
Hi everyone
I want a square scatterplot with abline(0,1) going exactly through the
SW and NE corners. By "square" I mean that the plotting region is
exactly square, and that the axis limits are identical.
x <- 1:20
y <- x+rep(c(-1,1),10)
lims <- range(c(x,y))
None of the following do this:
plot(x,y) ; abline(0,1) #not square
plot(x,y,asp=1);abline(0,1) #diagonal
2010 Feb 07
4
x-axis plot problem
Hi all,
I tried to have plot of many vector in one plot and i have got a nice plot
but i have problem with x-axis. I want to have month and year only(Jul.07
means July 2007) in x-axis without appearing other number behaind it.
I would appercit any help.
The R code:
F<-c(7.49,6.91,6.78,6.99,7.44,7.42)
M<-c(4.81,4.51,5.21,4.65,4.75,3.86)
P<-c(7.49,15.03,15.19,15.32,15.42,15.45)
2002 Jan 07
1
Help with displaying multiple data elements on one graph
I'm interested if anyone can help me to the R to display multiple data
elements on one graph - just a simple graph, nothing fancy. I can't seem
to find an example of this. An example of what I'm looking for is, say, a
CPU graph which graphs user, system, and idle time as a cumulative stack
representing each data element as a different color. See the following URL
for an example
2007 Oct 24
1
Adding a second y axis and specifying yaxs="i"
Hello All,
I have plotted a barplot and placed a line plot over top using
par(new=TRUE).
In the first plot I have specified that yaxs="i" and xaxs="i". However
when I add a new axis to side 4 (right) and try to specify yaxs="i" it
does nothing and the axis line begins above the x axis when I want the
two points to meet. Can anyone tell me how to specify the