Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Altair Tutorial

Eitan Lees
November 10, 2018

Altair Tutorial

Here are the slides presented at an Altair tutorial and workshop I gave in the Department of Scientific Computing at FSU.

Eitan Lees

November 10, 2018
Tweet

More Decks by Eitan Lees

Other Decks in Technology

Transcript

  1. Exploratory Data Visualization with Altair

  2. None
  3. Acknowledgments - Altair is developed by Jake Vanderplas and Brian

    Granger in close collaboration with the UW Interactive Data Lab - Much of this tutorial is from Jake Vanderplas’ PyCon 2018 tutorial - Special thanks to the Altair Community on GitHub.
  4. Python Visualization Landscape

  5. Python Visualization Landscape

  6. Building Blocks of Visualization 1. Data 2. Transformations 3. Marks

    4. Encoding - mapping from fields to mark properties 5. Scale - functions that map data to visual scales 6. Guides - visualizations of scales (axes, legends, etc.)
  7. Key: Visualization concepts should map directly to visualization implementation

  8. Hypothesis: Good implementation can influence good conceptualization

  9. ~ familiar tools ~

  10. None
  11. None
  12. Strengths: - Designed like MatLab: switching was easy - Many

    rendering backends - Can reproduce just about any plot (with a bit of effort) - Well-tested, standard tool for over a decade Weaknesses: - API is imperative & often overly verbose - Poor support for web/interactive graphics - Often slow for large & complicated data
  13. Example: Statistical Data Tidy data: i.e. rows are samples, columns

    are features
  14. Tidy data: i.e. rows are samples, columns are features “

    I want to scatter petal length vs. sepal length, and color by species” Example: Statistical Data
  15. None
  16. None
  17. Problem: We’re mixing the what with the how

  18. Toward a well-motivated Declarative Visualization Imperative - Specify How something

    should be done. - Specification & Execution intertwined. - “Put a red circle here and a blue circle here” Declarative - Specify What should be done. - Separates Specification from Execution - “Map <x> to a position, and <y> to a color” Declarative visualizations lets you think about the data and relationships, rather than incidental details
  19. Toward a well-motivated Declarative Visualization Imperative - Specify How something

    should be done. - Specification & Execution intertwined. - “Put a red circle here and a blue circle here” Declarative - Specify What should be done. - Separates Specification from Execution - “Map <x> to a position, and <y> to a color” Declarative visualizations lets you think about the data and relationships, rather than incidental details
  20. Based on the Vega and Vega-Lite grammars https://altair-viz.github.io/ Altair Declarative

    visualization in Python
  21. Altair for Statistical Visualization

  22. Encodings are Flexible:

  23. Altair is Interactive

  24. ...

  25. None
  26. ~ From D3 to Vega to Altair ~

  27. D3 is everywhere

  28. But working with D3 can be challenging ...

  29. “Simple” Barchart

  30. D3 is a Javascript package that streamlines the manipulation of

    objects on a webpage
  31. Vega is a detailed declarative specification for visualizations, built on

    D3
  32. Vega-Lite is a simpler declarative specification aimed at statistical visualization

  33. Altair is a Python API for creating Vega-Lite specifications

  34. None
  35. ~ Thinking about Visualization ~

  36. None
  37. None
  38. None
  39. None
  40. None
  41. None
  42. None
  43. None
  44. None
  45. Key: Visualization concepts should map directly to visualization implementation Check

    out Jeff Heer’s class on data visualization https://courses.cs.washington.edu/courses/cse442/17au/