Skip to content

Commit

Permalink
update ggplot_I lecture
Browse files Browse the repository at this point in the history
  • Loading branch information
ngotelli committed Apr 7, 2024
1 parent 9c72d7c commit be7af7a
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 69 deletions.
52 changes: 35 additions & 17 deletions Lectures/OlderLectures/ggplot_I.Rmd → Lectures/ggplot_I.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -100,26 +100,44 @@ ggplot(data=d) +
aes(x=fl, y=cty) +
geom_boxplot(fill="thistle")
# qplot(x=d$fl, y=d$cty,geom="boxplot",fill=I("green"))
# basic barplot (long format)
# qplot(x=d$fl,geom="bar",fill=I("green"))
# qplot(x=d$fl,geom="bar",fill="green")
ggplot(data=d) +
aes(x=fl) +
geom_bar(fill="thistle",color="black")
# bar plot with specified counts or meansw
# xTreatment <- c("Control","Low","High")
# yResponse <- c(12,2.5,22.9)
# qplot(x=xTreatment,y=yResponse,geom="col",fill=I(c("red","green","blue")))
# basic curves and functions
# myVec <- seq(1,100,by=0.1)
# myFun <- function(x) sin(x) + 0.1*x
# qplot(x=myVec,y=sin(myVec),geom="line") # built in functions
# qplot(x=myVec,y=dgamma(myVec,shape=5, scale=3),geom="line") # stats d functions
# qplot(x=myVec,y=myFun(myVec),geom="line") # user-defined functions
x_treatment <- c("Control","Low","High")
y_response <- c(12,2.5,22.9)
summary_data <- data.frame(x_treatment,y_response)
ggplot(data=summary_data) +
aes(x=x_treatment,y=y_response) +
geom_col(fill=c("grey50","goldenrod","goldenrod"),col="black")
# basic curves and functions
my_vec <- seq(1,100,by=0.1)
# plot simple mathematical functions
d_frame <- data.frame(x=my_vec,y=sin(my_vec))
ggplot(data=d_frame) +
aes(x=x,y=y) +
geom_line()
# plot probability functions
d_frame <- data.frame(x=my_vec,y=dgamma(my_vec,shape=5, scale=3))
ggplot(data=d_frame) +
aes(x=x,y=y) +
geom_line()
# plot user-defined functions
my_fun <- function(x) sin(x) + 0.1*x
d_frame <- data.frame(x=my_vec,y=my_fun(my_vec))
ggplot(data=d_frame) +
aes(x=x,y=y) +
geom_line()
```

Expand Down
107 changes: 64 additions & 43 deletions Lectures/OlderLectures/ggplot_I.html → Lectures/ggplot_I.html

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions index.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ March 20 | [dplyr+SQL lecture notes](Lectures/dplyr_SQL_Lecture.html) | [Homewo
March 21 | [For Loops I](Lectures/ForLoops_I.html) | -
March 26 | [For Loops II](Lectures/Lecture17_S2021.xhtml) | -
March 27 | - | [Homework #9](Homeworks/Homework_09.html)
March 28 | [Control Structures III](Lectures/Lecture18_S2021.xhtml) | -
April 2 | [Randomization Tests](Lectures/Lecture19_S2021) | -
March 28 | [Strategic Coding Practices I](CourseMaterials/StrategicCodingPractices.zip) | -
April 2 | [Strategic Coding Practices II](CourseMaterials/StrategicCodingPractices.zip) | -
April 3 | - | [Homework #10](Homeworks/Homework_10.html)
April 4 | [Batch Processing](Lectures/Lecture_20.xhtml) | -
April 9 | [ggplot I](Lectures/Lecture_21.xhtml) | -
April 4 | [ggplot I](Lectures/ggplot_I.html) | -
April 9 | [ggplot II](Lectures/Lecture_21.xhtml) | -
April 10 | **Portfolio Check #3** | [Homework #11](Homeworks/Homework_11.html)
April 11 | [ggplot II](Lectures/Lecture22_S2021.xhtml) | -
April 16 | [ggplot III](Lectures/Lecture23_S2021.xhtml) | -
Expand Down
11 changes: 6 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,14 @@ <h2>Lecture Outlines &amp; Homework Assignments</h2>
</tr>
<tr class="odd">
<td>March 28</td>
<td><a href="Lectures/Lecture18_S2021.xhtml">Control Structures
III</a></td>
<td><a href="CourseMaterials/StrategicCodingPractices.zip">Strategic
Coding Practices I</a></td>
<td>-</td>
</tr>
<tr class="even">
<td>April 2</td>
<td><a href="Lectures/Lecture19_S2021">Randomization Tests</a></td>
<td><a href="CourseMaterials/StrategicCodingPractices.zip">Strategic
Coding Practices II</a></td>
<td>-</td>
</tr>
<tr class="odd">
Expand All @@ -291,12 +292,12 @@ <h2>Lecture Outlines &amp; Homework Assignments</h2>
</tr>
<tr class="even">
<td>April 4</td>
<td><a href="Lectures/Lecture_20.xhtml">Batch Processing</a></td>
<td><a href="Lectures/ggplot_I.html">ggplot I</a></td>
<td>-</td>
</tr>
<tr class="odd">
<td>April 9</td>
<td><a href="Lectures/Lecture_21.xhtml">ggplot I</a></td>
<td><a href="Lectures/Lecture_21.xhtml">ggplot II</a></td>
<td>-</td>
</tr>
<tr class="even">
Expand Down

0 comments on commit be7af7a

Please sign in to comment.