Displaying 20 results from an estimated 10000 matches similar to: "ggplot2 stacked line plot"
2010 Feb 03
1
odbcConnectExcel2007 connection error
Hi all,
Apologies if I violate any posting etiquette - this is my first
submission to the R mailing list. I regularly use
'odbcConnectExcel2007' (from package 'RODBC') to read data from named
ranges in excel workbooks into R. I recently received the following
error message when attempting to set up a connection channel (i.e. ch1
<- odbcConnectExcel2007('path to excel 2007
2010 Apr 21
1
ggplot and scale_x_date
Hi all,
I have a question about setting arbitrary breaks/labels when using GGPLOT
and date/time data on the x-axis. I want to specify the breaks/limits
arbitrarily rather than using scale_x_date(major = 'blah'), much like when
arbitrarily defining breaks/labels using scale_x_discrete(breaks = blah,
labels = blah)
I have tried variants such as:
scale_x_date(major = seq(from =
2009 Jan 22
1
ggplot2 example
I need to plot two graphics just like the example below but for some reason your example crashes. Using facet_wrap seems to be the cause:
library(ggplot2)
upper <- with(economics, data.frame(date,value = psavert, position = "upper"))
upper
lower <- with(economics, data.frame(date,value = unemploy,position = "lower"))
lower
#upper$date <-
2024 Dec 06
1
ggplot2: Plot multiple lines using stacked data.
I am trying to use ggplot2 to create a figure with multiple lines, one line for each value of the variable Day. Each group of data for Day requires seven lines. The dataframe has data for 4 days and thus 4*7=28 lines.
I can create a plot, but the plot only contains dots. The dots for each day should be connected each day's data by a different line. There should be a total of four lines on the
2023 Mar 27
1
Cambiar orden top-down stacked area ggplot2
Buenos días, con el código de abajo obtengo un agregate que empieza por
abajo con la categoría C7 y termina arriba por la C1. Me gustaría que
fuera al revés, que la C1 estuviera abajo y ascendiera hasta tener la C7
arriba.
Gracias,
Manuel
year<-c(rep(1990, times=7),rep(2018, times=7),rep(2040, times=7),rep(2060,
times=7),rep(2080, times=7),rep(2100, times=7))
2010 Oct 05
2
is there a way to avoid "traveling" grid?
Hello!
If you run the whole code below, it'll produce a stacked diagram. And
it looks good - because the tick-marks are aligned with the grid.
However, if I stretch the graph window, grid becomes misaligned with
the tickmarks. Or, rather, it seems aligned for the first and the last
tick mark, but not for tickmarks in between.
Can it be addressed?
Thank you!
Dimitri
### Creating a data set
2013 Apr 30
1
Stacked geom_bar with aggregated SE -ggplot2
Hi there,?
I've been battling with an extension of this in my own data: getting
appropriate error bars once data is stacked in a bar graph.?
(original question:
http://r.789695.n4.nabble.com/ggplot2-se-variable-in-geom-errorbar-s-limits-
td3311176.html). It wouldn't let me reply to that thread.
A modification of the earlier answer:?
data(diamonds)?
?diamonds_df <- ddply(diamonds,
2010 Feb 04
2
ggplot2 / time series with different scales
I am trying to plot this dataset using ggplot2:
df <- data.frame(
sid = c(rep('11',30),rep('22',30)),
time = rep(ISOdate(year = 2010, month = 1, day = 1:30),2),
sales = c(rnorm(30, 1000, 20),rnorm(30, 900, 10)),
price = c(rnorm(30, 2, 0.5),rnorm(30, 3,0.5))
)
Plotting just the sales can be done easily:
ggplot(data=df, aes(x=time, y=sales, group=sid, color=sid)) +
2011 Jan 30
2
ggplot2 -- scale_colour_manual()
According to Hadley's ggplot book (p. 109), both the graphs below should have a legend, and yet none appears in my hands.
Any suggestions? I can't see a typo. Is there a bug?
library(ggplot2)
data(LakeHuron)
huron = data.frame(year=1875:1972,level=LakeHuron)
p = ggplot(huron, aes(year)) +
geom_line(aes(y= level - 5), colour = 'blue') +
geom_line(aes(y= level + 5), colour
2008 Oct 06
2
Stacked area chart and legends
I have found lots of good advice on this forum about stacked area charts but
I?ve run into problems with the 2 recommended options: stackploy in plotrix
or qplot in ggplot2. I have a many page report that will be in a 2x2 page
format ?par(mfrow=c(2,2))?? and need one of the page components to be a
stacked chart.
I?d prefer to use stackpoly, if possible, but I?m stuck on how to do the
legend in
2011 Feb 17
3
ggplot2, 'se' variable in geom_errorbar's limits?
Dear R-list
I'm working with with geom_errorbar; specifically I'm trying to
reproduce the example Hadley Wickham have on
http://had.co.nz/ggplot2/geom_errorbar.html (all in the button of the
page) where he makes an nice plot with errorbars and then draw lines
between the points.
What confuses me is the 'limits' he defines for the errorbars from the
se variable.
First he creates
2018 Jan 19
2
Split charts with ggplot2, tidyquant
So the general strategy for getting these into separate panels in ggplot
is to have a single variable that will be your response and a factor
variable that indexes which original variable it came from. This can be
accomplished in many ways, but the way I use is with the melt() function
in the reshape2 package.
For example,
library(reshape2)
plotDF <- melt(SPYdf,
??? ??? ??? ??? ??? ???
2010 Feb 05
1
ggplot stacked bar chart help
I'm trying to create a stacked bar chart with x=month, y=volume, and
factor=type.
volume type month
100 A SEP09
200 A OCT09
300 A DEC09
400 B SEP09
500 B OCT09
600 B DEC09
700 C SEP09
800 C OCT09
900 C DEC09
Following Hadley's examples, I get 3 bars with SEP09: 3-A,
2011 Jul 24
1
barplot colors
Hi,
In barplot(height, col = ...), the col = vector recycles so that the
same colors are used for each bar. I would like to use different colors
in different bars (corresponding to another piece of information, here,
the region of the country being represented).
For example,
x = matrix(c(5,2,3,1),nrow=2)
barplot(x,col=1:4)
will draw two bars with two segments each, but each colored red and
2009 Oct 09
2
Creating a Clustered-Stacked Column Chart
Hi all,
In R, is there some functions or ways to create a Clustered-Stacked
Column Chart as the example in the following page
http://peltiertech.com/Excel/ChartsHowTo/ClusterStack.html?
I have browsed the R Graph Gallery (http://addictedtor.free.fr/graphiques/)
and searched the R site, and didnot find an appropriate method to do it.
Anybody has met this problem before?
Thanks a lot.
2012 Nov 08
2
Stacked Barchart as relative share
Hi @ all,
I'm looking for a solution to plot a dataframe as a stacked bar chart like
on this picture:
http://4.bp.blogspot.com/_79SognVSu7A/S6OtzgksPSI/AAAAAAAABrw/-IuFNewdZFE/s400/Stacked%2BBar%2BChart.png
My dataframe
example2.csv <http://r.789695.n4.nabble.com/file/n4648854/example2.csv>
My questions:
Is there a standard function to convert the values to 100 percent relate to
2012 Jul 06
1
How to compare stacked histograms/datasets
Hello All,
I have a couple of stacked histograms which I need to compare/evaluate for
similarity or difference.
http://r.789695.n4.nabble.com/file/n4635668/Selection_011.png
I believe rather than evaluating histograms is will be east to work with
dataset used to plot these stacked histograms, which is in format:
RED PURPLE BLUE
GREY
2010 Jan 26
5
Strange tick in ggplot geom_area; and ordering, again
In the area plots below, I see 4 triangle ticks at both sides of the bar; I
believe these are non-stacked values for p, but they are definitively
confusing.
In addition, I would like to get the order of the colors in the plot the
same as in the legend, and not arranged alphabetically (the factor is
ordered, don't touch my order). Hadley once mentioned an undocumented
aestetics
2018 Jan 19
0
Split charts with ggplot2, tidyquant
Hi Charlie,
Thanks. This is helpful. As mentioned in my original question, I want to be
able to plot a few such charts on the same page,
say a 2 x 2 grid with such a chart for each of 4 different stocks. Using
your solution I accomplished this by making
a list pLst of your ggplots and then calling cowplot::plot_grid(
plotlist=pLst, nrow=2, ncol=2 ) That worked fine.
The one issue I have is that
2008 Sep 24
1
qplot, stacked area, own colourscheme
Dear list,
I would like to apply my own colours to a stacked area plot, done with
qplot, but I have not succeeded...
What do I have so far (I am dealing with the development of cover of
specific groups of plants):
library(ggplot2)
library(RODBC)
channel <- odbcConnect("myusername", case="tolower")
sql <- "select trial, cover_of, dateofsurvey, cover from