Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

bar chart with seaborn

import seaborn as sns
import matplotlib.pyplot as plt

fig, ax = plt.subplots(figsize=(10,10))
# x and y are lists
sns.barplot(x=x, y=y, color='goldenrod', ax=ax, label="Some Label")
ax.set_xlabel("X-Label")
ax.set_ylabel("Y-Label")
ax.legend()
plt.show()
Comment

seaborn bar plot dataset

# importing the required library
import seaborn as sns
import matplotlib.pyplot as plt
 
# read a titanic.csv file
# from seaborn library
df = sns.load_dataset('titanic')
 
# class v / s fare barplot
sns.barplot(x = 'class', y = 'fare', hue = 'sex', data = df)
 
# Show the plot
plt.show()
Comment

seaborn bar plot

# importing the required library
import seaborn as sns
import matplotlib.pyplot as plt
 
# read a titanic.csv file
# from seaborn library
df = sns.load_dataset('titanic')
 
# class v / s fare barplot
sns.barplot(x = 'class', y = 'fare', data = df)
 
# Show the plot
plt.show()
Comment

stacked bar chart using seaborn

import matplotlib.pyplot as plt
import seaborn as sns

#set seaborn plotting aesthetics
sns.set(style='white')

#create stacked bar chart
df.set_index('Day').plot(kind='bar', stacked=True, color=['steelblue', 'red'])
Comment

PREVIOUS NEXT
Code Example
Python :: convert unix timestamp to datetime python pandas 
Python :: how to make a discord bot dm someone python 
Python :: python get int from string 
Python :: fibonacci python 
Python :: python3 as default python path macos 
Python :: string module in python 
Python :: decisiontreeclassifier sklearn 
Python :: get distance between 2 multidimentional point in python 
Python :: how to switch python version in ubuntu 
Python :: python read file 
Python :: how to convert column to index in pandas 
Python :: convert dictionary keys to int python 
Python :: wait for element to be visible selenium python 
Python :: tkinter start maximized 
Python :: how to change font sizetkniter 
Python :: python pandas trim values in dataframe 
Python :: how to rotate the x label for subplot 
Python :: how to subtract 2 lists in python 
Python :: how to know if python is 64 or 32 bit 
Python :: json not readable python 
Python :: write custom query odoo 
Python :: remove minimize and maximize and cancle button python pyqt5 
Python :: oddlyspecific09123890183019283 
Python :: python detect tty 
Python :: normalise list python 
Python :: python httpserver 
Python :: values outside range pandas 
Python :: python wget download 
Python :: remove item from list while looping 
Python :: python gt index in for cycle 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =