- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Best way to display Seaborn/Matplotlib plots with a dark iPython Notebook profile
To display a Seaborn/Matplolib plot with a dark background, we can use "dark" in set_style() method that gives an aesthetic style to the plots.
Steps
Set the figure size and adjust the padding between and around the subplots.
Use "dark" in set_style() method that sets the aesthetic style.
Create a Pandas dataframe with two columns.
Show point estimates and confidence intervals with bars, using bar plot() method.
Rotate xticks by 45 degrees.
To display the figure, use show() method.
Example
import pandas import matplotlib.pylab as plt import seaborn as sns import numpy as np plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True sns.set_style("dark") df = pandas.DataFrame({"X-Axis": [np.random.randint(10) for i in range(10)], "Y-Axis": [i for i in range(10)]}) bar_plot = sns.barplot(x='X-Axis', y='Y-Axis', data=df) plt.xticks(rotation=45) plt.show()
Output
- Related Articles
- How to display print statements interlaced with Matplotlib plots inline in iPython?
- Displaying rotatable 3D plots in IPython or Jupyter Notebook
- Automatically run %matplotlib inline in IPython Notebook
- Matplotlib animation not working in IPython Notebook?
- Save figure as file from iPython notebook using Matplotlib
- How to set the matplotlib figure default size in ipython notebook?
- How to hide in IPython notebook?
- What is the currently correct way to dynamically update plots in Jupyter/iPython?
- How do I get interactive plots again in Spyder/Ipython/matplotlib?
- How do I show the same Matplotlib figure several times in a single IPython notebook?
- How to dynamically update a plot in a loop in Ipython notebook?
- Plot width settings in ipython notebook\n\n
- How can Seaborn library be used to display categorical scatter plots in Python?
- Python Pandas - Draw a set of horizontal bar plots with Seaborn
- Python Pandas - Draw a set of Horizontal point plots with Seaborn

Advertisements