Fix Python – Plotting with seaborn using the matplotlib object-oriented interface

I strongly prefer using matplotlib in OOP style:
f, axarr = plt.subplots(2, sharex=True)

This makes it easier to keep track of multiple figures and subplots.
Question: How to use seaborn this way? Or, how to change this example to OOP style? How to tell seaborn plotting functions like lmplot which Figure or A….

Fix Python – How to set some xlim and ylim in Seaborn lmplot facetgrid

I’m using sns.lmplot to plot a linear regression, dividing my dataset into two groups with a categorical variable.
For both x and y, I’d like to manually set the lower bound on both plots, but leave the upper bound at the Seaborn default.
Here’s a simple example:
import pandas as pd
import seaborn as sns
import numpy as np

n = 200

Fix Python – Seaborn – Why import as sns?

Why do you always import seaborn as sns and not with the letters of the name as sbn?
Is sns an acronym for something?
Or is it some kind of joke?
As cel commented, someone put this as an issue in github.
There they do not answer the question but say that it is a joke related to the original name of the library.
I was unsuccessful in trying ….

Fix Python – plot different color for different categorical levels using matplotlib

I have this data frame diamonds which is composed of variables like (carat, price, color), and I want to draw a scatter plot of price to carat for each color, which means different color has different color in the plot.
This is easy in R with ggplot:
ggplot(aes(x=carat, y=price, color=color), #by setting color=color, ggplot automatically draw in ….

Fix Python – matplotlib/seaborn: first and last row cut in half of heatmap plot

When plotting heatmaps with seaborn (and correlation matrices with matplotlib) the first and the last row is cut in halve.
This happens also when I run this minimal code example which I found online.
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

data = pd.read_csv(‘….

Fix Python – Python matplotlib multiple bars

How to plot multiple bars in matplotlib, when I tried to call the bar function multiple times, they overlap and as seen the below figure the highest value red can be seen only.
How can I plot the multiple bars with dates on the x-axes?
So far, I tried this:
import matplotlib.pyplot as plt
import datetime

x = [
datetime.datetime(2011, 1, 4, 0….

Fix Python – Seaborn showing scientific notation in heatmap for 3-digit numbers

I’m creating a heatmap from a pandas pivot_table as below:
table2 = pd.pivot_table(df,values=’control’,columns=’Year’,index=’Region’,aggfunc=np.sum)

It creates a heat map as shown below. You can see the numbers are not huge (max 750), but it’s showing them in scientific notation. If I view the table its….

Fix Python – How to add hovering annotations to a plot

I am using matplotlib to make scatter plots. Each point on the scatter plot is associated with a named object. I would like to be able to see the name of an object when I hover my cursor over the point on the scatter plot associated with that object. In particular, it would be nice to be able to quickly see the names of the points that are outlier….