similar to: GGPLOT2: Reverse order of legend to match order of x-axis

Displaying 20 results from an estimated 4000 matches similar to: "GGPLOT2: Reverse order of legend to match order of x-axis"

2009 Jul 28
2
Density plot in ggplot2
Hi all, I was trying to draw a stacked density plot like that : library(ggplot2); library(plyr) dat <- cbind(rnorm(300), rep(c(1,2), each=150)) ggplot() + geom_density(aes(x=dat[,1], fill=factor(dat[,2]), position="stack")) + xlab("") + ylab("") + scale_colour_manual(name = "Pallet", labels = c("X", "Y")) Here
2017 Sep 26
2
Adding non-data line to legend ggplot2 Maximum Contaminant Level
Hello everyone, I have a plot showing chloride concentrations for various point over time. I also have a dotted line that show the Secondary Maximum Contaminant Level (my screening limit) on the graphs at 250 mg/L. But I can not figure out how to include the dotted line / Secondary Maximum Contaminant Level in the legend. Any thoughts? My code is as following and is linked to my data on the
2017 Oct 05
0
Adding non-data line to legend ggplot2 Maximum Contaminant Level
Well, here is one way but it seems a bit clumsy. In words, I created a new data.frame with "250" in the Chloride vector and "SMCL" in the Detections vector and supplessed one legend. Warning: For my convenience I am using different data.frame names . library(ggplot2) MyData <-read.csv("http://doylesdartden.com/Stats/TimeSeriesExample.csv", sep=",")
2017 Oct 01
0
Adding non-data line to legend ggplot2 Maximum Contaminant Level
I just glanced at the problem but I think you would have to create a new variable to replace the hline. What about adding some text annotation in the graph instead? On Tuesday, September 26, 2017, 3:51:46 PM EDT, David Doyle <kydaviddoyle at gmail.com> wrote: Hello everyone, I have a plot showing chloride concentrations for various point over time. I also have a dotted line that
2010 Oct 20
1
Adding Legend about two quantile lines at ggplot
Hi, all. I'd like to add legend on my graph but I can't. My code is follows. library(ggplot2) score1<-rnorm(100,0,5) score2<-rnorm(400,10,15) mydata<-data.frame(score1,score2) ggplot(mydata,aes(y=score2,x=score1))+geom_point()+stat_quantile(quantiles=c(0.50),col="red")+stat_quantile(quantiles=c(0.90),col="blue",size=2) I like to add legend indicating the
2009 Dec 01
1
ggplot legend for multiple time series
Hello All, I am trying to create a legend for a black-white graph. The package I use is ggplot2. It can add colors to the legend key but not line types. Can you please help? # example from Wickman (2009, ggplot2 - elegant graphics for data analysis, page 109) library(ggplot2) huron <- data.frame(year=1875:1972, level=LakeHuron) ggplot(huron, aes(year)) +
2010 Nov 23
1
specifying colours in a ggplot2 piechart
Someone was asking how to do a 16 category piechart in OpenOffice Calc and it appears that it can not be done (which we, probably, should be happy about) but I thought that I'd try it in ggplot2. It works but I then thought I'd like to make the colours more distinctive but fro some reason I don't seem to be able to use manually assigned colours. Can anyone suggest where I'm
2008 Jun 10
1
Sweave, ggplot2 and two-page figures
I am using Sweave to generate a document in which ggplot2 figures are embedded. I am using the following code in a particular plot within a subfloat environment: <<qplotARbosreg, echo = FALSE, fig = TRUE>>= print(qplot(bosday2, Arday2, data= arbostimearonlyNArm, colour=factor(bos2), shape=factor(bos2), size=factor(cumARscore), position="jitter", main="Days to BOS by
2010 Jan 27
1
ggplot2 theme for custom point colors?
1. Is it possible to set the point colors in a ggplot2 theme? For example, to default to these colors: scale_colour_manual(value = c("red", "orange", "yellow", "green", "blue") 2. Is it possible to set this theme in .Rprofile, similar to: my.lattice.colors = function () { .......etc.....} options(lattice.theme=".mw.lattice.colors") --
2024 Mar 05
1
How to invert axis within defined range with ggplot2 scale_y_reverse?
Hello, I am drawing some data with ggplot2 and would like to reverse the order of the y axis and set a custom range for it. I can do the former but when I add the key `limits` to `scale_y_reverse` I get an error as shows below and, worse, no data shown in the plot. How can I properly set a reverse y scale with a defined range in ggplot2? Thank you ``` A <- rep(c(0, 3, 6, 12, 24), 3) B <-
2024 Mar 05
1
How to invert axis within defined range with ggplot2 scale_y_reverse?
On 05/03/2024 7:16 a.m., Luigi Marongiu wrote: > A <- rep(c(0, 3, 6, 12, 24), 3) > B <- c(rep(0,5), rep(1,5), rep(2,5)) > V <- c(27.5, 27.01, 27.75, 27.98, 27.4, 25.69, > 26.17, 27.78, 26.08, > 24.97, 23.18, 21.78, 22.49, 21.85, 22.2) > df <- data.frame(Conc = A, Time = B, Value = V) > df$Conc = as.factor(df$Conc) >
2023 Jul 02
0
How to plot both lines and points by group on ggplot2
Thank you that is exactly it! The problem was to connect each point of the series 'Conc' with a line. Best regards Luigi On Sat, Jul 1, 2023 at 8:33?PM Chris Evans <chrishold at psyctc.org> wrote: > > > On 01/07/2023 19:20, Luigi Marongiu wrote: > > Hello, > > I have a dataframe with measurements stratified by the concentration > > of a certain substance.
2010 Sep 20
1
ggplot2 - bar colour
Hi All, I have trying to do what I thought was a reasonably simple graph but I think I'm now going in circles with the colour. Attached is a picture of where I'm up to. The line creating this is: qplot(ageincgraph$age, ageincgraph$rate, position="dodge", stat="identity", geom="bar" ) + aes( colour=ageincgraph$era) +
2011 Jan 05
3
Adding lines in ggplot2
Hello, this is probably a recurrent question, but I couldn't find any answers that didn't involve the expression "data frame"... so perhaps I'm looking for something new here. I wanted to find a code equivalent to > x=sqrt(1:10) > y=log(1:10) > plot(1:10, x, type="lines", col="darkgreen") > lines(1:10, y, col="red") to use with
2012 Mar 05
2
ggplot2
I just updated to R 2.14 with ggplot2 0.9 and am finding bugs. > ggplot2 "GPL-2" "2.14.0" This example is taken from pg 101 in the ggplot book. > plot <- qplot(date, psavert, data = economics, geom = "line") + > ylab("Personal savings rate") + geom_hline(xintercept = 0, colour = > "grey50")' > plot +
2011 Sep 07
2
ggplot2-Issue placing error bars behind data points
Hi all, This seems like a basic problem, but no amount of playing with the code has solved it. I have a time-series data set like that shown below (only longer) and am seeking to plot the data with filled, circular points and error bars. I would like the error bars to be behind the points otherwise they tend to obscure the points (especially when I have a lot of points in the actual data set).
2011 Oct 18
3
Ordering of stack in ggplot (package ggplot2)
I'm trying to reproduce the 3rd graph on the page of this site: http://learnr.wordpress.com/2009/03/17/ggplot2-barplots/ . However, the data below produces a ggplot with the stacks sorted in alphabetical order from the bottom up. I'd like the stacks to be in the order "Europe", "Asia", "Americas, "Africa", "Oceania". Is there an easy way to
2010 Feb 08
3
ggplot2 stacked line plot
Hi all, I have been hunting around for hours trying to figure out how to generate a stacked line chart using ggplot2. This type of chart can be generated in excel 2007 by selecting: Chart type > Line > Stacked line. I can generate a stacked area chart using the following code: p <- ggplot2(~, aes(x = ~, y = ~, colour = Type)) + geom_area(aes(position = 'stack', fill = Type))
2012 Feb 01
1
ggplot2(0.9.0): could not find function "=="
Hi, I have a question related to the newest version of ggplot2 (0.9.0). I just updated this morning and from CRAN it looks like the Mac version is the only one at 0.9.0 as of right now. http://cran.r-project.org/web/packages/ggplot2/index.html Anyway, I was in the midst of a project where I was trying to replicate "Back-to-back Bar Charts" in this blog post.
2009 Jun 01
1
ggplot2: How to export several plots with same width?
I have three plots and I want the *plot area* to be of the same width on each plot. Since the three plots have different legends, the text width of the legend affects the width of the plot area (longer legend text = narrower plot area). Exporting the three figures to postscript device of same size gives thus unequal plot areas. How can I calculate the correct width of postscript device for each