Home > Enterprise >  Is it possible to add count on the y-axis of joyplots?
Is it possible to add count on the y-axis of joyplots?

Time:11-24

I would like to add a y-axis showing the count value for each category within my Joyplot, along the lines of what's possible with ggplot (e.g. desired output with count on y-axis

Example code:

import joypy
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import cm

iris = pd.read_csv("data/iris.csv")
fig, axes = joypy.joyplot(iris)

Current output:

joyplot example

CodePudding user response:

joypy.joyplot can not easily be adapted. For example, the first y-tick of each subplot is used for the name. Also, a dummy subplot is used just for the common x-axis.

An alternative could be to use Seaborn which offers easier options for customization. See for example Seaborn's joyplot with y-axis for histograms

Here is a somewhat similar Seaborn plot.

from matplotlib import pyplot as plt
import seaborn as sns

iris = sns.load_dataset('iris')
sns.set_style("ticks", {'axes.grid': True})
g = sns.displot(data=iris, row='species', kind='hist', x="sepal_width", height=2, aspect=3)

seaborn sns.displot

CodePudding user response:

You could add a enter image description here

  • Related