Skip to main content
Formatted question and code
Source Link
stefan
  • 130.3k
  • 6
  • 42
  • 84

I am attempting to plot a bubble plot using the geom_point function in ggplot2. The y values represent a comparison of differentially expressed genes between two tissue types, but there are two comparisons for each two tissue types, each going the opposite way e.g. for a comparison between aortic endothelium and haemogenic endothelium I have two comparisons: AEvsHE and HEvsAE.I would like these two comparisons to be next to eachother on the plot but that is not how ggplot2 has ordered them. 

Is there a way to 'override' the algorithm that R uses and order the y values manually? If it helps here

Here is my code so far:

ggplot(cl,aes(y=DEG,x=comparison, size=enrichment))+geom_point(alpha=0.5)+scale_size(range=c(1,5), name="enrichment")+theme_bw()

Thanks in advance.

ggplot(cl,aes(y=DEG,x=comparison, size=enrichment))+ geom_point(alpha=0.5)+scale_size(range=c(1,5), name="enrichment")+ theme_bw() 

I am attempting to plot a bubble plot using the geom_point function in ggplot2. The y values represent a comparison of differentially expressed genes between two tissue types, but there are two comparisons for each two tissue types, each going the opposite way e.g. for a comparison between aortic endothelium and haemogenic endothelium I have two comparisons: AEvsHE and HEvsAE.I would like these two comparisons to be next to eachother on the plot but that is not how ggplot2 has ordered them. Is there a way to 'override' the algorithm that R uses and order the y values manually? If it helps here is my code so far:

ggplot(cl,aes(y=DEG,x=comparison, size=enrichment))+geom_point(alpha=0.5)+scale_size(range=c(1,5), name="enrichment")+theme_bw()

Thanks in advance.

I am attempting to plot a bubble plot using the geom_point function in ggplot2. The y values represent a comparison of differentially expressed genes between two tissue types, but there are two comparisons for each two tissue types, each going the opposite way e.g. for a comparison between aortic endothelium and haemogenic endothelium I have two comparisons: AEvsHE and HEvsAE.I would like these two comparisons to be next to eachother on the plot but that is not how ggplot2 has ordered them. 

Is there a way to 'override' the algorithm that R uses and order the y values manually?

Here is my code so far:

ggplot(cl,aes(y=DEG,x=comparison, size=enrichment))+ geom_point(alpha=0.5)+scale_size(range=c(1,5), name="enrichment")+ theme_bw() 
Source Link

Can I manually reorder my y axis in ggplot2?

I am attempting to plot a bubble plot using the geom_point function in ggplot2. The y values represent a comparison of differentially expressed genes between two tissue types, but there are two comparisons for each two tissue types, each going the opposite way e.g. for a comparison between aortic endothelium and haemogenic endothelium I have two comparisons: AEvsHE and HEvsAE.I would like these two comparisons to be next to eachother on the plot but that is not how ggplot2 has ordered them. Is there a way to 'override' the algorithm that R uses and order the y values manually? If it helps here is my code so far:

ggplot(cl,aes(y=DEG,x=comparison, size=enrichment))+geom_point(alpha=0.5)+scale_size(range=c(1,5), name="enrichment")+theme_bw()

Thanks in advance.