How do I accomplish faceting with a JupyterChart? #3429
-
Hi there, I would like to be able to create a small multiples arrangement of JupyterCharts - is there currently a way to do this? I looked through StackOverflow, the docs, and previous discussions and issues, but I was unable to find an answer on my own. Here's a MWE: The following code creates a simple faceted plot using a Chart: import altair as alt
import pandas as pd
source = pd.DataFrame({
'a': ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'],
'b': [28, 55, 43, 91, 81, 53, 19, 87, 52],
'c': [5, 5, 5, 10, 10, 10, 15, 15, 15]
})
chart = alt.Chart(source).mark_bar().encode(
x='a',
y='b'
)
chart.facet(column='c') The following code creates a JupyterChart with the same data: import altair as alt
import pandas as pd
source = pd.DataFrame({
'a': ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'],
'b': [28, 55, 43, 91, 81, 53, 19, 87, 52],
'c': [5, 5, 5, 10, 10, 10, 15, 15, 15]
})
chart = alt.Chart(source).mark_bar().encode(
x='a',
y='b'
)
jchart = alt.JupyterChart(chart)
jchart I would like to be able to make a JupyterChart that is faceted in the same way as the regular Chart, but of course when I try to run Any advice is appreciated. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
chart = alt.Chart(source).mark_bar().encode(
x='a',
y='b'
).facet(column='c')
jchart = alt.JupyterChart(chart) Is not working? |
Beta Was this translation helpful? Give feedback.
Is not working?