X-axis labels illegible. Display every other label on X-axis ggplot22019 Community Moderator ElectionHow to show every second R ggplot2 x-axis label value?Show every nth row name in ggplot2Rotating and spacing axis labels in ggplot2label specific point in ggplot2How to set width of y-axis tick labels in ggplot2 in R?ggplot2 - custom grob over axis linesggplot2: Adding sample size information to x-axis tick labelsHow can I format text axis labels with exponents in ggplot2?ggplot2 - multiple rows in axis-labelsggplot2: Show category and sub-category for x-axis labelsLog axis labels in ggplot2: Show only necessary digits?Adjusting Axis Label Position using ggplotly()
What kind of footwear is suitable for walking in micro gravity environment?
Hot air balloons as primitive bombers
Did Nintendo change its mind about 68000 SNES?
Why didn’t Eve recognize the little cockroach as a living organism?
Isn't the word "experience" wrongly used in this context?
Do people actually use the word "kaputt" in conversation?
Exit shell with shortcut (not typing exit) that closes session properly
Would it be believable to defy demographics in a story?
Why do I have a large white artefact on the rendered image?
Print a physical multiplication table
TDE Master Key Rotation
Someone scrambled my calling sign- who am I?
UK Tourist Visa- Enquiry
When should a starting writer get his own webpage?
Is a square zero matrix positive semidefinite?
Hackerrank All Women's Codesprint 2019: Name the Product
Does fire aspect on a sword, destroy mob drops?
Is "inadequate referencing" a euphemism for plagiarism?
Writing in a Christian voice
Asserting that Atheism and Theism are both faith based positions
Would this string work as string?
Justification failure in beamer enumerate list
When did hardware antialiasing start being available?
Error in master's thesis, I do not know what to do
X-axis labels illegible. Display every other label on X-axis ggplot2
2019 Community Moderator ElectionHow to show every second R ggplot2 x-axis label value?Show every nth row name in ggplot2Rotating and spacing axis labels in ggplot2label specific point in ggplot2How to set width of y-axis tick labels in ggplot2 in R?ggplot2 - custom grob over axis linesggplot2: Adding sample size information to x-axis tick labelsHow can I format text axis labels with exponents in ggplot2?ggplot2 - multiple rows in axis-labelsggplot2: Show category and sub-category for x-axis labelsLog axis labels in ggplot2: Show only necessary digits?Adjusting Axis Label Position using ggplotly()
I have the following plot but the x-axis labels are too small to read. If I increase the size they become overlapped and illegible

I have tried the code form the following link
But I get an error 'wrong sign in 'by' argument'
I also tried the following link
How to show every second R ggplot2 x-axis label value?
but as a beginner I couldn't quite follow the code and aren't sure if there is an added complication with the labels being dates.
I have a df of 100 genes across 170 samples + a 'Genes' column. I then use the following code to make the data long:
mat_dataNew<-mat_data %>% gather(sample, expression, -Genes)
#log10-transform Counts data
mat_dataNew <- mutate(mat_dataNew, log10_NormCounts = log10(expression))
I then plot with:
ggplot(mat_dataNew, aes(x=reorder(Genes, -log10_NormCounts), y=log10_NormCounts, colour=Group)) +
geom_point(size=.5) +
theme(axis.text.x=element_text(angle=90, size=4)) +
labs(x = "100 most abundant Genes", y = "Gene Expression (Log10 Normalised Counts)")
I have tried reading about scale_x_continuous but couldn't seem to find an answer. Could you please help to suggest some code so that the x axis label is legible? I thought maybe the easiest option would be to display every other label???
r ggplot2
add a comment |
I have the following plot but the x-axis labels are too small to read. If I increase the size they become overlapped and illegible

I have tried the code form the following link
But I get an error 'wrong sign in 'by' argument'
I also tried the following link
How to show every second R ggplot2 x-axis label value?
but as a beginner I couldn't quite follow the code and aren't sure if there is an added complication with the labels being dates.
I have a df of 100 genes across 170 samples + a 'Genes' column. I then use the following code to make the data long:
mat_dataNew<-mat_data %>% gather(sample, expression, -Genes)
#log10-transform Counts data
mat_dataNew <- mutate(mat_dataNew, log10_NormCounts = log10(expression))
I then plot with:
ggplot(mat_dataNew, aes(x=reorder(Genes, -log10_NormCounts), y=log10_NormCounts, colour=Group)) +
geom_point(size=.5) +
theme(axis.text.x=element_text(angle=90, size=4)) +
labs(x = "100 most abundant Genes", y = "Gene Expression (Log10 Normalised Counts)")
I have tried reading about scale_x_continuous but couldn't seem to find an answer. Could you please help to suggest some code so that the x axis label is legible? I thought maybe the easiest option would be to display every other label???
r ggplot2
3
How about just using coor_flip() to put text on y-axis and making it a bit more readable? ggplot2.tidyverse.org/reference/coord_flip.html
– Oleksiy
Mar 6 at 23:21
1
Do you really need to show 100 genes? From the plot you showed, looks like a lot of them are pretty similar
– Tung
Mar 6 at 23:37
And you wantscale_x_discretenotscale_x_continuous
– Tung
Mar 6 at 23:38
fyi you can usefct_lump()to lump similar genes in to a new “other” level r4ds.had.co.nz/factors.html#modifying-factor-levels
– Tung
Mar 6 at 23:48
add a comment |
I have the following plot but the x-axis labels are too small to read. If I increase the size they become overlapped and illegible

