Please, add comments using the ADD COMMENT or ADD REPLY buttons above (instead of adding an answer). This helps keep conversations organized. Yes, what you explain looks exactly like the symptoms of using factors that follow a particular order. The searches I mentioned above should help you find a solution. Without the code you are using to obtain your plot it is not possible to go further.
Graph in R: sort alpha-numerically X-axis
Hello,
I am facing the problem to plot a typical CNV plot using R (and ggplot2), with ratios on the Y axis and the chromosome and position interval on the X-axis (e.g chr1:17000-17100) but I only get it sorted numerically by default. Do you know how could I do it?
• 3,173 views
•
link
1 answer
@ddiez, Thanks for answering. My problem was that for example after chr1:17000-17000 being the last interval from that chromosome, it should follow chr2:xxx-yyy following an alphanumeric order, but I was getting chr10:xxx-yyy. By using factors I can handle this, as you say, so many thanks.
• 0 views
•
link
• 0 views
•
link
Log in to answer this question.
Not completely sure what you mean. Are the values "chr1:17000-17100" plotted like that in the x-axis? (in which case they would be considered factors and ordered by their order as factors. If that is the case then googling for something like "order factor ggplot2" may give you some hints (this is a commonly asked question). At any rate, I would suggest you add a minimum reproducible example so that people in this site can see what you get and give you an alternative.