Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to overlap two barplots in seaborn

# instead of seaborn use plt.bar 

import matplotlib.pyplot as plt
import seaborn as sns

# Load the example car crash dataset
crashes = sns.load_dataset("car_crashes").sort_values("total", ascending=False)

# states of interest
txcahi = crashes[crashes['abbrev'].isin(['TX','CA','HI'])]

# Plot the total crashes
f, ax = plt.subplots(figsize=(10, 5))
plt.xticks(rotation=90, fontsize=10)

plt.bar(height="total", x="abbrev", data=crashes, label="Total", color="lightgray")
plt.bar(height="total", x="abbrev", data=txcahi, label="Total", color="red")

sns.despine(left=True, bottom=True)
Comment

PREVIOUS NEXT
Code Example
Python :: list programs in python 
Python :: {"message": "401: Unauthorized", "code": 0} discord 
Python :: re.sub 
Python :: quicksort algorithm in python 
Python :: python file exists 
Python :: python pyttsx3 
Python :: change value in tuple 
Python :: python - login 
Python :: Async-Sync 
Python :: negative slicing in python list 
Python :: logger 
Python :: pandas get row if difference previous 
Python :: changes in settings.py for media storage without db 
Python :: sum of even numbers 
Python :: Create A Template In Django 
Python :: Exception in thread 
Python :: issubclass python example 
Python :: remove timezone from a datetime object? 
Python :: python string: .strip() 
Python :: how to read specific words from a file in python 
Python :: how to schedule python script in windows 
Python :: how to store categorical variables in separate dataframe 
Python :: python multidimensional dictionary 
Python :: numpy datatime object 
Python :: how to use djoser signals 
Python :: python in line elif 
Python :: python merge list no duplicates 
Python :: função map python 
Python :: is the multiply code in python 
Python :: how to activate venv python 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =