WEEK 4: More VIsualisations, aesthetics and annotations Flashcards

1
Q

ggplot2

A

The ggplot2 package lets you use R code to specify the dataset, geom, and aesthetics of your plot.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

aesthetic

A

a connection or mapping between a visual feature in your plot and a variable in your data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

A geom

A

Refers to the geometric object used to represent your data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Facets

A

With facets, you can create separate plots for all the variables in your dataset.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Label and annote

A

You can add text like titles, subtitles and captions to communicate the purpose of your plot or highlight important data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

To create a plot

A

Follow these three steps: start with the ggplot function and choose a dataset to work with, add a geom_function to display your data, map the variables you want to plot in the argument of the aes function.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Aesthetics for points

A

X,Y Shape, Color, Size, Alpha (transparency)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

ggplot2 function

A

ggplot(data =penguins) + geompoint(mapping = aes(x= length, y = height, color = species))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

geom funtions

A

geom_point
geom_bar
geom_line

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

If we want to plot a separate line for each elements of our data

A

add line type to the aes funtion
Ex: ggplot(data =penguins) + geom_point(mapping = aes(x= length, y = height, linetype=species))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Jittering

A

helps us deal with over-plotting, which happens when the data points in a plot overlap with each other.
Ex: ggplot(data =penguins) + geom_jitter(mapping = aes(x= length, y = height, linetype=species))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

bar chat aesthetics function

A

ggplot (data=diamonds) + geom_bar ( mapping =aes(x=cut, color=cut or fill = cut))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Ggplot2’s smoothing functionality

A

Is helpful because it adds a smoothing line as another layer to a plot; the smoothing line helps the data to make sense to a casual observer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Facet functions

A

Let you display smaller groups or subsets of your data.
To facet your plot by a single variable, use facet underscore wrap.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

tidle (~)

A

To facet your plot by a single variable, use facet underscore wrap.
If your is visual is too busy, for example, if it’s got too many variables or levels within variables, faceting can be a good option.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

When to use $

A

You can use the ‘&’ character to demonstrate that you want two different conditions to be true. Also, you can use the ‘$’ character to specify which column in the data frame you are referencing

17
Q

paste0() funtion

A

you can use the paste0() function to use your newly-created variables in your labels. This is really handy, because if the data gets updated and there is more recent data added, you don’t have to change the code below because the variables are dynamic