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

Scientific Visualization

Eitan Lees
November 07, 2018

Scientific Visualization

A talk I gave in the Department of Scientific Computing at Florida State University covering scientific visualization.

Eitan Lees

November 07, 2018
Tweet

More Decks by Eitan Lees

Other Decks in Science

Transcript

  1. Scientific Visualization
    By Eitan Lees

    View Slide

  2. Scientific Visualization
    By Eitan Lees
    *
    * Mostly in python

    View Slide

  3. Scientific Visualization
    By Eitan Lees
    *
    * Mostly in python
    Data

    View Slide

  4. Scientific Visualization
    By Eitan Lees
    *
    * Mostly in python
    Data Plots

    View Slide

  5. By Eitan Lees
    Data Plots

    View Slide

  6. Scientific Visualization
    By Eitan Lees

    View Slide

  7. View Slide

  8. Acknowledgements
    - Sachin Shanbhag for letting me
    explore
    - Nathan Crock for putting it all
    together
    - Much of today’s talk comes from
    Jake Vanderplas’ PyCon 2017 talk
    - Brian Granger and the Jupyter
    project

    View Slide

  9. Show and Tell

    View Slide

  10. So you want to make a plot?

    View Slide

  11. - Visit
    - Mongo
    - Vesta
    - Gnuplot
    - TikZ
    - Matlab
    - Matplotlib
    - Adobe
    Illustrator

    View Slide

  12. View Slide

  13. Government Solutions

    View Slide

  14. View Slide

  15. View Slide

  16. Advantages:
    - All in one platform
    - Developed with scientific application
    in mind
    - Very popular for physical modeling
    Weakness:
    - Too much for simple plots
    - GUI forward
    - Stability

    View Slide

  17. Commercial Solutions

    View Slide

  18. Data
    Visualization

    View Slide

  19. View Slide

  20. Python
    Visualization
    Landscape

    View Slide

  21. View Slide

  22. Strengths:
    - Designed like MatLab: switching was easy

    View Slide

  23. Strengths:
    - Designed like MatLab: switching was easy
    - Many rendering backends

    View Slide

  24. Strengths:
    - Designed like MatLab: switching was easy
    - Many rendering backends
    - Can reproduce just about any plot (with a bit of effort)

    View Slide

  25. 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

    View Slide

  26. View Slide

  27. 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

    View Slide

  28. Objective:
    Improve on the weaknesses of matplotlib
    (without sacrificing the strengths!)

    View Slide

  29. Building on Matplotlib
    Common Idea: Keep
    matplotlib as a versatile
    well tested backend,
    and provide a new
    domain specific API.

    View Slide

  30. Key Features:
    - Provides the DataFrame object
    - Also provides a simple API for
    plotting

    View Slide

  31. Key Features:
    - Provides the DataFrame object
    - Also provides a simple API for
    plotting
    - Recently more sophisticated
    statistical visualization tools
    have been added

    View Slide

  32. Key Features:
    - Like pandas, wraps matplotlib
    - Nice set of color palettes & plot styles
    - Focus on statistical visualization & modeling

    View Slide

  33. View Slide

  34. View Slide

  35. View Slide

  36. But what about the
    internet?!?

    View Slide

  37. View Slide

  38. View Slide

  39. Common Idea: build a new API
    that produces a plot serialization
    (often JSON) that can be displayed
    in the browser (often in Jupyter
    notebooks)

    View Slide

  40. Bokeh

    View Slide

  41. View Slide

  42. Bokeh
    Advantages:
    - Web view/interactivity
    - Handles large data and/or
    streaming datasets
    - Geographical visualizations
    - Fully open source
    Weakness:
    - Plotly has some paid features
    - Limited output formats
    - Smaller (but growing) community

    View Slide

  43. View Slide

  44. View Slide

  45. The elephant in the room

    View Slide

  46. View Slide

  47. D3 is everywhere

    View Slide

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

    View Slide

  49. “Simple”
    Barchart

    View Slide

  50. D3 is a Javascript package
    that streamlines the
    manipulation of objects on
    a webpage

    View Slide

  51. Vega is a detailed
    declarative specification
    for visualizations, built on
    D3

    View Slide

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

    View Slide

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

    View Slide

  54. View Slide

  55. Bridging the gap

    View Slide

  56. View Slide

  57. - Aggregates data and sends pixels
    - Can handle interactive
    visualization of billions of rows
    - Datasets themselves stored in
    objects that automatically produce
    intelligent visualizations

    View Slide

  58. Don’t care about the
    internet?

    View Slide

  59. Want more power?

    View Slide

  60. View Slide

  61. View Slide

  62. View Slide

  63. The Python Visualization Landscape

    View Slide

  64. Toward Declarative Visualization

    View Slide

  65. What do you mean by declarative
    visualization?

    View Slide

  66. Example: Statistical Data
    Tidy data: i.e. rows are samples, columns are features

    View Slide

  67. 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

    View Slide

  68. View Slide

  69. View Slide

  70. Problem:
    We’re mixing the what with the how

    View Slide

  71. 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 to a position,
    and to a color”
    Declarative visualizations lets you think about the data
    and relationships, rather than incidental details

    View Slide

  72. 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 to a position,
    and to a color”
    Declarative visualizations lets you think about the data
    and relationships, rather than incidental details

    View Slide

  73. Based on the Vega and Vega-Lite grammars
    https://altair-viz.github.io/
    Altair
    Declarative visualization in Python

    View Slide

  74. Altair for Statistical Visualization

    View Slide

  75. Encodings are Flexible:

    View Slide

  76. Altair is Interactive

    View Slide

  77. ...

    View Slide

  78. ...
    Altair Tutorial THIS Friday in THIS room
    from 3:30-4:30 pm

    View Slide