Histogram(L4)
x: the vector to visualize col=: change the color of the histogram xlim=/ylim=: define the range of x/y axis xlab=/ylab=: rename the label for x/y axis right=TRUE/FALSE: "TRUE" stands for the right-closed (left-opened) interval. "FALSE" stands for the right-opened (left-closed) interval main=: name the title for the histogram breaks=: set up the value of x axis Single Boxplot(L5)
x: the vector to visualize horizontal=TRUE/FALSE: make the boxplot horizontally or vertically log=: if the x value is in the log scale Multiple Boxplot(L5)
dataset: the dataset to visualize aes(x= ,y=): plot by x & y labs(): label the element in the boxplot theme(legend.position): assign the position of the legend Violin Plot(L5)
dataset: the dataset to visualize aes(x= ,y=): plot by x & y geom_violin: get the violin plot coord_flip(): flip the x and y coordinate theme(): customize the non-data component Ridgeline Plot(L5)
dataset: the dataset to visualize aes(x= ,y= ): plot by x & y geom_density_ridges(): get the Ridgeline plot fill= : fill the Ridgeline with specific color alpha= : set the transparency of the area under the Ridgeline Q-Q plot (Quantile-Quantile)(L6)
qqnorm(): produce a normal QQ plot of the values in x qqline(): add a line to a “theoretical”, by default normal, quantile-quantile plot Types of data(L8)
Tidy Data(L10)
|
Parallel Coordinates(L13)
dataset: the dataset to visualize columns= : select columns of data that will include in the plot scale= : method to scale the data (default is "std") alphaLines= : value of alpha scaler for the lines of the parcoord plot or a column name of the data splineFactor= : logical or numeric operator indicating whether spline interpolation should be used groupColumn = : a single variable to group (color) by Biplot (L14)
prcomp(): perform a principal components analysis on the given data matrix draw_biplot():perform PCA on a data frame and draw a biplot Cleveland dot plot(L15)
fct_reorder(): reorder factor levels by sorting along the variables geom_point(): create scatterplots theme_linedraw(): add black lines of various widths on white backgrounds Multivariate Data(L15)
Alluvial diagram(L16)
geom_alluvium(): plot both the lodes themselves, using geom_lode(), and the flows between them, using geom_flow() geom_stratum(): plot rectangles for these strata of a provided width geom_text(): add only text to the plot scale_x_discrete(): set the values for discrete x scale aesthetics Heatmap(L17)
geom_rect(): use the locations of the four corners (xmin, xmax, ymin and ymax) geom_tile(): use the center of the tile and its size (x, y, width, height) geom_raster(): a high performance special case for when all the tiles are the same size coord_fixed(): a fixed scale coordinate system forces a specified ratio between data units on the axes |
Time series(L20)
ggplot(dataset, aes(x= ,y= ,color= )): plot multiple time series by different colors geom_smooth(): add a smooth line according to the data method= : smoothing method (function) to use span= : control the amount of smoothing for the default loess smoother Factor in R
|
Cheatography
https://cheatography.com
Data Visualization in R for GR5293 Cheat Sheet (DRAFT) by Icey_cey
Data visualization grammar in R for GR5293
This is a draft cheat sheet. It is a work in progress and is not finished yet.