Reputation: 79
I have a dataframe with 3 columns which are airline, date_flown, and sentiment. I'm not sure why but rather than rows of 5 columns being created, one giant row of all charts is created. Is there an issue with my code?
What I'm trying to achieve is one plot of smaller charts where each row contains 5 charts.
alt.Chart(df_airline_sentiment).mark_line().encode(
x='date_flown:T',
y='sentiment:Q',
).properties(
width=200,
height=200,
).facet(
column='airline:N',
columns = 5
)
Upvotes: 0
Views: 249
Reputation: 21
The first argument of the .facet()
is the column that you want to facet. In your case, it is the airline:N. This value, however, is not assigned to the column
as you have done in your code. Rather, you pass it without any argument name.
alt.Chart(df).mark_line().encode(
x='date_flown:T',
y='sentiment:Q'
).properties(
width=200,
height=200
).facet(
'airline:N',
columns = 5
)
Upvotes: 1