geom_dotplot rounding decimal place of dot fill
up vote
0
down vote
favorite
I have created a boxplot of some data using ggplot2 in which I am displaying the data points as dots along the vertical axis of the plot.
bp2 <- ggplot(DBS, aes(DBS_Electrode,Proximal_Lead_Bowing, color=DBS_Electrode)) +
geom_boxplot() + geom_dotplot(binaxis="y", stackdir="center", fill="white",
dotsize=0.5) + theme_classic()
bp2 + scale_color_manual(values=c("goldenrod3","gray62","dodgerblue1")) +
theme(legend.position = "none") + xlab("") + ylab("Proximal Lead Bowing (mm)")
It appears that my output is rounding the data points to the nearest tenth such that the data points along the axis of each boxplot have several instances in which multiple points are being displayed at the same level along the Y-axis (see plot http://rpubs.com/Gopher16/441664). This is a misrepresentation of the data as there is are no data points that have the exact same measures of proximal lead bowing. (Data was measured to the nearest thousandth). How can I change this output such that all data points are displayed along a vertical axis along each boxplot (i.e. read the data points to the nearest thousandth rather than rounding to the nearest tenth so that no points are displayed at the same level along the Y-axis)?
r ggplot2
add a comment |
up vote
0
down vote
favorite
I have created a boxplot of some data using ggplot2 in which I am displaying the data points as dots along the vertical axis of the plot.
bp2 <- ggplot(DBS, aes(DBS_Electrode,Proximal_Lead_Bowing, color=DBS_Electrode)) +
geom_boxplot() + geom_dotplot(binaxis="y", stackdir="center", fill="white",
dotsize=0.5) + theme_classic()
bp2 + scale_color_manual(values=c("goldenrod3","gray62","dodgerblue1")) +
theme(legend.position = "none") + xlab("") + ylab("Proximal Lead Bowing (mm)")
It appears that my output is rounding the data points to the nearest tenth such that the data points along the axis of each boxplot have several instances in which multiple points are being displayed at the same level along the Y-axis (see plot http://rpubs.com/Gopher16/441664). This is a misrepresentation of the data as there is are no data points that have the exact same measures of proximal lead bowing. (Data was measured to the nearest thousandth). How can I change this output such that all data points are displayed along a vertical axis along each boxplot (i.e. read the data points to the nearest thousandth rather than rounding to the nearest tenth so that no points are displayed at the same level along the Y-axis)?
r ggplot2
could I edit in the image from your RPubs link? That way the image can be seen here and there's no risk of link breakage.
– Sam Firke
Nov 21 at 17:48
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have created a boxplot of some data using ggplot2 in which I am displaying the data points as dots along the vertical axis of the plot.
bp2 <- ggplot(DBS, aes(DBS_Electrode,Proximal_Lead_Bowing, color=DBS_Electrode)) +
geom_boxplot() + geom_dotplot(binaxis="y", stackdir="center", fill="white",
dotsize=0.5) + theme_classic()
bp2 + scale_color_manual(values=c("goldenrod3","gray62","dodgerblue1")) +
theme(legend.position = "none") + xlab("") + ylab("Proximal Lead Bowing (mm)")
It appears that my output is rounding the data points to the nearest tenth such that the data points along the axis of each boxplot have several instances in which multiple points are being displayed at the same level along the Y-axis (see plot http://rpubs.com/Gopher16/441664). This is a misrepresentation of the data as there is are no data points that have the exact same measures of proximal lead bowing. (Data was measured to the nearest thousandth). How can I change this output such that all data points are displayed along a vertical axis along each boxplot (i.e. read the data points to the nearest thousandth rather than rounding to the nearest tenth so that no points are displayed at the same level along the Y-axis)?
r ggplot2
I have created a boxplot of some data using ggplot2 in which I am displaying the data points as dots along the vertical axis of the plot.
bp2 <- ggplot(DBS, aes(DBS_Electrode,Proximal_Lead_Bowing, color=DBS_Electrode)) +
geom_boxplot() + geom_dotplot(binaxis="y", stackdir="center", fill="white",
dotsize=0.5) + theme_classic()
bp2 + scale_color_manual(values=c("goldenrod3","gray62","dodgerblue1")) +
theme(legend.position = "none") + xlab("") + ylab("Proximal Lead Bowing (mm)")
It appears that my output is rounding the data points to the nearest tenth such that the data points along the axis of each boxplot have several instances in which multiple points are being displayed at the same level along the Y-axis (see plot http://rpubs.com/Gopher16/441664). This is a misrepresentation of the data as there is are no data points that have the exact same measures of proximal lead bowing. (Data was measured to the nearest thousandth). How can I change this output such that all data points are displayed along a vertical axis along each boxplot (i.e. read the data points to the nearest thousandth rather than rounding to the nearest tenth so that no points are displayed at the same level along the Y-axis)?
r ggplot2
r ggplot2
asked Nov 21 at 17:04
Jake Niederer
12
12
could I edit in the image from your RPubs link? That way the image can be seen here and there's no risk of link breakage.
– Sam Firke
Nov 21 at 17:48
add a comment |
could I edit in the image from your RPubs link? That way the image can be seen here and there's no risk of link breakage.
– Sam Firke
Nov 21 at 17:48
could I edit in the image from your RPubs link? That way the image can be seen here and there's no risk of link breakage.
– Sam Firke
Nov 21 at 17:48
could I edit in the image from your RPubs link? That way the image can be seen here and there's no risk of link breakage.
– Sam Firke
Nov 21 at 17:48
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
First let's make this reproducible, and thus a more useful example for future readers, by using a built-in data set:
ggplot(iris, aes(Species, Sepal.Length)) +
geom_boxplot() +
geom_dotplot(binaxis = "y", stackdir = "center", fill = "white", dotsize = 0.5) +
theme_classic()
This exhibits the behavior you find unwanted: geom_dotplot()
bins the points, making multiple points appear horizontally adjacent to each other even though their Sepal.Length
values differ.
You could specify binwidth = 0.01
or other small value to geom_dotplot
but that's just reducing the problem, and introducing other issues.
You might want geom_jitter
instead:
ggplot(iris, aes(Species, Sepal.Length)) +
geom_boxplot() +
geom_jitter(width = 0.2) +
theme_classic()
This preserves the small differences in the unique y-values, which seems to be your chief concern.
Thank you for this! This was extremely helpful
– Jake Niederer
Nov 21 at 18:08
Glad it helped! If you feel the problem is solved, you can mark the answer "accepted" by clicking the check mark.
– Sam Firke
Nov 21 at 18:23
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
First let's make this reproducible, and thus a more useful example for future readers, by using a built-in data set:
ggplot(iris, aes(Species, Sepal.Length)) +
geom_boxplot() +
geom_dotplot(binaxis = "y", stackdir = "center", fill = "white", dotsize = 0.5) +
theme_classic()
This exhibits the behavior you find unwanted: geom_dotplot()
bins the points, making multiple points appear horizontally adjacent to each other even though their Sepal.Length
values differ.
You could specify binwidth = 0.01
or other small value to geom_dotplot
but that's just reducing the problem, and introducing other issues.
You might want geom_jitter
instead:
ggplot(iris, aes(Species, Sepal.Length)) +
geom_boxplot() +
geom_jitter(width = 0.2) +
theme_classic()
This preserves the small differences in the unique y-values, which seems to be your chief concern.
Thank you for this! This was extremely helpful
– Jake Niederer
Nov 21 at 18:08
Glad it helped! If you feel the problem is solved, you can mark the answer "accepted" by clicking the check mark.
– Sam Firke
Nov 21 at 18:23
add a comment |
up vote
0
down vote
First let's make this reproducible, and thus a more useful example for future readers, by using a built-in data set:
ggplot(iris, aes(Species, Sepal.Length)) +
geom_boxplot() +
geom_dotplot(binaxis = "y", stackdir = "center", fill = "white", dotsize = 0.5) +
theme_classic()
This exhibits the behavior you find unwanted: geom_dotplot()
bins the points, making multiple points appear horizontally adjacent to each other even though their Sepal.Length
values differ.
You could specify binwidth = 0.01
or other small value to geom_dotplot
but that's just reducing the problem, and introducing other issues.
You might want geom_jitter
instead:
ggplot(iris, aes(Species, Sepal.Length)) +
geom_boxplot() +
geom_jitter(width = 0.2) +
theme_classic()
This preserves the small differences in the unique y-values, which seems to be your chief concern.
Thank you for this! This was extremely helpful
– Jake Niederer
Nov 21 at 18:08
Glad it helped! If you feel the problem is solved, you can mark the answer "accepted" by clicking the check mark.
– Sam Firke
Nov 21 at 18:23
add a comment |
up vote
0
down vote
up vote
0
down vote
First let's make this reproducible, and thus a more useful example for future readers, by using a built-in data set:
ggplot(iris, aes(Species, Sepal.Length)) +
geom_boxplot() +
geom_dotplot(binaxis = "y", stackdir = "center", fill = "white", dotsize = 0.5) +
theme_classic()
This exhibits the behavior you find unwanted: geom_dotplot()
bins the points, making multiple points appear horizontally adjacent to each other even though their Sepal.Length
values differ.
You could specify binwidth = 0.01
or other small value to geom_dotplot
but that's just reducing the problem, and introducing other issues.
You might want geom_jitter
instead:
ggplot(iris, aes(Species, Sepal.Length)) +
geom_boxplot() +
geom_jitter(width = 0.2) +
theme_classic()
This preserves the small differences in the unique y-values, which seems to be your chief concern.
First let's make this reproducible, and thus a more useful example for future readers, by using a built-in data set:
ggplot(iris, aes(Species, Sepal.Length)) +
geom_boxplot() +
geom_dotplot(binaxis = "y", stackdir = "center", fill = "white", dotsize = 0.5) +
theme_classic()
This exhibits the behavior you find unwanted: geom_dotplot()
bins the points, making multiple points appear horizontally adjacent to each other even though their Sepal.Length
values differ.
You could specify binwidth = 0.01
or other small value to geom_dotplot
but that's just reducing the problem, and introducing other issues.
You might want geom_jitter
instead:
ggplot(iris, aes(Species, Sepal.Length)) +
geom_boxplot() +
geom_jitter(width = 0.2) +
theme_classic()
This preserves the small differences in the unique y-values, which seems to be your chief concern.
answered Nov 21 at 17:42
Sam Firke
9,38325167
9,38325167
Thank you for this! This was extremely helpful
– Jake Niederer
Nov 21 at 18:08
Glad it helped! If you feel the problem is solved, you can mark the answer "accepted" by clicking the check mark.
– Sam Firke
Nov 21 at 18:23
add a comment |
Thank you for this! This was extremely helpful
– Jake Niederer
Nov 21 at 18:08
Glad it helped! If you feel the problem is solved, you can mark the answer "accepted" by clicking the check mark.
– Sam Firke
Nov 21 at 18:23
Thank you for this! This was extremely helpful
– Jake Niederer
Nov 21 at 18:08
Thank you for this! This was extremely helpful
– Jake Niederer
Nov 21 at 18:08
Glad it helped! If you feel the problem is solved, you can mark the answer "accepted" by clicking the check mark.
– Sam Firke
Nov 21 at 18:23
Glad it helped! If you feel the problem is solved, you can mark the answer "accepted" by clicking the check mark.
– Sam Firke
Nov 21 at 18:23
add a comment |
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%2f53417197%2fgeom-dotplot-rounding-decimal-place-of-dot-fill%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
could I edit in the image from your RPubs link? That way the image can be seen here and there's no risk of link breakage.
– Sam Firke
Nov 21 at 17:48