joypy icon indicating copy to clipboard operation
joypy copied to clipboard

Creating subplots with joypy

Open bwang482 opened this issue 6 years ago • 4 comments

Thanks for the great library @sbebo !!

I am struggling a little bit on dynamically creating subplot using joypy:

import joypy
import pandas as pd
from matplotlib import cm
import matplotlib.pyplot as plt

f, a = plt.subplots(2, 1)
data = pd.read_csv('../data.txt', sep="\t", header=None)

for c, i in enumerate(range(0, len(data), 50)):
    x_range = list(range(i, i+50, 1))
    fig, axes = joypy.joyplot(data[i:i+50], kind="values", x_range=x_range, colormap=cm.Set2,
                             figsize=(100,10))
    **a[c] = f.add_subplot(fig) # this is wrong! Though I can't figure out how to add joyplot as subplot to my figure..**
    a[c].set_xticks(x_range);

f.savefig('joyplot.png', bbox_inches='tight') 

Any suggestions would be appreciated! Thanks!

bwang482 avatar Nov 16 '18 15:11 bwang482

Hi, and thank you for using it. Quick answer (don't have much time to reply now): as it's implemented, I'm afraid is not super easy to have multiple subplots. I would have to think a bit about it and experiment a bit. I'll try to get back to you, if I manage :)

leotac avatar Nov 20 '18 18:11 leotac

Thanks @sbebo !

bwang482 avatar Nov 22 '18 09:11 bwang482

Hello bumping this older thread to see if @sbebo or @bluemonk482 or anyone else ever stumbled upon a solution for this!

Acaravan avatar Aug 15 '20 07:08 Acaravan

Same problem with subplots. Is there an alternative way?

Shinibaig avatar May 14 '22 05:05 Shinibaig