ggplot common query syntax summary

 

 

Main map

Scatter

Histogram

line chart

Figure violin

Point map

Evolutionary tree

Loop

Alluvial map

 

Axis

To remove unnecessary axis distance, so that a more compact pattern

ggplot2 Bar Graph remove unnecessary distance between axis label and 0 count on y axis

scale_y_discrete(expand = c(0,0))  

The corresponding coordinate axis in a controlled expand

 

Coordinate axis shows the percentage of

scale_y_continuous(labels = percent_format())

 

x and y axes inverted diagonal

coord_flip()

  

legend

Legend of the order reversed

scale_fill_manual(guide = guide_legend(reverse=F))

  

Faceted

 

Continue to add ~  

 

Guess you like

Origin www.cnblogs.com/leezx/p/11234380.html