[R] Points but no lines in qplot.

Sarah Goslee sarah.goslee at gmail.com
Thu Jun 30 14:50:40 CEST 2011


Hi,

You seem to be using qplot() from the ggplot2 package, but you really
need to specify: there are several packages with a function of that
name.

That said, when I run your example I get a plot with both lines and
points, which means we're going to need more information from you,
specifically sessionInfo(). You may just need to update R and/or the
package.

Mine, which works:
> sessionInfo()
R version 2.13.0 (2011-04-13)
Platform: x86_64-redhat-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods
[8] base

other attached packages:
[1] ggplot2_0.8.9 proto_0.3-8   reshape_0.8.3 plyr_1.4

loaded via a namespace (and not attached):
[1] digest_0.4.2 tools_2.13.0


Sarah

On Thu, Jun 30, 2011 at 8:31 AM, Ashim Kapoor <ashimkapoor at gmail.com> wrote:
> Dear R helpers,
>
> I have molten data which is : -
>
>> t3
>   Year       variable        value
> 1  2005     ICICI.Bank 274883700000
> 2  2006     ICICI.Bank 431668500000
> 3  2007     ICICI.Bank 595153000000
> 4  2008     ICICI.Bank 630857600000
> 5  2009     ICICI.Bank 545263300000
> 6  2005      HDFC.Bank   2658600000
> 7  2006      HDFC.Bank   7891000000
> 8  2007      HDFC.Bank  18031100000
> 9  2008      HDFC.Bank  27393400000
> 10 2009      HDFC.Bank  85769900000
> 11 2005            PNB           NA
> 12 2006            PNB           NA
> 13 2007            PNB  75137300000
> 14 2008            PNB 109035900000
> 15 2009            PNB 118837700000
> 16 2005            SBI 232442700000
> 17 2006            SBI 461432100000
> 18 2007            SBI 623252100000
> 19 2008            SBI 857680000000
> 20 2009            SBI 929450000000
> 21 2005      ICICI.HFC  23557565000
> 22 2006      ICICI.HFC  32154003000
> 23 2007      ICICI.HFC  37469402000
> 24 2008      ICICI.HFC  34675548000
> 25 2009      ICICI.HFC  54316755000
> 26 2005           HDFC 242590882274
> 27 2006           HDFC 302617792386
> 28 2007           HDFC 373624461430
> 29 2008           HDFC 483781358576
> 30 2009           HDFC 548894352646
> 31 2005        PNB.HFL   8052107836
> 32 2006        PNB.HFL   9466332836
> 33 2007        PNB.HFL  12193816630
> 34 2008        PNB.HFL  15604023235
> 35 2009        PNB.HFL  17056184555
> 36 2005          LICHF           NA
> 37 2006          LICHF           NA
> 38 2007          LICHF 170106489367
> 39 2008          LICHF 206187781841
> 40 2009          LICHF 252528694322
> 41 2005    Canara.Bank           NA
> 42 2006    Canara.Bank  67204000000
> 43 2007    Canara.Bank  67509700000
> 44 2008    Canara.Bank  66586000000
> 45 2009    Canara.Bank  77761100000
> 46 2005 Bank.of.Baroda  29717300000
> 47 2006 Bank.of.Baroda  38368000000
> 48 2007 Bank.of.Baroda  54146000000
> 49 2008 Bank.of.Baroda  67449000000
> 50 2009 Bank.of.Baroda  82761700000
> 51 2005      Axis.Bank  11278100000
> 52 2006      Axis.Bank  26086000000
> 53 2007      Axis.Bank  47635300000
> 54 2008      Axis.Bank  77796300000
> 55 2009      Axis.Bank 111004900000
>
> When I do
>
>  qplot(Year,value,data=t3,geom=c("point","line"),color=variable)
>
> I don't see a line for each level of variable. I see the colored points ,
> but no line joining them . Could someone be kind enough to tell me where I
> am wrong ?
>
> Many thanks.
>

-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list