How do I change the size of the points based on the value of the column using ggplot?
Using ggplot on rstudio, I am trying to change the size of the point of my scatter plot based on the log of the pvalue column. This is how my matrix looks like.
head(BDpvalue)
id t-value pvalue mean.f mean.m Gene Chromosome
1 ILMN_1212619 3.0512842692996 0.00938046962249251 85.40076 80.02744 Mfap3l 8
2 ILMN_1212693 3.40887110529531 0.00452088152864021 87.28189 82.89533 Snx33 9
3 ILMN_1213324 -4.54750670298688 0.000414140589714275 82.68924 88.81421 Zfp961 8
4 ILMN_1213848 -3.63180275429357 0.00246745595956587 421.61780 469.51845 Itgb1bp1 12
5 ILMN_1213961 2.97573716869553 0.00960659647288939 82.01748 78.44721 Copg2 6
6 ILMN_1214482 -4.23666060706341 0.000813240203181102 136.55021 153.34681 2700081O15Rik 19
>
The code to change the size based on the log of the pvalue column seems correct to me, but for some reason I am not seeing a change in the graph, this is the code that I used.
ggplot(BDpvalue, aes(x=(log(mean.m,10)+log(mean.f,10))/2,
y= log(mean.f/mean.m,10),color=Chromosome) + geom_point(aes(size=(-log(pvalue,10))))
r ggplot2
|
show 1 more comment
Using ggplot on rstudio, I am trying to change the size of the point of my scatter plot based on the log of the pvalue column. This is how my matrix looks like.
head(BDpvalue)
id t-value pvalue mean.f mean.m Gene Chromosome
1 ILMN_1212619 3.0512842692996 0.00938046962249251 85.40076 80.02744 Mfap3l 8
2 ILMN_1212693 3.40887110529531 0.00452088152864021 87.28189 82.89533 Snx33 9
3 ILMN_1213324 -4.54750670298688 0.000414140589714275 82.68924 88.81421 Zfp961 8
4 ILMN_1213848 -3.63180275429357 0.00246745595956587 421.61780 469.51845 Itgb1bp1 12
5 ILMN_1213961 2.97573716869553 0.00960659647288939 82.01748 78.44721 Copg2 6
6 ILMN_1214482 -4.23666060706341 0.000813240203181102 136.55021 153.34681 2700081O15Rik 19
>
The code to change the size based on the log of the pvalue column seems correct to me, but for some reason I am not seeing a change in the graph, this is the code that I used.
ggplot(BDpvalue, aes(x=(log(mean.m,10)+log(mean.f,10))/2,
y= log(mean.f/mean.m,10),color=Chromosome) + geom_point(aes(size=(-log(pvalue,10))))
r ggplot2
please post a reproducible dataset withdput()
– the_darkside
Nov 12 '18 at 1:24
3
Your parentheses are wrong;geom_point
should be outside ofggplot
:ggplot(BDpvalue, aes(x = (log(mean.m, 10) + log(mean.f, 10))/2, y = log(mean.f/mean.m,10), color = Chromosome)) + geom_point(aes(size = -log(pvalue,10)))
– alistaire
Nov 12 '18 at 1:28
I tried using the code from above and got an error message: Error in Math.factor(pvalue, 10) : ‘log’ not meaningful for factors
– 151
Nov 12 '18 at 1:53
1
tryBDpvalue$pvalue <- as.numeric(BDpvalue$pvalue)
– passiflora
Nov 12 '18 at 3:35
@passiflora,BDpvalue$pvalue <- as.numeric(BDpvalue$pvalue)
will return the factor levels. To get the original numerical values of the factor useBDpvalue$pvalue <-as.numeric(as.character(BDpvalue$pvalue))
– Niek
Nov 12 '18 at 7:47
|
show 1 more comment
Using ggplot on rstudio, I am trying to change the size of the point of my scatter plot based on the log of the pvalue column. This is how my matrix looks like.
head(BDpvalue)
id t-value pvalue mean.f mean.m Gene Chromosome
1 ILMN_1212619 3.0512842692996 0.00938046962249251 85.40076 80.02744 Mfap3l 8
2 ILMN_1212693 3.40887110529531 0.00452088152864021 87.28189 82.89533 Snx33 9
3 ILMN_1213324 -4.54750670298688 0.000414140589714275 82.68924 88.81421 Zfp961 8
4 ILMN_1213848 -3.63180275429357 0.00246745595956587 421.61780 469.51845 Itgb1bp1 12
5 ILMN_1213961 2.97573716869553 0.00960659647288939 82.01748 78.44721 Copg2 6
6 ILMN_1214482 -4.23666060706341 0.000813240203181102 136.55021 153.34681 2700081O15Rik 19
>
The code to change the size based on the log of the pvalue column seems correct to me, but for some reason I am not seeing a change in the graph, this is the code that I used.
ggplot(BDpvalue, aes(x=(log(mean.m,10)+log(mean.f,10))/2,
y= log(mean.f/mean.m,10),color=Chromosome) + geom_point(aes(size=(-log(pvalue,10))))
r ggplot2
Using ggplot on rstudio, I am trying to change the size of the point of my scatter plot based on the log of the pvalue column. This is how my matrix looks like.
head(BDpvalue)
id t-value pvalue mean.f mean.m Gene Chromosome
1 ILMN_1212619 3.0512842692996 0.00938046962249251 85.40076 80.02744 Mfap3l 8
2 ILMN_1212693 3.40887110529531 0.00452088152864021 87.28189 82.89533 Snx33 9
3 ILMN_1213324 -4.54750670298688 0.000414140589714275 82.68924 88.81421 Zfp961 8
4 ILMN_1213848 -3.63180275429357 0.00246745595956587 421.61780 469.51845 Itgb1bp1 12
5 ILMN_1213961 2.97573716869553 0.00960659647288939 82.01748 78.44721 Copg2 6
6 ILMN_1214482 -4.23666060706341 0.000813240203181102 136.55021 153.34681 2700081O15Rik 19
>
The code to change the size based on the log of the pvalue column seems correct to me, but for some reason I am not seeing a change in the graph, this is the code that I used.
ggplot(BDpvalue, aes(x=(log(mean.m,10)+log(mean.f,10))/2,
y= log(mean.f/mean.m,10),color=Chromosome) + geom_point(aes(size=(-log(pvalue,10))))
r ggplot2
r ggplot2
edited Nov 12 '18 at 1:17
NelsonGon
846217
846217
asked Nov 12 '18 at 1:13
151
11
11
please post a reproducible dataset withdput()
– the_darkside
Nov 12 '18 at 1:24
3
Your parentheses are wrong;geom_point
should be outside ofggplot
:ggplot(BDpvalue, aes(x = (log(mean.m, 10) + log(mean.f, 10))/2, y = log(mean.f/mean.m,10), color = Chromosome)) + geom_point(aes(size = -log(pvalue,10)))
– alistaire
Nov 12 '18 at 1:28
I tried using the code from above and got an error message: Error in Math.factor(pvalue, 10) : ‘log’ not meaningful for factors
– 151
Nov 12 '18 at 1:53
1
tryBDpvalue$pvalue <- as.numeric(BDpvalue$pvalue)
– passiflora
Nov 12 '18 at 3:35
@passiflora,BDpvalue$pvalue <- as.numeric(BDpvalue$pvalue)
will return the factor levels. To get the original numerical values of the factor useBDpvalue$pvalue <-as.numeric(as.character(BDpvalue$pvalue))
– Niek
Nov 12 '18 at 7:47
|
show 1 more comment
please post a reproducible dataset withdput()
– the_darkside
Nov 12 '18 at 1:24
3
Your parentheses are wrong;geom_point
should be outside ofggplot
:ggplot(BDpvalue, aes(x = (log(mean.m, 10) + log(mean.f, 10))/2, y = log(mean.f/mean.m,10), color = Chromosome)) + geom_point(aes(size = -log(pvalue,10)))
– alistaire
Nov 12 '18 at 1:28
I tried using the code from above and got an error message: Error in Math.factor(pvalue, 10) : ‘log’ not meaningful for factors
– 151
Nov 12 '18 at 1:53
1
tryBDpvalue$pvalue <- as.numeric(BDpvalue$pvalue)
– passiflora
Nov 12 '18 at 3:35
@passiflora,BDpvalue$pvalue <- as.numeric(BDpvalue$pvalue)
will return the factor levels. To get the original numerical values of the factor useBDpvalue$pvalue <-as.numeric(as.character(BDpvalue$pvalue))
– Niek
Nov 12 '18 at 7:47
please post a reproducible dataset with
dput()
– the_darkside
Nov 12 '18 at 1:24
please post a reproducible dataset with
dput()
– the_darkside
Nov 12 '18 at 1:24
3
3
Your parentheses are wrong;
geom_point
should be outside of ggplot
: ggplot(BDpvalue, aes(x = (log(mean.m, 10) + log(mean.f, 10))/2, y = log(mean.f/mean.m,10), color = Chromosome)) + geom_point(aes(size = -log(pvalue,10)))
– alistaire
Nov 12 '18 at 1:28
Your parentheses are wrong;
geom_point
should be outside of ggplot
: ggplot(BDpvalue, aes(x = (log(mean.m, 10) + log(mean.f, 10))/2, y = log(mean.f/mean.m,10), color = Chromosome)) + geom_point(aes(size = -log(pvalue,10)))
– alistaire
Nov 12 '18 at 1:28
I tried using the code from above and got an error message: Error in Math.factor(pvalue, 10) : ‘log’ not meaningful for factors
– 151
Nov 12 '18 at 1:53
I tried using the code from above and got an error message: Error in Math.factor(pvalue, 10) : ‘log’ not meaningful for factors
– 151
Nov 12 '18 at 1:53
1
1
try
BDpvalue$pvalue <- as.numeric(BDpvalue$pvalue)
– passiflora
Nov 12 '18 at 3:35
try
BDpvalue$pvalue <- as.numeric(BDpvalue$pvalue)
– passiflora
Nov 12 '18 at 3:35
@passiflora,
BDpvalue$pvalue <- as.numeric(BDpvalue$pvalue)
will return the factor levels. To get the original numerical values of the factor use BDpvalue$pvalue <-as.numeric(as.character(BDpvalue$pvalue))
– Niek
Nov 12 '18 at 7:47
@passiflora,
BDpvalue$pvalue <- as.numeric(BDpvalue$pvalue)
will return the factor levels. To get the original numerical values of the factor use BDpvalue$pvalue <-as.numeric(as.character(BDpvalue$pvalue))
– Niek
Nov 12 '18 at 7:47
|
show 1 more comment
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53254850%2fhow-do-i-change-the-size-of-the-points-based-on-the-value-of-the-column-using-gg%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53254850%2fhow-do-i-change-the-size-of-the-points-based-on-the-value-of-the-column-using-gg%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
please post a reproducible dataset with
dput()
– the_darkside
Nov 12 '18 at 1:24
3
Your parentheses are wrong;
geom_point
should be outside ofggplot
:ggplot(BDpvalue, aes(x = (log(mean.m, 10) + log(mean.f, 10))/2, y = log(mean.f/mean.m,10), color = Chromosome)) + geom_point(aes(size = -log(pvalue,10)))
– alistaire
Nov 12 '18 at 1:28
I tried using the code from above and got an error message: Error in Math.factor(pvalue, 10) : ‘log’ not meaningful for factors
– 151
Nov 12 '18 at 1:53
1
try
BDpvalue$pvalue <- as.numeric(BDpvalue$pvalue)
– passiflora
Nov 12 '18 at 3:35
@passiflora,
BDpvalue$pvalue <- as.numeric(BDpvalue$pvalue)
will return the factor levels. To get the original numerical values of the factor useBDpvalue$pvalue <-as.numeric(as.character(BDpvalue$pvalue))
– Niek
Nov 12 '18 at 7:47