I have tried the code form the following link
But I get an error 'wrong sign in 'by' argument'
I also tried the following link
How to show every second R ggplot2 x-axis label value?
but as a beginner I couldn't quite follow the code and aren't sure if there is an added complication with the labels being dates.
I have a df of 100 genes across 170 samples + a 'Genes' column. I then use the following code to make the data long:
mat_dataNew<-mat_data %>% gather(sample, expression, -Genes)
#log10-transform Counts data
mat_dataNew <- mutate(mat_dataNew, log10_NormCounts = log10(expression))
I then plot with:
ggplot(mat_dataNew, aes(x=reorder(Genes, -log10_NormCounts), y=log10_NormCounts, colour=Group)) +
geom_point(size=.5) +
theme(axis.text.x=element_text(angle=90, size=4)) +
labs(x = "100 most abundant Genes", y = "Gene Expression (Log10 Normalised Counts)")
I have tried reading about scale_x_continuous but couldn't seem to find an answer. Could you please help to suggest some code so that the x axis label is legible? I thought maybe the easiest option would be to display every other label???
r ggplot2
I have the following plot but the x-axis labels are too small to read. If I increase the size they become overlapped and illegible

I have tried the code form the following link
But I get an error 'wrong sign in 'by' argument'
I also tried the following link
How to show every second R ggplot2 x-axis label value?
but as a beginner I couldn't quite follow the code and aren't sure if there is an added complication with the labels being dates.
I have a df of 100 genes across 170 samples + a 'Genes' column. I then use the following code to make the data long:
mat_dataNew<-mat_data %>% gather(sample, expression, -Genes)
#log10-transform Counts data
mat_dataNew <- mutate(mat_dataNew, log10_NormCounts = log10(expression))
I then plot with:
ggplot(mat_dataNew, aes(x=reorder(Genes, -log10_NormCounts), y=log10_NormCounts, colour=Group)) +
geom_point(size=.5) +
theme(axis.text.x=element_text(angle=90, size=4)) +
labs(x = "100 most abundant Genes", y = "Gene Expression (Log10 Normalised Counts)")
I have tried reading about scale_x_continuous but couldn't seem to find an answer. Could you please help to suggest some code so that the x axis label is legible? I thought maybe the easiest option would be to display every other label???
r ggplot2
r ggplot2
edited Mar 7 at 2:02
Z.Lin
12.9k22238
12.9k22238
asked Mar 6 at 23:15
zoezoe
376
376
3
How about just using coor_flip() to put text on y-axis and making it a bit more readable? ggplot2.tidyverse.org/reference/coord_flip.html
– Oleksiy
Mar 6 at 23:21
1
Do you really need to show 100 genes? From the plot you showed, looks like a lot of them are pretty similar
– Tung
Mar 6 at 23:37
And you wantscale_x_discretenotscale_x_continuous
– Tung
Mar 6 at 23:38
fyi you can usefct_lump()to lump similar genes in to a new “other” level r4ds.had.co.nz/factors.html#modifying-factor-levels
– Tung
Mar 6 at 23:48
add a comment |
3
How about just using coor_flip() to put text on y-axis and making it a bit more readable? ggplot2.tidyverse.org/reference/coord_flip.html
– Oleksiy
Mar 6 at 23:21
1
Do you really need to show 100 genes? From the plot you showed, looks like a lot of them are pretty similar
– Tung
Mar 6 at 23:37
And you wantscale_x_discretenotscale_x_continuous
– Tung
Mar 6 at 23:38
fyi you can usefct_lump()to lump similar genes in to a new “other” level r4ds.had.co.nz/factors.html#modifying-factor-levels
– Tung
Mar 6 at 23:48
3
3
How about just using coor_flip() to put text on y-axis and making it a bit more readable? ggplot2.tidyverse.org/reference/coord_flip.html
– Oleksiy
Mar 6 at 23:21
How about just using coor_flip() to put text on y-axis and making it a bit more readable? ggplot2.tidyverse.org/reference/coord_flip.html
– Oleksiy
Mar 6 at 23:21
1
1
Do you really need to show 100 genes? From the plot you showed, looks like a lot of them are pretty similar
– Tung
Mar 6 at 23:37
Do you really need to show 100 genes? From the plot you showed, looks like a lot of them are pretty similar
– Tung
Mar 6 at 23:37
And you want
scale_x_discrete not scale_x_continuous– Tung
Mar 6 at 23:38
And you want
scale_x_discrete not scale_x_continuous– Tung
Mar 6 at 23:38
fyi you can use
fct_lump() to lump similar genes in to a new “other” level r4ds.had.co.nz/factors.html#modifying-factor-levels– Tung
Mar 6 at 23:48
fyi you can use
fct_lump() to lump similar genes in to a new “other” level r4ds.had.co.nz/factors.html#modifying-factor-levels– Tung
Mar 6 at 23:48
add a 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%2f55033695%2fx-axis-labels-illegible-display-every-other-label-on-x-axis-ggplot2%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.
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%2f55033695%2fx-axis-labels-illegible-display-every-other-label-on-x-axis-ggplot2%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
3
How about just using coor_flip() to put text on y-axis and making it a bit more readable? ggplot2.tidyverse.org/reference/coord_flip.html
– Oleksiy
Mar 6 at 23:21
1
Do you really need to show 100 genes? From the plot you showed, looks like a lot of them are pretty similar
– Tung
Mar 6 at 23:37
And you want
scale_x_discretenotscale_x_continuous– Tung
Mar 6 at 23:38
fyi you can use
fct_lump()to lump similar genes in to a new “other” level r4ds.had.co.nz/factors.html#modifying-factor-levels– Tung
Mar 6 at 23:48