Violin Plot and ChatGPT

I have trouble with the data definition for hv.Violin: I wanted to draw several Violin plots on the same graph, and could not figure out how to provide the data.

I figured ChatGPT might write the code for me.
I had to ask it for corrections twice, but then got working code!

import numpy as np
import holoviews as hv
from holoviews import dim, opts

# Generate some sample data
data1 = np.random.randn(100)
data2 = np.random.randn(100) + 1

# Combine the two datasets into a single pandas DataFrame
data = {'Values': np.concatenate((data1, data2)),
        'Dataset': np.concatenate((np.repeat('Dataset 1', len(data1)),
                                    np.repeat('Dataset 2', len(data2))))}
df = hv.Dataset(data, ['Dataset'], 'Values')

# Display the two violin plots in a single plot using Holoviews, 'Dataset', 'Values')

Vow! That said, what are the data formats that hv.Violin can handle?
The data structure I am starting out with is a dictionary with each key associated with the data for a violin plot

1 Like