Joshua Ebner Profile picture
Feb 21 14 tweets 13 min read
How to Make Small Multiple Charts in Python, with Plotly

🧵

sharpsightlabs.com/blog/plotly-sm…

#datascience #datavisualization #Python #pythonlearning
Remember: small multiple charts break out a visualization by a categorical variable.

We take a simple chart and break it out into panels.

#Datavisualization #datascience
There are a variety of tools to make small multiple charts in Python, including the Seaborn FacetGrid technique.

#Python #Datavisualization #datascience

BTW: If you're an R user, you can also create small multiple charts with facet_wrap and facet_grid.

#rstats #Datavisualization #datascience

But if you're using Python, you can create small multiple charts in Plotly using specific parameters inside of most Plotly Express functions.

#Python #Datavisualization #datascience
For example, you can create a small multiple from a:

– plotly histogram
– plotly scatterplot
– plotly bar chart
– plotly heatmap (px.imshow)

#Python #Datavisualization #datascience Image
The syntax for a Plotly small multiple is pretty simple.

As mentioned previously, you create a small multiple by using specific *parameters* inside existing plotly functions.

#Python #Datavisualization #datascience Image
You can use "facet_row=" to specify the variable on which to facet row-wise.

You can use "facet_col=" to specify the variable on which to facet column-wise.

#Python #Datavisualization #datascience
You can also use "facet_col_wrap=" to specify the number of panels in the horizontal direction (i.e., column wise)

#Python #Datavisualization #datascience Image
Here's a quick example faceting a Plotly histogram by column:

#Python #Datavisualization #datascience ImageImageImage
And here's a quick example faceting a Plotly histogram by row:

#Python #Datavisualization #datascience ImageImage
And here, we'll facet by row *and* column:

#Python #Datavisualization #datascience ImageImage
Small multiples are a very powerful tool for data visualization and analysis.

They're also extremely under-used.

You need to learn them.

#Datavisualization #datascience #dataanalytics
For more tutorials about data visualization and data science, follow me here: @Josh_Ebner

Every day, I post tutorials and threads about data science, data visualization, and ML in Python and R.

#datascience #machinelearning #Python #rstats

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Joshua Ebner

Joshua Ebner Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @Josh_Ebner

Feb 23
7 Secrets To Help You Master Python Data Science

🧵

#Python #datascience #dataanalytics
1. Focus on Foundations ImageImage
Many people try to start with the coolest, sexiest topics (like machine learning).

You'll do much better if you focus on foundational topics like data wrangling, data visualization, and data analysis.

#datascience #Python #datavisualization
Read 19 tweets
Jan 12
How to Create Small Multiple Charts in Python, with Plotly

🧵[1/23]

sharpsightlabs.com/blog/plotly-sm…

#python #datascience #pythoncode #datavisualization
[2/]

Before I get into the mechanics of how to create a small multiple charts in Python, let me quickly explain why they are so important.
[3/]

Small multiple charts are one of my favorite chart types.

They are very powerful, and also highly under-used.

#datascience #dataanalytics #datavisualization
Read 23 tweets
Jan 11
How to Do a Data Analysis

🧵[1/42]

#datascience #DataAnalytics #Python #rstats
[2/42]

When you do data analysis, you first need to start by clarifying objectives.

Why are you doing the analysis?
What’s the end goal? (e.g., the thing you’re trying to improve, understand, etc)

#datascience #DataAnalytics #data
[3/42]

To do this in a business setting, you’ll typically talk with stakeholders, business partners, and other team members who are familiar with the subject of the analysis.
Read 42 tweets
Jan 10
Why You're Very Likely to Become A Millionaire in Data Science or Machine Learning

🧵[1/n]

#datascience #jobs #money #machinelearning
[2/n]

The reasons that you're likely to become a millionaire in data science:

1. salaries are already high in 2021
2. competition for high salaries is weaker than you think
3. salaries are likely to increase in the 2020s

Let's look at each of these.

#datascience #money #jobs
[3/n]

Let's start with current salaries.

According to Kaggle, the median salary for a US Data Scientist in 2021 is close to $200,000.

kaggle.com/kaggle-survey-…

#datascience #data #jobs
Read 30 tweets
Dec 30, 2021
Merging two or more datasets is extremely important in data science.

Here's a quick thread that covers the basics of data merges in Python.

🧵[1/19]

#Python #datascience #DataAnalytics
[2/19]

In Python ...

You can combine two Pandas dataframes using the "merge" function.

You can also use the "join" function (which defaults to joining on the index)

#Python #datascience #DataAnalytics
[3/19]

When you merge dataframes, you'll typically have a so-called "key" variable.

This is the variable upon which you'll join the dataframes.

#Python #datascience
Read 19 tweets
Dec 29, 2021
In Python ...

You can combine Numpy arrays vertically or horizontally using np.concatenate

#Python #pythoncode #datascience
The first argument to the function is a list (or collection) of arrays that you want to combine.

You can actually combine many arrays ...just put them inside the list.
The axis parameter controls the direction along which you combine the arrays.

For 2D arrays ...

'axis = 0' combines vertically
'axis = 1' combines horizontally
Read 6 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(