[R] plotting the regression coefficients

greg holly mak.hholly at gmail.com
Sat Feb 10 21:04:30 CET 2018


Hi Peter;

The R code you provided works very well. Once again thanks so much for
this. The number of variables in my data set that should appear on the
y-axis is 733 and they are not numerical (for example the name of one
variable is *palmitoyl-arachidonoyl-glycerol (16:0/20:4) [1]**. So, the
plot looks very messy in one page. How can I make the plot to print out on
multiple pages?

Regards,

Greg

On Thu, Feb 8, 2018 at 4:33 PM, greg holly <mak.hholly at gmail.com> wrote:

> Hi Petr;
>
> Thanks so much. Exactly this is what I need. I will play to change color
> and so on but this backbound is perfect to me. I do appreciate your help
> and support.
>
> Regards,
> Greg
>
> On Thu, Feb 8, 2018 at 1:29 PM, PIKAL Petr <petr.pikal at precheza.cz> wrote:
>
>> Hi
>>
>> I copied your values to R, here it is
>>
>>
>>
>> > dput(temp)
>>
>>
>>
>> temp <- structure(list(par1 = structure(1:4, .Label = c("x1", "x2", "x3",
>>
>> "x4"), class = "factor"), y1 = c(-0.19, 0.45, -0.09, -0.16),
>>
>>     y2 = c(0.4, -0.75, 0.14, -0.01), y3 = c(-0.06, -8.67, 1.42,
>>
>>     2.21), y4 = c(0.13, -0.46, 0.06, 0.06)), .Names = c("par1",
>>
>> "y1", "y2", "y3", "y4"), class = "data.frame", row.names = c(NA,
>>
>> -4L))
>>
>>
>>
>> For plotting it need to be reshaped
>>
>>
>>
>> library(reshape2)
>>
>> library(ggplot2)
>>
>>
>>
>> temp <- melt(temp)
>>
>> p <- ggplot(temp, aes(x=par1, y=variable, size=abs(value),
>> colour=factor(sign(value))))
>>
>> p+geom_point()
>>
>>
>>
>> Is this what you wanted?
>>
>>
>>
>> Cheers
>>
>> Petr
>>
>> And preferably do not post in HTML, the email content could be scrambled.
>>
>>
>>
>> *From:* greg holly [mailto:mak.hholly at gmail.com]
>> *Sent:* Thursday, February 8, 2018 9:23 AM
>> *To:* PIKAL Petr <petr.pikal at precheza.cz>
>> *Cc:* r-help mailing list <r-help at r-project.org>
>> *Subject:* Re: [R] plotting the regression coefficients
>>
>>
>>
>> Hi Petr;
>>
>>
>>
>> Thanks for your reply. It is much appreciated. A small example is given
>> below for 4 independent and 4 dependent variables only. The values given
>> are regression coefficients.I have looked ggplot documents before writing
>> to you. Unfortunately, I could not figure out as my experience in ggplot is
>> ignorable
>>
>>
>>
>> Regards.
>>
>> Greg
>>
>>
>>
>> y1 y2 y3 y4
>>
>> x1 -0.19 0.40 -0.06 0.13
>>
>> x2 0.45 -0.75 -8.67 -0.46
>>
>> x3 -0.09 0.14 1.42 0.06
>>
>> x4 -0.16 -0.01 2.21 0.06
>>
>>
>>
>>
>>
>> On Thu, Feb 8, 2018 at 10:19 AM, PIKAL Petr <petr.pikal at precheza.cz>
>> wrote:
>>
>> Hi
>>
>> Example, example, example - preferably working.
>>
>> Wild guess - did you try ggplot?
>>
>> Cheers
>> Petr
>>
>>
>>
>> > -----Original Message-----
>> > From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of greg
>> holly
>> > Sent: Thursday, February 8, 2018 8:14 AM
>> > To: r-help mailing list <r-help at r-project.org>
>> > Subject: [R] plotting the regression coefficients
>> >
>> > Hi Dear all;
>> >
>> > I would like to create a plot for regression coefficients with each
>> independent
>> > variable (x) along the side and the phenotypes (y) across the top (as
>> given
>> > below). For each data point, direction and magnitude of effect could be
>> color
>> > and significance could be the size of the circle? Is this possible?
>> >
>> >
>> > I would greatly be appreciated your help.
>> >
>> > Thanks,
>> >
>> > Greg
>> >
>> >
>> >
>> >   y1 y2 y3 y4 y5 y6
>> > x1
>> > x2
>> > x3
>> > x4
>> > x5
>> > x6
>> > x7
>> > x8
>> > x9
>> > x10
>> > x11
>> > x12
>> > x13
>> > x14
>> > x15
>> > x16
>> > x17
>> > .
>> > .
>> >
>>
>> > [[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/posti
>> ng-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.
>>
>>
>>
>> ------------------------------
>> 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.
>>
>
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list