Re: [R] ggplot rank stack bar automatically.

2012-02-21 Thread vd3000
Hi Ista, I got it. I try to deselect the all packages and try to run the code again. Eventually, the console display no "digest" package. You are so nice. A lot of things to learn... Many thanks. Best, VD -- View this message in context: http://r.789695.n4.nabble.com/ggplot-rank-stack-bar-autom

Re: [R] ggplot rank stack bar automatically.

2012-02-20 Thread Ista Zahn
Hi, That is not what I get. After running your code I get levels(df.m$Period) [1] "1991-00" "1901-10" "1981-90" "2001-06" "1911-20" "1881-90" "1971-80" [8] "1921-30" "1891-00" "1961-70" "1871-80" "1851-60" "1951-60" "1861-70" [15] "1841-50" "1941-50" "1831-40" "1931-40" "1820-30" this is my v

Re: [R] ggplot rank stack bar automatically.

2012-02-20 Thread vd3000
> df <- structure(c(106487, 495681, 1597442, 2452577, 2065141, 2271925, 4735484, 3555352, 8056040, 4321887, 2463194, 347566, 621147, 1325727, 1123492, 800368, 761550, 1359737, 1073726, 36, 53, 141, 41538, 64759, 124160, 69942, 74862, 323543, 247236, 112059, 16595, 3702

Re: [R] ggplot rank stack bar automatically.

2012-02-18 Thread Ista Zahn
Hi VD, The plot should not be the same after reordering. Please show us what you did, and what the result was. Best, Ista On Saturday, February 18, 2012 06:22:00 PM vd3000 wrote: > Hi, Ista, > > > I found the graph were same as "before recording" > http://izahn.homedns.org/tmp/barplotOriginal

Re: [R] ggplot rank stack bar automatically.

2012-02-18 Thread vd3000
Hi, Ista, I found the graph were same as "before recording" http://izahn.homedns.org/tmp/barplotOriginal.png Anyway, I will try again, Many thanks. I am now trying to stack it horizontally and found that the axis text overlap each other!! New battle start again. X_X!! VD. -- View this messag

Re: [R] ggplot rank stack bar automatically.

2012-02-18 Thread Ista Zahn
Hi, Here is what I get before reordering: http://izahn.homedns.org/tmp/barplotOriginal.png and after reordering: http://izahn.homedns.org/tmp/barplotReordered.png Are you saying you get something different? Or that this is not what you were trying to do? Best, Ista On Friday, February 17, 201

Re: [R] ggplot rank stack bar automatically.

2012-02-18 Thread vd3000
Hi, Ista, 1. /"df.m <- transform(df.m, Period = reorder(Period, -1*value)) ggplot(df.m, aes(x = Period, y = value/1e+06, fill = Region)) + geom_bar(stat = "identity", position = "stack") "/ I have followed your instruction but I found the sequence did not change. 2. I am looking for the st

Re: [R] ggplot rank stack bar automatically.

2012-02-16 Thread R. Michael Weylandt
No I'm talking about changing the order (the first part of your question). What you see as dates on the axis aren't actually "Date"s (in the sense of the R class of that name) but rather factors. To R they are just labelled categories so it just uses an arbitrary order to plot them: if you chan

Re: [R] ggplot rank stack bar automatically.

2012-02-16 Thread Ista Zahn
Hi vd, The answer to the first part of your question is reorder. To continue the learnr example: df.m <- transform(df.m, Period = reorder(Period, -1*value)) ggplot(df.m, aes(x = Period, y = value/1e+06, fill = Region)) + geom_bar(stat = "identity", position = "stack") For the second questi

Re: [R] ggplot rank stack bar automatically.

2012-02-16 Thread vd3000
Hi, Micheal, Are you talking about the recode for eliminating "\" problem? I think I am looking for how to eliminate it when I import the data file... THAnks. VD. -- View this message in context: http://r.789695.n4.nabble.com/ggplot-rank-stack-bar-automatically-tp4391042p4393328.html Sent from

Re: [R] ggplot rank stack bar automatically.

2012-02-15 Thread R. Michael Weylandt
It looks like period is a factor, so you can reorder the factor levels however you wish and then plot them the same way. I believe recode() in library(car) is a popular function for doing this, but I haven't used it myself. Michael On Wed, Feb 15, 2012 at 11:34 AM, vd3000 wrote: > Hi, all, > > I

[R] ggplot rank stack bar automatically.

2012-02-15 Thread vd3000
Hi, all, I am currently trying to learn this example. http://learnr.wordpress.com/2009/03/17/ggplot2-barplots/ I created the stack bar easily. If I would like to rank the stack bar from the highest on the right, shortest on the left and eventually I could show the data "1991-00" on the left