question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Facet without column or row

See original GitHub issue

With altair < 3.0, I was able to do this:

[1]
import altair.vegalite.v2 as alt
from vega_datasets import data

source = data.cars()

line = alt.Chart().mark_line().encode(x="Year", y="mean(Miles_per_Gallon)")

line.facet(data=source)

And then, on another jupyter cell, quickly iterate with facet plot with:

[2]
line.facet(data=source, column='Origin')

However, I get Javascript Error: Cannot read property 'length' of undefined when I specify a facet plot without column or row with altair 3.0.

Is there a way to specify a plot and a facet plot from line?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
romainmartinezcommented, May 23, 2019

Hi Jake, I can confirm that with the current master branch, both ways of declaring data (with alt.Chart(data) and chart.properties(data=data)) work correctly, even with layered charts. Thank you for the awesome support.

1reaction
jakevdpcommented, May 21, 2019

Another note, in case it helps your current workflow: in place of the empty facet, you can always do:

line = alt.Chart().mark_line().encode(x="Year", y="mean(Miles_per_Gallon)")
line.properties(data=source)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Lay out panels in a grid — facet_grid • ggplot2
facet_grid () forms a matrix of panels defined by row and column faceting variables ... there should be no faceting on this dimension...
Read more >
17 Faceting - ggplot2: Elegant Graphics for Data Analysis
facet_grid () has an additional parameter called space , which takes the same values as scales . When space is “free”, each column...
Read more >
Facet by different data columns — facet_matrix • ggforce
The facet_matrix() facet allows you to put different data columns into different rows and columns in a grid of panels.
Read more >
How to specify columns in facet_grid OR how to change labels ...
I can use facet_grid so that I can take advantage of the labeller function but then there seems to be no straightforward way...
Read more >
Facets
This relieves the constraint that ggplot2::facet_grid() has that a scale can only be free between rows and columns of the layout, and instead...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found