[R] two plots in qplot
Ista Zahn
izahn at psych.rochester.edu
Fri Mar 25 17:10:25 CET 2011
Hi Denis,
On Fri, Mar 25, 2011 at 10:33 AM, Denis Kazakiewicz
<d.kazakiewicz at gmail.com> wrote:
> Dear Ista
> Thank you very much for your time and suggestion
> Right now I am trying to study trends in drugs sales which can be
> reduced to the following example
>
> drug1 drug2 year
> 4 4 1
> 8 5 2
> 6 9 3
>
>
>
>
> I want to draw plot with two lines in it were 'year' would be on x axis
> and sale level of two drugs on the same y axis
qplot(year, drug1, data=dat, geom="line") + geom_line(aes(y=drug2))
should do it.
>
> Denis
>
>
> У Пят, 25/03/2011 у 09:51 -0400, Ista Zahn піша:
>> Hi Denis,
>> Yes, just specify the variables in an aes call inside your geom_*
>> call. Hard to be more specific without an example...
>>
>> Best,
>> Ista
>>
>> On Fri, Mar 25, 2011 at 1:24 AM, Denis Kazakiewicz
>> <d.kazakiewicz at gmail.com> wrote:
>> > Hello
>> > I simply want to plot two variables against one 'year' variable in
>> > qplot.
>> > Is any way of doing this without reshaping data in long format and using
>> > facet function afterwards?
>> >
>> > Thank you
>> >
>> > Denis
>> >
>> > ______________________________________________
>> > R-help at r-project.org mailing list
>> > https://stat.ethz.ch/mailman/listinfo/r-help
>> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> > and provide commented, minimal, self-contained, reproducible code.
>> >
>>
>>
>>
>
>
>
--
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org
More information about the R-help
mailing list