Skip to content
Advertisement

Altair Ridgeline doesn’t create a plot with nominal groups

I try to create a Ridgeline plot in altair. Let’s assume my dataframe consists of str and float columns:

JavaScript

with values like

JavaScript

I used code from Altair gallery to create my chart: https://altair-viz.github.io/gallery/ridgeline_plot.html. My code with changed data and column names:

JavaScript

When I use row=alt.Row('a:T'...) it thinks my data is temporal month, but works fine:

enter image description here

But when I change type there to nominal 'a:N', result is empty. How to fix it?

Advertisement

Answer

For chart rendering errors like this, often there are clues in the browser’s developer console. In this case the following error is reported:

JavaScript

I believe that "%B" is not a valid format code for nominal data. If you remove format='%B' from the header, the nominal row encoding will work.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement