Week 11
Introduction to seaborn

Soci—269

Sakeef M. Karim
Amherst College

AN INTRODUCTION TO QUANTITATIVE SOCIOLOGY—CULTURE & POWER

Visualization in Python
November 10th

Reminder

Coding Assignment in Python

Coding Assignment Deadline

Your second coding assignment is due by 8:00 PM on Friday, November 21st.

Reminder

Coding Assignment in Python

Assignment instructions are available online.

Another Invitation

Kellogg Lecture

Title

The Electric New Deal

Description

Click to Expand or Close

Scroll to access the entire description.

In 2021, Margot Lurie was the recipient of the Rufus B. Kellogg University Fellowship, one of the Amherst College Fellowships for graduate study, which is awarded for three years of graduate study to a recent graduate, and asks the recipient to return to campus to give a lecture or presentation.

Today, energy policy is a taken-for-granted site of national state intervention, yet this was not always the case. In this talk, Margot examines a moment when the American state worked to greatly expand its role in the almost entirely privately controlled energy system. During the New Deal, the federal government pursued a loose “National Power Policy”–a variety of institutional and legislative innovations intended to increase the supply and consumption of cheap electricity nationwide. Through an historical sociological study, Lurie asks why energy emerged as an object of state strategy and reflect on the enduring social, (geo)political, and environmental consequences of the National Power Policy.

The Basics of seaborn

Refresher

We can use reticulate to deploy seaborn in :

Show the underlying code
library(reticulate)

# Create new Anaconda directory featuring select packages:

conda_create("soci269")

# Moving forward, to use the conda environment created above, simply run: 

# use_condaenv("NAME OF ENV GOES HERE")

# use_condaenv("soci269")

# Add pandas, seaborn and matplotlib to your new Anaconda (conda) environment:

conda_install("soci269", c("pandas", "seaborn", "matplotlib"))

# GENERATING PLOTS VIA SEABORN --------------------------------------------

sns <- import("seaborn")

plt <- import("matplotlib.pyplot")

# Let's generate a simple plot via seaborn:

sns$set_theme()

sns$scatterplot(x = "bill_depth_mm",
                y = "bill_length_mm",
                hue = "species",
                data = palmerpenguins::penguins)

plt$show()

Guides and Cheatsheets

Full Page

Guides and Cheatsheets

To Jupyter

Launch Colab

Note

The rest of today’s session will take place in Colab!

More seaborn
November 12th

A Reminder

Kellogg Lecture

Title

The Electric New Deal

Description

Click to Expand or Close

Scroll to access the entire description.

In 2021, Margot Lurie was the recipient of the Rufus B. Kellogg University Fellowship, one of the Amherst College Fellowships for graduate study, which is awarded for three years of graduate study to a recent graduate, and asks the recipient to return to campus to give a lecture or presentation.

Today, energy policy is a taken-for-granted site of national state intervention, yet this was not always the case. In this talk, Margot examines a moment when the American state worked to greatly expand its role in the almost entirely privately controlled energy system. During the New Deal, the federal government pursued a loose “National Power Policy”–a variety of institutional and legislative innovations intended to increase the supply and consumption of cheap electricity nationwide. Through an historical sociological study, Lurie asks why energy emerged as an object of state strategy and reflect on the enduring social, (geo)political, and environmental consequences of the National Power Policy.

An Update

You can take a bit more time with
the second coding assignment.

An Update

Second Coding Assignment Soft Deadline

Your second coding assignment is due by 8:00 PM on Friday, November 21st.
This is a soft deadline.

An Update

Second Coding Assignment Hard Deadline

All coding assignments (in Python ) must be submitted by 8:00 PM on Wednesday, December 3rd.

An Update

As you know, assignment instructions are available online.

seaborn.objects
November 12th

seaborn and the Grammar of Graphics

Full Page

seaborn and the Grammar of Graphics

Full Page

Back to Jupyter

Launch Colab

Note

The rest of today’s session will take place in Colab!

Enjoy the Weekend

Reference(s)

McKinney, Wes. 2022. Python for Data Analysis: Data Wrangling with Pandas, NumPy, and Jupyter. 3rd Edition. Sebastopol, CA: O’Reilly.