From the course: R for Data Science: Lunch Break Lessons
par: pch and points
From the course: R for Data Science: Lunch Break Lessons
par: pch and points
- [Instructor] In your graphs, you can control what kind of points are being used to plot your data and the command that you'll need to use for that is pch. So as part of par, and I can show you how this works, let's set up a simple plot, plot one through 10, and on the right-hand side, you can see that I have a simple plot going from one to 10 with points. Now, if I want to change the point that's being used right now, it's a small circle, I can use the par pch command. So let's go par parentheses, pch equals 10, and that's a random number, but they all correspond to different points. Now, if I select plot again, you'll see that the pch number, the point changes. I have a circle with the cross in the middle. Likewise, I can change that pch number to, we'll say 12, and then run the plot again, I have a box with a cross in the middle. Now I can combine pch with the plot command, let me show you how that works, rather than specifying pch and plot, I can use the ability of plot to pass parameters on the pch. So let's go ahead and repeat our plot command this is plot one colon 10, which will plot one through 10 and then comma, pch equals say 14. Now I've got a plot with point number 14. I can also change the point size of that by adding and an cex, which has character expansion to three. And you can see that we have large boxes now with triangles inside. So plot allows us to pass commands on to par. Now you might be curious about what different plots are available. And the documentation also includes examples that show all of the available points and to run the examples, you can type an example, parentheses quote points, and what this will do is run through each of the example. So I'll need to hit return to see the next plot, and you can see it in the right-hand side, the examples files for points has given us a sample plot. Now, if you keep going through the examples, you'll see another example there, but here is all of the symbols that's available to you via pch. So for example, zero is a box and six is an upside down triangle and 12 is a box with a cross through it. And there are more and more and more and more and more, and you can see that it goes on and on and on. So I'd highly recommend that you play a little bit with the example files in the documentation. There's many many more characters there than you'll ever possibly need in any one graph, but perhaps you have a special need for something that needs to be used to plot the data out in a scatterplot. So that's pch it's part of par and it can be used with other graphic functions such as plot.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
-
Exercise File: Subscribe to access.
Ex_Files_R_Data_Lunch_Break.zip -
Exercise File: Subscribe to access.
Ex_Files_R_for_Data_Sci_2021_Q3.zip -
Exercise File: Subscribe to access.
Ex_Files_R_for_Data_Sci_2021_Q4.zip -
Exercise File: Subscribe to access.
Ex_Files_R_for_Data_Sci_2022_Q1.zip -
Exercise File: Subscribe to access.
Ex_Files_R_for_Data_Sci_2022_Q2.zip -
Exercise File: Subscribe to access.
Ex_Files_R_for_Data_Sci_2022_Q3.zip -
Exercise File: Subscribe to access.
Ex_Files_R_for_Data_Sci_2022_Q4.zip -
Exercise File: Subscribe to access.
Ex_Files_R_for_Data_Sci_2023_Q1.zip -
Exercise File: Subscribe to access.
Ex_Files_R_for_Data_Sci_2023_Q2.zip
Download courses and learn on the go
Watch courses on your mobile device without an internet connection. Download courses using your iOS or Android LinkedIn Learning app.
Contents
-
-
R built-in data sets5m 21s
-
Vector math5m 57s
-
Subsetting7m 17s
-
R data types: Basic types7m 34s
-
R data types: Vector5m 16s
-
R data types: List5m 27s
-
R data types: Factor5m 15s
-
R data types: Matrix8m 48s
-
R data types: Array3m 50s
-
R data types: Data frame6m 44s
-
Data frames: Order and merge8m 10s
-
Data frames: Read and update4m 44s
-
-
-
Switch on factors2m 18s
-
Any/all4m 13s
-
sub, gsub, regex, and backreferences4m 52s
-
agrep and fuzzy matching4m 44s
-
combn finds combinations2m 33s
-
edit, fix, and dataentry4m 57s
-
zeallot5m 30s
-
menu2m 58s
-
person3m 16s
-
txtProgressBar3m 13s
-
zip and tar3m 50s
-
bitwise4m 11s
-
by is like tapply4m 15s
-
Update your R4m 1s
-
-
-
matrix, row, and column4m 41s
-
cumsum, cumprod, cummax, an dcummin4m 11s
-
issymetric3m 14s
-
file.access4m
-
file.info4m 1s
-
dput and dget4m 35s
-
Sort a data frame by multiple columns4m 12s
-
diag2m 52s
-
crossprod3m 13s
-
upper.tri and lower.tri3m 7s
-
strsplit() splits strings at matched characters2m 37s
-
Use setnames() to change the name of an object5m 3s
-
Change the structure of a vector with stack()4m 44s
-
-
-
Use droplevels() to simplify factors3m 26s
-
Use .Rmd for documentation7m 2s
-
Use rep() to create long repetitive vectors4m 58s
-
Use format() to improve readability4m 53s
-
Use pmax() and pmin() to discover the scope of paired vectors5m 18s
-
Use print() for more than you do now4m 55s
-
Use range() and extendrange() to analyze and manipulate groups of numbers3m 42s
-
Evaluate the importance of a number with rank()4m 51s
-
Use saveRDS() and readRDS() to serialize objects3m 26s
-
Use regular expressions with regexpr() and gregexpr()4m 22s
-
message5m 21s
-
regexpr5m 45s
-
diff4m 50s
-
-
-
exists1m 57s
-
formulas4m 42s
-
RPres5m 26s
-
lattice: Introduction5m 8s
-
lattice: xyplot5m 37s
-
lattice: cloud and wireframe4m 31s
-
lattice: contourplot4m 8s
-
lattice: barchart4m 57s
-
lattice: splom charts6m 14s
-
lattice: panels4m 50s
-
lattice: stripplot3m 18s
-
whichmin and whichmax2m 52s
-
par: font, size, color5m 10s
-
-
-
par: margins6m 21s
-
par: pch and points3m 17s
-
legend5m 26s
-
identical3m 28s
-
Matrix math: Overview of functions1m 38s
-
Matrix math review4m 50s
-
matrix: solve systems4m 11s
-
matrix: solve inverse3m 32s
-
matrix: backsolve and forwardsolve5m 24s
-
Matrix: Determinant3m
-
Arrays and outer2m 49s
-
Matrix: Crossproduct2m 7s
-
Matrix SVD and QR decomposition3m 39s
-
-
-
Analyze term-document matrix5m 38s
-
NLP packages: Tidytext5m 7s
-
NLP packages: Quanteda7m 40s
-
NLP packages: Sentiment analysis8m 28s
-
Word clouds3m 10s
-
Hidden features of installr4m 1s
-
Use the Matrix package5m 29s
-
Create a sparse matrix4m 21s
-
Sparse matrices, triangles, and more6m 25s
-
Bootstrap analysis with R6m 8s
-
checkUsage4m 41s
-
-
-
Use R on the Raspberry Pi7m 32s
-
list2df()4m 28s
-
Introduction to clustering2m 23s
-
Clustering with kmeans6m 57s
-
Clustering with pam and clara6m 23s
-
Understanding silhouette graphs8m 39s
-
Clustering with fanny5m 23s
-
Clustering with hclust5m 12s
-
Clustering with agnes6m 22s
-
Clustering with diana4m 20s
-
cutree and identify with hclust4m 15s
-
Clustering with mona4m 31s
-
Clustering: dist vs. daisy4m 32s
-
-
-
Parameterized R markdown3m 42s
-
Run R on a schedule2m 53s
-
The new forward pipe operator3m 56s
-
Backslash lambda functions5m 24s
-
Dist() in depth5m 29s
-
Scale()3m 9s
-
toJSON4m 6s
-
fromJSON3m 48s
-
Validate JSON2m 28s
-
Plotmath and expression2m 24s
-
Run R in batch mode5m 40s
-
Explore music3m 49s
-
BEEP2m 3s
-
-
-
install.packages4m 27s
-
old.packages, new.packages, and update.packages2m 44s
-
library and require5m 32s
-
Excel in R: SUM5m 51s
-
Excel in R: IF6m 12s
-
Excel in R: LOOKUP5m 17s
-
Excel in R: LEFT and RIGHT4m 15s
-
Excel in R: MATCH4m 50s
-
Excel in R: CHOOSE4m 46s
-
Excel in R: DATE4m 8s
-
Excel in R: DAYS3m 55s
-
Excel in R: FIND and FINDB3m 9s
-
-
-
Excel in R: INDEX2m 28s
-
Excel in R: COUNT4m 5s
-
Excel in R: AVERAGE6m 39s
-
Excel in R: SUMIF and AVERAGEIF5m 17s
-
Excel in R: COUNTIF4m 48s
-
Excel in R: CONCATENATE4m 23s
-
Excel in R: MAX and MIN6m 56s
-
Excel in R: PROPER4m 28s
-
Excel in R: AND6m 58s
-
Excel in R: LEN3m 57s
-
Excel in R: COUNTA6m 28s
-
Excel in R: NETWORKDAYS6m 59s
-
Excel in R: IFERROR6m 27s
-
-
-
Introduction to Plumber6m 5s
-
Plumber request and response objects6m 43s
-
getwd setwd4m 24s
-
Use Visual Studio Code with R4m 34s
-
Tibbles4m 37s
-
Overview of dplyr4m 52s
-
dplyr: mutate6m 3s
-
dplyr: select4m 18s
-
dplyr: filter2m 27s
-
dplyr: slice and friends2m 59s
-
dplyr: summarise2m 55s
-
dplyr: arrange1m 43s
-
dplyr: group_by2m 34s
-
-
-
dbplyr translates R to SQL5m 14s
-
dplyr: pull4m 41s
-
dplyr: joins3m 50s
-
R7 OOP: Introduction6m 7s
-
R7 OOP: Properties4m 27s
-
R7 OOPS: Property getters and setters5m 38s
-
R7 OOPS: Validators3m 22s
-
R7 OOP: Class Inheritance3m 36s
-
R7 OOP: Generics and Methods6m 39s
-
Python with RStudio5m 12s
-
Animating plots3m 1s
-
Animating ggplot4m 3s
-
Introduction to Quarto6m 50s
-