[R] graphs

John Kane jrkrideau at inbox.com
Sat Mar 14 15:04:29 CET 2015


I suspect that this does look a bit easier to interpret. It certainly beats 68 lines on one graph. Still it's a lot of individual subplots.

What I was suggesting was grouping all NASS, HASS, etc. together and graphing each so that you get several lines per subplot. I don't know if this makes sense in your context but it should reduce the size of the overall plot.

Ugly simple-minded example of what I meant below.

library(ggplot2)
names   <-  c('hass', "ham", 'nacs', 'nass')
line  <-  c('alpha', "beta")
xval  <-  1:4

dat1  <-  data.frame(group= rep(names, each = 3, 4),
tt  =  rep(line, each =12 , 2),
xx  =  rep(xval, 12 ),
yy  =  rnorm(48))

p  <-  ggplot(dat1, aes(xx, yy, colour = tt)) + geom_line() +
      facet_grid(. ~ group)
p

John Kane
Kingston ON Canada


> -----Original Message-----
> From: mir.salam at uef.fi
> Sent: Fri, 13 Mar 2015 16:27:06 +0000
> To: jrkrideau at inbox.com, petr.pikal at precheza.cz, r-help at r-project.org
> Subject: RE: [R] graphs
> 
> 
> __Dear all,
> 
> You can see the plot specif curves in the enclosed document. Inclusion of
> all plot specif curves in one plot may not be look  good and finally it
> will be unreadable. I am agree with Petrr and John. This graph is more
> readable.
> 
> 
> Best regards
> Salam
> 
> 
> 
> 
> 
> 
> 
> 
> ______________________________________
> From: John Kane <jrkrideau at inbox.com>
> Sent: Friday, March 13, 2015 4:12 PM
> To: PIKAL Petr; Mir Salam; r-help at r-project.org
> Subject: Re: [R] graphs
> 
> @Petr
> 
> I agree. I think Mir would get a totally unreadable graph. I occasionally
> look at some spagetti graphs from climate research, and I find 8 - 12
> lines are incomprehensible (I'm not a subject matter expert)'
> 
> @Mir
> 
> Is there any logical way to break down the data ? I think Petr is correct
> in that ggplot2 should be able to do it but I'd suggest thinking about,
> perhaps, facetting the data to produce some reasonable number of panels.
> 
> Here is a simple three-panel plot to illustrate what I mean but I have
> easily produced a 9 or 10 panel plot which reduces visual clutter
> immensely.
> 
> library(plyr) library(ggplot2)
> 
> df1 = data.frame(basel_asset_class =
c("bank","bank","bank","bank","bank","bank","bank","corporate","corporate","corporate","corporate","corporate","corporate","corporate","sovereign","sovereign","sovereign","sovereign","sovereign","sovereign","sovereign"),
> ratings =
c("AAA","AA","A","BBB","BB","B","CCC","AAA","AA","A","BBB","BB","B","CCC","AAA","AA","A","BBB","BB","B","CCC"),
> default_probability =
> c(0.0027,0.0029,0.0031,0.0034,0.0037,0.004,0.0043,0.0025,0.0024,0.0024,0.0023,0.0022,0.0021,0.0021,0.003,0.0031,0.0032,0.0033,0.0034,0.0035,0.0036))
> 
> names(df1) <- c("class", "rate", "default")
> 
> p <- ggplot(df1, aes(rate, default,colour=class)) + geom_point() +
> facet_grid(class ~.) + theme(legend.position="none")
> p
> 
> John Kane
> Kingston ON Canada
> 
> 
>> -----Original Message-----
>> From: petr.pikal at precheza.cz
>> Sent: Fri, 13 Mar 2015 11:34:42 +0000
>> To: mir.salam at uef.fi, r-help at r-project.org
>> Subject: Re: [R] graphs
>> 
>> Hi
>> 
>> Your example is not reproducible, but I presume you could use ggplot
>> together with predict. However, I wonder how do you want to distinguish
>> 68 curves in one picture.
>> I would
>> 
>> Cheers
>> Petr
>> 
>> 
>>> -----Original Message-----
>>> From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Mir
>>> Salam
>>> Sent: Sunday, March 08, 2015 10:57 PM
>>> To: r-help at r-project.org
>>> Subject: [R] graphs
>>> 
>>> Dear all,
>>> 
>>>  I need help to get different 68  plots specifc fitted curves in one
>>> plot with respective field data observations (age vs dominant height).
>>> 
>>> 
>>> 
>>> aspdomH2<-groupedData(domH2~age|plotno,data=aspdomH2)
>>> 
>>> 
>>> 
>>> names(aspdomH2)
>>> 
>>> plotno, age, origin, soilcharacter, domH2,
>>> 
>>> 
>>> 
>>> plotno-different plot no. I have 68 plots
>>> 
>>> age- every plot have from age 5 to 30 years
>>> 
>>> origin- two, native aspen and hybrid aspen
>>> 
>>> domH2<-dominant height
>>> 
>>> soilcharacter-3, clay, silt and mold. both origin have different soil
>>> charcter
>>> 
>>> 
>>> 
>>> #### then I fit model
>>> 
>>> fm2cham.nlme<-nlme(domH2~cham(age,b0,b1,b2),
>>>                data=aspdomH2,
>>>                fixed = list(b0~1+origin+soilcharacter,b1~ 1,b2 ~
>>> 1+origin+soilcharacter),
>>>                random = b0+b2~1|plotno,
>>>                start=c(b0=26.3387,0,0,0,b1=0.1065,b2=1.9453,0,0,0),
>>>                weights=varPower(form = ~age, 0.5),
>>>                correlation=corAR1())
>>> 
>>> 
>>> 
>>> #### parameter values
>>> 
>>> Fixed effects: list(b0 ~ 1 + origin + soil character, b1 ~ 1, b2 ~ 1 +
>>> origin + soil character)
>>> 
>>>                                         Value
>>> b0.(Intercept)                 21.081124
>>> b0.origin1                        7.735064
>>> b0.soilcharactermold   10.689051
>>> b0.soilcharactersilt       3.906585
>>> b1                                      0.079035
>>> b2.(Intercept)                  1.616360
>>> b2.origin1                        -0.384421
>>> b2.soilcharactermold      0.612285
>>> b2.soilcharactersilt          0.527462
>>> 
>>> 
>>> 
>>> ##### I can easily get the augmented plot.  I got  different 68 plots
>>> specific curves.
>>> 
>>> #######
>>> 
>>> Any body can help me how can I will get all 68 plots specific fitted
>>> curves in one plot with respective plot specific age and dominant
>>> height obervations? (x axis will represent age, y axis will represent
>>> dominant height and fitted curves of all 68 plots)
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>>       [[alternative HTML version deleted]]
>>> 
>>> ______________________________________________
>>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> 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.
>> 
>> ________________________________
>> Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou
>> určeny pouze jeho adresátům.
>> Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě
>> neprodleně jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho
>> kopie vymažte ze svého systému.
>> Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento
>> email jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
>> Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou
>> modifikacemi
>> či zpožděním přenosu e-mailu.
>> 
>> V případě, že je tento e-mail součástí obchodního jednání:
>> - vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření
>> smlouvy, a to z jakéhokoliv důvodu i bez uvedení důvodu.
>> - a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně
>> přijmout; Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky
>> ze
>> strany příjemce s dodatkem či odchylkou.
>> - trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve
>> výslovným dosažením shody na všech jejích náležitostech.
>> - odesílatel tohoto emailu informuje, že není oprávněn uzavírat za
>> společnost žádné smlouvy s výjimkou případů, kdy k tomu byl písemně
>> zmocněn nebo písemně pověřen a takové pověření nebo plná moc byly
>> adresátovi tohoto emailu případně osobě, kterou adresát zastupuje,
>> předloženy nebo jejich existence je adresátovi či osobě jím zastoupené
>> známá.
>> 
>> This e-mail and any documents attached to it may be confidential and are
>> intended only for its intended recipients.
>> If you received this e-mail by mistake, please immediately inform its
>> sender. Delete the contents of this e-mail with all attachments and its
>> copies from your system.
>> If you are not the intended recipient of this e-mail, you are not
>> authorized to use, disseminate, copy or disclose this e-mail in any
>> manner.
>> The sender of this e-mail shall not be liable for any possible damage
>> caused by modifications of the e-mail or by delay with transfer of the
>> email.
>> 
>> In case that this e-mail forms part of business dealings:
>> - the sender reserves the right to end negotiations about entering into
>> a
>> contract in any time, for any reason, and without stating any reasoning.
>> - if the e-mail contains an offer, the recipient is entitled to
>> immediately accept such offer; The sender of this e-mail (offer)
>> excludes
>> any acceptance of the offer on the part of the recipient containing any
>> amendment or variation.
>> - the sender insists on that the respective contract is concluded only
>> upon an express mutual agreement on all its aspects.
>> - the sender of this e-mail informs that he/she is not authorized to
>> enter into any contracts on behalf of the company except for cases in
>> which he/she is expressly authorized to do so in writing, and such
>> authorization or power of attorney is submitted to the recipient or the
>> person represented by the recipient, or the existence of such
>> authorization is known to the recipient of the person represented by the
>> recipient.
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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.
> 
> ____________________________________________________________
> Can't remember your password? Do you need a strong and secure password?
> Use Password manager! It stores your passwords & protects your account.
> Check it out at http://mysecurelogon.com/manager
> 
>

____________________________________________________________
FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!



More information about the R-help mailing list