Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple subplots not being drawn in FigureCanvasKivy #50

Open
janssen opened this issue Apr 5, 2017 · 1 comment
Open

Multiple subplots not being drawn in FigureCanvasKivy #50

janssen opened this issue Apr 5, 2017 · 1 comment

Comments

@janssen
Copy link
Contributor

janssen commented Apr 5, 2017

I'm using seaborn.jointplot to plot several columns in a pandas DataFrame against each other. Using FigureCanvasKivyAgg, it looks like this:

jointplot-iris-figure-canvas-kivyagg

(This is one of the standard pandas test datasets, the measured lengths and widths of the petals and sepals from three varieties of iris.)

However, when I plot it with FigureCanvasKivy, I get this:

jointplot-iris-figure-canvas-kivy

Looks like something in FigureCanvasKivy is not enumerating all the subplots.

@janssen janssen changed the title Multiple Multiple subplots not being drawn in FigureCanvasKivy Apr 5, 2017
@janssen
Copy link
Contributor Author

janssen commented Apr 5, 2017

Here's a simple program to illustrate the problem. You need to have matplotlib, pandas, and seaborn installed to run this:

import sys, os

import matplotlib
matplotlib.use("module://kivy.garden.matplotlib.backend_kivyagg")
from kivy.garden.matplotlib import FigureCanvasKivy, FigureCanvasKivyAgg

from matplotlib import pyplot as plt

import pandas
import pandas.io.tests
import seaborn

from kivy.app import App
from kivy.uix.boxlayout import BoxLayout

class TestApp(App):

    def build(self):

        box = BoxLayout(orientation="horizontal")

        df = pandas.read_csv(os.path.join(pandas.io.tests.__path__[0], "data", "iris.csv"))
        print df

        seaborn.set_palette('bright')
        seaborn.set_style('whitegrid')
        seaborn.pairplot(data=df,
                         hue="Name",
                         kind="scatter",
                         diag_kind="hist",
                         x_vars=("SepalLength", "SepalWidth"),
                         y_vars=("PetalLength", "PetalWidth"))

        box.add_widget(FigureCanvasKivyAgg(plt.gcf()))
        box.add_widget(FigureCanvasKivy(plt.gcf()))
        return box


if __name__ == "__main__":
    TestApp().run()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant