8000 brokenaxes with factoryplot · Issue #90 · bendichter/brokenaxes · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
brokenaxes with factoryplot #90
Open
@thomashirtz

Description

@thomashirtz

Hello,

Is it possible to use brokenaxes with seaborn factoryplot ? This is my attempt of doing it, it doesn't seem to put the histogram on the broken axis.

import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import seaborn as sns
import pandas as pd
from brokenaxes import brokenaxes

a = np.array([
    [0, 20],
    [1, 5],
    [2, 2],
    [3, 1],
])

b = np.array([
    [0, 10],
    [1, 30],
    [2, 2],
    [3, 1],
])

df = pd.DataFrame({"A" : a[:, 1] , "B" : b[:, 1], "Index" : a[:, 0]})
melted = pd.melt(df, id_vars="Index", var_name="Type", value_name="Count")
melted['Index'] = melted['Index'].astype(int)

fig = plt.figure(figsize=(5, 2))
bax = brokenaxes(ylims=((0, 12), (18, 31)), hspace=.05)
ax = sns.factorplot(x='Index', y='Count', hue='Type', data=melted, kind='bar', legend=False, ax=bax)
fig.show()

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0