similar to: altering legend with plot(density(..))

Displaying 20 results from an estimated 40000 matches similar to: "altering legend with plot(density(..))"

2007 Sep 10
3
plot legend: combining filled boxes and lines
Hello, I have difficulties combining boxes and lines in plot legend. I searched previous R-posts and found this (with no solution): http://tolstoy.newcastle.edu.au/R/help/06/07/30248.html. Is there a way to avoid boxes behind the line legends? x1 <- rnorm(100) x2 <- rnorm(100, 2) hist(x1, main = "", col = "orange",ylab = "density", xlab = "x", freq =
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)
2008 Sep 04
2
Adding a legend to R graph device with several plots (no to individual plots!)
Dear Users, I already posted this question: it either went unnoticed, or it is to basic (if this is so, please sent me a hint). I would like to know if there is a way to add a common legend to an arrangement of plots. In the example below, I get four plots in my device. each one has a density for 1995 and one for 2006. I have found that using legend or smartlegend I can add a legend to each plot,
2010 Apr 19
1
densCols: what are the computed densities and how to create a legend
Hi, I'm using the densCols function for a scatterplot and cannot figure out 1) how to extract the computed densities, and 2) how to create a legend based that represents the upper and lower ranges of the densities. For example: movers.den <- densCols(move$x, move$y) table(movers.den) #08306B #083775 #083B7C #083D7E #3989C1 #3F8FC4 28 22 101 25
2009 Aug 27
1
Wishlist: specify the border color of boxes in legend() (PR#13913)
I could not find a way to specify the border color of the boxes drawn in a legend, so that the legend can match exactly the colors of the actual plot (e.g. in the case of two superimposed histograms which have different shading and different borders). Indeed, the legend function seems to hard code the color "black" for the borders in this call: rect2(left = xt, top = yt +
2010 Feb 19
1
"Legend" question
Hi, I want to get a histogram with the legend for my data. I drew a normal density curve and kernel density curve in the histogram, and I also label mean and median in the X axis. From the code, I got two legend: One shows "Normal Density" and "Kernel Density" and their corresponding lines, the other shows "Mean = value" and "Median = value" and their
2011 Aug 21
2
Increase the size of the boxes but not the text in a legend
HI there, I want to add a legend to a plot using the density and angle argument, so patterns with lines in different angles are used in the plot and should be referred to. When I use default settings, the filled boxes are too small. With the cex argument I can enlarge the whole legend, but then the text gets too big. How could I just increase the size of the single boxes and not the text. I
2005 Aug 22
1
How to add legend of plot.Design function (method=image)? (if (!.R.) )
Hi, When running z <- plot(fit, age=NA, cholesterol=NA, perim=boundaries, method='image') Legend(z, fun=plogis, at=qlogis(c(.01,.05,.1,.2,.3,.4,.5)), zlab='Probability') And after pointing the cursor to the plot() screen in R, I obtain the following message: Using function "locator(2)" to place opposite corners of image.legend Error in
2003 Dec 12
1
legend() graphics output bug (PR#5725)
Full_Name: Daniel Gasser Version: 1.8.1 OS: Win XP Submission from: (NULL) (130.60.20.92) The legend()-Function shows a different behaviour than it did in Version 1.6.1. It plots a black box left of the legend lines on each legend row. In 1.6.1 there was just the line in appropriate color for each row in the legend (i was using exactly the same legend statement and same plot function). My legend
2008 May 31
2
How to add space between main title to leave space for legend?
Hello, everybody: I recently encountered an example with in which the graph was placed in a way that did not leave room for a legend. Maybe you would describe it as "legend too big", I'm not sure. I found myself wishing I could force in some space after the title. Here's working example where I'd like to make room for a legend. x <- rnorm(100) hist(x, freq=F,
2010 Nov 11
3
overlap histogram and density
Hi, Does anybody encounter the same problem when we overlap histogram and density     that the density line seem to shift to the right a little bit?           If you do have the same problem, what should we do to correct that?           Thank you.           par(mar=c(4,4,2,1.2),oma=c(0,0,0,0))     hist(datobs,prob=TRUE, main ="Volume of a catchment from four    
2010 May 03
2
Plotting legend outside of multiple panels
Hello, I have used layout() to produce to 2 plots on a page, leaving a plotting space above them. I would like "Legend", which will actually be a real legend, to be centered above the two graphs. Right now I am only able to position "Legend" above the second graph that I create... obviously I am stuck in its margin space. Is there a way to draw the legend in the empty
2004 Nov 08
1
whishlist: legend - changing color of the boxes-border
Hi, Drawing a legend I would like to be able to specify the color of boxes which are drawn if fill or density is specified. eg. legend(0,40000,c("raw","LR/PR-TPS"),fill=c(1,2),col=c(1,2),density=c(20,20),angle=c(-20,45),bty="n") Currently the color of the boxes -- border is always black and can *not* be changed. To get this option only a *minimal* change is
2009 Aug 19
2
ggplot2 legend problem
I'm trying to overlay two histograms using transparency to enable viewing of multiple distributions on a single scale. So far ggplot2 seems to do what I want. However I'm having a problem generating the legend coloring appropriate to each distribution in the plot. Here is a test case to show my best (failed) effort so far: library(ggplot2) x <- data.frame(X=rnorm(1000, mean=0)) y
2009 Sep 02
1
Howto Superimpose Multiple Density Curves Into One Plot
I have a data that looks like this: http://dpaste.com/88561/plain/ And I intend to create multiple density curve into one plot, where each curve correspond to the unique ID. I tried to use "sm" package, with this code, but without success. __BEGIN__ library(sm) dat <- read.table("mydat.txt"); plotfn <- ("~/Desktop/flowgram_superimposed.pdf"); pdf(plotfn);
2008 Jul 27
1
Color of box frame in Legend (Was: Matrix barplot)
On Sun, 27 Jul 2008, S Ellison wrote: > Looking at the legend() source the filled box line colour is hardcoded : > if (mfill) { > if (plot) { > fill <- rep(fill, length.out = n.leg) > rect2(left = xt, top = yt + ybox/2, dx = xbox, dy = ybox, > col = fill, density = density, angle = angle, > border =
2006 Oct 13
3
Barplot legend position
Dear useRs, I'm trying to create a barplot like so: x=matrix(1:10,2,5) barplot(x,leg=c("left","right"),besid=T) The legend is placed in default position topright, however the data are plotted there too. I tried controlling the legend position by adding x="topleft" but this results in an error that x matches multiple formal arguments. Leaving out the legend
2011 Jun 10
1
smoothScatter function question and adding a legend
Hello, I have a few questions, regarding the smoothScatter function. I have a scatter plot with more than 500,000 data points for two samples. So, I am wanting to display the density in colors to convince people that my good correlation coefficient is not due to an "influential point effect" and plus, I also want to make my scatter plot look pretty. Anyway ... I have been able to
2010 Jan 04
3
how to plot multiple density functions in one graph
Hello, I am new to R and have two easy questions. How can you plot multiple density functions in one graph? I have five beta densities that I would like to plot in one graph. I understand how to plot one beta density as a line: plot (x,(dbeta(x,shape1=,shape2=,), type ="l") Does the Pareto distribution need to be added to R with an additional package? thanks, John [[alternative
2011 Dec 01
2
legend, "lheight", and alignment
Hello, A bit of fairly simple code, yet I don't seem to be able to manipulate it quite as much as I would like: 1) It would be nice if the objects appearing in the legend were aligned, and by aligned I mean the boxes are centered over the lines. Do I need to adjust the use of "NA" in the code below to accomplish this? Here's how it appears on my machine: