Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Video Player
00:00
00:00
00:00
- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
Great job getting set up! Now it's time to challenge you to make some scatter plots.
Challenge
- What is the relationship between:
- Level and Attack Points?
- Level and Defense Points?
Bonus: use sns.relplot(kind='scatter')
to solve one of these questions.
Solution
sns.scatterplot(data=monsters, x='Level', y='Attack Points')
sns.relplot(kind='scatter', data=monsters, x='Level', y='Defense Points')
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Great job getting set up.
0:00
Now it's time to challenge you
to make some scatter plots.
0:02
What is the relationship between Level and
Attack Points and
0:06
Level and Defense Points?
0:10
Bonus: use sns.relplot(kind='scatter')
to solve one of these questions.
0:13
The seaborn library has many
functions to achieve the same plots.
0:20
For each of the following challenges,
0:24
I'll drop a bonus hint into
which ones you can use.
0:26
You can find all of these functions
in the seaborn API documentation.
0:30
Now it's time to take the challenge.
0:35
Pause me and try it out on your own.
0:38
What is the relationship between Level and
Attack Points?
0:41
To draw a scatterplot,
0:46
we can call sns.scatterplot(data=monsters,
0:50
x='Level', y='Attack Points').
0:57
Remember that these
parameters can be found in
1:06
the previous cell when we
called monsters.head().
1:10
They are the headings to
each of these columns.
1:16
And it looks like I'll have a typo here.
1:22
I need Attack_Points.
1:24
Nice, there seems to be a general
positive correlation between Level and
1:34
Attack Points.
1:39
As Level gets higher, so do Attack Points.
1:41
How about for Defense Points?
1:46
Let's do one with the bonus hint,
sns.relplot.
1:48
In Jupyter Lab, you can use the shift
tab keyboard combo on a function to open
1:54
the method signature documentation to get
more information about that function.
1:59
It looks like this function
is set up similarly to
2:04
the scatterplot function
where we have data, x, and y.
2:08
When I scroll down, there's documentation
about what relplot is used for.
2:15
Feel free to read through this.
2:20
It's the same as what is in the seaborn
API documentation from their website.
2:24
Let's use this function,
2:29
sns.relplot(data=monsters, x='Level',
2:33
y='Defense_Points'), with an underscore.
2:40
The default kind for
the relplot is a scatter plot,
2:52
but we can be explicit by
setting kind='scatter'.
2:58
Let's run the cell.
3:03
And we've got a scatterplot
that shows a general
3:05
positive correlation between Level and
Defense Points.
3:09
Generally, as Level increases,
so do the Defense Points.
3:13
Awesome, are you ready for
the next challenge?
3:20
I'll catch you there.
3:23
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up