I have been using joypy for plotting what are called ridgeline/joy plots. I want to divide my dataframe equally into several parts, and recursively making each one of them as joy plot and adding them altogether for the ease of visualisation. Without doing so I just get one very long plot which is difficult to view. I have tried using subplots
and making a new joypy.joyplot
within a for-loop, but no success :(
import joypy
import mplcursors
from matplotlib import cm
import matplotlib.pyplot as plt
data = pd.DataFrame(np.random.rand(180,7), columns=list('ABCDEFG'))
x_range = list(range(len(data)))
fig, axes = joypy.joyplot(data, kind="values", x_range=x_range, colormap=cm.Set2,
figsize=(100,10))
axes[-1].set_xticks(x_range);
mplcursors.cursor(hover=True)
fig.savefig('joyplot.png', bbox_inches='tight')
What I have tried:
import joypy
from matplotlib import cm
import matplotlib.pyplot as plt
f, a = plt.subplots(2, 1)
data = pd.DataFrame(np.random.rand(180,7), columns=list('ABCDEFG'))
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),
title="Emotion evolution over an interview")
# I don't know what to do here so the current fig can be added as subplot..
a[c].set_xticks(x_range);
fig.show()
Also, does anyone know how to make the plot interactive, as when my mouse hovers over the plot then the its value of the y-axis appears. mplcursors
doesn't seem to work. Any help is appreciated! Thanks.