From 96961c7659d0e1d6bf94a61ca6193098001f75e2 Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Mon, 21 Mar 2022 12:15:35 -0700 Subject: [PATCH 01/25] Change to sphinx pydata theme --- doc/conf.py | 4 ++-- doc/requirements.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 82dd2d983..fab93ee77 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -73,7 +73,7 @@ # built documents. # # The short X.Y version. -version = "4.3.0.dev0" +version = "5.0.0" # The full version, including alpha/beta/rc tags. release = version @@ -127,7 +127,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = "sphinx_rtd_theme" +html_theme = "pydata_sphinx_theme" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the diff --git a/doc/requirements.txt b/doc/requirements.txt index 2b04086f3..bd6db4365 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -2,5 +2,5 @@ sphinx jinja2 numpydoc pillow -sphinx_rtd_theme mistune<=0.8.4 +pydata-sphinx-theme From 802e146f223867aaafc97f5cf0e4144ded9a56d5 Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Mon, 21 Mar 2022 12:21:11 -0700 Subject: [PATCH 02/25] Update templates, css, and config for the pydata theme --- doc/_static/custom.css | 41 +++++++++++++++++++++++++++++- doc/_templates/navbar-project.html | 4 +++ doc/_templates/sidebar-logo.html | 13 ++++++++++ doc/conf.py | 11 ++++++++ 4 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 doc/_templates/navbar-project.html create mode 100644 doc/_templates/sidebar-logo.html diff --git a/doc/_static/custom.css b/doc/_static/custom.css index fd823a163..94707e008 100644 --- a/doc/_static/custom.css +++ b/doc/_static/custom.css @@ -23,4 +23,43 @@ table.docutils td p { table.docutils td li { line-height: 18px; -} \ No newline at end of file +} + +/* Everything below this comment is for the pydata sphinx theme*/ + +/* Blue topbar */ +.navbar-light { + background-color: #16A7F0 !important; +} +/* White text in topbar */ +.navbar-light a { + color: #fff !important; +} +/* White bold project title in topbar */ +.navbar-light p.title { + font-size: 26px !important; + font-weight: 800 !important; + color: #fff !important; + margin-left: 180%; +} + +/* Version number in the same darkblue color as other text */ +div.navbar-brand-box p#site-version.site-version { + color: #130654 !important; +} +/* The box that contains the logo and the version number */ +div.navbar-brand-box a { + width: 100% !important; + height: auto !important; + flex-direction: column !important; +} +/* The logo */ +div.navbar-brand-box img { + display: block !important; + height: auto !important; + width: auto !important; + max-height: 18vh !important; + max-width: 100% !important; + margin: 0 auto !important; + margin-top: -40px !important; +} diff --git a/doc/_templates/navbar-project.html b/doc/_templates/navbar-project.html new file mode 100644 index 000000000..2b8ece77e --- /dev/null +++ b/doc/_templates/navbar-project.html @@ -0,0 +1,4 @@ + +

{{ project }}

+
+ diff --git a/doc/_templates/sidebar-logo.html b/doc/_templates/sidebar-logo.html new file mode 100644 index 000000000..e3c1e8f3a --- /dev/null +++ b/doc/_templates/sidebar-logo.html @@ -0,0 +1,13 @@ + diff --git a/doc/conf.py b/doc/conf.py index fab93ee77..ff3033f6b 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -159,6 +159,17 @@ html_static_path = ["_static", "_images"] +html_theme_options = { +"navbar_start": ["navbar-project"], +"navbar_center": ["navbar-nav"], +"navbar_end": ["navbar-icon-links"], +} + +html_sidebars = { + "**": ["sidebar-logo", "search-field", "sidebar-nav-bs", "sidebar-ethical-ads"], + "gallery/index": ["sidebar-logo", "search-field", "sidebar-ethical-ads"] +} + # adapted from: http://rackerlabs.github.io/docs-rackspace/tools/rtd-tables.html # and # https://github.com/rtfd/sphinx_rtd_theme/issues/117 From 645e5e37b1f65a57099583d4047a7f5e35a06b48 Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Mon, 21 Mar 2022 12:22:33 -0700 Subject: [PATCH 03/25] Update index structure for the pydata theme --- doc/getting_started/overview.rst | 10 +++++ doc/index.rst | 72 ++++---------------------------- doc/releases/changes.rst | 4 +- doc/user_guide/API.rst | 4 ++ doc/user_guide/data.rst | 48 +++++++++++++++++++++ doc/user_guide/ecosystem.rst | 4 +- 6 files changed, 75 insertions(+), 67 deletions(-) diff --git a/doc/getting_started/overview.rst b/doc/getting_started/overview.rst index 995d02b42..787987569 100644 --- a/doc/getting_started/overview.rst +++ b/doc/getting_started/overview.rst @@ -33,3 +33,13 @@ concise grammar. .. _Vega: http://vega.github.io/vega .. _Vega-Lite: http://vega.github.io/vega-lite + + +.. toctree:: + :maxdepth: 1 + :caption: Getting Started + :hidden: + + self + installation + starting diff --git a/doc/index.rst b/doc/index.rst index ec0a18b1e..466a9db24 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -17,80 +17,26 @@ Altair's API is simple, friendly and consistent and built on top of the powerful Vega-Lite_ visualization grammar. This elegant simplicity produces beautiful and effective visualizations with a minimal amount of code. -.. toctree:: - :maxdepth: 1 - :caption: Getting Started +Altair is BSD-licensed and the source is available on `GitHub`_, +where you can also report `bugs and feature requests`_. +For general questions, please use `StackOverflow`_. - getting_started/overview - getting_started/installation - getting_started/starting +You can browse this documentation via the link in the top navigation panel or by viewing the full site :ref:`genindex`. .. toctree:: :maxdepth: 1 - :caption: Gallery + :hidden: + Getting Started + User Guide gallery/index - -.. toctree:: - :maxdepth: 1 - :caption: User Guide - - user_guide/data - user_guide/encoding - user_guide/marks - user_guide/transform/index - user_guide/interactions - user_guide/interactions2 - user_guide/configuration - user_guide/compound_charts - user_guide/scale_resolve - user_guide/saving_charts - user_guide/customization - user_guide/times_and_dates - user_guide/faq - user_guide/troubleshooting - user_guide/internals user_guide/API user_guide/ecosystem - -.. toctree:: - :maxdepth: 1 - :caption: Case Studies - - case_studies/exploring-weather - -.. toctree:: - :maxdepth: 1 - :caption: Advanced Usage - - user_guide/importing - user_guide/display_frontends - user_guide/custom_renderers - user_guide/data_transformers - -.. toctree:: - :maxdepth: 1 - :caption: Release Notes - releases/changes -Bug Reports & Questions ------------------------ - -Altair is BSD-licensed and the source is available on `GitHub`_. If any -questions or issues come up as you use Altair, please get in touch via -`Git Issues`_ or our `Google Group`_. - - -Indices and tables ------------------- - -* :ref:`genindex` -* :ref:`modindex` - - .. _GitHub: http://github.com/altair-viz/altair .. _Git Issues: http://github.com/altair-viz/altair/issues .. _Vega: http://vega.github.io/vega .. _Vega-Lite: http://vega.github.io/vega-lite -.. _Google Group: https://groups.google.com/forum/#!forum/altair-viz +.. _bugs and feature requests: https://github.com/altair-viz/altair/issues/new/choose +.. _StackOverflow: https://stackoverflow.com/tags/altair diff --git a/doc/releases/changes.rst b/doc/releases/changes.rst index 859f703f4..9b5ff7544 100644 --- a/doc/releases/changes.rst +++ b/doc/releases/changes.rst @@ -1,7 +1,7 @@ .. _changes: -Altair Change Log -================= +Release Notes +============= Version 4.3.0 (unreleased) -------------------------- diff --git a/doc/user_guide/API.rst b/doc/user_guide/API.rst index 94f89230b..fcddd7f93 100644 --- a/doc/user_guide/API.rst +++ b/doc/user_guide/API.rst @@ -15,6 +15,7 @@ Top-Level Objects .. autosummary:: :toctree: generated/toplevel/ + :caption: Top-Level Objects :nosignatures: Chart @@ -32,6 +33,7 @@ Encoding Channels .. autosummary:: :toctree: generated/channels/ + :caption: Encoding Channels :nosignatures: Angle @@ -140,6 +142,7 @@ API Functions .. autosummary:: :toctree: generated/api/ + :caption: API Functions :nosignatures: binding @@ -170,6 +173,7 @@ Low-Level Schema Wrappers .. autosummary:: :toctree: generated/core/ + :caption: Low-Level Schema Wrappers :nosignatures: Aggregate diff --git a/doc/user_guide/data.rst b/doc/user_guide/data.rst index c76a742c9..7c6ac9fad 100644 --- a/doc/user_guide/data.rst +++ b/doc/user_guide/data.rst @@ -432,3 +432,51 @@ data before usage in Altair using GeoPandas for example as such: .. _Protocol geo_interface: https://gist.github.com/sgillies/2217756 .. _Packages supporting the geo_interface: https://github.com/mlaloux/Python-geo_interface-applications .. _The GeoJSON format: https://tools.ietf.org/html/rfc7946#section-3.1.9 + + +.. toctree:: + :maxdepth: 1 + :caption: User Guide + :hidden: + + self + encoding + marks + transform/index + interactions + interactions2 + configuration + compound_charts + scale_resolve + saving_charts + customization + times_and_dates + + +.. toctree:: + :maxdepth: 1 + :caption: Advanced Usage + :hidden: + + internals + importing + display_frontends + custom_renderers + data_transformers + + +.. toctree:: + :maxdepth: 1 + :caption: Case Studies + :hidden: + + case_studies/exploring-weather + + +.. toctree:: + :maxdepth: 1 + :caption: Getting Help + :hidden: + + faq + troubleshooting diff --git a/doc/user_guide/ecosystem.rst b/doc/user_guide/ecosystem.rst index 0ebdd52bf..e4ce96dae 100644 --- a/doc/user_guide/ecosystem.rst +++ b/doc/user_guide/ecosystem.rst @@ -1,7 +1,7 @@ .. _ecosystem: -Altair Ecosystem -================ +Ecosystem +========= This is a list of projects related to or built on top of Altair. We hope to make it easier to find these projects by listing them here. If you know of a project that should be added, please let us know. From 6f0affaa1854f7c4c3f5bbdf060a89b7ee2ab45c Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Mon, 21 Mar 2022 12:23:24 -0700 Subject: [PATCH 04/25] Move case studies and setup redirect --- doc/conf.py | 4 ++++ doc/{ => user_guide}/case_studies/exploring-weather.rst | 0 2 files changed, 4 insertions(+) rename doc/{ => user_guide}/case_studies/exploring-weather.rst (100%) diff --git a/doc/conf.py b/doc/conf.py index ff3033f6b..fc583c07e 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -38,6 +38,7 @@ "altair.sphinxext.altairplot", "altair.sphinxext.altairgallery", "altair.sphinxext.schematable", + "sphinxext.rediraffe", ] altair_plot_links = {"editor": True, "source": False, "export": False} @@ -170,6 +171,9 @@ "gallery/index": ["sidebar-logo", "search-field", "sidebar-ethical-ads"] } +rediraffe_redirects = { + 'case_studies/exploring-weather.rst': 'user_guide/case_studies/exploring-weather.rst' +} # adapted from: http://rackerlabs.github.io/docs-rackspace/tools/rtd-tables.html # and # https://github.com/rtfd/sphinx_rtd_theme/issues/117 diff --git a/doc/case_studies/exploring-weather.rst b/doc/user_guide/case_studies/exploring-weather.rst similarity index 100% rename from doc/case_studies/exploring-weather.rst rename to doc/user_guide/case_studies/exploring-weather.rst From 273f6b7fb5e2df69c15df9b39baa41333490b38b Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Mon, 21 Mar 2022 12:24:26 -0700 Subject: [PATCH 05/25] Point to Vega-Lite docs for mark properties --- doc/user_guide/marks.rst | 56 +++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/doc/user_guide/marks.rst b/doc/user_guide/marks.rst index 4fbcf547c..a82a17a53 100644 --- a/doc/user_guide/marks.rst +++ b/doc/user_guide/marks.rst @@ -10,36 +10,38 @@ used to map columns to visual attributes of the plot. The ``mark`` property is what specifies how exactly those attributes should be represented on the plot. -Altair provides a number of basic mark properties: - -========== ============================ =================================================== ==================================== -Mark Name Method Description Example -========== ============================ =================================================== ==================================== -arc :meth:`~Chart.mark_arc` A pie chart. :ref:`gallery_pie_chart` -area :meth:`~Chart.mark_area` A filled area plot. :ref:`gallery_simple_stacked_area_chart` -bar :meth:`~Chart.mark_bar` A bar plot. :ref:`gallery_simple_bar_chart` -circle :meth:`~Chart.mark_circle` A scatter plot with filled circles. :ref:`gallery_one_dot_per_zipcode` -geoshape :meth:`~Chart.mark_geoshape` A geographic shape :ref:`gallery_choropleth` -image :meth:`~Chart.mark_image` A scatter plot with image markers. :ref:`user-guide-image-mark` -line :meth:`~Chart.mark_line` A line plot. :ref:`gallery_simple_line_chart` -point :meth:`~Chart.mark_point` A scatter plot with configurable point shapes. :ref:`gallery_scatter_linked_brush` -rect :meth:`~Chart.mark_rect` A filled rectangle, used for heatmaps :ref:`gallery_simple_heatmap` -rule :meth:`~Chart.mark_rule` A vertical or horizontal line spanning the axis. :ref:`gallery_candlestick_chart` -square :meth:`~Chart.mark_square` A scatter plot with filled squares. N/A -text :meth:`~Chart.mark_text` A scatter plot with points represented by text. :ref:`gallery_bar_chart_with_labels` -tick :meth:`~Chart.mark_tick` A vertical or horizontal tick mark. :ref:`gallery_strip_plot` -trail :meth:`~Chart.mark_trail` A line with variable widths. :ref:`gallery_trail_marker` -========== ============================ =================================================== ==================================== +Altair provides a number of basic mark properties +(the mark properties column links to the Vega-Lite documentation +that allows you to interactively explore the effects of modifying each property): + +============================ =================================================== ======================================== ================================================================ +Mark Description Example Mark Properties +============================ =================================================== ======================================== ================================================================ +:meth:`~Chart.mark_arc` A pie chart. :ref:`gallery_pie_chart` `Vega-Lite Docs `_ +:meth:`~Chart.mark_area` A filled area plot. :ref:`gallery_simple_stacked_area_chart` `Vega-Lite Docs `_ +:meth:`~Chart.mark_bar` A bar plot. :ref:`gallery_simple_bar_chart` `Vega-Lite Docs `_ +:meth:`~Chart.mark_circle` A scatter plot with filled circles. :ref:`gallery_one_dot_per_zipcode` `Vega-Lite Docs `_ +:meth:`~Chart.mark_geoshape` A geographic shape :ref:`gallery_choropleth` `Vega-Lite Docs `_ +:meth:`~Chart.mark_image` A scatter plot with image markers. :ref:`user-guide-image-mark` `Vega-Lite Docs `_ +:meth:`~Chart.mark_line` A line plot. :ref:`gallery_simple_line_chart` `Vega-Lite Docs `_ +:meth:`~Chart.mark_point` A scatter plot with configurable point shapes. :ref:`gallery_scatter_linked_brush` `Vega-Lite Docs `_ +:meth:`~Chart.mark_rect` A filled rectangle, used for heatmaps :ref:`gallery_simple_heatmap` `Vega-Lite Docs `_ +:meth:`~Chart.mark_rule` A vertical or horizontal line spanning the axis. :ref:`gallery_candlestick_chart` `Vega-Lite Docs `_ +:meth:`~Chart.mark_square` A scatter plot with filled squares. N/A `Vega-Lite Docs `_ +:meth:`~Chart.mark_text` A scatter plot with points represented by text. :ref:`gallery_bar_chart_with_labels` `Vega-Lite Docs `_ +:meth:`~Chart.mark_tick` A vertical or horizontal tick mark. :ref:`gallery_strip_plot` `Vega-Lite Docs `_ +:meth:`~Chart.mark_trail` A line with variable widths. :ref:`gallery_trail_marker` `Vega-Lite Docs `_ +============================ =================================================== ======================================== ================================================================ In addition, Altair provides the following compound marks: -========== ============================== ================================ ================================== -Mark Name Method Description Example -========== ============================== ================================ ================================== -box plot :meth:`~Chart.mark_boxplot` A box plot. :ref:`gallery_boxplot` -error band :meth:`~Chart.mark_errorband` A continuous band around a line. :ref:`gallery_line_with_ci` -error bar :meth:`~Chart.mark_errorbar` An errorbar around a point. :ref:`gallery_errorbars_with_ci` -========== ============================== ================================ ================================== +============================== ================================ ================================== ================================================================ +Mark Description Example Mark Properties +============================== ================================ ================================== ================================================================ +:meth:`~Chart.mark_boxplot` A box plot. :ref:`gallery_boxplot` `Vega-Lite Docs `_ +:meth:`~Chart.mark_errorband` A continuous band around a line. :ref:`gallery_line_with_ci` `Vega-Lite Docs `_ +:meth:`~Chart.mark_errorbar` An errorbar around a point. :ref:`gallery_errorbars_with_ci` `Vega-Lite Docs `_ +============================== ================================ ================================== ================================================================ In Altair, marks can be most conveniently specified by the ``mark_*`` methods of the Chart object, which take optional keyword arguments that are passed to From d9d6c59160dcdea426c67ee3bd831b8e4d9a2df2 Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Mon, 21 Mar 2022 17:28:56 -0700 Subject: [PATCH 06/25] Add headings and reorganize order of sections and headings for clarity --- doc/index.rst | 17 ++++--- doc/user_guide/data.rst | 22 ++------- doc/user_guide/encoding.rst | 85 ++++++++++++++++++++++++++------- doc/user_guide/interactions.rst | 4 +- 4 files changed, 84 insertions(+), 44 deletions(-) diff --git a/doc/index.rst b/doc/index.rst index 466a9db24..1942857eb 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -9,8 +9,7 @@ Altair: Declarative Visualization in Python :size: 15 Altair is a declarative statistical visualization library for Python, based on -Vega_ and Vega-Lite_, and the source is available on -`GitHub `_. +Vega_ and Vega-Lite_. With Altair, you can spend more time understanding your data and its meaning. Altair's API is simple, friendly and consistent and built on top of the @@ -19,9 +18,14 @@ beautiful and effective visualizations with a minimal amount of code. Altair is BSD-licensed and the source is available on `GitHub`_, where you can also report `bugs and feature requests`_. -For general questions, please use `StackOverflow`_. +For general questions, please ask on `StackOverflow`_ +using the `altair` tag. -You can browse this documentation via the link in the top navigation panel or by viewing the full site :ref:`genindex`. +You can browse this documentation +via the links in the top navigation panel +or by viewing the full site :ref:`genindex`. +In addition to reading this documentation page, +it can be helpful to also browse the `Vega-Lite documentation `_. .. toctree:: :maxdepth: 1 @@ -29,10 +33,11 @@ You can browse this documentation via the link in the top navigation panel or by Getting Started User Guide - gallery/index - user_guide/API + Examples + API user_guide/ecosystem releases/changes + Help .. _GitHub: http://github.com/altair-viz/altair .. _Git Issues: http://github.com/altair-viz/altair/issues diff --git a/doc/user_guide/data.rst b/doc/user_guide/data.rst index 7c6ac9fad..69b1fae5b 100644 --- a/doc/user_guide/data.rst +++ b/doc/user_guide/data.rst @@ -448,9 +448,10 @@ data before usage in Altair using GeoPandas for example as such: configuration compound_charts scale_resolve - saving_charts - customization times_and_dates + customization + configuration + saving_charts .. toctree:: @@ -463,20 +464,3 @@ data before usage in Altair using GeoPandas for example as such: display_frontends custom_renderers data_transformers - - -.. toctree:: - :maxdepth: 1 - :caption: Case Studies - :hidden: - - case_studies/exploring-weather - - -.. toctree:: - :maxdepth: 1 - :caption: Getting Help - :hidden: - - faq - troubleshooting diff --git a/doc/user_guide/encoding.rst b/doc/user_guide/encoding.rst index 3841d1234..de984f6ec 100644 --- a/doc/user_guide/encoding.rst +++ b/doc/user_guide/encoding.rst @@ -40,7 +40,8 @@ Encoding Channels Altair provides a number of encoding channels that can be useful in different circumstances; the following table summarizes them: -Position Channels: +Position Channels +^^^^^^^^^^^^^^^^^ ========== =================== ================================= =================================== Channel Altair Class Description Example @@ -63,7 +64,8 @@ theta :class:`Theta` The start arc angle :ref:`galler theta2 :class:`Theta2` The end arc angle (radian) :ref:`gallery_pacman_chart` ========== =================== ================================= =================================== -Mark Property Channels: +Mark Property Channels +^^^^^^^^^^^^^^^^^^^^^^ ============= ====================== ============================== ========================================= Channel Altair Class Description Example @@ -82,7 +84,8 @@ strokeOpacity :class:`StrokeOpacity` The opacity of the line N/A strokeWidth :class:`StrokeWidth` The width of the line N/A ============= ====================== ============================== ========================================= -Text and Tooltip Channels: +Text and Tooltip Channels +^^^^^^^^^^^^^^^^^^^^^^^^^ ======= ================ ======================== ========================================= Channel Altair Class Description Example @@ -92,7 +95,8 @@ key :class:`Key` -- N/A tooltip :class:`Tooltip` The tooltip value :ref:`gallery_scatter_tooltips` ======= ================ ======================== ========================================= -Hyperlink Channel: +Hyperlink Channel +^^^^^^^^^^^^^^^^^ ======= ================ ======================== ========================================= Channel Altair Class Description Example @@ -100,7 +104,8 @@ Channel Altair Class Description Example href :class:`Href` Hyperlink for points :ref:`gallery_scatter_href` ======= ================ ======================== ========================================= -Level of Detail Channel: +Level of Detail Channel +^^^^^^^^^^^^^^^^^^^^^^^ ======= ================ =============================== ========================================= Channel Altair Class Description Example @@ -108,7 +113,8 @@ Channel Altair Class Description Example detail :class:`Detail` Additional property to group by :ref:`gallery_ranged_dot_plot` ======= ================ =============================== ========================================= -Order Channel: +Order Channel +^^^^^^^^^^^^^ ======= ================ ============================= ===================================== Channel Altair Class Description Example @@ -116,7 +122,8 @@ Channel Altair Class Description Example order :class:`Order` Sets the order of the marks :ref:`gallery_connected_scatterplot` ======= ================ ============================= ===================================== -Facet Channels: +Facet Channels +^^^^^^^^^^^^^^ ======= ================ =============================================== ============================================= Channel Altair Class Description Example @@ -254,64 +261,105 @@ titles, binning parameters, aggregation, sorting, and many more. The particular options that are available vary by encoding type; the various options are listed below. +X and Y +^^^^^^^ The :class:`X` and :class:`Y` encodings accept the following options: .. altair-object-table:: altair.PositionFieldDef +Color, Fill, and Stroke +^^^^^^^^^^^^^^^^^^^^^^^ + The :class:`Color`, :class:`Fill`, and :class:`Stroke` encodings accept the following options: .. altair-object-table:: altair.FieldOrDatumDefWithConditionMarkPropFieldDefGradientstringnull +Shape +^^^^^ + The :class:`Shape` encoding accepts the following options: .. altair-object-table:: altair.FieldOrDatumDefWithConditionMarkPropFieldDefTypeForShapestringnull +Order +^^^^^ + +The :class:`Order` encoding accepts the following options: + +.. altair-object-table:: altair.OrderFieldDef + +Angle, FillOpacity, Opacity, Size, StrokeOpacity, and StrokeWidth +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + The :class:`Angle`, :class:`FillOpacity`, :class:`Opacity`, :class:`Size`, :class:`StrokeOpacity`, and :class:`StrokeWidth` encodings accept the following options: .. altair-object-table:: altair.FieldOrDatumDefWithConditionMarkPropFieldDefnumber +StrokeDash +^^^^^^^^^^ + +The :class:`StrokeDash` encoding accepts the following options: + +.. altair-object-table:: altair.FieldOrDatumDefWithConditionMarkPropFieldDefnumberArray + +Row and Column +^^^^^^^^^^^^^^ + The :class:`Row` and :class:`Column`, and :class:`Facet` encodings accept the following options: .. altair-object-table:: altair.RowColumnEncodingFieldDef +Facet +^^^^^ + The :class:`Facet` encoding accepts the following options: .. altair-object-table:: altair.FacetEncodingFieldDef +Text +^^^^ + The :class:`Text` encoding accepts the following options: .. altair-object-table:: altair.FieldOrDatumDefWithConditionStringFieldDefText +Description, Href, Tooltip, Url +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + The :class:`Description`, :class:`Href`, :class:`Tooltip`, and :class:`Url` encodings accept the following options: .. altair-object-table:: altair.StringFieldDefWithCondition +Detail and Key +^^^^^^^^^^^^^^ + The :class:`Detail` and :class:`Key` encodings accept the following options: .. altair-object-table:: altair.FieldDefWithoutScale +Latitude and Longitude +^^^^^^^^^^^^^^^^^^^^^^ + The :class:`Latitude` and :class:`Longitude` encodings accept the following options: .. altair-object-table:: altair.LatLongFieldDef -The :class:`Latitude2`, :class:`Longitude2`, :class:`Radius2`, :class:`Theta2`, :class:`X2`, :class:`Y2`, :class:`XError`, :class:`YError`, -:class:`XError2`, and :class:`YError2` encodings accept the following options: - -.. altair-object-table:: altair.SecondaryFieldDef - -The :class:`Order` encoding accepts the following options: - -.. altair-object-table:: altair.OrderFieldDef +Radius and Theta +^^^^^^^^^^^^^^^^ The :class:`Radius` and :class:`Theta` encodings accept the following options: .. altair-object-table:: altair.PositionFieldDefBase -The :class:`StrokeDash` encoding accepts the following options: +Latitude2, Longitude2, Radius2, Theta2, X2, Y2, XError, YError, XError2, and YError2 +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The :class:`Latitude2`, :class:`Longitude2`, :class:`Radius2`, :class:`Theta2`, :class:`X2`, :class:`Y2`, :class:`XError`, :class:`YError`, :class:`XError2`, and :class:`YError2` encodings accept the following options: + +.. altair-object-table:: altair.SecondaryFieldDef -.. altair-object-table:: altair.FieldOrDatumDefWithConditionMarkPropFieldDefnumberArray .. _encoding-aggregates: @@ -368,6 +416,9 @@ represents the mean of a third quantity, such as acceleration: color='average(Acceleration):Q' ) +Aggregation Functions +^^^^^^^^^^^^^^^^^^^^^ + In addition to ``count`` and ``average``, there are a large number of available aggregation functions built into Altair; they are listed in the following table: diff --git a/doc/user_guide/interactions.rst b/doc/user_guide/interactions.rst index eecff9c9d..847362dfe 100644 --- a/doc/user_guide/interactions.rst +++ b/doc/user_guide/interactions.rst @@ -2,8 +2,8 @@ .. _user-guide-interactions: -Bindings, Selections, Conditions: Making Charts Interactive -=========================================================== +Interactive Charts: Bindings, Selections, Conditions +==================================================== One of the unique features of Altair, inherited from Vega-Lite, is a declarative grammar of not just visualization, but *interaction*. There are three From 9de2dfb1fc64a2fda956a34c99d262abce65c7cd Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Mon, 21 Mar 2022 18:34:14 -0700 Subject: [PATCH 07/25] Remove ToC dropdown error created from empty ToC --- altair/sphinxext/altairgallery.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/altair/sphinxext/altairgallery.py b/altair/sphinxext/altairgallery.py index 0a768e831..2dc4bd311 100644 --- a/altair/sphinxext/altairgallery.py +++ b/altair/sphinxext/altairgallery.py @@ -105,9 +105,6 @@ {% if strict %}:strict:{% endif %} {{ code | indent(4) }} - -.. toctree:: - :hidden: """ ) From 411c9508ea5e7ebee331a7e6b01e2f08f6848b52 Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Mon, 21 Mar 2022 19:41:14 -0700 Subject: [PATCH 08/25] Improve ToC for galleries and move seattle weather to original location --- altair/sphinxext/altairgallery.py | 13 ++++++++----- .../case_studies/exploring-weather.rst | 9 ++++++++- doc/conf.py | 1 - 3 files changed, 16 insertions(+), 7 deletions(-) rename doc/{user_guide => }/case_studies/exploring-weather.rst (99%) diff --git a/altair/sphinxext/altairgallery.py b/altair/sphinxext/altairgallery.py index 2dc4bd311..72bb47068 100644 --- a/altair/sphinxext/altairgallery.py +++ b/altair/sphinxext/altairgallery.py @@ -67,13 +67,16 @@
+{% endfor %} + + .. toctree:: - :hidden: -{% for example in group %} - {{ example.name }} -{%- endfor %} + :maxdepth: 2 + :caption: Examples + :hidden: -{% endfor %} + Gallery + Tutorials <../case_studies/exploring-weather> """ ) diff --git a/doc/user_guide/case_studies/exploring-weather.rst b/doc/case_studies/exploring-weather.rst similarity index 99% rename from doc/user_guide/case_studies/exploring-weather.rst rename to doc/case_studies/exploring-weather.rst index b85609e23..69309a2f6 100644 --- a/doc/user_guide/case_studies/exploring-weather.rst +++ b/doc/case_studies/exploring-weather.rst @@ -1,7 +1,7 @@ .. _exploring-weather: Exploring Seattle Weather -========================= +------------------------- (This tutorial is adapted from `Vega-Lite's documentation `_) @@ -266,3 +266,10 @@ If you want to further customize your charts, you can refer to Altair's :ref:`API`. .. _Pandas: http://pandas.pydata.org/ + + +.. toctree:: + :maxdepth: 1 + :hidden: + + self diff --git a/doc/conf.py b/doc/conf.py index fc583c07e..8d1429164 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -168,7 +168,6 @@ html_sidebars = { "**": ["sidebar-logo", "search-field", "sidebar-nav-bs", "sidebar-ethical-ads"], - "gallery/index": ["sidebar-logo", "search-field", "sidebar-ethical-ads"] } rediraffe_redirects = { From 193f7cc4ffaafd695214d6b1d98fccc21122218a Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Mon, 21 Mar 2022 19:44:37 -0700 Subject: [PATCH 09/25] Do not use rediraffe since it is now not needed Also move a couple of section inside conf.py --- doc/conf.py | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 8d1429164..bf65ce8f7 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -38,7 +38,7 @@ "altair.sphinxext.altairplot", "altair.sphinxext.altairgallery", "altair.sphinxext.schematable", - "sphinxext.rediraffe", + # "sphinxext.rediraffe", ] altair_plot_links = {"editor": True, "source": False, "export": False} @@ -133,7 +133,11 @@ # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -# html_theme_options = {} +html_theme_options = { +"navbar_start": ["navbar-project"], +"navbar_center": ["navbar-nav"], +"navbar_end": ["navbar-icon-links"], +} # Add any paths that contain custom themes here, relative to this directory. # html_theme_path = [] @@ -159,20 +163,6 @@ # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ["_static", "_images"] - -html_theme_options = { -"navbar_start": ["navbar-project"], -"navbar_center": ["navbar-nav"], -"navbar_end": ["navbar-icon-links"], -} - -html_sidebars = { - "**": ["sidebar-logo", "search-field", "sidebar-nav-bs", "sidebar-ethical-ads"], -} - -rediraffe_redirects = { - 'case_studies/exploring-weather.rst': 'user_guide/case_studies/exploring-weather.rst' -} # adapted from: http://rackerlabs.github.io/docs-rackspace/tools/rtd-tables.html # and # https://github.com/rtfd/sphinx_rtd_theme/issues/117 @@ -195,7 +185,15 @@ def setup(app): # html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -# html_sidebars = {} +html_sidebars = { + "**": ["sidebar-logo", "search-field", "sidebar-nav-bs", "sidebar-ethical-ads"], +} + +# Redirection of old page locations via the rediraffe sphinx-extension +# It seems like only pages can be redirected, not headings within pages +# rediraffe_redirects = { +# 'case_studies/exploring-weather.rst': 'user_guide/case_studies/exploring-weather.rst' +# } # Additional templates that should be rendered to pages, maps page names to # template names. From 901320f8929476884109daab93e383bea8d19ea4 Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Mon, 21 Mar 2022 19:44:51 -0700 Subject: [PATCH 10/25] Rename API Reference topbar entry --- doc/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/index.rst b/doc/index.rst index 1942857eb..800ef06ab 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -34,7 +34,7 @@ it can be helpful to also browse the `Vega-Lite documentation User Guide Examples - API + Reference user_guide/ecosystem releases/changes Help From c2bff55c524b62b6f23ce8544db7ab751b9dd5a4 Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Mon, 21 Mar 2022 19:45:25 -0700 Subject: [PATCH 11/25] Move the `...` button next to each chart --- doc/_static/altair-plot.css | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/_static/altair-plot.css b/doc/_static/altair-plot.css index 06e9a91b7..a80013846 100644 --- a/doc/_static/altair-plot.css +++ b/doc/_static/altair-plot.css @@ -8,6 +8,5 @@ .vega-embed { margin-bottom: 20px; margin-top: 20px; - width: 100%; } From 4c5093cc219ebac11c698f2fde8b0e122a1f8ffc Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Mon, 21 Mar 2022 19:59:59 -0700 Subject: [PATCH 12/25] Add getting help landing page --- doc/user_guide/getting_help.rst | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 doc/user_guide/getting_help.rst diff --git a/doc/user_guide/getting_help.rst b/doc/user_guide/getting_help.rst new file mode 100644 index 000000000..f033066af --- /dev/null +++ b/doc/user_guide/getting_help.rst @@ -0,0 +1,28 @@ +Getting Help +============ + +Altair is BSD-licensed and the source is available on `GitHub`_, +where you can also report `bugs and feature requests`_. +For general questions, please ask on `StackOverflow`_ +using the `altair` tag. + +You can browse this documentation +via the links in the top navigation panel +or by viewing the full site :ref:`genindex`. +In addition to reading this documentation page, +it can be helpful to also browse the `Vega-Lite documentation `_. + +.. toctree:: + :maxdepth: 1 + :caption: Getting Help + :hidden: + + faq + troubleshooting + +.. _GitHub: http://github.com/altair-viz/altair +.. _Git Issues: http://github.com/altair-viz/altair/issues +.. _Vega: http://vega.github.io/vega +.. _Vega-Lite: http://vega.github.io/vega-lite +.. _bugs and feature requests: https://github.com/altair-viz/altair/issues/new/choose +.. _StackOverflow: https://stackoverflow.com/tags/altair From 0a651728f2935eec5733f6516656487c548d2cf3 Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Mon, 21 Mar 2022 20:46:23 -0700 Subject: [PATCH 13/25] Format to pass flake8 tests --- doc/conf.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index bf65ce8f7..9caa858f6 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -134,9 +134,9 @@ # further. For a list of options available for each theme, see the # documentation. html_theme_options = { -"navbar_start": ["navbar-project"], -"navbar_center": ["navbar-nav"], -"navbar_end": ["navbar-icon-links"], + "navbar_start": ["navbar-project"], + "navbar_center": ["navbar-nav"], + "navbar_end": ["navbar-icon-links"], } # Add any paths that contain custom themes here, relative to this directory. @@ -163,6 +163,7 @@ # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ["_static", "_images"] + # adapted from: http://rackerlabs.github.io/docs-rackspace/tools/rtd-tables.html # and # https://github.com/rtfd/sphinx_rtd_theme/issues/117 @@ -170,6 +171,7 @@ def setup(app): app.add_css_file("theme_overrides.css") app.add_css_file("custom.css") + # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. From 42f29058ebd3f5706920a2446e1cacf64c1d6933 Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Mon, 21 Mar 2022 21:08:15 -0700 Subject: [PATCH 14/25] Make gallery and mini-gallery paths relative so that images show up --- altair/sphinxext/altairgallery.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/altair/sphinxext/altairgallery.py b/altair/sphinxext/altairgallery.py index 72bb47068..e0bb5ac39 100644 --- a/altair/sphinxext/altairgallery.py +++ b/altair/sphinxext/altairgallery.py @@ -59,7 +59,7 @@ {% for example in group %} - + {{ example.title }} {% endfor %} @@ -87,7 +87,7 @@
{% for example in examples %} - + {% endfor %}
From c1d1b552a4499850b87debbc960ae6136332f2fc Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Tue, 22 Mar 2022 19:12:29 -0700 Subject: [PATCH 15/25] Compute current copyright year --- doc/conf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/conf.py b/doc/conf.py index 9caa858f6..ebb4ca716 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -14,6 +14,7 @@ import sys import os +from datetime import datetime # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -66,7 +67,7 @@ # General information about the project. project = "Altair" -copyright = "2016-2020, Altair Developers" +copyright = "2016-{}, Altair Developers".format(datetime.now().year) author = "Brian Granger and Jake VanderPlas" # The version info for the project you're documenting, acts as replacement for From 073526f38bc9e901c6792497d56fa9bb3aedf904 Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Thu, 24 Mar 2022 23:10:18 -0700 Subject: [PATCH 16/25] Use recommend way to install via pip Remove dollar sign for easy copy paste --- altair/sphinxext/altairgallery.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/altair/sphinxext/altairgallery.py b/altair/sphinxext/altairgallery.py index e0bb5ac39..7c8dea866 100644 --- a/altair/sphinxext/altairgallery.py +++ b/altair/sphinxext/altairgallery.py @@ -45,7 +45,7 @@ .. code-block:: none - $ pip install vega_datasets + python -m pip install vega_datasets {% for grouper, group in examples %} From 27f0789cbf9b3492c945f9c83c5b8c8807e562d4 Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Tue, 22 Mar 2022 20:29:05 -0700 Subject: [PATCH 17/25] Adjust title positioning for narrow screens/windows --- doc/_static/custom.css | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/doc/_static/custom.css b/doc/_static/custom.css index 94707e008..36fe8f625 100644 --- a/doc/_static/custom.css +++ b/doc/_static/custom.css @@ -40,7 +40,27 @@ table.docutils td li { font-size: 26px !important; font-weight: 800 !important; color: #fff !important; - margin-left: 180%; + text-align: center; + width: 100%; +} +/* There is a small jump in the title positionin when the navbar transitions full */ +/* title to the collapse button. 27% width here makes that jump as discrete as possible */ +div#navbar-start { + width: 27%; + margin-left: 0px !important; +} +/* Adjust the title position for narrow screens, such as mobile phones. */ +/* This also prevents that the collapse button stacks under the title, */ +/* which would cover a bit of the logo. 719px makes the title */ +/* switch to narrow screen layout at the same time as the rest of the page. */ +@media only screen and (max-width: 719px) { + div#navbar-start { + width: 60%; + margin-left: 0px !important; + } + .navbar-light p.title { + text-align: right; + } } /* Version number in the same darkblue color as other text */ From cb197d16f7a3a2c78f00172c75702f0fd25bb13a Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Thu, 24 Mar 2022 23:01:27 -0700 Subject: [PATCH 18/25] Remove use of deprecated functionality from the documentation --- doc/case_studies/exploring-weather.rst | 2 +- doc/user_guide/compound_charts.rst | 6 +- doc/user_guide/interactions.rst | 88 ++++++++++++-------------- doc/user_guide/transform/filter.rst | 4 +- doc/user_guide/transform/pivot.rst | 4 +- 5 files changed, 48 insertions(+), 56 deletions(-) diff --git a/doc/case_studies/exploring-weather.rst b/doc/case_studies/exploring-weather.rst index 69309a2f6..6146de4fb 100644 --- a/doc/case_studies/exploring-weather.rst +++ b/doc/case_studies/exploring-weather.rst @@ -237,7 +237,7 @@ of the selection (for more information on selections, see ).properties( width=600, height=400 - ).add_selection( + ).add_parameter( brush ) diff --git a/doc/user_guide/compound_charts.rst b/doc/user_guide/compound_charts.rst index ecf711990..d85f322ba 100644 --- a/doc/user_guide/compound_charts.rst +++ b/doc/user_guide/compound_charts.rst @@ -195,7 +195,7 @@ with a ``brush`` selection to add interaction: lower = base.properties( height=60 - ).add_selection(brush) + ).add_parameter(brush) alt.vconcat(upper, lower) @@ -362,7 +362,7 @@ layered chart with a hover selection: .. altair-plot:: - hover = alt.selection_single(on='mouseover', nearest=True, empty='none') + hover = alt.selection_point(on='mouseover', nearest=True, empty='none') base = alt.Chart(iris).encode( x='petalLength:Q', @@ -373,7 +373,7 @@ layered chart with a hover selection: height=180, ) - points = base.mark_point().add_selection( + points = base.mark_point().add_parameter( hover ) diff --git a/doc/user_guide/interactions.rst b/doc/user_guide/interactions.rst index 847362dfe..d6f4947d8 100644 --- a/doc/user_guide/interactions.rst +++ b/doc/user_guide/interactions.rst @@ -60,7 +60,7 @@ property: x='Miles_per_Gallon:Q', y='Horsepower:Q', color='Origin:N' - ).add_selection( + ).add_parameter( brush ) @@ -83,7 +83,7 @@ for points outside the selection: x='Miles_per_Gallon:Q', y='Horsepower:Q', color=alt.condition(brush, 'Origin:N', alt.value('lightgray')) - ).add_selection( + ).add_parameter( brush ) @@ -105,7 +105,7 @@ tied to ``"Miles_per_Gallon"`` ).properties( width=250, height=250 - ).add_selection( + ).add_parameter( brush ) @@ -131,14 +131,14 @@ We can modify the brush definition, and leave the rest of the code unchanged: ).properties( width=250, height=250 - ).add_selection( + ).add_parameter( brush ) chart.encode(x='Acceleration:Q') | chart.encode(x='Miles_per_Gallon:Q') -Selection Types: Interval, Single, Multi -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Selection Types: Interval and Point +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ With this interesting example under our belt, let's take a more systematic look at some of the types of selections available in Altair. @@ -161,7 +161,7 @@ selection: ).properties( width=300, height=180 - ).add_selection( + ).add_parameter( selector ) @@ -200,7 +200,7 @@ chart scales; this is how Altair plots can be made interactive: x='Horsepower:Q', y='Miles_per_Gallon:Q', color='Origin:N' - ).add_selection( + ).add_parameter( scales ) @@ -208,15 +208,15 @@ Because this is such a common pattern, Altair provides the :meth:`Chart.interact method which creates such a selection more concisely. -Single Selections -^^^^^^^^^^^^^^^^^ -A *single* selection allows you to select a single chart element at a time using -mouse actions. By default, points are selected on click: +Point Selections +^^^^^^^^^^^^^^^^ +A *point* selection allows you to select chart elements one at a time +via mouse actions. By default, points are selected on click: .. altair-plot:: - single = alt.selection_single() - make_example(single) + point = alt.selection_point() + make_example(point) By changing some arguments, we can select points on mouseover rather than on click. We can also set the ``nearest`` flag to ``True`` so that the nearest @@ -224,32 +224,24 @@ point is highlighted: .. altair-plot:: - single_nearest = alt.selection_single(on='mouseover', nearest=True) - make_example(single_nearest) + point_nearest = alt.selection_point(on='mouseover', nearest=True) + make_example(point_nearest) -Multiple Selections -^^^^^^^^^^^^^^^^^^^ -A *multi* selection is similar to a *single* selection, but it allows for -multiple chart objects to be selected at once. +Point selections also allow for multiple chart objects to be selected. By default, chart elements can be added to and removed from the selection by clicking on them while holding the *shift* key: -.. altair-plot:: - - multi = alt.selection_multi() - make_example(multi) - -In addition to the options seen in :func:`selection_single`, the multi selection -accepts the ``toggle`` parameter, which controls whether points can be removed -from the selection once they are added. - -For example, here is a plot where you can "paint" the chart objects by hovering -over them with your mouse: +The point selection accepts the ``toggle`` parameter, +which controls whether points can be removed from the selection +once they are added. +For example, +here is a plot where you can "paint" the chart objects +by hovering over them with your mouse: .. altair-plot:: - multi_mouseover = alt.selection_multi(on='mouseover', toggle=False, empty='none') - make_example(multi_mouseover) + point_mouseover = alt.selection_point(on='mouseover', toggle=False, empty='none') + make_example(point_mouseover) Composing Multiple Selections ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -283,7 +275,7 @@ selection. x='Cylinders:O', y='Origin:O', color=alt.condition(alex | morgan, 'count()', alt.ColorValue("grey")) - ).add_selection( + ).add_parameter( alex, morgan ).properties( width=300, @@ -313,7 +305,7 @@ with a matching ``Origin``. .. altair-plot:: - selection = alt.selection_multi(fields=['Origin']) + selection = alt.selection_point(fields=['Origin']) color = alt.condition(selection, alt.Color('Origin:N', legend=None), alt.value('lightgray')) @@ -328,7 +320,7 @@ with a matching ``Origin``. legend = alt.Chart(cars).mark_point().encode( y=alt.Y('Origin:N', axis=alt.Axis(orient='right')), color=color - ).add_selection( + ).add_parameter( selection ) @@ -346,7 +338,7 @@ cylinders: .. altair-plot:: - selection = alt.selection_multi(fields=['Origin', 'Cylinders']) + selection = alt.selection_point(fields=['Origin', 'Cylinders']) color = alt.condition(selection, alt.Color('Origin:N', legend=None), alt.value('lightgray')) @@ -362,7 +354,7 @@ cylinders: y=alt.Y('Origin:N', axis=alt.Axis(orient='right')), x='Cylinders:O', color=color - ).add_selection( + ).add_parameter( selection ) @@ -375,19 +367,19 @@ Binding: Adding Data Driven Inputs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ With an understanding of the selection types and conditions, you can now add data-driven input elements to the charts using the ``bind`` option. As specified by `Vega-lite binding `_, selections can be bound two-ways: -1. Single selections can be bound directly to an input element, *for example, a radio button.* +1. Point selections can be bound directly to an input element, *for example, a radio button.* 2. Interval selections which can be bound to scale, *for example, zooming in on a map.* Input Element Binding ^^^^^^^^^^^^^^^^^^^^^ -With single selections, an input element can be added to the chart to establish a binding between the input and the selection. +With point selections, an input element can be added to the chart to establish a binding between the input and the selection. For instance, using our example from above a dropdown can be used to highlight cars from a specific ``origin`` : .. altair-plot:: input_dropdown = alt.binding_select(options=['Europe','Japan','USA'], name='Country') - selection = alt.selection_single(fields=['Origin'], bind=input_dropdown) + selection = alt.selection_point(fields=['Origin'], bind=input_dropdown) color = alt.condition(selection, alt.Color('Origin:N', legend=None), alt.value('lightgray')) @@ -397,7 +389,7 @@ For instance, using our example from above a dropdown can be used to highlight c y='Miles_per_Gallon:Q', color=color, tooltip='Name:N' - ).add_selection( + ).add_parameter( selection ) @@ -424,14 +416,14 @@ Bindings and input elements can also be used to filter data on the client side. .. altair-plot:: input_dropdown = alt.binding_select(options=['Europe','Japan','USA'], name='Country') - selection = alt.selection_single(fields=['Origin'], bind=input_dropdown) + selection = alt.selection_point(fields=['Origin'], bind=input_dropdown) alt.Chart(cars).mark_point().encode( x='Horsepower:Q', y='Miles_per_Gallon:Q', color='Origin:N', tooltip='Name:N' - ).add_selection( + ).add_parameter( selection ).transform_filter( selection @@ -451,7 +443,7 @@ With interval selections, the ``bind`` property can be set to the value of ``"sc y='Miles_per_Gallon:Q', color='Origin:N', tooltip='Name:N' - ).add_selection( + ).add_parameter( selection ) @@ -476,8 +468,8 @@ points based on whether they are smaller or larger than the value: }) slider = alt.binding_range(min=0, max=100, step=1, name='cutoff:') - selector = alt.selection_single(name="SelectorName", fields=['cutoff'], - bind=slider, init={'cutoff': 50}) + selector = alt.selection_point(name="SelectorName", fields=['cutoff'], + bind=slider, value=[{'cutoff': 50}]) alt.Chart(df).mark_point().encode( x='xval', @@ -486,7 +478,7 @@ points based on whether they are smaller or larger than the value: alt.datum.xval < selector.cutoff, alt.value('red'), alt.value('blue') ) - ).add_selection( + ).add_parameter( selector ) diff --git a/doc/user_guide/transform/filter.rst b/doc/user_guide/transform/filter.rst index b4e2757f0..733d9a1dd 100644 --- a/doc/user_guide/transform/filter.rst +++ b/doc/user_guide/transform/filter.rst @@ -133,7 +133,7 @@ to select the data to be shown in the top chart: from vega_datasets import data pop = data.population.url - selection = alt.selection_multi(fields=['year']) + selection = alt.selection_point(fields=['year']) top = alt.Chart().mark_line().encode( x='age:O', @@ -151,7 +151,7 @@ to select the data to be shown in the top chart: color=alt.condition(selection, alt.value('steelblue'), alt.value('lightgray')) ).properties( width=600, height=100 - ).add_selection( + ).add_parameter( selection ) diff --git a/doc/user_guide/transform/pivot.rst b/doc/user_guide/transform/pivot.rst index c095b54c7..4b5ce297f 100644 --- a/doc/user_guide/transform/pivot.rst +++ b/doc/user_guide/transform/pivot.rst @@ -49,7 +49,7 @@ values on multiple lines: source = data.stocks() base = alt.Chart(source).encode(x='date:T') columns = sorted(source.symbol.unique()) - selection = alt.selection_single( + selection = alt.selection_point( fields=['date'], nearest=True, on='mouseover', empty='none', clear='mouseout' ) @@ -61,7 +61,7 @@ values on multiple lines: ).mark_rule().encode( opacity=alt.condition(selection, alt.value(0.3), alt.value(0)), tooltip=[alt.Tooltip(c, type='quantitative') for c in columns] - ).add_selection(selection) + ).add_parameter(selection) lines + points + rule From 73238f307506e55201ddbef5914144bdf4d907b1 Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Fri, 25 Mar 2022 01:32:15 -0700 Subject: [PATCH 19/25] Merge interactions 1 and 2 --- doc/user_guide/data.rst | 2 - doc/user_guide/interactions.rst | 237 ++++++++++++++++++++++++++++--- doc/user_guide/interactions2.rst | 219 ---------------------------- 3 files changed, 217 insertions(+), 241 deletions(-) delete mode 100644 doc/user_guide/interactions2.rst diff --git a/doc/user_guide/data.rst b/doc/user_guide/data.rst index 69b1fae5b..7cbcfca0b 100644 --- a/doc/user_guide/data.rst +++ b/doc/user_guide/data.rst @@ -444,8 +444,6 @@ data before usage in Altair using GeoPandas for example as such: marks transform/index interactions - interactions2 - configuration compound_charts scale_resolve times_and_dates diff --git a/doc/user_guide/interactions.rst b/doc/user_guide/interactions.rst index d6f4947d8..5d40a9266 100644 --- a/doc/user_guide/interactions.rst +++ b/doc/user_guide/interactions.rst @@ -2,33 +2,146 @@ .. _user-guide-interactions: -Interactive Charts: Bindings, Selections, Conditions +Interactive Charts: Parameters, Conditions, Bindings ==================================================== One of the unique features of Altair, inherited from Vega-Lite, is a -declarative grammar of not just visualization, but *interaction*. There are three -core concepts of this grammar: - -- the :func:`selection` object which captures interactions from the mouse or through other inputs to effect the chart. Inputs can either be events like mouse clicks or drags. Inputs can also be elements like a drop-down, radio button or slider. Selections can be used alone but if you want to change any element of your chart you will need to connect them to a *condition*. -- the :func:`condition` function takes the selection input and changes an element of the chart based on that input. -- the ``bind`` property of a selection which establishes a two-way binding between the selection and an input element of your chart. +declarative grammar of not just visualization, but *interaction*. +This is both convenient and powerful, +as we will see in this section. +There are three core concepts of this grammar: + +- Parameters are the basic building blocks in the grammar of interaction. + They can either be a simple variable or the more complex :func:`selection` + that map user input (e.g., mouse clicks and drags) to data queries. +- The :func:`condition` function takes the selection input + and changes an element of the chart based on that input. +- The ``bind`` property of selections establishes a two-way binding + between the selection and an input element of your chart, + such as a drop-down, radio button or slider. Interactive charts can use one or more of these elements to create rich interactivity between the viewer and the data. -Selections: Building Blocks of Interactions -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Parameters: Building Blocks of Interaction +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Interactivity in Altair is built around *parameters*, of which there are two types: variables and selections. We introduce these concepts through a series examples. + +.. note:: + + This material was changed considerably with the release of Altair 5. In particular, Altair 4 had selections but not variables, and the term ``parameter`` first appeared in Altair 5. + +.. _basic variable: + +Variables: Storing and Reusing Values +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Variables are the simplest forms of parameters can take. +Variable parameters allow for a value to be defined once +and then reused throughout the rest of the chart. +Here is a simple scatter-plot created from the ``cars`` dataset: + +.. altair-plot:: + + import altair as alt + from vega_datasets import data + + cars = data.cars.url + + alt.Chart(cars).mark_circle().encode( + x='Miles_per_Gallon:Q', + y='Horsepower:Q', + color='Origin:N' + ) + +We can create a variable parameter using :func:`parameter`, and assign that parameter a default value of 0.1 using the ``value`` property, as follows: + +.. altair-plot:: + :output: none + + op_var = alt.parameter(value=0.1) + +In order to use this variable in the chart specification, we explicitly add it to the chart using the :meth:`Chart.add_parameter` method, and we can then reference the variable within the chart specification. Here we set the opacity using our ``op_var`` parameter. + +.. altair-plot:: + + import altair as alt + from vega_datasets import data + + cars = data.cars.url + + op_var = alt.parameter(value=0.1) + + alt.Chart(cars).mark_circle(opacity=op_var).encode( + x='Miles_per_Gallon:Q', + y='Horsepower:Q', + color='Origin:N' + ).add_parameter( + op_var + ) + +It's reasonable to ask whether all this effort is necessary. Here is a more natural way to accomplish the same thing. We avoid the use of both :func:`alt.parameter` and ``add_parameter``. + +.. altair-plot:: + + import altair as alt + from vega_datasets import data + + cars = data.cars.url + + op_var2 = 0.1 + + alt.Chart(cars).mark_circle(opacity=op_var2).encode( + x='Miles_per_Gallon:Q', + y='Horsepower:Q', + color='Origin:N' + ) + +The benefit of using :func:`alt.parameter` doesn't become apparent until we incorporate an additional component, such as in the following, where we use the ``bind`` property of the parameter, so that the parameter becomes bound to an input element. In this example, that input element is a slider widget. + +.. altair-plot:: + + import altair as alt + from vega_datasets import data + + cars = data.cars.url + + slider = alt.binding_range(min=0, max=1, step=0.05, name='opacity:') + op_var = alt.parameter(value=0.1, bind=slider) + alt.Chart(cars).mark_circle(opacity=op_var).encode( + x='Miles_per_Gallon:Q', + y='Horsepower:Q', + color='Origin:N' + ).add_parameter( + op_var + ) -Selections in Altair come in a few flavors, and they can be *bound* to +Now we can dynamically change the opacity of the points in our chart using the slider. A noteworthy aspect of this chart is that these effects are controlled entirely within your web browser. Once the Vega-Lite chart specification has been created by Altair, the result is an interactive chart, and that interactivity no longer requires a running Python environment. + +The above example includes some aspects which occur frequently when creating interactive charts in Altair: + +1. Creating a variable parameter using :func:`parameter`. +2. Attaching the parameter to a chart using the :meth:`Chart.add_parameter` method. +3. Binding the parameter to an input widget (such as the slider above) using the parameter's ``bind`` property. + + +Selections: Capturing Inputs +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Selections parameters capture inputs such as mouse clicks and they can be *bound* to particular charts or sub-charts in your visualization, then referenced in other parts of the visualization. +There are two types of selections: +:func:`selection_interval` and :func:`selection_point`. -Example: Linked-Brush Scatter-Plot -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Here we will create a simple chart and then add an selection interval to it. +We could create a selection interval via ``alt.parameter(select="interval")``, +but it is more convenient to use the shorter ``alt.selection_interval`` +(and this also matches the syntax that was used in Altair 4). -As a motivation, let's create a simple chart and then add some selections -to it. Here is a simple scatter-plot created from the ``cars`` dataset: +Here is a simple scatter-plot created from the ``cars`` dataset: .. altair-plot:: @@ -67,10 +180,14 @@ property: The result above is a chart that allows you to click and drag to create a selection region, and to move this region once the region is created. -Conditions: Making the chart respond +So far this example is very similar to what we did in the :ref:`variable example `: +we created a selection parameter using ``brush = alt.selection_interval()``, +and we attached that parameter to the chart using ``add_parameter``. + +Conditions: Making the Chart Respond ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -This is neat, but the selection doesn't actually *do* anything yet. +The example above is neat, but the selection doesn't actually *do* anything yet. To use this selection, we need to reference it in some way within the chart. Here, we will use the :func:`condition` function to create a conditional color encoding: we'll tie the color to the ``"Origin"`` @@ -89,6 +206,15 @@ for points outside the selection: As you can see, with this simple change, the color of the points responds to the selection. +In the sample above, +we are using the selection parameter ``brush`` as a *predicate* +(something that evaluates as `True` or `False`). +This is controlled by the line ``color=alt.condition(brush, 'Origin:N', alt.value('lightgray'))``. +Data points which fall within the selection evaluate as ``True``, +and data points which fall outside the selection evaluate to ``False``. +The ``'Origin:N'`` specifies how to color the points which fall within the selection, +and the ``alt.value('lightgray')`` specifies that the outside points should be given a constant color value; +you can remember this as ``alt.condition(, , )``. This approach becomes even more powerful when the selection behavior is tied across multiple views of the data within a compound chart. @@ -140,8 +266,8 @@ We can modify the brush definition, and leave the rest of the code unchanged: Selection Types: Interval and Point ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -With this interesting example under our belt, let's take a more systematic -look at some of the types of selections available in Altair. +Now that we have seen the basics of how we can use a selection to interact with a chart, +let's take a more systematic look at some of the types of selection parameters available in Altair. For simplicity, we'll use a common chart in all the following examples; a simple heat-map based on the ``cars`` dataset. For convenience, let's write a quick Python function that will take a selection @@ -363,6 +489,48 @@ cylinders: By fine-tuning the behavior of selections in this way, they can be used to create a wide variety of linked interactive chart types. + +Filtering Data with Selections +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Using a selection parameter to filter data works in much the same way +as using it within ``alt.condition``, +For example, in ``transform_filter(brush)``, +we are again using the selection parameter ``brush`` as a predicate. +Data points which evaluate to ``True`` (i.e., data points which lie within the selection) are kept, +and data points which evaluate to ``False`` are filtered out. + +It is not possible to both select and filter in the same chart, +so typically this functionality will be used when at least two sub-charts are present. +In the following example, +we attach the selection parameter to the upper chart, +and then filter data in the lower chart based selection in the upper chart. +You can explore how the counts changes in the bar chart +depending on the size and position of the selection in the scatter plot. + +.. altair-plot:: + + brush = alt.selection_interval() + + points = alt.Chart(cars).mark_circle().encode( + x='Horsepower:Q', + y='Miles_per_Gallon:Q', + color='Origin:N' + ).add_parameter( + brush + ) + + bars = alt.Chart(cars).mark_bar().encode( + x='count()', + y='Origin:N', + color='Origin:N' + ).transform_filter( + brush + ) + + points & bars + + Binding: Adding Data Driven Inputs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ With an understanding of the selection types and conditions, you can now add data-driven input elements to the charts using the ``bind`` option. As specified by `Vega-lite binding `_, selections can be bound two-ways: @@ -378,7 +546,7 @@ For instance, using our example from above a dropdown can be used to highlight c .. altair-plot:: - input_dropdown = alt.binding_select(options=['Europe','Japan','USA'], name='Country') + input_dropdown = alt.binding_select(options=['Europe','Japan','USA'], name='Region ') selection = alt.selection_point(fields=['Origin'], bind=input_dropdown) color = alt.condition(selection, alt.Color('Origin:N', legend=None), @@ -415,7 +583,7 @@ Bindings and input elements can also be used to filter data on the client side. .. altair-plot:: - input_dropdown = alt.binding_select(options=['Europe','Japan','USA'], name='Country') + input_dropdown = alt.binding_select(options=['Europe','Japan','USA'], name='Region ') selection = alt.selection_point(fields=['Origin'], bind=input_dropdown) alt.Chart(cars).mark_point().encode( @@ -496,3 +664,32 @@ for ideas about how they can be applied to more interesting charts. For more information on how to fine-tune selections, including specifying other mouse and keystroke options, see the `Vega-Lite Selection documentation `_. + +Limitations +~~~~~~~~~~~ + +Some possible use cases for the above interactivity are not currently supported by Vega-Lite, and hence are not currently supported by Altair. Here are some examples. + +1. If we are using a ``selection_point``, it would be natural to want to return information about the chosen data point, and then process that information using Python. This is not currently possible (and as of December 2021 it does not seem likely to become possible any time soon), so any data processing will have to be handled using tools such as ``transform_calculate``, etc. You can follow the progress on this in the following issue: https://github.com/altair-viz/altair/issues/1153. +2. It is not possible to use an encoding such as ``y=column_variable`` to then dynamically display different charts based on different column choices. Similar functionality could be created using for example ``ipywidgets`` or ``panel``, but the resulting interactivity would be controlled by Python, and would not work for example as a stand-alone web page. The underlying reason this is not possible is that in Vega-Lite, the ``field`` property does not accept a parameter as value; see the `field Vega-Lite documentation `_. You can follow the discussion in this issue https://github.com/vega/vega-lite/issues/7365. In the meantime you can workaround this by transforming the data into long form using either `melt` in pandas or :meth:`transform_fold` in Altair. + +.. altair-plot:: + source = data.cars().melt(id_vars=['Origin', 'Name', 'Year', 'Horsepower']) + dropdown_options = source['variable'].drop_duplicates().tolist() + + dropdown = alt.binding_select(options=dropdown_options, name='X-axis column ') + selection = alt.selection_point( + fields=['variable'], + value=[{'variable': dropdown_options[0]}], + bind=dropdown + ) + + alt.Chart(source).mark_circle().encode( + x=alt.X('value:Q', title=''), + y='Horsepower', + color='Origin', + ).add_parameter( + selection + ).transform_filter( + selection + ) diff --git a/doc/user_guide/interactions2.rst b/doc/user_guide/interactions2.rst deleted file mode 100644 index c1e15b023..000000000 --- a/doc/user_guide/interactions2.rst +++ /dev/null @@ -1,219 +0,0 @@ -.. currentmodule:: altair - -.. _user-guide-interactions2: - -Parameters: Variables and Selections -==================================== - -Interactivity in Altair is built around *parameters*, of which there are two types: variables and selections. We introduce these concepts through a series examples. - -.. note:: - - This material was changed considerably with the release of Altair 5. In particular, Altair 4 had selections but not variables, and the term ``parameter`` first appeared in Altair 5. - -.. _basic variable: - -Basic Example: Using a variable -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Here is a simple scatter-plot created from the ``cars`` dataset: - -.. altair-plot:: - - import altair as alt - from vega_datasets import data - - cars = data.cars.url - - alt.Chart(cars).mark_circle().encode( - x='Miles_per_Gallon:Q', - y='Horsepower:Q', - color='Origin:N' - ) - -We can create a variable parameter using :func:`parameter`, and assign that parameter a default value of 0.1 using the ``value`` property, as follows: - -.. altair-plot:: - :output: none - - op_var = alt.parameter(value=0.1) - -In order to use this variable in the chart specification, we explicitly add it to the chart using the :meth:`Chart.add_parameter` method, and we can then reference the variable within the chart specification. Here we set the opacity using our ``op_var`` parameter. - -.. altair-plot:: - - import altair as alt - from vega_datasets import data - - cars = data.cars.url - - op_var = alt.parameter(value=0.1) - - alt.Chart(cars).mark_circle(opacity=op_var).encode( - x='Miles_per_Gallon:Q', - y='Horsepower:Q', - color='Origin:N' - ).add_parameter( - op_var - ) - -It's reasonable to ask whether all this effort is necessary. Here is a more natural way to accomplish the same thing. We avoid the use of both :func:`alt.parameter` and ``add_parameter``. - -.. altair-plot:: - - import altair as alt - from vega_datasets import data - - cars = data.cars.url - - op_var2 = 0.1 - - alt.Chart(cars).mark_circle(opacity=op_var2).encode( - x='Miles_per_Gallon:Q', - y='Horsepower:Q', - color='Origin:N' - ) - -The benefit of using :func:`alt.parameter` doesn't become apparent until we incorporate an additional component, such as in the following, where we use the ``bind`` property of the parameter, so that the parameter becomes bound to an input element. In this example, that input element is a slider widget. - -.. altair-plot:: - - import altair as alt - from vega_datasets import data - - cars = data.cars.url - - slider = alt.binding_range(min=0, max=1, step=0.05, name='opacity:') - op_var = alt.parameter(value=0.1, bind=slider) - - alt.Chart(cars).mark_circle(opacity=op_var).encode( - x='Miles_per_Gallon:Q', - y='Horsepower:Q', - color='Origin:N' - ).add_parameter( - op_var - ) - -Now we can dynamically change the opacity of the points in our chart using the slider. A noteworthy aspect of this chart is that these effects are controlled entirely within your web browser. Once the Vega-Lite chart specification has been created by Altair, the result is an interactive chart, and that interactivity no longer requires a running Python environment. - -The above example includes some aspects which occur frequently when creating interactive charts in Altair: - -- Creating a variable parameter using :func:`parameter`. -- Attaching the parameter to a chart using the :meth:`Chart.add_parameter` method. -- Binding the parameter to an input widget using the parameter's ``bind`` property. (In the above example, the input widget is a slider widget.) - -Some further aspects that we will see below include: - -- Creating a *selection* parameter. -- Using a parameter within a :func:`condition`. -- Using a parameter within a :meth:`Chart.transform_filter`. - -Using selection parameters -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The basic syntax for adding a selection parameter to a chart is similar to the syntax for a variable parameter. Instead of creating the parameter using ``alt.parameter``, we will typically use ``alt.selection_interval`` or ``alt.selection_point``. Here is a basic example, again using the ``cars`` dataset: - -.. altair-plot:: - - import altair as alt - from vega_datasets import data - - cars = data.cars.url - - brush = alt.selection_interval() - - alt.Chart(cars).mark_circle().encode( - x='Miles_per_Gallon:Q', - y='Horsepower:Q', - color='Origin:N' - ).add_parameter( - brush - ) - - -If you click and drag on the above chart, you will see that the corresponding region gets highlighted. - -So far this example is very similar to what we did in the :ref:`variable example `. Here we have done two things: we created a selection parameter using ``brush = alt.selection_interval()``, and we attached that parameter to the chart using ``add_parameter``. - -The line ``brush = alt.selection_interval()`` is equivalent to ``brush = alt.parameter(select="interval")``; we will typically use the ``selection_interval`` version, because it is shorter and because it matches the syntax that was used in Altair 4. - -Typically selection parameters will be used in conjunction with ``condition`` or with ``transform_filter``. Here are some possibilities. - -Using a selection within a condition -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -In the following example, we are using the selection parameter ``brush`` as a *predicate* (something that evaluates as `True` or `False`). This is controlled by the line ``color=alt.condition(brush, 'Origin:N', alt.value('lightgray'))``. Data points which fall within the selection evaluate as ``True``, and data points which fall outside the selection evaluate to ``False``. The ``'Origin:N'`` specifies how to color the points which fall within the selection, and the ``alt.value('lightgray')`` specifies that the outside points should be given a constant color value. - -.. altair-plot:: - - import altair as alt - from vega_datasets import data - - cars = data.cars.url - - brush = alt.selection_interval() - - alt.Chart(cars).mark_circle().encode( - x='Miles_per_Gallon:Q', - y='Horsepower:Q', - color=alt.condition(brush, 'Origin:N', alt.value('lightgray')) - ).add_parameter( - brush - ) - -Using a selection to filter the data -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Once you are comfortable with using a parameter within ``alt.condition``, using a parameter within ``transform_filter`` works in much the same way. For example, in ``transform_filter(brush)``, we are again using the selection parameter ``brush`` as a predicate. Data points which evaluate to ``True`` (i.e., data points which lie within the selection) are kept, and data points which evaluate to ``False`` are removed. - -It is not possible to both select and filter in the same chart, so typically this functionality will be used when at least two sub-charts are present. In the following example, we attach the selection parameter to the left chart, and then filter data using the selection parameter on the right chart. We specify explicit domains for the right chart so that the positions of the points remain steady. - -.. altair-plot:: - - import altair as alt - from vega_datasets import data - - cars = data.cars.url - - brush = alt.selection_interval() - - c1 = alt.Chart(cars).mark_point().encode( - x = "Horsepower:Q", - y = "Miles_per_Gallon:Q" - ).add_parameter(brush) - - c2 = alt.Chart(cars).mark_point().encode( - x = alt.X("Acceleration:Q", scale=alt.Scale(domain=[0,25])), - y = alt.Y("Displacement:Q", scale=alt.Scale(domain=[0,500])), - ).transform_filter(brush) - - alt.vconcat(c1,c2) - - -Limitations -^^^^^^^^^^^ - -Some possible use cases for the above interactivity are not currently supported by Vega-Lite, and hence are not currently supported by Altair. Here are some examples. - -1. If we are using a ``selection_point``, it would be natural to want to return information about the chosen data point, and then process that information using Python. This is not currently possible (and as of December 2021 it does not seem likely to become possible any time soon), so any data processing will have to be handled using tools such as ``transform_calculate``, etc. - -2. It is not possible to use an encoding such as ``y=column_variable`` to then dynamically display different charts based on different column choices. Similar functionality could be created using for example ``ipywidgets``, but the resulting interactivity would be controlled by Python, and would not work for example as a stand-alone web page. The underlying reason this is not possible is that in Vega-Lite, the ``field`` property does not accept a parameter as value; see the `field Vega-Lite documentation `_. A first approximation of a workaround is given in the following example. - -.. altair-plot:: - import pandas as pd - import altair as alt - - df = pd.DataFrame({'col0':range(4), 'col1':list('ABAA'), 'col2':list('CDDC')}) - df_long = df.melt(id_vars=['col0'], var_name='column') - - col_dropdown = alt.binding_select(options=df_long['column'].unique()) - col_param = alt.parameter(bind=col_dropdown, name="ColumnParam", value='col1') - - alt.Chart(df_long).mark_bar().encode( - x = "value:N", - y = "count()", - ).transform_filter( - "datum.column == ColumnParam" - ).add_parameter( - col_param - ) \ No newline at end of file From 2fe884fa3fe3a92435b1cead4a7e79bb9b1319b2 Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Fri, 25 Mar 2022 11:45:49 -0700 Subject: [PATCH 20/25] Contrast variable and selection parameters in expression strings --- doc/user_guide/interactions.rst | 41 +++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/doc/user_guide/interactions.rst b/doc/user_guide/interactions.rst index 5d40a9266..a9a94501d 100644 --- a/doc/user_guide/interactions.rst +++ b/doc/user_guide/interactions.rst @@ -614,10 +614,14 @@ With interval selections, the ``bind`` property can be set to the value of ``"sc ).add_parameter( selection ) - -Selection Values in Expressions + +Parameter Values in Expressions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Selection Parameters +^^^^^^^^^^^^^^^^^^^^ + Selection values can be accessed directly and used in expressions that affect the chart. For example, here we create a slider to choose a cutoff value, and color points based on whether they are smaller or larger than the value: @@ -635,15 +639,16 @@ points based on whether they are smaller or larger than the value: 'yval': rand.randn(100).cumsum() }) - slider = alt.binding_range(min=0, max=100, step=1, name='cutoff:') + slider = alt.binding_range(min=0, max=100, step=1, name='Cutoff ') selector = alt.selection_point(name="SelectorName", fields=['cutoff'], bind=slider, value=[{'cutoff': 50}]) - + alt.Chart(df).mark_point().encode( x='xval', y='yval', color=alt.condition( alt.datum.xval < selector.cutoff, + # 'datum.xval < SelectorName.cutoff', # An equivalent alternative alt.value('red'), alt.value('blue') ) ).add_parameter( @@ -654,6 +659,34 @@ Selector values can be similarly used anywhere that expressions are valid, for example, in a :ref:`user-guide-calculate-transform` or a :ref:`user-guide-filter-transform`. +Variable Parameters +^^^^^^^^^^^^^^^^^^^ + +While it is useful to know +how to access selection parameter values +in expression strings, +the variable parameters introduced in Altair 5 +often provides a more convenient syntax +for simple interactions like this one +since they can also be accessed in expression strings: + +.. altair-plot:: + + slider = alt.binding_range(min=0, max=100, step=1, name='Cutoff ') + selector = alt.parameter(name='SelectorName', value=50, bind=slider) + + alt.Chart(df).mark_point().encode( + x='xval', + y='yval', + color=alt.condition( + alt.datum.xval < selector, + # 'datum.xval < SelectorName', # An equivalent alternative + alt.value('red'), alt.value('blue') + ) + ).add_parameter( + selector + ) + Further Examples ~~~~~~~~~~~~~~~~ From 1e608042c97de8cd63ce7faa11d1b0026c21faa8 Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Fri, 15 Apr 2022 11:47:17 -0700 Subject: [PATCH 21/25] Note how to use custom Panel callbacks with Altair selections --- doc/user_guide/interactions.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/user_guide/interactions.rst b/doc/user_guide/interactions.rst index a9a94501d..c19231e64 100644 --- a/doc/user_guide/interactions.rst +++ b/doc/user_guide/interactions.rst @@ -704,6 +704,9 @@ Limitations Some possible use cases for the above interactivity are not currently supported by Vega-Lite, and hence are not currently supported by Altair. Here are some examples. 1. If we are using a ``selection_point``, it would be natural to want to return information about the chosen data point, and then process that information using Python. This is not currently possible (and as of December 2021 it does not seem likely to become possible any time soon), so any data processing will have to be handled using tools such as ``transform_calculate``, etc. You can follow the progress on this in the following issue: https://github.com/altair-viz/altair/issues/1153. + + - The dashboarding package ``Panel`` has added support for processing Altair selections with custom callbacks in their 0.13 release. This is currently the only Python dashboarding package that supports custom callbacks for Altair selections and you can read more about how to use this functionality in `the Panel documentation `_. + 2. It is not possible to use an encoding such as ``y=column_variable`` to then dynamically display different charts based on different column choices. Similar functionality could be created using for example ``ipywidgets`` or ``panel``, but the resulting interactivity would be controlled by Python, and would not work for example as a stand-alone web page. The underlying reason this is not possible is that in Vega-Lite, the ``field`` property does not accept a parameter as value; see the `field Vega-Lite documentation `_. You can follow the discussion in this issue https://github.com/vega/vega-lite/issues/7365. In the meantime you can workaround this by transforming the data into long form using either `melt` in pandas or :meth:`transform_fold` in Altair. .. altair-plot:: From a417d6def38df98c3e634eb7191555b941bc8340 Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Fri, 15 Apr 2022 11:53:35 -0700 Subject: [PATCH 22/25] Add more succinct example of selecting columns from dropdowns --- doc/user_guide/interactions.rst | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/doc/user_guide/interactions.rst b/doc/user_guide/interactions.rst index c19231e64..0a1f1c5fb 100644 --- a/doc/user_guide/interactions.rst +++ b/doc/user_guide/interactions.rst @@ -713,10 +713,14 @@ Some possible use cases for the above interactivity are not currently supported source = data.cars().melt(id_vars=['Origin', 'Name', 'Year', 'Horsepower']) dropdown_options = source['variable'].drop_duplicates().tolist() - dropdown = alt.binding_select(options=dropdown_options, name='X-axis column ') + dropdown = alt.binding_select( + options=dropdown_options, + name='X-axis column' + ) selection = alt.selection_point( fields=['variable'], value=[{'variable': dropdown_options[0]}], + # init={'variable': dropdown_options[0]}, # For Altair 4 bind=dropdown ) @@ -724,8 +728,31 @@ Some possible use cases for the above interactivity are not currently supported x=alt.X('value:Q', title=''), y='Horsepower', color='Origin', - ).add_parameter( + ).add_selection( selection ).transform_filter( selection ) + +Taking advantage of the parameter interface introduced in Altair 5, we can express this more succinctly: + +.. altair-plot:: + dropdown = alt.binding_select( + options=['Miles_per_Gallon', 'Acceleration', 'Displacement'], + name='X-axis column ' + ) + param = alt.parameter( + name='selected_column', + value='Miles_per_Gallon', + bind=dropdown + ) + + alt.Chart(data.cars.url).mark_circle().encode( + x='x:Q', + y='Horsepower:Q', + color='Origin:N' + ).transform_calculate( + x='datum[selected_column]' + ).add_parameter( + param + ) From c6eafbcf4991f3062db622dc601ecba3812c5f43 Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Fri, 15 Apr 2022 12:19:03 -0700 Subject: [PATCH 23/25] Make examples equivalent --- doc/user_guide/interactions.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/user_guide/interactions.rst b/doc/user_guide/interactions.rst index 0a1f1c5fb..3cfbee39c 100644 --- a/doc/user_guide/interactions.rst +++ b/doc/user_guide/interactions.rst @@ -710,7 +710,7 @@ Some possible use cases for the above interactivity are not currently supported 2. It is not possible to use an encoding such as ``y=column_variable`` to then dynamically display different charts based on different column choices. Similar functionality could be created using for example ``ipywidgets`` or ``panel``, but the resulting interactivity would be controlled by Python, and would not work for example as a stand-alone web page. The underlying reason this is not possible is that in Vega-Lite, the ``field`` property does not accept a parameter as value; see the `field Vega-Lite documentation `_. You can follow the discussion in this issue https://github.com/vega/vega-lite/issues/7365. In the meantime you can workaround this by transforming the data into long form using either `melt` in pandas or :meth:`transform_fold` in Altair. .. altair-plot:: - source = data.cars().melt(id_vars=['Origin', 'Name', 'Year', 'Horsepower']) + source = data.cars().melt(id_vars=['Origin', 'Name', 'Year', 'Horsepower', 'Cylinders']) dropdown_options = source['variable'].drop_duplicates().tolist() dropdown = alt.binding_select( @@ -738,7 +738,7 @@ Taking advantage of the parameter interface introduced in Altair 5, we can expre .. altair-plot:: dropdown = alt.binding_select( - options=['Miles_per_Gallon', 'Acceleration', 'Displacement'], + options=['Miles_per_Gallon', 'Displacement', 'Weight_in_lbs', 'Acceleration'], name='X-axis column ' ) param = alt.parameter( From 2e14a8732d5d89a67cc1c5ad81b949ab18d0af65 Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Tue, 19 Apr 2022 21:44:37 -0700 Subject: [PATCH 24/25] Add minimal jupyterlite setup --- doc/conf.py | 3 +++ doc/index.rst | 1 + doc/jupyterlite_config.json | 8 ++++++++ 3 files changed, 12 insertions(+) create mode 100644 doc/jupyterlite_config.json diff --git a/doc/conf.py b/doc/conf.py index ebb4ca716..653c080d9 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -39,9 +39,12 @@ "altair.sphinxext.altairplot", "altair.sphinxext.altairgallery", "altair.sphinxext.schematable", + 'jupyterlite_sphinx', # "sphinxext.rediraffe", ] +jupyterlite_config = "jupyterlite_config.json" + altair_plot_links = {"editor": True, "source": False, "export": False} autodoc_default_flags = ["members", "inherited-members"] diff --git a/doc/index.rst b/doc/index.rst index 800ef06ab..c1090be4e 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -38,6 +38,7 @@ it can be helpful to also browse the `Vega-Lite documentation + Try online .. _GitHub: http://github.com/altair-viz/altair .. _Git Issues: http://github.com/altair-viz/altair/issues diff --git a/doc/jupyterlite_config.json b/doc/jupyterlite_config.json new file mode 100644 index 000000000..13f1bc4b9 --- /dev/null +++ b/doc/jupyterlite_config.json @@ -0,0 +1,8 @@ +{ + "LiteBuildConfig": { + "ignore_sys_prefix": true, + "piplite_urls": [ + "https://files.pythonhosted.org/packages/py3/a/altair/altair-4.2.0-py3-none-any.whl" + ] + } +} From 9c792ad4adf77c560c0267526192eeb212354e5a Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Tue, 19 Apr 2022 21:45:46 -0700 Subject: [PATCH 25/25] Add extension gallery notebooks to jupyterlite --- doc/jupyterlite/.jupyterlite.doit.db | Bin 0 -> 122880 bytes doc/jupyterlite/Makefile | 7 + doc/jupyterlite/_output/api/contents/all.json | 1921 +++++++++++++++++ .../_output/api/translations/all.json | 9 + .../_output/api/translations/en.json | 4 + doc/jupyterlite/_output/bootstrap.js | 92 + doc/jupyterlite/_output/config-utils.js | 267 +++ .../_output/doc/workspaces/index.html | 14 + .../jupyterlab_pygments/install.json | 5 + .../jupyterlab_pygments/package.json | 104 + .../static/568.1e2faa2ba0bbe59c4780.js | 1 + .../static/747.8eb3ddccc7ec4987bff9.js | 1 + .../remoteEntry.aa1060b2d1221f8e5688.js | 1 + .../jupyterlab_pygments/static/style.js | 4 + .../static/third-party-licenses.json | 16 + .../_output/files/airport_connections.ipynb | 109 + doc/jupyterlite/_output/files/airports.ipynb | 72 + .../_output/files/airports_count.ipynb | 78 + .../_output/files/anscombe_plot.ipynb | 59 + .../_output/files/area_chart_gradient.ipynb | 69 + .../files/bar_and_line_with_dual_axis.ipynb | 61 + .../_output/files/bar_chart_horizontal.ipynb | 54 + .../_output/files/bar_chart_sorted.ipynb | 54 + .../files/bar_chart_trellis_compact.ipynb | 89 + .../bar_chart_with_highlighted_bar.ipynb | 60 + .../bar_chart_with_highlighted_segment.ipynb | 69 + .../_output/files/bar_chart_with_labels.ipynb | 64 + .../files/bar_chart_with_mean_line.ipynb | 60 + .../files/bar_chart_with_negatives.ipynb | 59 + .../_output/files/bar_rounded.ipynb | 58 + .../_output/files/bar_with_rolling_mean.ipynb | 66 + .../files/beckers_barley_trellis_plot.ipynb | 72 + .../files/beckers_barley_wrapped_facet.ipynb | 61 + .../_output/files/binned_heatmap.ipynb | 55 + .../_output/files/binned_scatterplot.ipynb | 55 + doc/jupyterlite/_output/files/boxplot.ipynb | 57 + .../_output/files/bubble_plot.ipynb | 55 + .../_output/files/bump_chart.ipynb | 68 + .../_output/files/candlestick_chart.ipynb | 83 + .../_output/files/choropleth.ipynb | 62 + .../_output/files/choropleth_repeat.ipynb | 67 + .../_output/files/co2_concentration.ipynb | 104 + .../_output/files/comet_chart.ipynb | 71 + .../_output/files/connected_scatterplot.ipynb | 57 + .../files/cumulative_count_chart.ipynb | 60 + .../files/cumulative_wiki_donations.ipynb | 56 + .../_output/files/density_facet.ipynb | 67 + .../_output/files/density_stack.ipynb | 74 + .../files/diverging_stacked_bar_chart.ipynb | 406 ++++ .../_output/files/donut_chart.ipynb | 57 + .../_output/files/dot_dash_plot.ipynb | 79 + .../_output/files/errorbars_with_ci.ipynb | 63 + .../_output/files/errorbars_with_std.ipynb | 62 + doc/jupyterlite/_output/files/falkensee.ipynb | 121 ++ .../_output/files/filled_step_chart.ipynb | 58 + .../_output/files/gantt_chart.ipynb | 59 + .../_output/files/gapminder_bubble_plot.ipynb | 57 + .../_output/files/grouped_bar_chart.ipynb | 56 + .../_output/files/grouped_bar_chart2.ipynb | 59 + .../files/grouped_bar_chart_horizontal.ipynb | 56 + .../grouped_bar_chart_with_error_bars.ipynb | 64 + doc/jupyterlite/_output/files/hexbins.ipynb | 82 + .../_output/files/histogram_responsive.ipynb | 74 + ...histogram_with_a_global_mean_overlay.ipynb | 63 + .../_output/files/horizon_graph.ipynb | 80 + .../files/horizontal_stacked_bar_chart.ipynb | 55 + .../_output/files/image_tooltip.ipynb | 60 + .../_output/files/interactive_brush.ipynb | 58 + .../files/interactive_cross_highlight.ipynb | 88 + .../interactive_layered_crossfilter.ipynb | 84 + .../_output/files/interactive_legend.ipynb | 63 + .../files/interactive_scatter_plot.ipynb | 55 + .../_output/files/interval_selection.ipynb | 71 + .../_output/files/iowa_electricity.ipynb | 66 + doc/jupyterlite/_output/files/isotype.ipynb | 117 + .../_output/files/isotype_emoji.ipynb | 102 + .../_output/files/isotype_grid.ipynb | 77 + .../_output/files/jitter_chart.ipynb | 60 + .../_output/files/layer_line_color_rule.ipynb | 67 + .../_output/files/layered_area_chart.ipynb | 55 + .../_output/files/layered_bar_chart.ipynb | 55 + .../files/layered_chart_bar_mark.ipynb | 71 + .../files/layered_chart_with_dual_axis.ipynb | 69 + .../_output/files/layered_heatmap_text.ipynb | 80 + .../_output/files/layered_histogram.ipynb | 68 + .../files/line_chart_with_color_datum.ipynb | 60 + .../files/line_chart_with_cumsum.ipynb | 63 + .../_output/files/line_chart_with_datum.ipynb | 71 + .../files/line_chart_with_generator.ipynb | 60 + .../files/line_chart_with_points.ipynb | 63 + .../_output/files/line_percent.ipynb | 57 + .../_output/files/line_with_ci.ipynb | 61 + .../_output/files/line_with_log_scale.ipynb | 57 + .../_output/files/london_tube.ipynb | 98 + .../_output/files/multi_series_line.ipynb | 57 + .../files/multifeature_scatter_plot.ipynb | 56 + .../_output/files/multiline_highlight.ipynb | 75 + .../_output/files/multiline_tooltip.ipynb | 106 + .../_output/files/multiple_interactions.ipynb | 129 ++ .../_output/files/multiple_marks.ipynb | 56 + .../_output/files/natural_disasters.ipynb | 68 + .../files/normalized_stacked_area_chart.ipynb | 55 + .../files/normalized_stacked_bar_chart.ipynb | 55 + .../files/normed_parallel_coordinates.ipynb | 80 + .../_output/files/one_dot_per_zipcode.ipynb | 64 + .../_output/files/pacman_chart.ipynb | 56 + .../_output/files/parallel_coordinates.ipynb | 67 + .../_output/files/percentage_of_total.ipynb | 60 + doc/jupyterlite/_output/files/pie_chart.ipynb | 57 + .../_output/files/pie_chart_with_labels.ipynb | 63 + .../_output/files/poly_fit_regression.ipynb | 75 + doc/jupyterlite/_output/files/pyramid.ipynb | 58 + .../_output/files/radial_chart.ipynb | 64 + .../_output/files/ranged_dot_plot.ipynb | 82 + .../_output/files/ridgeline_plot.ipynb | 102 + .../_output/files/scatter_href.ipynb | 62 + .../_output/files/scatter_linked_brush.ipynb | 64 + .../_output/files/scatter_linked_table.ipynb | 88 + .../_output/files/scatter_marginal_hist.ipynb | 89 + .../_output/files/scatter_matrix.ipynb | 62 + .../_output/files/scatter_qq.ipynb | 63 + .../_output/files/scatter_tooltips.ipynb | 59 + .../files/scatter_with_histogram.ipynb | 99 + .../_output/files/scatter_with_labels.ipynb | 68 + .../scatter_with_layered_histogram.ipynb | 99 + .../_output/files/scatter_with_loess.ipynb | 70 + .../_output/files/scatter_with_minimap.ipynb | 88 + .../files/scatter_with_rolling_mean.ipynb | 70 + .../files/seattle_weather_interactive.ipynb | 99 + .../_output/files/select_detail.ipynb | 104 + .../_output/files/select_mark_area.ipynb | 69 + .../_output/files/selection_histogram.ipynb | 71 + .../files/selection_layer_bar_month.ipynb | 69 + .../_output/files/simple_bar_chart.ipynb | 57 + .../_output/files/simple_heatmap.ipynb | 63 + .../_output/files/simple_histogram.ipynb | 55 + .../_output/files/simple_line_chart.ipynb | 61 + .../files/simple_scatter_with_errorbars.ipynb | 82 + .../files/simple_stacked_area_chart.ipynb | 55 + .../_output/files/slider_cutoff.ipynb | 69 + .../_output/files/slope_graph.ipynb | 55 + .../files/sorted_error_bars_with_ci.ipynb | 75 + .../_output/files/stacked_bar_chart.ipynb | 56 + .../stacked_bar_chart_sorted_segments.ipynb | 60 + .../files/stacked_bar_chart_with_text.ipynb | 66 + .../_output/files/stem_and_leaf.ipynb | 78 + .../_output/files/step_chart.ipynb | 61 + .../_output/files/streamgraph.ipynb | 59 + .../_output/files/strip_plot.ipynb | 54 + doc/jupyterlite/_output/files/stripplot.ipynb | 79 + .../files/table_bubble_plot_github.ipynb | 55 + .../_output/files/top_k_items.ipynb | 66 + .../_output/files/top_k_letters.ipynb | 79 + .../_output/files/top_k_with_others.ipynb | 70 + .../_output/files/trail_marker.ipynb | 55 + .../_output/files/trellis_area.ipynb | 58 + .../files/trellis_area_sort_array.ipynb | 60 + .../_output/files/trellis_histogram.ipynb | 56 + .../_output/files/trellis_scatter_plot.ipynb | 55 + .../files/trellis_stacked_bar_chart.ipynb | 56 + .../_output/files/us_employment.ipynb | 97 + .../us_incomebrackets_by_state_facet.ipynb | 68 + .../files/us_population_over_time.ipynb | 75 + .../files/us_population_over_time_facet.ipynb | 64 + .../us_population_pyramid_over_time.ipynb | 94 + .../_output/files/us_state_capitals.ipynb | 82 + .../_output/files/violin_plot.ipynb | 78 + .../_output/files/weather_heatmap.ipynb | 63 + .../_output/files/wheat_wages.ipynb | 97 + .../_output/files/wilkinson-dot-plot.ipynb | 66 + .../_output/files/wind_vector_map.ipynb | 63 + .../_output/files/window_rank.ipynb | 81 + doc/jupyterlite/_output/files/world_map.ipynb | 66 + .../_output/files/world_projections.ipynb | 65 + doc/jupyterlite/_output/index.html | 68 + doc/jupyterlite/_output/jupyter-lite.ipynb | 55 + doc/jupyterlite/_output/jupyter-lite.json | 24 + .../_output/jupyterlite.schema.v0.json | 324 +++ .../_output/kernelspecs/javascript.svg | 67 + .../_output/kernelspecs/python.png | Bin 0 -> 2180 bytes doc/jupyterlite/_output/lab/favicon.ico | Bin 0 -> 324251 bytes doc/jupyterlite/_output/lab/index.html | 34 + .../_output/lab/jupyter-lite.ipynb | 55 + doc/jupyterlite/_output/lab/jupyter-lite.json | 7 + doc/jupyterlite/_output/lab/package.json | 260 +++ doc/jupyterlite/_output/lab/tree/index.html | 14 + .../_output/lab/workspaces/index.html | 14 + doc/jupyterlite/_output/package.json | 48 + .../_output/piplite.schema.v0.json | 113 + doc/jupyterlite/_output/repl/index.html | 34 + .../_output/repl/jupyter-lite.ipynb | 55 + .../_output/repl/jupyter-lite.json | 7 + doc/jupyterlite/_output/repl/package.json | 210 ++ .../_output/retro/consoles/favicon.ico | Bin 0 -> 1150 bytes .../_output/retro/consoles/index.html | 35 + .../_output/retro/consoles/jupyter-lite.ipynb | 55 + .../_output/retro/consoles/jupyter-lite.json | 8 + .../_output/retro/edit/favicon.ico | Bin 0 -> 1150 bytes doc/jupyterlite/_output/retro/edit/index.html | 35 + .../_output/retro/edit/jupyter-lite.ipynb | 55 + .../_output/retro/edit/jupyter-lite.json | 8 + doc/jupyterlite/_output/retro/favicon.ico | Bin 0 -> 32038 bytes doc/jupyterlite/_output/retro/index.html | 20 + .../_output/retro/jupyter-lite.ipynb | 55 + .../_output/retro/jupyter-lite.json | 8 + .../_output/retro/notebooks/favicon.ico | Bin 0 -> 1150 bytes .../_output/retro/notebooks/index.html | 36 + .../retro/notebooks/jupyter-lite.ipynb | 55 + .../_output/retro/notebooks/jupyter-lite.json | 8 + doc/jupyterlite/_output/retro/package.json | 230 ++ doc/jupyterlite/_output/retro/tree/index.html | 35 + .../_output/retro/tree/jupyter-lite.ipynb | 55 + .../_output/retro/tree/jupyter-lite.json | 7 + doc/jupyterlite/_output/tree/index.html | 14 + doc/jupyterlite/file_prefix | 8 + .../files/airport_connections.ipynb | 109 + doc/jupyterlite/files/airports.ipynb | 72 + doc/jupyterlite/files/airports_count.ipynb | 78 + doc/jupyterlite/files/anscombe_plot.ipynb | 59 + .../files/area_chart_gradient.ipynb | 69 + .../files/bar_and_line_with_dual_axis.ipynb | 61 + .../files/bar_chart_horizontal.ipynb | 54 + doc/jupyterlite/files/bar_chart_sorted.ipynb | 54 + .../files/bar_chart_trellis_compact.ipynb | 89 + .../bar_chart_with_highlighted_bar.ipynb | 60 + .../bar_chart_with_highlighted_segment.ipynb | 69 + .../files/bar_chart_with_labels.ipynb | 64 + .../files/bar_chart_with_mean_line.ipynb | 60 + .../files/bar_chart_with_negatives.ipynb | 59 + doc/jupyterlite/files/bar_rounded.ipynb | 58 + .../files/bar_with_rolling_mean.ipynb | 66 + .../files/beckers_barley_trellis_plot.ipynb | 72 + .../files/beckers_barley_wrapped_facet.ipynb | 61 + doc/jupyterlite/files/binned_heatmap.ipynb | 55 + .../files/binned_scatterplot.ipynb | 55 + doc/jupyterlite/files/boxplot.ipynb | 57 + doc/jupyterlite/files/bubble_plot.ipynb | 55 + doc/jupyterlite/files/bump_chart.ipynb | 68 + doc/jupyterlite/files/candlestick_chart.ipynb | 83 + doc/jupyterlite/files/choropleth.ipynb | 62 + doc/jupyterlite/files/choropleth_repeat.ipynb | 67 + doc/jupyterlite/files/co2_concentration.ipynb | 104 + doc/jupyterlite/files/comet_chart.ipynb | 71 + .../files/connected_scatterplot.ipynb | 57 + .../files/cumulative_count_chart.ipynb | 60 + .../files/cumulative_wiki_donations.ipynb | 56 + doc/jupyterlite/files/density_facet.ipynb | 67 + doc/jupyterlite/files/density_stack.ipynb | 74 + .../files/diverging_stacked_bar_chart.ipynb | 406 ++++ doc/jupyterlite/files/donut_chart.ipynb | 57 + doc/jupyterlite/files/dot_dash_plot.ipynb | 79 + doc/jupyterlite/files/errorbars_with_ci.ipynb | 63 + .../files/errorbars_with_std.ipynb | 62 + doc/jupyterlite/files/falkensee.ipynb | 121 ++ doc/jupyterlite/files/filled_step_chart.ipynb | 58 + doc/jupyterlite/files/gantt_chart.ipynb | 59 + .../files/gapminder_bubble_plot.ipynb | 57 + doc/jupyterlite/files/grouped_bar_chart.ipynb | 56 + .../files/grouped_bar_chart2.ipynb | 59 + .../files/grouped_bar_chart_horizontal.ipynb | 56 + .../grouped_bar_chart_with_error_bars.ipynb | 64 + doc/jupyterlite/files/hexbins.ipynb | 82 + .../files/histogram_responsive.ipynb | 74 + ...histogram_with_a_global_mean_overlay.ipynb | 63 + doc/jupyterlite/files/horizon_graph.ipynb | 80 + .../files/horizontal_stacked_bar_chart.ipynb | 55 + doc/jupyterlite/files/image_tooltip.ipynb | 60 + doc/jupyterlite/files/interactive_brush.ipynb | 58 + .../files/interactive_cross_highlight.ipynb | 88 + .../interactive_layered_crossfilter.ipynb | 84 + .../files/interactive_legend.ipynb | 63 + .../files/interactive_scatter_plot.ipynb | 55 + .../files/interval_selection.ipynb | 71 + doc/jupyterlite/files/iowa_electricity.ipynb | 66 + doc/jupyterlite/files/isotype.ipynb | 117 + doc/jupyterlite/files/isotype_emoji.ipynb | 102 + doc/jupyterlite/files/isotype_grid.ipynb | 77 + doc/jupyterlite/files/jitter_chart.ipynb | 60 + .../files/layer_line_color_rule.ipynb | 67 + .../files/layered_area_chart.ipynb | 55 + doc/jupyterlite/files/layered_bar_chart.ipynb | 55 + .../files/layered_chart_bar_mark.ipynb | 71 + .../files/layered_chart_with_dual_axis.ipynb | 69 + .../files/layered_heatmap_text.ipynb | 80 + doc/jupyterlite/files/layered_histogram.ipynb | 68 + .../files/line_chart_with_color_datum.ipynb | 60 + .../files/line_chart_with_cumsum.ipynb | 63 + .../files/line_chart_with_datum.ipynb | 71 + .../files/line_chart_with_generator.ipynb | 60 + .../files/line_chart_with_points.ipynb | 63 + doc/jupyterlite/files/line_percent.ipynb | 57 + doc/jupyterlite/files/line_with_ci.ipynb | 61 + .../files/line_with_log_scale.ipynb | 57 + doc/jupyterlite/files/london_tube.ipynb | 98 + doc/jupyterlite/files/multi_series_line.ipynb | 57 + .../files/multifeature_scatter_plot.ipynb | 56 + .../files/multiline_highlight.ipynb | 75 + doc/jupyterlite/files/multiline_tooltip.ipynb | 106 + .../files/multiple_interactions.ipynb | 129 ++ doc/jupyterlite/files/multiple_marks.ipynb | 56 + doc/jupyterlite/files/natural_disasters.ipynb | 68 + .../files/normalized_stacked_area_chart.ipynb | 55 + .../files/normalized_stacked_bar_chart.ipynb | 55 + .../files/normed_parallel_coordinates.ipynb | 80 + .../files/one_dot_per_zipcode.ipynb | 64 + doc/jupyterlite/files/pacman_chart.ipynb | 56 + .../files/parallel_coordinates.ipynb | 67 + .../files/percentage_of_total.ipynb | 60 + doc/jupyterlite/files/pie_chart.ipynb | 57 + .../files/pie_chart_with_labels.ipynb | 63 + .../files/poly_fit_regression.ipynb | 75 + doc/jupyterlite/files/pyramid.ipynb | 58 + doc/jupyterlite/files/radial_chart.ipynb | 64 + doc/jupyterlite/files/ranged_dot_plot.ipynb | 82 + doc/jupyterlite/files/ridgeline_plot.ipynb | 102 + doc/jupyterlite/files/scatter_href.ipynb | 62 + .../files/scatter_linked_brush.ipynb | 64 + .../files/scatter_linked_table.ipynb | 88 + .../files/scatter_marginal_hist.ipynb | 89 + doc/jupyterlite/files/scatter_matrix.ipynb | 62 + doc/jupyterlite/files/scatter_qq.ipynb | 63 + doc/jupyterlite/files/scatter_tooltips.ipynb | 59 + .../files/scatter_with_histogram.ipynb | 99 + .../files/scatter_with_labels.ipynb | 68 + .../scatter_with_layered_histogram.ipynb | 99 + .../files/scatter_with_loess.ipynb | 70 + .../files/scatter_with_minimap.ipynb | 88 + .../files/scatter_with_rolling_mean.ipynb | 70 + .../files/seattle_weather_interactive.ipynb | 99 + doc/jupyterlite/files/select_detail.ipynb | 104 + doc/jupyterlite/files/select_mark_area.ipynb | 69 + .../files/selection_histogram.ipynb | 71 + .../files/selection_layer_bar_month.ipynb | 69 + doc/jupyterlite/files/simple_bar_chart.ipynb | 57 + doc/jupyterlite/files/simple_heatmap.ipynb | 63 + doc/jupyterlite/files/simple_histogram.ipynb | 55 + doc/jupyterlite/files/simple_line_chart.ipynb | 61 + .../files/simple_scatter_with_errorbars.ipynb | 82 + .../files/simple_stacked_area_chart.ipynb | 55 + doc/jupyterlite/files/slider_cutoff.ipynb | 69 + doc/jupyterlite/files/slope_graph.ipynb | 55 + .../files/sorted_error_bars_with_ci.ipynb | 75 + doc/jupyterlite/files/stacked_bar_chart.ipynb | 56 + .../stacked_bar_chart_sorted_segments.ipynb | 60 + .../files/stacked_bar_chart_with_text.ipynb | 66 + doc/jupyterlite/files/stem_and_leaf.ipynb | 78 + doc/jupyterlite/files/step_chart.ipynb | 61 + doc/jupyterlite/files/streamgraph.ipynb | 59 + doc/jupyterlite/files/strip_plot.ipynb | 54 + doc/jupyterlite/files/stripplot.ipynb | 79 + .../files/table_bubble_plot_github.ipynb | 55 + doc/jupyterlite/files/top_k_items.ipynb | 66 + doc/jupyterlite/files/top_k_letters.ipynb | 79 + doc/jupyterlite/files/top_k_with_others.ipynb | 70 + doc/jupyterlite/files/trail_marker.ipynb | 55 + doc/jupyterlite/files/trellis_area.ipynb | 58 + .../files/trellis_area_sort_array.ipynb | 60 + doc/jupyterlite/files/trellis_histogram.ipynb | 56 + .../files/trellis_scatter_plot.ipynb | 55 + .../files/trellis_stacked_bar_chart.ipynb | 56 + doc/jupyterlite/files/us_employment.ipynb | 97 + .../us_incomebrackets_by_state_facet.ipynb | 68 + .../files/us_population_over_time.ipynb | 75 + .../files/us_population_over_time_facet.ipynb | 64 + .../us_population_pyramid_over_time.ipynb | 94 + doc/jupyterlite/files/us_state_capitals.ipynb | 82 + doc/jupyterlite/files/violin_plot.ipynb | 78 + doc/jupyterlite/files/weather_heatmap.ipynb | 63 + doc/jupyterlite/files/wellcome.ipynb | 111 + doc/jupyterlite/files/wheat_wages.ipynb | 97 + .../files/wilkinson-dot-plot.ipynb | 66 + doc/jupyterlite/files/wind_vector_map.ipynb | 63 + doc/jupyterlite/files/window_rank.ipynb | 81 + doc/jupyterlite/files/world_map.ipynb | 66 + doc/jupyterlite/files/world_projections.ipynb | 65 + doc/jupyterlite/wellcome.ipynb | 111 + 376 files changed, 27472 insertions(+) create mode 100644 doc/jupyterlite/.jupyterlite.doit.db create mode 100644 doc/jupyterlite/Makefile create mode 100644 doc/jupyterlite/_output/api/contents/all.json create mode 100644 doc/jupyterlite/_output/api/translations/all.json create mode 100644 doc/jupyterlite/_output/api/translations/en.json create mode 100644 doc/jupyterlite/_output/bootstrap.js create mode 100644 doc/jupyterlite/_output/config-utils.js create mode 100644 doc/jupyterlite/_output/doc/workspaces/index.html create mode 100644 doc/jupyterlite/_output/extensions/jupyterlab_pygments/install.json create mode 100644 doc/jupyterlite/_output/extensions/jupyterlab_pygments/package.json create mode 100644 doc/jupyterlite/_output/extensions/jupyterlab_pygments/static/568.1e2faa2ba0bbe59c4780.js create mode 100644 doc/jupyterlite/_output/extensions/jupyterlab_pygments/static/747.8eb3ddccc7ec4987bff9.js create mode 100644 doc/jupyterlite/_output/extensions/jupyterlab_pygments/static/remoteEntry.aa1060b2d1221f8e5688.js create mode 100644 doc/jupyterlite/_output/extensions/jupyterlab_pygments/static/style.js create mode 100644 doc/jupyterlite/_output/extensions/jupyterlab_pygments/static/third-party-licenses.json create mode 100644 doc/jupyterlite/_output/files/airport_connections.ipynb create mode 100644 doc/jupyterlite/_output/files/airports.ipynb create mode 100644 doc/jupyterlite/_output/files/airports_count.ipynb create mode 100644 doc/jupyterlite/_output/files/anscombe_plot.ipynb create mode 100644 doc/jupyterlite/_output/files/area_chart_gradient.ipynb create mode 100644 doc/jupyterlite/_output/files/bar_and_line_with_dual_axis.ipynb create mode 100644 doc/jupyterlite/_output/files/bar_chart_horizontal.ipynb create mode 100644 doc/jupyterlite/_output/files/bar_chart_sorted.ipynb create mode 100644 doc/jupyterlite/_output/files/bar_chart_trellis_compact.ipynb create mode 100644 doc/jupyterlite/_output/files/bar_chart_with_highlighted_bar.ipynb create mode 100644 doc/jupyterlite/_output/files/bar_chart_with_highlighted_segment.ipynb create mode 100644 doc/jupyterlite/_output/files/bar_chart_with_labels.ipynb create mode 100644 doc/jupyterlite/_output/files/bar_chart_with_mean_line.ipynb create mode 100644 doc/jupyterlite/_output/files/bar_chart_with_negatives.ipynb create mode 100644 doc/jupyterlite/_output/files/bar_rounded.ipynb create mode 100644 doc/jupyterlite/_output/files/bar_with_rolling_mean.ipynb create mode 100644 doc/jupyterlite/_output/files/beckers_barley_trellis_plot.ipynb create mode 100644 doc/jupyterlite/_output/files/beckers_barley_wrapped_facet.ipynb create mode 100644 doc/jupyterlite/_output/files/binned_heatmap.ipynb create mode 100644 doc/jupyterlite/_output/files/binned_scatterplot.ipynb create mode 100644 doc/jupyterlite/_output/files/boxplot.ipynb create mode 100644 doc/jupyterlite/_output/files/bubble_plot.ipynb create mode 100644 doc/jupyterlite/_output/files/bump_chart.ipynb create mode 100644 doc/jupyterlite/_output/files/candlestick_chart.ipynb create mode 100644 doc/jupyterlite/_output/files/choropleth.ipynb create mode 100644 doc/jupyterlite/_output/files/choropleth_repeat.ipynb create mode 100644 doc/jupyterlite/_output/files/co2_concentration.ipynb create mode 100644 doc/jupyterlite/_output/files/comet_chart.ipynb create mode 100644 doc/jupyterlite/_output/files/connected_scatterplot.ipynb create mode 100644 doc/jupyterlite/_output/files/cumulative_count_chart.ipynb create mode 100644 doc/jupyterlite/_output/files/cumulative_wiki_donations.ipynb create mode 100644 doc/jupyterlite/_output/files/density_facet.ipynb create mode 100644 doc/jupyterlite/_output/files/density_stack.ipynb create mode 100644 doc/jupyterlite/_output/files/diverging_stacked_bar_chart.ipynb create mode 100644 doc/jupyterlite/_output/files/donut_chart.ipynb create mode 100644 doc/jupyterlite/_output/files/dot_dash_plot.ipynb create mode 100644 doc/jupyterlite/_output/files/errorbars_with_ci.ipynb create mode 100644 doc/jupyterlite/_output/files/errorbars_with_std.ipynb create mode 100644 doc/jupyterlite/_output/files/falkensee.ipynb create mode 100644 doc/jupyterlite/_output/files/filled_step_chart.ipynb create mode 100644 doc/jupyterlite/_output/files/gantt_chart.ipynb create mode 100644 doc/jupyterlite/_output/files/gapminder_bubble_plot.ipynb create mode 100644 doc/jupyterlite/_output/files/grouped_bar_chart.ipynb create mode 100644 doc/jupyterlite/_output/files/grouped_bar_chart2.ipynb create mode 100644 doc/jupyterlite/_output/files/grouped_bar_chart_horizontal.ipynb create mode 100644 doc/jupyterlite/_output/files/grouped_bar_chart_with_error_bars.ipynb create mode 100644 doc/jupyterlite/_output/files/hexbins.ipynb create mode 100644 doc/jupyterlite/_output/files/histogram_responsive.ipynb create mode 100644 doc/jupyterlite/_output/files/histogram_with_a_global_mean_overlay.ipynb create mode 100644 doc/jupyterlite/_output/files/horizon_graph.ipynb create mode 100644 doc/jupyterlite/_output/files/horizontal_stacked_bar_chart.ipynb create mode 100644 doc/jupyterlite/_output/files/image_tooltip.ipynb create mode 100644 doc/jupyterlite/_output/files/interactive_brush.ipynb create mode 100644 doc/jupyterlite/_output/files/interactive_cross_highlight.ipynb create mode 100644 doc/jupyterlite/_output/files/interactive_layered_crossfilter.ipynb create mode 100644 doc/jupyterlite/_output/files/interactive_legend.ipynb create mode 100644 doc/jupyterlite/_output/files/interactive_scatter_plot.ipynb create mode 100644 doc/jupyterlite/_output/files/interval_selection.ipynb create mode 100644 doc/jupyterlite/_output/files/iowa_electricity.ipynb create mode 100644 doc/jupyterlite/_output/files/isotype.ipynb create mode 100644 doc/jupyterlite/_output/files/isotype_emoji.ipynb create mode 100644 doc/jupyterlite/_output/files/isotype_grid.ipynb create mode 100644 doc/jupyterlite/_output/files/jitter_chart.ipynb create mode 100644 doc/jupyterlite/_output/files/layer_line_color_rule.ipynb create mode 100644 doc/jupyterlite/_output/files/layered_area_chart.ipynb create mode 100644 doc/jupyterlite/_output/files/layered_bar_chart.ipynb create mode 100644 doc/jupyterlite/_output/files/layered_chart_bar_mark.ipynb create mode 100644 doc/jupyterlite/_output/files/layered_chart_with_dual_axis.ipynb create mode 100644 doc/jupyterlite/_output/files/layered_heatmap_text.ipynb create mode 100644 doc/jupyterlite/_output/files/layered_histogram.ipynb create mode 100644 doc/jupyterlite/_output/files/line_chart_with_color_datum.ipynb create mode 100644 doc/jupyterlite/_output/files/line_chart_with_cumsum.ipynb create mode 100644 doc/jupyterlite/_output/files/line_chart_with_datum.ipynb create mode 100644 doc/jupyterlite/_output/files/line_chart_with_generator.ipynb create mode 100644 doc/jupyterlite/_output/files/line_chart_with_points.ipynb create mode 100644 doc/jupyterlite/_output/files/line_percent.ipynb create mode 100644 doc/jupyterlite/_output/files/line_with_ci.ipynb create mode 100644 doc/jupyterlite/_output/files/line_with_log_scale.ipynb create mode 100644 doc/jupyterlite/_output/files/london_tube.ipynb create mode 100644 doc/jupyterlite/_output/files/multi_series_line.ipynb create mode 100644 doc/jupyterlite/_output/files/multifeature_scatter_plot.ipynb create mode 100644 doc/jupyterlite/_output/files/multiline_highlight.ipynb create mode 100644 doc/jupyterlite/_output/files/multiline_tooltip.ipynb create mode 100644 doc/jupyterlite/_output/files/multiple_interactions.ipynb create mode 100644 doc/jupyterlite/_output/files/multiple_marks.ipynb create mode 100644 doc/jupyterlite/_output/files/natural_disasters.ipynb create mode 100644 doc/jupyterlite/_output/files/normalized_stacked_area_chart.ipynb create mode 100644 doc/jupyterlite/_output/files/normalized_stacked_bar_chart.ipynb create mode 100644 doc/jupyterlite/_output/files/normed_parallel_coordinates.ipynb create mode 100644 doc/jupyterlite/_output/files/one_dot_per_zipcode.ipynb create mode 100644 doc/jupyterlite/_output/files/pacman_chart.ipynb create mode 100644 doc/jupyterlite/_output/files/parallel_coordinates.ipynb create mode 100644 doc/jupyterlite/_output/files/percentage_of_total.ipynb create mode 100644 doc/jupyterlite/_output/files/pie_chart.ipynb create mode 100644 doc/jupyterlite/_output/files/pie_chart_with_labels.ipynb create mode 100644 doc/jupyterlite/_output/files/poly_fit_regression.ipynb create mode 100644 doc/jupyterlite/_output/files/pyramid.ipynb create mode 100644 doc/jupyterlite/_output/files/radial_chart.ipynb create mode 100644 doc/jupyterlite/_output/files/ranged_dot_plot.ipynb create mode 100644 doc/jupyterlite/_output/files/ridgeline_plot.ipynb create mode 100644 doc/jupyterlite/_output/files/scatter_href.ipynb create mode 100644 doc/jupyterlite/_output/files/scatter_linked_brush.ipynb create mode 100644 doc/jupyterlite/_output/files/scatter_linked_table.ipynb create mode 100644 doc/jupyterlite/_output/files/scatter_marginal_hist.ipynb create mode 100644 doc/jupyterlite/_output/files/scatter_matrix.ipynb create mode 100644 doc/jupyterlite/_output/files/scatter_qq.ipynb create mode 100644 doc/jupyterlite/_output/files/scatter_tooltips.ipynb create mode 100644 doc/jupyterlite/_output/files/scatter_with_histogram.ipynb create mode 100644 doc/jupyterlite/_output/files/scatter_with_labels.ipynb create mode 100644 doc/jupyterlite/_output/files/scatter_with_layered_histogram.ipynb create mode 100644 doc/jupyterlite/_output/files/scatter_with_loess.ipynb create mode 100644 doc/jupyterlite/_output/files/scatter_with_minimap.ipynb create mode 100644 doc/jupyterlite/_output/files/scatter_with_rolling_mean.ipynb create mode 100644 doc/jupyterlite/_output/files/seattle_weather_interactive.ipynb create mode 100644 doc/jupyterlite/_output/files/select_detail.ipynb create mode 100644 doc/jupyterlite/_output/files/select_mark_area.ipynb create mode 100644 doc/jupyterlite/_output/files/selection_histogram.ipynb create mode 100644 doc/jupyterlite/_output/files/selection_layer_bar_month.ipynb create mode 100644 doc/jupyterlite/_output/files/simple_bar_chart.ipynb create mode 100644 doc/jupyterlite/_output/files/simple_heatmap.ipynb create mode 100644 doc/jupyterlite/_output/files/simple_histogram.ipynb create mode 100644 doc/jupyterlite/_output/files/simple_line_chart.ipynb create mode 100644 doc/jupyterlite/_output/files/simple_scatter_with_errorbars.ipynb create mode 100644 doc/jupyterlite/_output/files/simple_stacked_area_chart.ipynb create mode 100644 doc/jupyterlite/_output/files/slider_cutoff.ipynb create mode 100644 doc/jupyterlite/_output/files/slope_graph.ipynb create mode 100644 doc/jupyterlite/_output/files/sorted_error_bars_with_ci.ipynb create mode 100644 doc/jupyterlite/_output/files/stacked_bar_chart.ipynb create mode 100644 doc/jupyterlite/_output/files/stacked_bar_chart_sorted_segments.ipynb create mode 100644 doc/jupyterlite/_output/files/stacked_bar_chart_with_text.ipynb create mode 100644 doc/jupyterlite/_output/files/stem_and_leaf.ipynb create mode 100644 doc/jupyterlite/_output/files/step_chart.ipynb create mode 100644 doc/jupyterlite/_output/files/streamgraph.ipynb create mode 100644 doc/jupyterlite/_output/files/strip_plot.ipynb create mode 100644 doc/jupyterlite/_output/files/stripplot.ipynb create mode 100644 doc/jupyterlite/_output/files/table_bubble_plot_github.ipynb create mode 100644 doc/jupyterlite/_output/files/top_k_items.ipynb create mode 100644 doc/jupyterlite/_output/files/top_k_letters.ipynb create mode 100644 doc/jupyterlite/_output/files/top_k_with_others.ipynb create mode 100644 doc/jupyterlite/_output/files/trail_marker.ipynb create mode 100644 doc/jupyterlite/_output/files/trellis_area.ipynb create mode 100644 doc/jupyterlite/_output/files/trellis_area_sort_array.ipynb create mode 100644 doc/jupyterlite/_output/files/trellis_histogram.ipynb create mode 100644 doc/jupyterlite/_output/files/trellis_scatter_plot.ipynb create mode 100644 doc/jupyterlite/_output/files/trellis_stacked_bar_chart.ipynb create mode 100644 doc/jupyterlite/_output/files/us_employment.ipynb create mode 100644 doc/jupyterlite/_output/files/us_incomebrackets_by_state_facet.ipynb create mode 100644 doc/jupyterlite/_output/files/us_population_over_time.ipynb create mode 100644 doc/jupyterlite/_output/files/us_population_over_time_facet.ipynb create mode 100644 doc/jupyterlite/_output/files/us_population_pyramid_over_time.ipynb create mode 100644 doc/jupyterlite/_output/files/us_state_capitals.ipynb create mode 100644 doc/jupyterlite/_output/files/violin_plot.ipynb create mode 100644 doc/jupyterlite/_output/files/weather_heatmap.ipynb create mode 100644 doc/jupyterlite/_output/files/wheat_wages.ipynb create mode 100644 doc/jupyterlite/_output/files/wilkinson-dot-plot.ipynb create mode 100644 doc/jupyterlite/_output/files/wind_vector_map.ipynb create mode 100644 doc/jupyterlite/_output/files/window_rank.ipynb create mode 100644 doc/jupyterlite/_output/files/world_map.ipynb create mode 100644 doc/jupyterlite/_output/files/world_projections.ipynb create mode 100644 doc/jupyterlite/_output/index.html create mode 100644 doc/jupyterlite/_output/jupyter-lite.ipynb create mode 100644 doc/jupyterlite/_output/jupyter-lite.json create mode 100644 doc/jupyterlite/_output/jupyterlite.schema.v0.json create mode 100644 doc/jupyterlite/_output/kernelspecs/javascript.svg create mode 100644 doc/jupyterlite/_output/kernelspecs/python.png create mode 100644 doc/jupyterlite/_output/lab/favicon.ico create mode 100644 doc/jupyterlite/_output/lab/index.html create mode 100644 doc/jupyterlite/_output/lab/jupyter-lite.ipynb create mode 100644 doc/jupyterlite/_output/lab/jupyter-lite.json create mode 100644 doc/jupyterlite/_output/lab/package.json create mode 100644 doc/jupyterlite/_output/lab/tree/index.html create mode 100644 doc/jupyterlite/_output/lab/workspaces/index.html create mode 100644 doc/jupyterlite/_output/package.json create mode 100644 doc/jupyterlite/_output/piplite.schema.v0.json create mode 100644 doc/jupyterlite/_output/repl/index.html create mode 100644 doc/jupyterlite/_output/repl/jupyter-lite.ipynb create mode 100644 doc/jupyterlite/_output/repl/jupyter-lite.json create mode 100644 doc/jupyterlite/_output/repl/package.json create mode 100644 doc/jupyterlite/_output/retro/consoles/favicon.ico create mode 100644 doc/jupyterlite/_output/retro/consoles/index.html create mode 100644 doc/jupyterlite/_output/retro/consoles/jupyter-lite.ipynb create mode 100644 doc/jupyterlite/_output/retro/consoles/jupyter-lite.json create mode 100644 doc/jupyterlite/_output/retro/edit/favicon.ico create mode 100644 doc/jupyterlite/_output/retro/edit/index.html create mode 100644 doc/jupyterlite/_output/retro/edit/jupyter-lite.ipynb create mode 100644 doc/jupyterlite/_output/retro/edit/jupyter-lite.json create mode 100644 doc/jupyterlite/_output/retro/favicon.ico create mode 100644 doc/jupyterlite/_output/retro/index.html create mode 100644 doc/jupyterlite/_output/retro/jupyter-lite.ipynb create mode 100644 doc/jupyterlite/_output/retro/jupyter-lite.json create mode 100644 doc/jupyterlite/_output/retro/notebooks/favicon.ico create mode 100644 doc/jupyterlite/_output/retro/notebooks/index.html create mode 100644 doc/jupyterlite/_output/retro/notebooks/jupyter-lite.ipynb create mode 100644 doc/jupyterlite/_output/retro/notebooks/jupyter-lite.json create mode 100644 doc/jupyterlite/_output/retro/package.json create mode 100644 doc/jupyterlite/_output/retro/tree/index.html create mode 100644 doc/jupyterlite/_output/retro/tree/jupyter-lite.ipynb create mode 100644 doc/jupyterlite/_output/retro/tree/jupyter-lite.json create mode 100644 doc/jupyterlite/_output/tree/index.html create mode 100644 doc/jupyterlite/file_prefix create mode 100644 doc/jupyterlite/files/airport_connections.ipynb create mode 100644 doc/jupyterlite/files/airports.ipynb create mode 100644 doc/jupyterlite/files/airports_count.ipynb create mode 100644 doc/jupyterlite/files/anscombe_plot.ipynb create mode 100644 doc/jupyterlite/files/area_chart_gradient.ipynb create mode 100644 doc/jupyterlite/files/bar_and_line_with_dual_axis.ipynb create mode 100644 doc/jupyterlite/files/bar_chart_horizontal.ipynb create mode 100644 doc/jupyterlite/files/bar_chart_sorted.ipynb create mode 100644 doc/jupyterlite/files/bar_chart_trellis_compact.ipynb create mode 100644 doc/jupyterlite/files/bar_chart_with_highlighted_bar.ipynb create mode 100644 doc/jupyterlite/files/bar_chart_with_highlighted_segment.ipynb create mode 100644 doc/jupyterlite/files/bar_chart_with_labels.ipynb create mode 100644 doc/jupyterlite/files/bar_chart_with_mean_line.ipynb create mode 100644 doc/jupyterlite/files/bar_chart_with_negatives.ipynb create mode 100644 doc/jupyterlite/files/bar_rounded.ipynb create mode 100644 doc/jupyterlite/files/bar_with_rolling_mean.ipynb create mode 100644 doc/jupyterlite/files/beckers_barley_trellis_plot.ipynb create mode 100644 doc/jupyterlite/files/beckers_barley_wrapped_facet.ipynb create mode 100644 doc/jupyterlite/files/binned_heatmap.ipynb create mode 100644 doc/jupyterlite/files/binned_scatterplot.ipynb create mode 100644 doc/jupyterlite/files/boxplot.ipynb create mode 100644 doc/jupyterlite/files/bubble_plot.ipynb create mode 100644 doc/jupyterlite/files/bump_chart.ipynb create mode 100644 doc/jupyterlite/files/candlestick_chart.ipynb create mode 100644 doc/jupyterlite/files/choropleth.ipynb create mode 100644 doc/jupyterlite/files/choropleth_repeat.ipynb create mode 100644 doc/jupyterlite/files/co2_concentration.ipynb create mode 100644 doc/jupyterlite/files/comet_chart.ipynb create mode 100644 doc/jupyterlite/files/connected_scatterplot.ipynb create mode 100644 doc/jupyterlite/files/cumulative_count_chart.ipynb create mode 100644 doc/jupyterlite/files/cumulative_wiki_donations.ipynb create mode 100644 doc/jupyterlite/files/density_facet.ipynb create mode 100644 doc/jupyterlite/files/density_stack.ipynb create mode 100644 doc/jupyterlite/files/diverging_stacked_bar_chart.ipynb create mode 100644 doc/jupyterlite/files/donut_chart.ipynb create mode 100644 doc/jupyterlite/files/dot_dash_plot.ipynb create mode 100644 doc/jupyterlite/files/errorbars_with_ci.ipynb create mode 100644 doc/jupyterlite/files/errorbars_with_std.ipynb create mode 100644 doc/jupyterlite/files/falkensee.ipynb create mode 100644 doc/jupyterlite/files/filled_step_chart.ipynb create mode 100644 doc/jupyterlite/files/gantt_chart.ipynb create mode 100644 doc/jupyterlite/files/gapminder_bubble_plot.ipynb create mode 100644 doc/jupyterlite/files/grouped_bar_chart.ipynb create mode 100644 doc/jupyterlite/files/grouped_bar_chart2.ipynb create mode 100644 doc/jupyterlite/files/grouped_bar_chart_horizontal.ipynb create mode 100644 doc/jupyterlite/files/grouped_bar_chart_with_error_bars.ipynb create mode 100644 doc/jupyterlite/files/hexbins.ipynb create mode 100644 doc/jupyterlite/files/histogram_responsive.ipynb create mode 100644 doc/jupyterlite/files/histogram_with_a_global_mean_overlay.ipynb create mode 100644 doc/jupyterlite/files/horizon_graph.ipynb create mode 100644 doc/jupyterlite/files/horizontal_stacked_bar_chart.ipynb create mode 100644 doc/jupyterlite/files/image_tooltip.ipynb create mode 100644 doc/jupyterlite/files/interactive_brush.ipynb create mode 100644 doc/jupyterlite/files/interactive_cross_highlight.ipynb create mode 100644 doc/jupyterlite/files/interactive_layered_crossfilter.ipynb create mode 100644 doc/jupyterlite/files/interactive_legend.ipynb create mode 100644 doc/jupyterlite/files/interactive_scatter_plot.ipynb create mode 100644 doc/jupyterlite/files/interval_selection.ipynb create mode 100644 doc/jupyterlite/files/iowa_electricity.ipynb create mode 100644 doc/jupyterlite/files/isotype.ipynb create mode 100644 doc/jupyterlite/files/isotype_emoji.ipynb create mode 100644 doc/jupyterlite/files/isotype_grid.ipynb create mode 100644 doc/jupyterlite/files/jitter_chart.ipynb create mode 100644 doc/jupyterlite/files/layer_line_color_rule.ipynb create mode 100644 doc/jupyterlite/files/layered_area_chart.ipynb create mode 100644 doc/jupyterlite/files/layered_bar_chart.ipynb create mode 100644 doc/jupyterlite/files/layered_chart_bar_mark.ipynb create mode 100644 doc/jupyterlite/files/layered_chart_with_dual_axis.ipynb create mode 100644 doc/jupyterlite/files/layered_heatmap_text.ipynb create mode 100644 doc/jupyterlite/files/layered_histogram.ipynb create mode 100644 doc/jupyterlite/files/line_chart_with_color_datum.ipynb create mode 100644 doc/jupyterlite/files/line_chart_with_cumsum.ipynb create mode 100644 doc/jupyterlite/files/line_chart_with_datum.ipynb create mode 100644 doc/jupyterlite/files/line_chart_with_generator.ipynb create mode 100644 doc/jupyterlite/files/line_chart_with_points.ipynb create mode 100644 doc/jupyterlite/files/line_percent.ipynb create mode 100644 doc/jupyterlite/files/line_with_ci.ipynb create mode 100644 doc/jupyterlite/files/line_with_log_scale.ipynb create mode 100644 doc/jupyterlite/files/london_tube.ipynb create mode 100644 doc/jupyterlite/files/multi_series_line.ipynb create mode 100644 doc/jupyterlite/files/multifeature_scatter_plot.ipynb create mode 100644 doc/jupyterlite/files/multiline_highlight.ipynb create mode 100644 doc/jupyterlite/files/multiline_tooltip.ipynb create mode 100644 doc/jupyterlite/files/multiple_interactions.ipynb create mode 100644 doc/jupyterlite/files/multiple_marks.ipynb create mode 100644 doc/jupyterlite/files/natural_disasters.ipynb create mode 100644 doc/jupyterlite/files/normalized_stacked_area_chart.ipynb create mode 100644 doc/jupyterlite/files/normalized_stacked_bar_chart.ipynb create mode 100644 doc/jupyterlite/files/normed_parallel_coordinates.ipynb create mode 100644 doc/jupyterlite/files/one_dot_per_zipcode.ipynb create mode 100644 doc/jupyterlite/files/pacman_chart.ipynb create mode 100644 doc/jupyterlite/files/parallel_coordinates.ipynb create mode 100644 doc/jupyterlite/files/percentage_of_total.ipynb create mode 100644 doc/jupyterlite/files/pie_chart.ipynb create mode 100644 doc/jupyterlite/files/pie_chart_with_labels.ipynb create mode 100644 doc/jupyterlite/files/poly_fit_regression.ipynb create mode 100644 doc/jupyterlite/files/pyramid.ipynb create mode 100644 doc/jupyterlite/files/radial_chart.ipynb create mode 100644 doc/jupyterlite/files/ranged_dot_plot.ipynb create mode 100644 doc/jupyterlite/files/ridgeline_plot.ipynb create mode 100644 doc/jupyterlite/files/scatter_href.ipynb create mode 100644 doc/jupyterlite/files/scatter_linked_brush.ipynb create mode 100644 doc/jupyterlite/files/scatter_linked_table.ipynb create mode 100644 doc/jupyterlite/files/scatter_marginal_hist.ipynb create mode 100644 doc/jupyterlite/files/scatter_matrix.ipynb create mode 100644 doc/jupyterlite/files/scatter_qq.ipynb create mode 100644 doc/jupyterlite/files/scatter_tooltips.ipynb create mode 100644 doc/jupyterlite/files/scatter_with_histogram.ipynb create mode 100644 doc/jupyterlite/files/scatter_with_labels.ipynb create mode 100644 doc/jupyterlite/files/scatter_with_layered_histogram.ipynb create mode 100644 doc/jupyterlite/files/scatter_with_loess.ipynb create mode 100644 doc/jupyterlite/files/scatter_with_minimap.ipynb create mode 100644 doc/jupyterlite/files/scatter_with_rolling_mean.ipynb create mode 100644 doc/jupyterlite/files/seattle_weather_interactive.ipynb create mode 100644 doc/jupyterlite/files/select_detail.ipynb create mode 100644 doc/jupyterlite/files/select_mark_area.ipynb create mode 100644 doc/jupyterlite/files/selection_histogram.ipynb create mode 100644 doc/jupyterlite/files/selection_layer_bar_month.ipynb create mode 100644 doc/jupyterlite/files/simple_bar_chart.ipynb create mode 100644 doc/jupyterlite/files/simple_heatmap.ipynb create mode 100644 doc/jupyterlite/files/simple_histogram.ipynb create mode 100644 doc/jupyterlite/files/simple_line_chart.ipynb create mode 100644 doc/jupyterlite/files/simple_scatter_with_errorbars.ipynb create mode 100644 doc/jupyterlite/files/simple_stacked_area_chart.ipynb create mode 100644 doc/jupyterlite/files/slider_cutoff.ipynb create mode 100644 doc/jupyterlite/files/slope_graph.ipynb create mode 100644 doc/jupyterlite/files/sorted_error_bars_with_ci.ipynb create mode 100644 doc/jupyterlite/files/stacked_bar_chart.ipynb create mode 100644 doc/jupyterlite/files/stacked_bar_chart_sorted_segments.ipynb create mode 100644 doc/jupyterlite/files/stacked_bar_chart_with_text.ipynb create mode 100644 doc/jupyterlite/files/stem_and_leaf.ipynb create mode 100644 doc/jupyterlite/files/step_chart.ipynb create mode 100644 doc/jupyterlite/files/streamgraph.ipynb create mode 100644 doc/jupyterlite/files/strip_plot.ipynb create mode 100644 doc/jupyterlite/files/stripplot.ipynb create mode 100644 doc/jupyterlite/files/table_bubble_plot_github.ipynb create mode 100644 doc/jupyterlite/files/top_k_items.ipynb create mode 100644 doc/jupyterlite/files/top_k_letters.ipynb create mode 100644 doc/jupyterlite/files/top_k_with_others.ipynb create mode 100644 doc/jupyterlite/files/trail_marker.ipynb create mode 100644 doc/jupyterlite/files/trellis_area.ipynb create mode 100644 doc/jupyterlite/files/trellis_area_sort_array.ipynb create mode 100644 doc/jupyterlite/files/trellis_histogram.ipynb create mode 100644 doc/jupyterlite/files/trellis_scatter_plot.ipynb create mode 100644 doc/jupyterlite/files/trellis_stacked_bar_chart.ipynb create mode 100644 doc/jupyterlite/files/us_employment.ipynb create mode 100644 doc/jupyterlite/files/us_incomebrackets_by_state_facet.ipynb create mode 100644 doc/jupyterlite/files/us_population_over_time.ipynb create mode 100644 doc/jupyterlite/files/us_population_over_time_facet.ipynb create mode 100644 doc/jupyterlite/files/us_population_pyramid_over_time.ipynb create mode 100644 doc/jupyterlite/files/us_state_capitals.ipynb create mode 100644 doc/jupyterlite/files/violin_plot.ipynb create mode 100644 doc/jupyterlite/files/weather_heatmap.ipynb create mode 100644 doc/jupyterlite/files/wellcome.ipynb create mode 100644 doc/jupyterlite/files/wheat_wages.ipynb create mode 100644 doc/jupyterlite/files/wilkinson-dot-plot.ipynb create mode 100644 doc/jupyterlite/files/wind_vector_map.ipynb create mode 100644 doc/jupyterlite/files/window_rank.ipynb create mode 100644 doc/jupyterlite/files/world_map.ipynb create mode 100644 doc/jupyterlite/files/world_projections.ipynb create mode 100644 doc/jupyterlite/wellcome.ipynb diff --git a/doc/jupyterlite/.jupyterlite.doit.db b/doc/jupyterlite/.jupyterlite.doit.db new file mode 100644 index 0000000000000000000000000000000000000000..b5a4b461cd626431f67987a53ef151fb2faad7bb GIT binary patch literal 122880 zcmeHw36vz~U0=_1&(1yLOO|C@)@s)}R@$TPV}&KHwX%?HS+-ZUEX(8OtE#VNdv|7f z)ZL@iNDQV|W0Qb6O#(JY6d(@aG>19OGZEo>&NIA6AeflrkvuSj9OQ*7gqQrjs`{$C ztLp2cYHQ;_kFD9Ao$mVn{rj%}`TJjZ$6Fg6dem>Wwn^uxT6sxjW~Org(W8}0WfuRv z4*&758T_Tjf54yY=TTp?mD7(uyt@9^mD%<4mG$%Mzc%U()89`Km?AJmV2Z#Lfhhu0 z1f~c~5tt${MPQ1+6oD^R1iA||^Ecjb!%Vl`A?u~DK z@F@G2qjxSHO?-7o`*OYE9qrI(I!AY!_-}7(>*#K)u}xb0M=#U;li6?aNQWG~)Nbw! z{QATlvqx^c=Z2X|W5=Vo2Zh3N0epC0Q`2MOcv+8f$!?#y9@a^Rr z`1Z0#@$IGO@a-iUzRk<{cH|Cxo4X0$YAYaaKpJ;w>swmSHSHr?E2FFW1X-QRI4-wUB$AywVXhis93+UkEu^rmlK#k*E2 ze^Xie)ao-Uk1n5C{Pl&-{M+U}U;9LLYgWTA{=R-)wN`5M@a8PUIas7cNeFp})^o?| zPm`@Z+OD5HcJ}CV2Pcmnb1za%PK*6~?2+^O1L2Ry@S8Iio7?ovr6%1vv)gK3IzzTP zq|rL#HQh6p_ICF>w8fG$&iIWj+CC#15s!URHgrjo6it^-%Z99|rgHMAtjapZ@HJv+ zKGAK*w=JLgsx29&Vk(;NI+jADV;gvpM|ayyz9+AdNE-)N_2rs-cvBX1o#t-+a{Wr9 zbFtp+T%@gNah8XiV89e`I)Kwo9#v#X1tuCHu44Em&@wdHb1ls<9K&Q#`qcIOBEX3x z0&eG)YL^dBWZ~9!Ne4@!j;x=}#tzx4Uu?8HWv{v+g9`C8EVl5dF1Z?!Jc~%WPl;nu zRkaMAYKrL_re0{_4U-BOo>;6sdAOK`AyTF`X}!~IZgm>FWn-5ySQ0bcR8+&lW;J9P znAy6f>82#f4xy%O%bw&|l4jVZO(fG&wIXXSOB!I+T$t-F9?~qZ*!pU2w#at4SxJ3! ztLb3fZBw#SZ$6FFiR_n+;rKELq16==&|0c&5!=-?MN+A*II`n7ibN^4xglA)Sp?b% zgaqQp=WCB2&SU}Z>^aB{tnY3$OW)V2p@i@$>`Xicga~!0s#&UUVpl7UMpW5!Jxlj> zUn#UQ)3N}iCyvyfJA60`r5#p>xYc-;sW*|{bNz1NF$PZ}*}IT+?DS&_F&z(QAW{Kr&D{HpBDKF;V# zbbBYL#n!2!5k=N4>QmXKo~gS;(9YfVpsLxM?MC8Zm-s!IGoGE=Talk zZ~_yi?8TNID}_>|Nh=b&qK`?kM?9jLwn2SGA-Y9WS8{w@-MV6Hv=B-e!T_jqvm#wE zFb3*djU8Hdn_JCRy|uSR%SLR-pd#pGQ)ap}v_I7{RfX7|@2gm0j_)|O1szAysOBg| z&b(n#F$`x!7$&y!7IElS>9)v_L6aE9C!20E1;$q_+mSuo8=mIicr%GbCEM_bNnqPa zqzHz?q}n)O_W$b4Ybt9mu69?RTt2t>cMG4MKRoiTx#QK}pZ&4f%lOql)UT_L+*E5H z+F56rySKf!MLLbADb(l74HQ=F;HTzJ=}Tw#w9Ry9oYS(y$})m7*hZlk9G@ zvY=KyrK3+YGZQ(wh76j-Ed>}gG!DjQ@79&IZP^G zc;<#${qUt(=fD*JSbv(j9o*8}q;#i4=5R^e3>&U418xU9@DbWBu4hNF6$?uaZX4TG z4PR5?uW=m1_M9SXE?XWTcJdXqjl*D$oLDBHckZR4+kt6~ zft#S!+yaQ3fn%_2{DusgL@-`{rp|6w*|JQy^mPYEoDZu*bK!LLiQ&PS^JCe+4t>059% znT~7}SxISGfYQBdwZ`FXS?j0MqS$-wI=?oqhjU3hW)e59+scZ~&M*TfnB_SdbtLL) zwhtRtXXhBMPYMKS5!{9d1px0^6E&u7#zghgY1$X}b zBWtzaul{s(bM^#&`S$!$vtFmHI&&Tc~g#t8UnKlmIep}T%2;ClML9}`C5_yIt_7w4g9Dlv& zc5QDpcWE8L-QA02&qHdc6#jheDh9LSJ(vTE=~7A4JloW;e0@zOhRys?5>CA$w?tYN ztlE>ug_dYzdlv!OiGjI`ElB(OL>qv@i$*!cymTa1`r}`fDxl0PU zH?!pdVn=VSz3cgdEcK16ZBIQ_`Yw#z9DJk{PJ9#U7RyADROCV_(Ep)Y7?!6Q9`a9o z$x$Vp*`9@TjpT=B?hXB@=*ETDe6NM96R*)GZFo9L_n!*}OaaDk4KqlPa9}eLRn_6q z@ZqMFad=TUI^cmM5-DgCh$I4Tx8EX)rFL4Rfm|KZLhfPNiz_`=3N608)F9D`SUzz* z*)wG%E^1g>2&Z~BrMiPqv~3mCPm&*;EwJOS6J3Qak}$86p_v*g2@^Lo72Reo3j$Nz z_lSW%iSJ6DuR4~DJQ3A(bmpEdauud!VcYO#(KhUNusN;0cIj$^U_cRKvaU1b0RTyo zp(viMz`LVr)HHC!>k_qX>ca0>1Tm3B!0nOOio$?VA~tQc;Qxo4s2#e@+(y}Za>T$% z9Ai`6*4X*)=o-c8ZyJv3T83)-Fx`o)LKX8AMVAWUI7+gOg9l$zz4c(XMTimyg}Dp*JDw(AUTACBsHq9z_lvGEP0utP(^ov?+d;pROsIRN>H8jh z>WDm0M=r9khl&;2|4VZpuB`pe>QAnaWozk%#TOSE3u{L{kAIwgO%a$PFhyXBz;!|3 z>LapH(}*m*>mHKh_MBkg)Wyb40n=t0o9;`#j(bh=4TV^?j#Lh0wjqHRzHJ9}O+_xY zQIbJ(J0pp_87;E2iM;0^IB*>@@-v4^VHYU{iefNVC6Qzp209Wd6@^k_p}0#zm{W5t zNrua}kbRIX&&I(MXQ~f#Hzn-8oiXqJzbbWoy!-$4*WYH{+l%Gu;h!c{WuIm0-4zkR)rmk33G3KZbA{ z2k$slwfUUw?l(PTz@3f$%sp2}PYRt{9lCpc0=Mu74UCkWhuEkI^TRYugC`?QYiK%! zg{VNahAC~DCKPDhDU=_U5(Q_=?RSfuGl9k(oR{Srg6XkRFvX^Z%E|#;Bp2H@iXA;_ zBDnhiaHbrc{-+QtD5X%uc|mE9mP@#rHG|O0Yt~|6nO=&u%J)<3Idj; zJDgKPB|+lpnyO;4Gz!;-Yew>H16PM6BhwW{Pcrge9R(RWR4#Pur)AkVfMUCdR0GqM z4Bb|vTE8(@LA|-x+1=|zHSFo|Te5ha>xL7A0`o~y!p)IOkj++eZ?~UyA@mRS{Dt8$ zms}G3tdVt#Dbc=Wqn023I@|PY89@gN;XgzqbRUUZ2-*ZnbT0Y03Vki(M!5t5Gr}%N zEl}^Yvx98vUL}PH8dVQ;WF)is)Rtw%mk`mikq++QK#@I^Q~Rh(57Yi~Ni;0!FR`xU z>6#!FF_%oc#N9@9c3%Zu5+0uI2Q8GX9MDGi2pU_q=1K68Bazutbs0%nhT}RYPS3w` z_S*H`=59~})7+`=?xT>r;RSW$^-g0u%CbsH7lmt)jLrfeCIZ?D*0XQPDs^q-^h+{W z1r$O(iMU31)a3#yC>z7Ri(>nA)?6ift8u^-Sz%X{he}=Khsdgr!xoepwgQd=WQQQ7 z8C5e{f%Q~E(Pl1aQWvFYF;8%3=Mv;fv$f^b88yn#4bQJfMDl||IRewlGgQY%jxUOt zG-^4%>lv2s+Mcb4`K!6);h9hTOzb6Frj~JhkBy)Bm`kLTF&thWLsm1F%nFrM6!T** zQJJZ!8iLmjCBC5(9po^MYlX>9xg_gXQTxjhl2FA*;{-(lxdci^Il{tOG)daq9=`Eq zD5BW-(BBmkp?nJd7vG|`spDTf13D40eZvn4VRA{vE)u8#D71=7H-s2z0W}Sr2h`OS zWc#3mf+GLZ^r&VN5Hnals+0>HL8&q?p(GQ~Lgd4w`HXmb#cM_nY9kySlrvP8kuzpe z_*5*-GZYjoYN*N44K2(j$R|Zis1+FN0rLr4N7)M|77LsMSTL%uuxd0IF({_jkd6r& z7gSQBXxv1K2nmguTw*1ca)0zPIb;0#k|&5G<`XL74;z)K%AF0kEddfr=PlJl)gyes z$X3;Gp_*U`k}VCJ%#%WALm_!WLbPE1ygm32$uo_}q!U7g>Q}bmVe(kald8cL4dny> z18t0{$_D5WWV?W9X{EpC#v8G;Kw|^ZC}P1_=P1oU=?~RB)iqJK>sY3aL{%hg<=5JF z36ib0=oa+sX3GQ5REHbDLbPltAdygQs)Id3Qvny!#qdo+W}S(eLW1&|0@rR(o&+kp zRs*zZ;@uZ7bR_iwB3P?1mkqF4P(?FvLJ&;>1A&P&Qm{BgX}q}>R&cX{WC-j&*@m+`%F#(p99IGC z;9kQ5f@Nent_km`VyYl(&{03@Qq<_dQALlz{$FA&artEHk4kMdX_f{|bR7`C|)77AA-Lzz693ySsqn4)2D25`sq`-jm4cRH8Msi&{5Ng!b62YZd20OoXOM+?! zH3_jr1(RpWKnb>iCOJ?RqC&QOi@HO%>j7TSmWNNBf+RG^LZGQBCYCXno)irPMW{K{ z9m7JMhHW6fD*u7a4cYLT3${LTJ_SO>cW+?(%NpEY5b0w@D9haGEsz}*7y~(xg>EKa0kb3yzC_t3xo3x zut4F$MJgL0;KMa4f!YQ?BgTmk6O=JGWTVO_Ol&SrpwBZ?Q71MOWp-JqzG{HG4n=2} zMEI>89X5RdQ!$J7Q#4l-kdWqrC!KOGkYtkd_gs=h)6-u7m)zET(I_w*Fhh#3yAF9SzA3S><^K=Hl!}J^GPf#TZT7~T+5a^*o z(NSTrQmRTa{+Iv0iuJ5|i?(;cSp^oWY>_xh&>)!6<%0@Ol@wLAL9c+23&MDycav=2 zbzy`RQkWw<;$n-6G%kJ)8){&^>j+^W2g))`gu--G>mwzK;;w-1F2g|0k4~T@N0pq} zsPJ=G)>O8;9Y^zg94|8Rvyg9sz%4>@STx{MfOrw7Q?7NKLHNluz_G$V!C5FfsHlVx z5|TcAc9T+2PWg@pZV?rs!~*_bgnuZiC!70>fL;I-*Vj!uu-I|nIq+kcVCe;ulZTic zxOtJ~?t`({GYh!!f*I@c1A&OFJ=*IVY%-+3xTx!bV(6jd9?l@tz@Zk^(`*N&!A=2y zLaRNf(1Pkk$#9HhSix+A5u7(D(NH|pd+H$6#>~M$MlleAA7IzXzpD8$l%^Ml{lDxa zkH`2dnt<&)*AnM)MaN@b?NLf3egK3_b}(QN;04b!(nvwx?rHeDt{{oYrMOYu0tWyW z302xLK~+i^uBJ{v8C3|Mz(7tj@d)LbAp16#T=6*+Mx=J=Wjh_1019(CZi zli(}Ik%?Hb9x$tNZC^{Y*g>ucyG$fE5U;P0;fh5^gvN zG~%j4p%O^Y)}X!>(E!qvgeh70Q8@uiV6JHk5>GI9QJq@5BQQ1M2}2eVJC`s`j;c70 z0aj~-T)>Zu_#x&Etgkj4jQJ-lIJ<+z%~K^)*zkGM$4_6(h0ShrYrpO{I?#$Xp%}H1 zgCaPzBZ;8-utS@A$fs~ohe&Y*A;jUJf(uqXs5V`=U7Z3Kn+qotnuBy2?&V>ZKA$WF z?8T4=H@u9*A*72V+@fHU84mo2Frfn{gIC~A%iu9isQ6qpnuJt2*JNF3Y+Y{bw3|Dp zkimaS>~M**2XNr9xq>qcM+|fSxTr;jQw*^?+ps~1tw1*^;uGuR>EkzuSS&teGO}?X zmV~H<1-4``<{2)+WfqF1ZO4&Zxa>UBEih%=%@Lp1!0CTQA_Uicg|YbBq)I;T*xQviBQbSTa<72sc(6h+I?IMp}3WoIsrHr7z7X zTQY7asglZ!T*pG94zx(Bpy~uIxl9LqA&5=u$m2#>s(_;8QTS;(`(b@lwk#Ya1u0FC z1w;})`nVviNhe5a!1!SNMkS1?`7n4%0gbi~l`tlaxeLlS(8~-QE+eEvkp!DV^rUb+ zRZ%RWdk`496j(xRFnFp+eXt8GFchu973uVM+DR^Ujubkp1>QgGJl$boXk->4Gfu;O zrx}t5PdW&4%mU%Nh-GQuj)`^fY@GOtf`gdJ26{J3M!Xz?c+`hy0NYa6CBpbG6st(~ zQ{*;*{lCI`3I_Kd_=UkX3^HqhY+M&dPaDW)dMHYS+2$g@fcVf69M7RPB*ULNVvYHa zE#~>cqMAHig%#XEGB7BD6~qIBf^DNl2dW*8Q414`k~|B`Ex%;Fs3YuzT^twLNX0A6 z3|2dX2zkUBCR2i|5Rq%&ln@Cp5g*1@ETB-~@ZsV1aWzSb;VNe0&#) zvsgu7=W$WBBpL91X$lHXSlWtb6*wC<$xdg0Z%4TIFcXl3Al(YQvlIz*C_aJF4QhNB z&UpB8pejTSlX9KqE#fth#xst$6xu%n1*#et#E6WfK6sJ9CaieK#DYk~GC;+df6<7E z0h2ll-(W~-f<$AH73Kmb(8C$~9ixyEtr;$i8oJyyTp}#cXlkD2Na#EXMkgd*pp=W4 zpi|5bPuMUKk^CM3SaQ|Gry@cQ00!C$GIbIDw4tHcP?_MEATl8+V?>CU6tLrBVB$+I zZt9VeDZ)pC7X&idHlT4m(`MH!0s(Nc!WLd#IU|L98LkoZcGdDz;i<;ApI36vTL5Ge(HVQt7XA{gX z;@S@4{s?m+wu6*xvp|^&SL6mr9#a#^ErkhK1as}WQQSz$(|~)KCtz*LC0AeT78jZ7 zDEuaHr60RmzO*~5z@W19-HK`PJC3~LYWo*ezA8`o^;Xvh% zHmimUSfIsPXdQrcgpLAG9t$iR)<|&JH1VSlS;I^a0~x4TC-ARXrVLLdh+c7d_+WI# z3!+xKxsZvhqSzuDr-BG-2xNjjg1Rbr+TjM&JRNRZ2ttv9Y2x-rAz^-S_=P{FR}y=i zoy=pggy+Jjm;NN8Yf0X)@j9A-G9{O2@wpS)v%>;_u}l+m;L9ZwcLE67*(R}y4*?h+ zY#J3D%_!AHt|%-M5A|Rgax+~d`yt&}E}nD)`+qg+^nz|+NGOY%Sc${}4FMAib~a;; z)R2V<7J9S^mT}`F;aJttFc|u7{?(o)DM+4@k-9bsVM4x%i?WiUj^ZLSi62dRaJ3>0 z6XvT5DrL}_s}7<#AX!0o6&4sYc$>0Z;_zc&(kovJ@}JRO0*$|rZV2}+D_EmQZ^6YT zgKSDd_n`tlW}j?bhIf*VNFqZ3fCc~ID3Va@fdkT0kSDJzNH=DEyOEm&r-WX>6%ug> zv{Bpy9d`JIh9$}_G?2GoL&|qC-j$P zDv%Ciha$^IcYPZHH`tCUnnJ<-FFUq}R&50&;dM+P*NIxbXJZo|JP7kKY>?;YDxe3l zT^o%eQACVpk%(-e%)%fjCCD#PFXx)2XnGA{3R!$aBZmzVA-V=nwv94b+-({P;YA#0?G82rhgg+n6I(zyz0>i~2zmCnAWHKtus{ zg#uCAzzG5R3UH%?B{w>S#O8i4b`v-vFuqHvMs%b_SpW>0kw*y9H4Ga`$PxW^z7wdq zTfZFMtWDMnV8n^2$U#9fXwh(0`6ez1SQxN0Gz0WgXsxHC)*5*U`KK-67`cLm7mRIX zNZ>7AQ7A*jiUON7LN*jLh{kn@cB3ej{m=AG5blARD8FbSyMg#Nja?3Qu#_~Hk#Qj} z%D^8Qg8z_4br3K0khG~6@K>iUi+bdQi2O4nrjT(E0VmvD5(+I%AcRB!w&sx_t)uIV zquKD(7B~yGnmZ^rsCV`p!S%rxx2go2&c~M1eW)AE<%gOFWRRkz2*Nf7i1@Mn^3NEL zu#L5P6o!g{{Ki4CL4R}K`evhZanH#H zD8Bwxo#|;d`t4$MBdZqGvdo!>GB6wiNOMPc6dlR(Z?xF6j^^2!tba*WiLa$esP}T+ zZ*lsl03m+=hpC7rlBHPUm@9#zouJ?o2R0JSa3Uxw(zn9`te61xS`=9KHL*X2Da!R3 z-KN4=wphO|M0$Hkj(MM#%_N)mX&EICJ#8_XmAubJsI;-es+1fw)V)kQ2&e@46bPR7 zpZR$o-@mN;^Vst~ug@u;)nY#P0^nv+geL6&wY(yVTG!-#Ue9|IDk%jgJjmt?tKLI8 zpw?cT{*+h5sIJ4K9rU3oC|@rbGV(AKd>$%CH)-I&?9&+Xeo*A{Y(bY!G2iBWUgQPq z`Bw{m*xp*-~NOj1qe zeNKuhGVg;#RF8R|$4~qW*I3?1rp(%KMfOoG=6!O%UN}INnD>FbD>OP&n_K8U)*qr!N=zawmG^P%^cqfcmiNj0o(b@amF9vA9GYW_W-PCOT!{#`I0J&^^^PSV?Em#k zd%OF{z1@P5!hsD?ZHM@_psFw1Im!?X}`=l(YqrA`JryP`;Bvnz~N5*Gm znrbNTBe|4)R6%(k6=-jRR6ltimEpH$r*MDqN!~}p{7g~paFfKI4lfTH4pbJlEGus(7 zDS4lja60yAPVzo5*f+uC6n0>WX-4u2C!z_-`@9UAkGzi((sbl~V81hk@4#!|WZ)`R zyk82cY`w@%T;E>siTuNcCfqgl5MpDha}BH z-Y3Q@F+5`9WrUC%epPfajifoqD>hG}3f!p$rR?A9e1oQG2J%XpMH7(sSv(RHyif00{DWokd7p>PizSsVbI<#{beVeICuNkG=Y5p8 zOg!%sgL^1h=AHLpS!LRJpA`!hZ}MK5b>3$tvVpl@=NhO7Lk{D?GUvRaXO}7GecGrp z3Fm#NxXd^26Ni=Q=6z-=JXr8lk8X^3VHJE_y395A2aQ^ngwg1NVx_`E zyv#JWbjdQ&ybns=s@EcV$`72_=~WQDp6gPWbe;F($LsD|8t~!D;XCD;d8-F3pTQEv zydOVZVwm?yT)0GuVBW{^CB#9D=c(XQN|xy5m5=9+4wTsCeOS6gF87m!C2o12*jv5H z61BWf6qK0deO#bG4Ji@J``l2;3%m>iC0==-mr%;GO0@DmI$2_s_c^J}CMc20`}}l? zQ{E?W>-t)xs|!nvatk-IL@4i*Q))!P(=c73lUK446*hSv8yiK!3Yol5jy?Aggc}E| zu>Y$SwKDthnalWNoUg08R&x(;a`qZq-dTj?JE$dT<1f4WX9byl&mF5HPi7At9?zn< z=eYxj?_La8t=P}U9yzZ+5dJtpga--gw0%Y}V6udW)4WX5MS9}Wo#7H~99*^38a=!@ z3%Aq~k2K}-fD?_FM2;6hiDZGM9o&Mt&dO>*te3x>PE^p9V9nt3 zsLDYP1_=e~sB%X6tm+apb~6>9f(QbXK4?OsX$5*PWEX@bq~TS)V4q;CihzESfcIDf zSg5>a6jZD$C&=^AlLd8$`O(P;%=dJ==nxdh26Fa*;f$E*4uf)abQA;kIiWImJkjV8 z^oNG*7GbD_Q*)exw4``^VWI62pwmEoB!hHVAz<@k4RKM)3jPR`ZlbnT(~6KH^ikUP zN6ZuQ@P&n%RaWSW*+Nx4s55QWdlC#tCM%5w8>?+o*VKwE^gSrOL7Nd+t(O~h#!DxYA!61!5=Mmc?w7?SMMp5=^is3<%S->NKDGNlj zXrc-}AGFi*b#NhoFUKK@C99+WJfdQ}1T1{#;U;9fBj`@7q63mn7*jQB*EP)p-vBx& zqaqpHiv^ZXY`aG4^ayyugTO@>V9x=s2Ezm$@^lxB@lbbF9ls$(Hd_!u5)=apAqu)^ zp=GiPdRhey%+ah0XO!bR=!l7qvl6J#oC3sNS;d4&S)$#pssUjIS{M=!^b0Q77s2Nt zp#?oCm}Fw3ai{_Ak^Bc`U{D5bvB6@*q&!g#G^=pN@&OqHS{j0d70eZwAmX~d;Q%lf zlC9;OYi5He1Cm zTg$2gf<;UgEz<3*x7WD`Yp@tIAs5F9Q^nX%bjYLl;1WcW2(%dik)J7{vL5uI=)(pY z`~35kF6K-~5+h`4fgS?tXRu@WmTM~DVX(k@q$*HE&<_&e83ksH=iK%egC=E(wibAn z87g2AL}xtA5xVA45DL5K1_M?RFlXSz22*~1R0Nq2*#|U72pvn=hDYaUM`C9ZG!9(x zjQT_-AcOPJ>_|rU#r#smZu8J5J**ft0UTdWAYNe16=+m!p_LaS6$5~ZgC=q4Qpp&R z(A>)^LZ%bP^g|KjTriP5W;K-C^Bh80Mm zptTWDQE_X5l+LiIk3T#x!D$+d{RL+KuU0-)S^M{^U%m4F+1P)we7=GDRU5xhygn-URvQ2FT+XwT7iygv}32t6k@0tV;gAMjl zPzO2ibbw&VL_gu+o``W6m&#^r;Q;KL-%xw%P|pIkr>z8DoJ3Z1d7us-HwkF(RvW)* zW==py2nI0qFA;fs1=+{tp(q$o1m7fG5p%*Pk_fmxa!;*&XlE_LWClVaudh7(Mhu+9 zG4>Zs(DNrJj-w<4p4M5B2Yuj<+v?T0mItJ0#1w+uVP^%r+-T-x6R?znUlP5YS=T8Q ze7KTjD`?9B9=akYqfjJ3chatH9Ij?9#jMi1@?gsvEeTnC_Gy6!23{5lJHvnn*2OpY z?C`S#@?b}SL&Oa|FgX`prZ|A>yd_dCho!-l2ivewh44+#qa!DLL&XA&C(PQDhl^RO zE+YZEJoGXK6M{BDQ@EU;c@?aZ2ZW2Lm(I9X#HiKkN1V;!4FmKmI zHcfEN43vGA2Vi=v6lmP0(Eg$&OVChE|-?{MWBcGf5vD(+x-Zc9yGduWY*4I_#(Hc3tA!}=AXSbGz za`t#Br1?Fpj^A`9=kgQ?#FpjTM9VVGSXCZi>9JB^#mh2?>S+@C@u6z~yyzgu1?{qg zP7k1`Ck9%aqdP^BWtkz&#=-L^AE}-D(1~3Tprb2A=Pa|j8}8ZWUT1d?jffkq1USbS zsj1)CWF^--o7BVSIcA!k4l~q47?SmiLnlucDi#_cNZ=kvqn~4A=b^B)Q#{`z>KVH8 zbo&h1>Ui{N{mfRwIRom9i_IPNv@D%LhgNzDALlaJL~2SujYZ$zPl2TTlyq7?EuC_} zB6(Ur-PwGW!;cPxnx&nFg=|JI+RjRc4YLNS1EPiNo4Iy z!}w+9axGu@je`f@TD|q4mz$B8oZ&dfLSuUze@pH0!0+jB3xYjtlEo&{s z{@@fXMR{|9KAz?0)YCL zikv=z_+xqK2?k6;7cV*VZ^4;4R=_jok`qY;+}`(4?cnf{tc5pdpJ!Kbmk45ieJc0x z#!Fy$_z%6zScn}7W2R#`6g|$6EM~$EcWo0b<9!9K*w8<>$YLA^oMV9Z4&`Ac95M-9d#7=g*u$5E0+_W#U#D{FtS`duq;UA}$s z=N7(k{`}nE&HYsEV(r-MpU%91UrxVrAaH)8dP`^%F$*^LdVlDBwdSFmb$;{74Gyp* zbKykeO=KPo9agy3!|Y%*`;!RzS0Xo9M^Y!cM6D&`_1nb zMQ#$Q6$#?;@_-yZZW78^+tvarPeo;t=O7mrZBgO$MGHxrpj5(@9Fz-bBuvPS_x5BO z$q2y!=81QSLWaElH8`uvR_Zba6Tzm)LGyT|D*KLxPHv`-wwtnqZhQoh9F$Y|s!2(h zoSzf6ENOt1|JYo&diX?^c95#33zJp@ot<%rMP)PPEx|Db5P>S|7W3gC2V6mU7&67t z#}rO)g7&;VidJ+V4g3%rD{{(?DwW3hiGc3BzC;a72OpXb|!)xD(bS} zCzK_0e)W-(r=jUH^>H#1w@@%KEelY(@Xp$m!*f}yk<*O{sm97fZRF4?6r+npL0&sh z)LjMTYo3n+P8(HGri3Q;GHSRKUsEhkF68qXEgMk1=N%#sP7u)zOHrF>&FK=}->f_| zg+q!^L`fMdH1kbjc{&s$9euS8mlz6l4bz4j+eA!GFLbAfWdeFPzrA+h`TeXlnIMoT z53|HTDWq~V1I~GkBqiB6Sb}By#_EO2`d_TSxc;&A?e%l(>udjR?S^`X_9SN>$>hgRAvZ(6yb`d^m+^YV+!-?ZGQov&V4zHfPX>9>}?bE&oTrlpm| zKV1Ce;s+NWTfBSWZx?=j;oBE3FPyC&&i~E)Z_K|i|Gw(a&)<6FFOK};k*_)O$dT91 z{inGfox3{szBy@buJ${%kJt8Q|Ih4aWT-!Ogo6oJABNL6<>>%0+E>Q{d1p6Y()8`Anoj}t6Ze=9$EvifA^dowx% zRDR<2>Z6%29%!;u`SCMVlKnDHX+KcXTlrz(2Zj($&`)+Q4zPe$eo(5?>>z&>66?9- z!;iV5RxgX+kX_X~dsp>|%=e`Et*fG!@~XXFr;LNUt50S=mA|yFz;FAu>Z8M68-BKz zh|tbvjH>)oxk@uahJao_lrmtmJm zZ>WAC`vdn;3BLdactne~cfp>DNepp(ShVa0$_1VKYu#$* zlhdb8pkXEr$HzpgBlZ4>%SII)6R9_ZpQG~aqFq0P;q#SuRUgk>>nX)WU9tX{}`bb?*4^4%h267jOQFTt)zlEfQ$!RdL?p`XFNUisLG>f@R7oa)`PF4}nr@ZSk&AukB+u+cB%{OxgR=&a=2cZqlmTqu!UIu(d?XZAjOtrU=|ri=Wrs zS$$WwNbw~ZF8gOhi$PFk^d+JPC);Egh7O;pkZtrAuBlE*$Rae-e6LmCK zpntY{C36cV-pWHkJ?`hqcZg<}IV6JvuGQRvA-NfJKMtqjr9#B;o`FW0b)))JHUP28 zlvQi^hB4oka2vl{sb0>ksYp0i`x~>It99qbk+8qhzyP^*<4dXslRg0Qghcx|#VQdm3pXSLQ*{ah6f!VT!g1 zrx5DrRrT(uz9aLK^A|^-_Jc}wbJ*)xV)PD$k{2_qSFSEqZw%j3`NpN0_gC(%e0p}~ z^6Z6~&s7`M)3y2PZ`3|p`{?X1)OO|`J96XPAI<;k`LAD@S^l@n-&y%|<-aYTUjL=_ zZ(eU4Ik#>e`R?k+X1{L!?dvORzqj@yM?N!mWcI(V9jv{5?T#az)&DVbH@pXj%a>N) zI=fPP!~CsFf4gA8lkne{KC|-kb03;{Vda}wF0Cl@|7&TXw!HW|wa+j9=;GDc*39ST znv3nlx6i#e{}YS%FWj}TyLfB$e=ojl=0DahE&NsW*urlv{OrODwHK?;EgV!thoyiG z>F7Px=Q8Ja44$wfBA~hI96I7ij}xx)uVx2Ww__%1}MEQq2 zY};F((X#lsNO9z&T}(Bc-WTng_Naa#mG7z^tE}+PDLUWz$YDq^Kr2zuey<2(Vb`R} zcUF&ythc}|I8f-Li%t_hg?LM%_g&>%s=wC%(X#KKV5q*&MQba2B3E@|Ts@Cj?0SC|Z00>sPuZa^?F)nop_> z<1HfS#0{LcPFG3hAK*h(BPu-1E;DRnb&f#xf6|@DjyYT4DqXD$8FCR_=cfZLvUja_(LmS zE8O|bRtN3rdVa$2e&!eYYeiQ|d#kxinN_uWF+6ErFEXhzdW7C6JjKFxB)yA2eD;@$ zOfbGk`WxRI7oPp$!xK~ds1TX{>pSgckVWnmesM)A18qk+J7-0v_~09|>x&)|DOLk- zPOSWMA}14n(^F4{_}(hSH^QL5U+ybJnks*4Mi1a6(EwTXFK;?kt!JtZnIzScNP$R` zf!!~S$T;i<4TasIEnK;Et!$i zgA3Lsu0g=OisDjVHb9tZqGZjqd~iUUg{u3<77?jBw_g;IBk%*Er^1&9YI>|Bd@(1M zp$1%cI%p8Udu|y348)$Y3(|UOQqZ9i**8Mo;hYIO8Nx82Hbp>jFKW*sDG#XhSSg@* z3Ak#qOgb6M3gpMG=bIpi2hq1eHOo>#?PMD$1sTF&u-j^0Vyp}BeV*}}?f|z!ND7!C z41jvKFJf0rL<}+-6O{+t=&_SP#v9fQXu!d+?^r0o)sd5^gSH){$?Sh7IyzABiWSOr zA450*Tc@=T9KIv#RE%{@Bo%PqR;q1pdDxCMya-+p76dIHK>h4^s-jp#M}ns+**XDP z8}dL^9~>x!auvsu4+x+1L}kuA0MH*TC=bxA(S-Pc-V^&=@mwO=pgBhU0Qyi+$udnF zdE2O)QC*~e7RlMp6bEpfb8D9mPh>5~o(T}%(|vBw@=zNxXcD~mHn9WVZ^}5IknYaP ziZo9*T^F_Y6s0YuAyKey7XfdWRKV~?r}pUcPi0{^kUCNxY6HV0apGs-5JGEE`u$aR(J1}qPv$hFQQM15|@Bvx^WF&HMXA<@%El59;@JOh0jRLelC zACOO~s%o01Ydb}-5(vbW)0c^s(||LyJgf$WNkJ5sj|Ci)w&kH+j;yi1L%OS*)b>$d zqEl2o5lJsbvoa_LkU3r#Rg*Avc_6c(Jake+B@yBq4xq4V63-{p)fH;OFp$y03I#b- zV;wh$l0+ihM&vj=G-<5S9jn_Jj$ahAfrKJ$92_3&)E@t;5A-P7&id4&EfRQapFs!5 zHp>q=yGuIm#WFDCUG!2sAboJ5JJ)I4PKqr-2?qrp&K%I-;Y>DN9gQ>Cp`)Vg%0vqb z^w0n;rkks!4~;)=Y(^5NzPrD<&H7lLiTL{hk`gXlM9Zhi;BHnRoEj4A5^y3iPJ39f zFb_aw;Gtn1y8L(=DEYwFneSQ^Lj^#_tZ(PfnB=qK#68-sz3cgdtOFO#nj5=)$>C+J zkP96MJopmZ2;mLAaevc75JwtQ#M>5{qW$&@?9D9XwaPV&4EA^Ky;!ds!ncq z=ysT1hFagy8(t<#slh}*Dd@rnpa^bl#RT0rdKW5aP(>BT(;dSyJl!@7wNNo=#z$vN zUHVfZ!VN)+b$NIR225fWAJ!9e@XC2ZizEVW)~@K9i*r9hQ#Q^ZFAq4;h(hEHo%uw4 z5S2Qr;-JNm<{O%+Fve9^1!D%zcMxY3*_J|)0NuH!$PF+gi@QAZh72kM5WZ0Wh>j_e zEBUfTRWyonZM0^!D088x_*X|N#FR5kDt5%}h>kd(&fk}!UmkWDgAKuqEjoib=zEGg z8ePd)*HI0&96?h{+wcsuPAlZM%aVp+wJpLbqadt2tTF~mV#VD|leCx1d9-Co1FY`d z5)rbBbH&PoOgyFtIrQCR7pbD!RQHLdLF+(t$HX_ulsyy5Jn<~M&_y~#C;+Hj7J8wg z==xyhTzTN}u+-pqDd2ecM>p7!Mjan!56mE4l6@6j`9K3kWX(oHT-%^-*a$D@k`o97 z&~CmYs{c>q50-~kVxSaE+!F;o7BHErhVGZ9;!5cINT8#^=%KQVgAM({ExnLNo0Np} z|KD9%`<_*0Wqs+hi-!xRj{Mo&FVw!H_LkW%fdBtJai-+e6Wyxlw2Qoe9vICVTcs<% zq0hB{uoR}z(wn4jZr-JrAr02uJ>6LmZATQtNLOZ*w*-YlCV}G`u&M{49N6AIwPo;5 zgX@f0<_3JCs_a?F6F_olA*Y{Mrj3KQb!V#TL7TSFVlVvOX|{HV*PIBVct$ZF^=?HJ zvK(xP8hLB$&8JZg-Dzw`WwjFxJf@i*nwet_pPZ+d>c<>35rW%fhh6agoj5~C3Zn;{Ng^fgxDztId2>VcyxzGr~h3tfW>9m+$5 z0)US_2ZFB$vK)k?Ys8P$K~Awp+x4^fc+U;*2{O^b8##0mPJYLsQI*Pkh?c5CzrvN~ zpi8OZp~bdI9UBcxO&qSKQ%Iv9EgWEd=vfiR@8H?{|L96e44Z_LhqWeY5gs4%<9f8S zuF9lbY=`fQb~w*PO4mJ>x5LF_rZ9|;Mui3JJ>8(b>&u7=ArfsN?L+b`#iEj@nXCy@ z5%<{;p#b2~XG9?YH$hZT9&E{xl3>OA7mjRzr3d@fa&#YUseIXS(T&1Fi%n`04Sgw! zxylkBnz^-`S8DPH?_<2Xye-w<4vQM)1*H52O;Kz3|6jXHU47!|+H;2wXI(pE6iDWs zmeDz zIoExOC~7gJbZesFCQ_(|44PWc(Y>W1u7ji4w!zfvdZx{okI}!9AT{3BG}l7oI;1Za zGJS?g1rXodT^EsX_vhSl{kBI9Qyz}P$4x>R-)iWr2q-1T!`UEdGI0!-QTN)E+VGjW z;5GM<6!PGZWBTiH^W;iQ-ZOuiD8VVrv! zfeRX;dIQPbjs;`gDun51*#N8FT@{7IgXJA0=nm9dmbW?u1EwI1b~y7r143k0_^M(1 z;FLCybwOO$HypG+a8)R)P*;mAOOZqy2ak1Es`vGLOPvmgn%ZZX{*SUhn%}>4p}QGc$7NOo&Z= zlzfpwVs&+6#AS$ z90xMcN30M@ih&{QDoFA|^7=yP3q`_ueWZIt)ZvF68X-FpFVh=fd7Egu zCema_44g!gpQ9@3Z-Ar@)_=vvX$l85L5-bF5M?pownkG52i-o3o})t`VSa{Jcjs#F zcz!R-?B!KZWh-2Ro8bcPAXL}h zLKpYu&RMs)yPuedtOo9$qEZdTT#{ibP&$!+qk1MmI8DW_M3kX(VnorSD4F#&OBqVS}uu347 zU85U?j``HbW*Wqa?yE&6Lpg1TtaeSAcC|^?zO><;`B!Qd+ zF|a~a&{@&|tdrfFL>2e3>yee+mTqumjh2KfRv-|%23%HEG);ae?qjb=#$unMc|e}O<72N$|GRNuh;raT)D>UY7kJiYr0k>0|y3u4Q=?CmcY zP&gaNu4eZOn$MxOAMH%hh#-PbTT@)ojq z%p`nVbCz+>06rbQPs<^;LgDl`D4d}NvVT-$3OhR30Irc|BnbplX&&jmOyp$>E-EqO zZFw+`7&wV#e0OVsw;l(8OQ}Y5Wb#>P9E=;iVZ^Z+YwG6VxACm~+YW{^FSm~a2}i#od^6jOw+=ahn;xLBz!!us%Um_ z9>}_n+e`zCo9*H6x(t^M`f;ne?kjKs7V(r05ef+E-Md9gFIfC(a`W=w6AYNbjw=SJ zPh{GtWGI$tXof}+RMia_(C|+XQ$qp((MTc1KqL`>v$}VQLLEVRKt?CI@{kjan1rsk zYYmpT3qK8l_pUBeG=zp@Om%IKf@_d!j_FdXQ0AXdBw%+>_k_rsIIvo;Pjpi_WD-5T zX<=HkFfsTlR69tBaKRZ!P}`%!t%@y+b;$acU$afy4+Fcy{qCJ}qPFGfG>Ue}D;-g) zmTrBIDS!}LSVh1Vu33q}2yRB`l}zmid5P}0x}(`}_Y}HM#+49AU+CT;^4q530?C#o zM(%;l)t#D?}>C@4Q#Ho*Ew_jZvI%Cjyz zNC-wDNwP0bd7zFMI0b3s5<#9RyTD<9T1ap(Ks!LdZ`>rOTBxm zNWtZfh6GuEd0+|#OhFhQ*A_dj6;$}E$Y3?#`64#LmMCg5bShgKPH#^tloTwI2*4fh z9u>uiz%fP1c3;bh@*qnMl>&<EK|Sl207Id#{!;g&-Fv%X}E(e>T+2iIS__CMEtZtWv${+hA2y!r>L-?#eg>O-sRD}T81T`OA) z*2<~*zgnp-|K{@dFYhnEW%<^nzgha#r5{}S?xhbe9W1?fNm@F#aOcv?mTL2#T>PuW z-(LLH#h+RH#)ZAbXBNJ4abxkm#hVwa3tw3H?7|N(e0Y>sVfyiUK7H8Y^lVUz4OI%F$yw^V+5 zy?X0xz#bbUSXX}RORCRhb|%9EcAL9g>v6Ar+pX1y_?xyG9m=6R#eN6~VjsA<`UWl!kE+Ju)yhBV8E2nr5KQd|JGSyYYt>t4dIs-n)~dIJ?_-=fm4EcQ>bc;z{bkC{ zz0U4lr|vackE~R0j(`20)#@$555a1B?|Sw4OgPhlCH<=4x6O8^&K|YFy10$SBHUrK z+4ss6JZDcU!AD?^4n}_KE35KMzr0~t^_9iy4YTZ@EC1p(RXbXAeQP4fCawH4Q6so3 z&DNGzXT`h&O|UglSJCkG+hjKkT)$n^wl2lQ@)e?HW9*gnr!jhyb#{)PdxKo1nHxxy zVqf_xp(KpbpnipH(rCBdDU<{+ya-mKhyx)?S`$6@=|&UYus+h?3-?w(kSX)vrWX(> zRlZWMHZ!}i4Zc0W>hSD+weF1QZH*li5>ThboNXQCpzcSfSKn##eo>QRjG9bRs(h=c zg&)r?#jXtedU51D#PE%xF1YdgB7(kNTI`x=!Sc5xtol1d=<(MFel_MShtsh|_Cvwm zCu%#_|E}<*o8p&((=BLpOIzVfZxPDg+^t^@E4!L(r9}&JSu_V3)jXAdELxA@i*fXB zM~{88QGF_NWdu1?I8+>@QU&X`zS-zp+;c+d4bj$zecagX%}`C)^e{n&-M*{(c;>!H z8Qhf@#LuL={i&oUg-tNiG}A3%|J)IG?yl;e<5$zKDFR=N2p}c!tSBWgiiRZ4&=TEzVT>a&p3v6^c17kGr5@_a z9K>7T996-8W`G~tRvhZXTVJraG#h}>p=^sB%D57l+L_e;%Y#iYU<$XW!cjq{9&qy! zzMx=9(ZEh=tH{$q$&{wZI?7;dmRwmRSS6Au@Wfjp;M}Id*gRdNJENxtN}R%*raa&T z115pv5g`>#Gyt50FdupZBGp-SiR`elDvDN6KJn2ZO4AB4@QNe?aPRJ#qBe}F8jtIk z{WyAT5uC_^WU(P?qC6C_4G)c6kaOap3QJEXAbA;U|^}@ZH$e zME%^H<}*FDxje`QhDpN2k2-V)Vn>~WL^{M6S@%hkVvSjvXDBkbhJwc>M0AFGX_Q}WqG2b>I~Zf|6nki8fzYNd7s@XgN4kxJ`@1rTx{A?5yt^xjE;80>ooqFpWzD~nR#(}| z!0544v%@3wTG0GZc4Sl~T2KY3jKXS)3=!l4Iv(h|SUP&46x1<2I8GW=s8--5O9(Ru0EakG7a09lprLC-H`0CHMHrgY_num@SLDp6YPL!2J0vWYPe-d(Pbpdqjv=? z^uVqxLBa?|Q!`J)QLK8N>$*_XHI|X=`}PoIkxR-PE;90#4b1|9846Qmyqi#X{8ZHE zfqWXRyvq{&TKCf}58KYgM$0>e7Hpk;WO%@r+eSeB5*YtPYgW;8=8-XM8)Q@j)W`5= zfeMG9t`{V6DC6~A5X*+Htn$Q$qvNzp6`v5rA(G=z-9|C1B@I~;O2C_s&Yb9740bkK zhKt05y+pel=~T`TV;nE#3_Nf=lru#1 V*~Hts)M1Bh&r$~-XMb%R{9kUwOv3;G literal 0 HcmV?d00001 diff --git a/doc/jupyterlite/Makefile b/doc/jupyterlite/Makefile new file mode 100644 index 000000000..97d058e9d --- /dev/null +++ b/doc/jupyterlite/Makefile @@ -0,0 +1,7 @@ +all: + rm files/*.ipynb -f + cp ../../altair/examples/[a-z]*.py files/ + cp wellcome.ipynb files/ + for file_name in files/*.py; do echo $$file_name; cat file_prefix $$file_name | jupytext --from py:percent --to notebook --set-kernel python3 -o $${file_name%.*}.ipynb; done + sed s/python3/python/ files/*.ipynb -i + rm files/*.py diff --git a/doc/jupyterlite/_output/api/contents/all.json b/doc/jupyterlite/_output/api/contents/all.json new file mode 100644 index 000000000..0c15679c8 --- /dev/null +++ b/doc/jupyterlite/_output/api/contents/all.json @@ -0,0 +1,1921 @@ +{ + "content": [ + { + "content": null, + "created": "2022-04-19T21:09:38.825289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.169238Z", + "mimetype": null, + "name": "window_rank.ipynb", + "path": "window_rank.ipynb", + "size": 3026, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.813289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "scatter_marginal_hist.ipynb", + "path": "scatter_marginal_hist.ipynb", + "size": 2685, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.797288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "filled_step_chart.ipynb", + "path": "filled_step_chart.ipynb", + "size": 1448, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.809289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "multiline_highlight.ipynb", + "path": "multiline_highlight.ipynb", + "size": 2037, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.817289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "slider_cutoff.ipynb", + "path": "slider_cutoff.ipynb", + "size": 2072, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.809289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "line_chart_with_points.ipynb", + "path": "line_chart_with_points.ipynb", + "size": 1545, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.817289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "scatter_with_rolling_mean.ipynb", + "path": "scatter_with_rolling_mean.ipynb", + "size": 1793, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.805288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "line_chart_with_datum.ipynb", + "path": "line_chart_with_datum.ipynb", + "size": 1919, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.805288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "interactive_scatter_plot.ipynb", + "path": "interactive_scatter_plot.ipynb", + "size": 1351, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.801288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "interactive_brush.ipynb", + "path": "interactive_brush.ipynb", + "size": 1553, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.821289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "table_bubble_plot_github.ipynb", + "path": "table_bubble_plot_github.ipynb", + "size": 1357, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.825289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.169238Z", + "mimetype": null, + "name": "world_map.ipynb", + "path": "world_map.ipynb", + "size": 1799, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.809289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "normalized_stacked_bar_chart.ipynb", + "path": "normalized_stacked_bar_chart.ipynb", + "size": 1413, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.821289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "stripplot.ipynb", + "path": "stripplot.ipynb", + "size": 2144, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.813289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "scatter_qq.ipynb", + "path": "scatter_qq.ipynb", + "size": 1581, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.821289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "strip_plot.ipynb", + "path": "strip_plot.ipynb", + "size": 1243, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.809289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "multiple_marks.ipynb", + "path": "multiple_marks.ipynb", + "size": 1331, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.789287Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "bar_and_line_with_dual_axis.ipynb", + "path": "bar_and_line_with_dual_axis.ipynb", + "size": 1532, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.813289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "scatter_with_histogram.ipynb", + "path": "scatter_with_histogram.ipynb", + "size": 2861, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.789287Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "bar_chart_horizontal.ipynb", + "path": "bar_chart_horizontal.ipynb", + "size": 1310, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.793288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "bar_chart_with_highlighted_segment.ipynb", + "path": "bar_chart_with_highlighted_segment.ipynb", + "size": 1812, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.813289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "ridgeline_plot.ipynb", + "path": "ridgeline_plot.ipynb", + "size": 3010, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.821289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "trellis_scatter_plot.ipynb", + "path": "trellis_scatter_plot.ipynb", + "size": 1297, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.821289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "stacked_bar_chart_with_text.ipynb", + "path": "stacked_bar_chart_with_text.ipynb", + "size": 1820, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.801288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "grouped_bar_chart2.ipynb", + "path": "grouped_bar_chart2.ipynb", + "size": 1816, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.817289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "selection_layer_bar_month.ipynb", + "path": "selection_layer_bar_month.ipynb", + "size": 1939, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.805288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "interval_selection.ipynb", + "path": "interval_selection.ipynb", + "size": 1763, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.805288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "isotype_emoji.ipynb", + "path": "isotype_emoji.ipynb", + "size": 4319, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.793288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "beckers_barley_wrapped_facet.ipynb", + "path": "beckers_barley_wrapped_facet.ipynb", + "size": 1765, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.821289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "trellis_area_sort_array.ipynb", + "path": "trellis_area_sort_array.ipynb", + "size": 1553, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.825289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "us_population_over_time.ipynb", + "path": "us_population_over_time.ipynb", + "size": 2215, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.797288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "errorbars_with_std.ipynb", + "path": "errorbars_with_std.ipynb", + "size": 1651, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.817289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "seattle_weather_interactive.ipynb", + "path": "seattle_weather_interactive.ipynb", + "size": 3038, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.801288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "interactive_layered_crossfilter.ipynb", + "path": "interactive_layered_crossfilter.ipynb", + "size": 2378, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.789287Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "airport_connections.ipynb", + "path": "airport_connections.ipynb", + "size": 3566, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.793288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "candlestick_chart.ipynb", + "path": "candlestick_chart.ipynb", + "size": 2479, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.821289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "stacked_bar_chart_sorted_segments.ipynb", + "path": "stacked_bar_chart_sorted_segments.ipynb", + "size": 1501, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.793288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "bar_with_rolling_mean.ipynb", + "path": "bar_with_rolling_mean.ipynb", + "size": 1752, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.817289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "simple_scatter_with_errorbars.ipynb", + "path": "simple_scatter_with_errorbars.ipynb", + "size": 2133, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.793288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "bar_chart_with_mean_line.ipynb", + "path": "bar_chart_with_mean_line.ipynb", + "size": 1440, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.805288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "line_chart_with_cumsum.ipynb", + "path": "line_chart_with_cumsum.ipynb", + "size": 1791, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.821289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "step_chart.ipynb", + "path": "step_chart.ipynb", + "size": 1633, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.801288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "histogram_responsive.ipynb", + "path": "histogram_responsive.ipynb", + "size": 1958, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.817289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "scatter_with_loess.ipynb", + "path": "scatter_with_loess.ipynb", + "size": 1868, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.821289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "stacked_bar_chart.ipynb", + "path": "stacked_bar_chart.ipynb", + "size": 1362, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.789287Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "area_chart_gradient.ipynb", + "path": "area_chart_gradient.ipynb", + "size": 1886, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.797288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "donut_chart.ipynb", + "path": "donut_chart.ipynb", + "size": 1558, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.801288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "gantt_chart.ipynb", + "path": "gantt_chart.ipynb", + "size": 1428, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.809289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "london_tube.ipynb", + "path": "london_tube.ipynb", + "size": 3269, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.801288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "histogram_with_a_global_mean_overlay.ipynb", + "path": "histogram_with_a_global_mean_overlay.ipynb", + "size": 1527, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.813289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "scatter_href.ipynb", + "path": "scatter_href.ipynb", + "size": 1631, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.817289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "select_mark_area.ipynb", + "path": "select_mark_area.ipynb", + "size": 1905, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.793288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "boxplot.ipynb", + "path": "boxplot.ipynb", + "size": 1537, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.817289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "simple_histogram.ipynb", + "path": "simple_histogram.ipynb", + "size": 1356, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.793288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "beckers_barley_trellis_plot.ipynb", + "path": "beckers_barley_trellis_plot.ipynb", + "size": 2328, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.793288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "bar_chart_with_negatives.ipynb", + "path": "bar_chart_with_negatives.ipynb", + "size": 1547, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.817289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "simple_bar_chart.ipynb", + "path": "simple_bar_chart.ipynb", + "size": 1354, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.809289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "line_with_log_scale.ipynb", + "path": "line_with_log_scale.ipynb", + "size": 1444, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.813289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "ranged_dot_plot.ipynb", + "path": "ranged_dot_plot.ipynb", + "size": 2266, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.801288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "grouped_bar_chart_with_error_bars.ipynb", + "path": "grouped_bar_chart_with_error_bars.ipynb", + "size": 1583, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.821289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "trellis_histogram.ipynb", + "path": "trellis_histogram.ipynb", + "size": 1368, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.825289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.169238Z", + "mimetype": null, + "name": "us_state_capitals.ipynb", + "path": "us_state_capitals.ipynb", + "size": 2342, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.821289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "top_k_items.ipynb", + "path": "top_k_items.ipynb", + "size": 1746, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.813289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "scatter_matrix.ipynb", + "path": "scatter_matrix.ipynb", + "size": 1649, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.817289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "simple_heatmap.ipynb", + "path": "simple_heatmap.ipynb", + "size": 1595, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.793288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "bar_rounded.ipynb", + "path": "bar_rounded.ipynb", + "size": 1403, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.809289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "line_chart_with_generator.ipynb", + "path": "line_chart_with_generator.ipynb", + "size": 1486, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.825289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.169238Z", + "mimetype": null, + "name": "wind_vector_map.ipynb", + "path": "wind_vector_map.ipynb", + "size": 1915, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.813289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "scatter_tooltips.ipynb", + "path": "scatter_tooltips.ipynb", + "size": 1562, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.817289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "simple_stacked_area_chart.ipynb", + "path": "simple_stacked_area_chart.ipynb", + "size": 1320, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.821289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "stem_and_leaf.ipynb", + "path": "stem_and_leaf.ipynb", + "size": 2134, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.813289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "parallel_coordinates.ipynb", + "path": "parallel_coordinates.ipynb", + "size": 1904, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.809289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "multiple_interactions.ipynb", + "path": "multiple_interactions.ipynb", + "size": 4732, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.825289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "trellis_stacked_bar_chart.ipynb", + "path": "trellis_stacked_bar_chart.ipynb", + "size": 1424, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.817289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "scatter_with_layered_histogram.ipynb", + "path": "scatter_with_layered_histogram.ipynb", + "size": 3340, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.805288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "layered_chart_bar_mark.ipynb", + "path": "layered_chart_bar_mark.ipynb", + "size": 1753, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.797288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "co2_concentration.ipynb", + "path": "co2_concentration.ipynb", + "size": 3147, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.817289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "scatter_with_minimap.ipynb", + "path": "scatter_with_minimap.ipynb", + "size": 2490, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.821289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "trellis_area.ipynb", + "path": "trellis_area.ipynb", + "size": 1375, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.793288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "bump_chart.ipynb", + "path": "bump_chart.ipynb", + "size": 1885, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.805288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "isotype_grid.ipynb", + "path": "isotype_grid.ipynb", + "size": 2136, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.825289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "us_employment.ipynb", + "path": "us_employment.ipynb", + "size": 2798, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.805288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "layer_line_color_rule.ipynb", + "path": "layer_line_color_rule.ipynb", + "size": 1713, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.817289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "simple_line_chart.ipynb", + "path": "simple_line_chart.ipynb", + "size": 1393, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.809289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "line_with_ci.ipynb", + "path": "line_with_ci.ipynb", + "size": 1534, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.789287Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "airports_count.ipynb", + "path": "airports_count.ipynb", + "size": 2166, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.829289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.169238Z", + "mimetype": null, + "name": "world_projections.ipynb", + "path": "world_projections.ipynb", + "size": 1777, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.789287Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "anscombe_plot.ipynb", + "path": "anscombe_plot.ipynb", + "size": 1653, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.825289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "us_population_over_time_facet.ipynb", + "path": "us_population_over_time_facet.ipynb", + "size": 1644, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.805288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "layered_histogram.ipynb", + "path": "layered_histogram.ipynb", + "size": 1789, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.793288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "bar_chart_with_highlighted_bar.ipynb", + "path": "bar_chart_with_highlighted_bar.ipynb", + "size": 1684, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.813289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "pyramid.ipynb", + "path": "pyramid.ipynb", + "size": 1713, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.801288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "horizontal_stacked_bar_chart.ipynb", + "path": "horizontal_stacked_bar_chart.ipynb", + "size": 1385, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.809289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "normalized_stacked_area_chart.ipynb", + "path": "normalized_stacked_area_chart.ipynb", + "size": 1358, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.813289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "radial_chart.ipynb", + "path": "radial_chart.ipynb", + "size": 1772, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.793288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "bar_chart_with_labels.ipynb", + "path": "bar_chart_with_labels.ipynb", + "size": 1577, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.809289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "multifeature_scatter_plot.ipynb", + "path": "multifeature_scatter_plot.ipynb", + "size": 1432, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.813289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "pie_chart_with_labels.ipynb", + "path": "pie_chart_with_labels.ipynb", + "size": 1775, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.821289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "top_k_with_others.ipynb", + "path": "top_k_with_others.ipynb", + "size": 2103, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.805288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "layered_area_chart.ipynb", + "path": "layered_area_chart.ipynb", + "size": 1315, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.817289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "select_detail.ipynb", + "path": "select_detail.ipynb", + "size": 3365, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.797288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "falkensee.ipynb", + "path": "falkensee.ipynb", + "size": 4367, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.809289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "multiline_tooltip.ipynb", + "path": "multiline_tooltip.ipynb", + "size": 3585, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.789287Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "bar_chart_trellis_compact.ipynb", + "path": "bar_chart_trellis_compact.ipynb", + "size": 3879, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.797288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "choropleth_repeat.ipynb", + "path": "choropleth_repeat.ipynb", + "size": 1778, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.813289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "pacman_chart.ipynb", + "path": "pacman_chart.ipynb", + "size": 1453, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.825289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.169238Z", + "mimetype": null, + "name": "us_population_pyramid_over_time.ipynb", + "path": "us_population_pyramid_over_time.ipynb", + "size": 2922, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.813289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "poly_fit_regression.ipynb", + "path": "poly_fit_regression.ipynb", + "size": 2095, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.825289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.169238Z", + "mimetype": null, + "name": "weather_heatmap.ipynb", + "path": "weather_heatmap.ipynb", + "size": 1733, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.821289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "sorted_error_bars_with_ci.ipynb", + "path": "sorted_error_bars_with_ci.ipynb", + "size": 1941, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.797288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "cumulative_count_chart.ipynb", + "path": "cumulative_count_chart.ipynb", + "size": 1508, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.805288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "layered_heatmap_text.ipynb", + "path": "layered_heatmap_text.ipynb", + "size": 2125, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.793288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "bubble_plot.ipynb", + "path": "bubble_plot.ipynb", + "size": 1274, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.797288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "density_stack.ipynb", + "path": "density_stack.ipynb", + "size": 2173, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.801288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "hexbins.ipynb", + "path": "hexbins.ipynb", + "size": 2727, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.821289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "trail_marker.ipynb", + "path": "trail_marker.ipynb", + "size": 1311, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.797288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "density_facet.ipynb", + "path": "density_facet.ipynb", + "size": 1721, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.813289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "scatter_linked_table.ipynb", + "path": "scatter_linked_table.ipynb", + "size": 2591, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.797288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "diverging_stacked_bar_chart.ipynb", + "path": "diverging_stacked_bar_chart.ipynb", + "size": 13533, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.825289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.169238Z", + "mimetype": null, + "name": "wheat_wages.ipynb", + "path": "wheat_wages.ipynb", + "size": 3287, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.805288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "line_chart_with_color_datum.ipynb", + "path": "line_chart_with_color_datum.ipynb", + "size": 1739, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.793288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "choropleth.ipynb", + "path": "choropleth.ipynb", + "size": 1524, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.797288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "cumulative_wiki_donations.ipynb", + "path": "cumulative_wiki_donations.ipynb", + "size": 1700, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.805288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "layered_bar_chart.ipynb", + "path": "layered_bar_chart.ipynb", + "size": 1345, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.821289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "streamgraph.ipynb", + "path": "streamgraph.ipynb", + "size": 1524, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.801288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "interactive_legend.ipynb", + "path": "interactive_legend.ipynb", + "size": 1878, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.805288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "jitter_chart.ipynb", + "path": "jitter_chart.ipynb", + "size": 2068, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.813289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "percentage_of_total.ipynb", + "path": "percentage_of_total.ipynb", + "size": 1656, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.801288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "image_tooltip.ipynb", + "path": "image_tooltip.ipynb", + "size": 1611, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.805288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "iowa_electricity.ipynb", + "path": "iowa_electricity.ipynb", + "size": 1769, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.821289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "top_k_letters.ipynb", + "path": "top_k_letters.ipynb", + "size": 2634, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.817289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "selection_histogram.ipynb", + "path": "selection_histogram.ipynb", + "size": 1862, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.797288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "connected_scatterplot.ipynb", + "path": "connected_scatterplot.ipynb", + "size": 1722, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.801288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "interactive_cross_highlight.ipynb", + "path": "interactive_cross_highlight.ipynb", + "size": 2520, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.801288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "gapminder_bubble_plot.ipynb", + "path": "gapminder_bubble_plot.ipynb", + "size": 1633, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.793288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "binned_scatterplot.ipynb", + "path": "binned_scatterplot.ipynb", + "size": 1330, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.797288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "comet_chart.ipynb", + "path": "comet_chart.ipynb", + "size": 2592, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.797288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "errorbars_with_ci.ipynb", + "path": "errorbars_with_ci.ipynb", + "size": 1788, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.809289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "one_dot_per_zipcode.ipynb", + "path": "one_dot_per_zipcode.ipynb", + "size": 1675, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.813289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "scatter_linked_brush.ipynb", + "path": "scatter_linked_brush.ipynb", + "size": 1700, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.825289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "us_incomebrackets_by_state_facet.ipynb", + "path": "us_incomebrackets_by_state_facet.ipynb", + "size": 1755, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.809289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "multi_series_line.ipynb", + "path": "multi_series_line.ipynb", + "size": 1418, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.805288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "isotype.ipynb", + "path": "isotype.ipynb", + "size": 7806, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.805288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "layered_chart_with_dual_axis.ipynb", + "path": "layered_chart_with_dual_axis.ipynb", + "size": 1891, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.789287Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "bar_chart_sorted.ipynb", + "path": "bar_chart_sorted.ipynb", + "size": 1266, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.825289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.169238Z", + "mimetype": null, + "name": "wilkinson-dot-plot.ipynb", + "path": "wilkinson-dot-plot.ipynb", + "size": 1640, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.825289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.169238Z", + "mimetype": null, + "name": "violin_plot.ipynb", + "path": "violin_plot.ipynb", + "size": 2073, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.809289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "line_percent.ipynb", + "path": "line_percent.ipynb", + "size": 1430, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.817289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "slope_graph.ipynb", + "path": "slope_graph.ipynb", + "size": 1263, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.809289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "normed_parallel_coordinates.ipynb", + "path": "normed_parallel_coordinates.ipynb", + "size": 2515, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.801288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "grouped_bar_chart_horizontal.ipynb", + "path": "grouped_bar_chart_horizontal.ipynb", + "size": 1318, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.793288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "binned_heatmap.ipynb", + "path": "binned_heatmap.ipynb", + "size": 1413, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.809289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "natural_disasters.ipynb", + "path": "natural_disasters.ipynb", + "size": 1774, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.789287Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "airports.ipynb", + "path": "airports.ipynb", + "size": 1885, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.801288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "grouped_bar_chart.ipynb", + "path": "grouped_bar_chart.ipynb", + "size": 1288, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.813289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.161237Z", + "mimetype": null, + "name": "pie_chart.ipynb", + "path": "pie_chart.ipynb", + "size": 1534, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.797288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "dot_dash_plot.ipynb", + "path": "dot_dash_plot.ipynb", + "size": 2444, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.813289Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.165237Z", + "mimetype": null, + "name": "scatter_with_labels.ipynb", + "path": "scatter_with_labels.ipynb", + "size": 1622, + "type": "notebook", + "writable": true + }, + { + "content": null, + "created": "2022-04-19T21:09:38.801288Z", + "format": null, + "last_modified": "2022-04-19T21:07:30.157237Z", + "mimetype": null, + "name": "horizon_graph.ipynb", + "path": "horizon_graph.ipynb", + "size": 2423, + "type": "notebook", + "writable": true + } + ], + "created": "2022-04-19T21:09:38.825289Z", + "format": "json", + "last_modified": "2022-04-19T21:09:38.825289Z", + "mimetype": null, + "name": "", + "path": "", + "size": null, + "type": "directory", + "writable": true +} \ No newline at end of file diff --git a/doc/jupyterlite/_output/api/translations/all.json b/doc/jupyterlite/_output/api/translations/all.json new file mode 100644 index 000000000..0f1a90ee5 --- /dev/null +++ b/doc/jupyterlite/_output/api/translations/all.json @@ -0,0 +1,9 @@ +{ + "data": { + "en": { + "displayName": "English", + "nativeName": "English" + } + }, + "message": "" +} \ No newline at end of file diff --git a/doc/jupyterlite/_output/api/translations/en.json b/doc/jupyterlite/_output/api/translations/en.json new file mode 100644 index 000000000..2d378ee6a --- /dev/null +++ b/doc/jupyterlite/_output/api/translations/en.json @@ -0,0 +1,4 @@ +{ + "data": {}, + "message": "" +} \ No newline at end of file diff --git a/doc/jupyterlite/_output/bootstrap.js b/doc/jupyterlite/_output/bootstrap.js new file mode 100644 index 000000000..9db014aa8 --- /dev/null +++ b/doc/jupyterlite/_output/bootstrap.js @@ -0,0 +1,92 @@ +/*----------------------------------------------------------------------------- +| Copyright (c) Jupyter Development Team. +| Distributed under the terms of the Modified BSD License. +|----------------------------------------------------------------------------*/ + +// We copy some of the pageconfig parsing logic in @jupyterlab/coreutils +// below, since this must run before any other files are loaded (including +// @jupyterlab/coreutils). + +/** + * Get global configuration data for the Jupyter application. + * + * @param name - The name of the configuration option. + * + * @returns The config value or an empty string if not found. + * + * #### Notes + * All values are treated as strings. For browser based applications, it is + * assumed that the page HTML includes a script tag with the id + * `jupyter-config-data` containing the configuration as valid JSON. + */ +let _CONFIG_DATA = null; +function getOption(name) { + if (_CONFIG_DATA === null) { + let configData = {}; + // Use script tag if available. + if (typeof document !== 'undefined' && document) { + const el = document.getElementById('jupyter-config-data'); + + if (el) { + configData = JSON.parse(el.textContent || '{}'); + } + } + _CONFIG_DATA = configData; + } + + return _CONFIG_DATA[name] || ''; +} + +// eslint-disable-next-line no-undef +__webpack_public_path__ = getOption('fullStaticUrl') + '/'; + +function loadScript(url) { + return new Promise((resolve, reject) => { + const newScript = document.createElement('script'); + newScript.onerror = reject; + newScript.onload = resolve; + newScript.async = true; + document.head.appendChild(newScript); + newScript.src = url; + }); +} + +async function loadComponent(url, scope) { + await loadScript(url); + + // From https://webpack.js.org/concepts/module-federation/#dynamic-remote-containers + await __webpack_init_sharing__('default'); + const container = window._JUPYTERLAB[scope]; + // Initialize the container, it may provide shared modules and may need ours + await container.init(__webpack_share_scopes__.default); +} + +void (async function bootstrap() { + // This is all the data needed to load and activate plugins. This should be + // gathered by the server and put onto the initial page template. + const extension_data = getOption('federated_extensions'); + + // We first load all federated components so that the shared module + // deduplication can run and figure out which shared modules from all + // components should be actually used. We have to do this before importing + // and using the module that actually uses these components so that all + // dependencies are initialized. + let labExtensionUrl = getOption('fullLabextensionsUrl'); + const extensions = await Promise.allSettled( + extension_data.map(async data => { + await loadComponent(`${labExtensionUrl}/${data.name}/${data.load}`, data.name); + }) + ); + + extensions.forEach(p => { + if (p.status === 'rejected') { + // There was an error loading the component + console.error(p.reason); + } + }); + + // Now that all federated containers are initialized with the main + // container, we can import the main function. + let main = (await import('./index.js')).main; + window.addEventListener('load', main); +})(); diff --git a/doc/jupyterlite/_output/config-utils.js b/doc/jupyterlite/_output/config-utils.js new file mode 100644 index 000000000..2a4c757cb --- /dev/null +++ b/doc/jupyterlite/_output/config-utils.js @@ -0,0 +1,267 @@ +/** + * configuration utilities for jupyter-lite + * + * this file may not import anything else, and exposes no API + */ + +/* + * An `index.html` should `await import('../config-utils.js')` after specifying + * the key `script` tags... + * + * ```html + * + * ``` + */ +const JUPYTER_CONFIG_ID = 'jupyter-config-data'; + +/* + * The JS-mangled name for `data-jupyter-lite-root` + */ +const LITE_ROOT_ATTR = 'jupyterLiteRoot'; + +/** + * The well-known filename that contains `#jupyter-config-data` and other goodies + */ +const LITE_FILES = ['jupyter-lite.json', 'jupyter-lite.ipynb']; + +/** + * And this link tag, used like so to load a bundle after configuration. + * + * ```html + * + * ``` + */ +const LITE_MAIN = 'jupyter-lite-main'; + +/** + * The current page, with trailing server junk stripped + */ +const HERE = `${window.location.origin}${window.location.pathname.replace( + /(\/|\/index.html)?$/, + '' +)}/`; + +/** + * The computed composite configuration + */ +let _JUPYTER_CONFIG; + +/** + * A handle on the config script, must exist, and will be overridden + */ +const CONFIG_SCRIPT = document.getElementById(JUPYTER_CONFIG_ID); + +/** + * The relative path to the root of this JupyterLite + */ +const RAW_LITE_ROOT = CONFIG_SCRIPT.dataset[LITE_ROOT_ATTR]; + +/** + * The fully-resolved path to the root of this JupyterLite + */ +const FULL_LITE_ROOT = new URL(RAW_LITE_ROOT, HERE).toString(); + +/** + * Paths that are joined with baseUrl to derive full URLs + */ +const UNPREFIXED_PATHS = ['licensesUrl', 'themesUrl']; + +/* a DOM parser for reading html files */ +const parser = new DOMParser(); + +/** + * Merge `jupyter-config-data` on the current page with: + * - the contents of `.jupyter-lite#/jupyter-config-data` + * - parent documents, and their `.jupyter-lite#/jupyter-config-data` + * ...up to `jupyter-lite-root`. + */ +async function jupyterConfigData() { + /** + * Return the value if already cached for some reason + */ + if (_JUPYTER_CONFIG != null) { + return _JUPYTER_CONFIG; + } + + let parent = new URL(HERE).toString(); + let promises = [getPathConfig(HERE)]; + while (parent != FULL_LITE_ROOT) { + parent = new URL('..', parent).toString(); + promises.unshift(getPathConfig(parent)); + } + + const configs = (await Promise.all(promises)).flat(); + + let finalConfig = configs.reduce(mergeOneConfig); + + // apply any final patches + finalConfig = dedupFederatedExtensions(finalConfig); + + // hoist to cache + _JUPYTER_CONFIG = finalConfig; + + return finalConfig; +} + +/** + * Merge a new configuration on top of the existing config + */ +function mergeOneConfig(memo, config) { + for (const [k, v] of Object.entries(config)) { + switch (k) { + // this list of extension names is appended + case 'disabledExtensions': + case 'federated_extensions': + memo[k] = [...(memo[k] || []), ...v]; + break; + // these `@org/pkg:plugin` are merged at the first level of values + case 'litePluginSettings': + case 'settingsOverrides': + if (!memo[k]) { + memo[k] = {}; + } + for (const [plugin, defaults] of Object.entries(v || {})) { + memo[k][plugin] = { ...(memo[k][plugin] || {}), ...defaults }; + } + break; + default: + memo[k] = v; + } + } + return memo; +} + +function dedupFederatedExtensions(config) { + const originalList = Object.keys(config || {})['federated_extensions'] || []; + const named = {}; + for (const ext of originalList) { + named[ext.name] = ext; + } + let allExtensions = [...Object.values(named)]; + allExtensions.sort((a, b) => a.name.localeCompare(b.name)); + return config; +} + +/** + * Load jupyter config data from (this) page and merge with + * `jupyter-lite.json#jupyter-config-data` + */ +async function getPathConfig(url) { + let promises = [getPageConfig(url)]; + for (const fileName of LITE_FILES) { + promises.unshift(getLiteConfig(url, fileName)); + } + return Promise.all(promises); +} + +/** + * The current normalized location + */ +function here() { + return window.location.href.replace(/(\/|\/index.html)?$/, '/'); +} + +/** + * Maybe fetch an `index.html` in this folder, which must contain the trailing slash. + */ +export async function getPageConfig(url = null) { + let script = CONFIG_SCRIPT; + + if (url != null) { + const text = await (await window.fetch(`${url}index.html`)).text(); + const doc = parser.parseFromString(text, 'text/html'); + script = doc.getElementById(JUPYTER_CONFIG_ID); + } + return fixRelativeUrls(url, JSON.parse(script.textContent)); +} + +/** + * Fetch a jupyter-lite JSON or Notebook in this folder, which must contain the trailing slash. + */ +export async function getLiteConfig(url, fileName) { + let text = '{}'; + let config = {}; + const liteUrl = `${url || HERE}${fileName}`; + try { + text = await (await window.fetch(liteUrl)).text(); + const json = JSON.parse(text); + const liteConfig = fileName.endsWith('.ipynb') + ? json['metadata']['jupyter-lite'] + : json; + config = liteConfig[JUPYTER_CONFIG_ID] || {}; + } catch (err) { + console.warn(`failed get ${JUPYTER_CONFIG_ID} from ${liteUrl}`); + } + return fixRelativeUrls(url, config); +} + +export function fixRelativeUrls(url, config) { + let urlBase = new URL(url || here()).pathname; + for (const [k, v] of Object.entries(config)) { + config[k] = fixOneRelativeUrl(k, v, url, urlBase); + } + return config; +} + +export function fixOneRelativeUrl(key, value, url, urlBase) { + if (key === 'litePluginSettings' || key === 'settingsOverrides') { + // these are plugin id-keyed objects, fix each plugin + return Object.entries(value || {}).reduce((m, [k, v]) => { + m[k] = fixRelativeUrls(url, v); + return m; + }, {}); + } else if ( + !UNPREFIXED_PATHS.includes(key) && + key.endsWith('Url') && + value.startsWith('./') + ) { + // themesUrls, etc. are joined in code with baseUrl, leave as-is: otherwise, clean + return `${urlBase}${value.slice(2)}`; + } else if (key.endsWith('Urls') && Array.isArray(value)) { + return value.map((v) => (v.startsWith('./') ? `${urlBase}${v.slice(2)}` : v)); + } + return value; +} + +/** + * Update with the as-configured favicon + */ +function addFavicon(config) { + const favicon = document.createElement('link'); + favicon.rel = 'icon'; + favicon.type = 'image/x-icon'; + favicon.href = config.faviconUrl; + document.head.appendChild(favicon); +} + +/** + * The main entry point. + */ +async function main() { + const config = await jupyterConfigData(); + if (config.baseUrl === new URL(here()).pathname) { + window.location.href = config.appUrl.replace(/\/?$/, '/index.html'); + return; + } + // rewrite the config + CONFIG_SCRIPT.textContent = JSON.stringify(config, null, 2); + addFavicon(config); + const preloader = document.getElementById(LITE_MAIN); + const bundle = document.createElement('script'); + bundle.src = preloader.href; + bundle.main = preloader.main; + document.head.appendChild(bundle); +} + +/** + * TODO: consider better pattern for invocation. + */ +void main(); diff --git a/doc/jupyterlite/_output/doc/workspaces/index.html b/doc/jupyterlite/_output/doc/workspaces/index.html new file mode 100644 index 000000000..9849b7263 --- /dev/null +++ b/doc/jupyterlite/_output/doc/workspaces/index.html @@ -0,0 +1,14 @@ + + + + + + diff --git a/doc/jupyterlite/_output/extensions/jupyterlab_pygments/install.json b/doc/jupyterlite/_output/extensions/jupyterlab_pygments/install.json new file mode 100644 index 000000000..ee3b3e222 --- /dev/null +++ b/doc/jupyterlite/_output/extensions/jupyterlab_pygments/install.json @@ -0,0 +1,5 @@ +{ + "packageManager": "python", + "packageName": "jupyterlab_pygments", + "uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyterlab_pygments" +} diff --git a/doc/jupyterlite/_output/extensions/jupyterlab_pygments/package.json b/doc/jupyterlite/_output/extensions/jupyterlab_pygments/package.json new file mode 100644 index 000000000..e555ec834 --- /dev/null +++ b/doc/jupyterlite/_output/extensions/jupyterlab_pygments/package.json @@ -0,0 +1,104 @@ +{ + "name": "jupyterlab_pygments", + "version": "0.2.2", + "description": "Pygments theme using JupyterLab CSS variables", + "keywords": [ + "jupyter", + "jupyterlab", + "jupyterlab-extension" + ], + "homepage": "https://github.com/jupyterlab/jupyterlab_pygments", + "bugs": { + "url": "https://github.com/jupyterlab/jupyterlab_pygments/issues" + }, + "license": "BSD-3-Clause", + "author": { + "name": "Jupyter Development Team", + "email": "jupyter@googlegroups.com" + }, + "files": [ + "lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}", + "style/**/*.{css,js,eot,gif,html,jpg,json,png,svg,woff2,ttf}" + ], + "main": "lib/index.js", + "types": "lib/index.d.ts", + "style": "style/index.css", + "repository": { + "type": "git", + "url": "https://github.com/jupyterlab/jupyterlab_pygments.git" + }, + "scripts": { + "build": "jlpm build:css && jlpm build:lib && jlpm build:labextension:dev", + "build:prod": "jlpm clean && jlpm build:css && jlpm build:lib && jlpm build:labextension", + "build:labextension": "jupyter labextension build .", + "build:labextension:dev": "jupyter labextension build --development True .", + "build:lib": "tsc", + "build:css": "python generate_css.py", + "clean": "jlpm clean:lib", + "clean:lib": "rimraf lib tsconfig.tsbuildinfo style/base.css", + "clean:lintcache": "rimraf .eslintcache .stylelintcache", + "clean:labextension": "rimraf jupyterlab_pygments/labextension", + "clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache", + "eslint": "jlpm eslint:check --fix", + "eslint:check": "eslint . --cache --ext .ts,.tsx", + "install:extension": "jlpm build", + "lint": "jlpm stylelint && jlpm prettier && jlpm eslint", + "lint:check": "jlpm stylelint:check && jlpm prettier:check && jlpm eslint:check", + "prettier": "jlpm prettier:base --write --list-different", + "prettier:base": "prettier \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"", + "prettier:check": "jlpm prettier:base --check", + "stylelint": "jlpm stylelint:check --fix", + "stylelint:check": "stylelint --cache \"style/**/*.css\"", + "watch": "run-p watch:src watch:labextension", + "watch:src": "tsc -w", + "watch:labextension": "jupyter labextension watch ." + }, + "dependencies": { + "@jupyterlab/application": "^3.1.0" + }, + "devDependencies": { + "@jupyterlab/builder": "^3.1.0", + "@typescript-eslint/eslint-plugin": "^4.8.1", + "@typescript-eslint/parser": "^4.8.1", + "eslint": "^7.14.0", + "eslint-config-prettier": "^6.15.0", + "eslint-plugin-prettier": "^3.1.4", + "npm-run-all": "^4.1.5", + "prettier": "^2.1.1", + "rimraf": "^3.0.2", + "stylelint": "^14.3.0", + "stylelint-config-prettier": "^9.0.3", + "stylelint-config-recommended": "^6.0.0", + "stylelint-config-standard": "~24.0.0", + "stylelint-prettier": "^2.0.0", + "typescript": "~4.1.3" + }, + "sideEffects": [ + "style/*.css", + "style/index.js" + ], + "styleModule": "style/index.js", + "publishConfig": { + "access": "public" + }, + "jupyterlab": { + "extension": true, + "outputDir": "jupyterlab_pygments/labextension", + "_build": { + "load": "static/remoteEntry.aa1060b2d1221f8e5688.js", + "extension": "./extension", + "style": "./style" + } + }, + "jupyter-releaser": { + "hooks": { + "before-build-npm": [ + "python -m pip install jupyterlab~=3.1", + "jlpm" + ], + "before-build-python": [ + "jlpm clean:all" + ] + } + } +} diff --git a/doc/jupyterlite/_output/extensions/jupyterlab_pygments/static/568.1e2faa2ba0bbe59c4780.js b/doc/jupyterlite/_output/extensions/jupyterlab_pygments/static/568.1e2faa2ba0bbe59c4780.js new file mode 100644 index 000000000..2a00160a8 --- /dev/null +++ b/doc/jupyterlite/_output/extensions/jupyterlab_pygments/static/568.1e2faa2ba0bbe59c4780.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkjupyterlab_pygments=self.webpackChunkjupyterlab_pygments||[]).push([[568],{568:(t,e,a)=>{a.r(e),a.d(e,{default:()=>p});const p={id:"jupyterlab_pygments:plugin",autoStart:!0,activate:t=>{}}}}]); \ No newline at end of file diff --git a/doc/jupyterlite/_output/extensions/jupyterlab_pygments/static/747.8eb3ddccc7ec4987bff9.js b/doc/jupyterlite/_output/extensions/jupyterlab_pygments/static/747.8eb3ddccc7ec4987bff9.js new file mode 100644 index 000000000..63f9bec59 --- /dev/null +++ b/doc/jupyterlite/_output/extensions/jupyterlab_pygments/static/747.8eb3ddccc7ec4987bff9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkjupyterlab_pygments=self.webpackChunkjupyterlab_pygments||[]).push([[747],{150:(r,o,e)=>{e.d(o,{Z:()=>n});var t=e(645),i=e.n(t)()((function(r){return r[1]}));i.push([r.id,"\n/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n/* This file was auto-generated by generate_css.py in jupyterlab_pygments */\n\n.highlight .hll { background-color: var(--jp-cell-editor-active-background) }\n.highlight { background: var(--jp-cell-editor-background); color: var(--jp-mirror-editor-variable-color) }\n.highlight .c { color: var(--jp-mirror-editor-comment-color); font-style: italic } /* Comment */\n.highlight .err { color: var(--jp-mirror-editor-error-color) } /* Error */\n.highlight .k { color: var(--jp-mirror-editor-keyword-color); font-weight: bold } /* Keyword */\n.highlight .o { color: var(--jp-mirror-editor-operator-color); font-weight: bold } /* Operator */\n.highlight .p { color: var(--jp-mirror-editor-punctuation-color) } /* Punctuation */\n.highlight .ch { color: var(--jp-mirror-editor-comment-color); font-style: italic } /* Comment.Hashbang */\n.highlight .cm { color: var(--jp-mirror-editor-comment-color); font-style: italic } /* Comment.Multiline */\n.highlight .cp { color: var(--jp-mirror-editor-comment-color); font-style: italic } /* Comment.Preproc */\n.highlight .cpf { color: var(--jp-mirror-editor-comment-color); font-style: italic } /* Comment.PreprocFile */\n.highlight .c1 { color: var(--jp-mirror-editor-comment-color); font-style: italic } /* Comment.Single */\n.highlight .cs { color: var(--jp-mirror-editor-comment-color); font-style: italic } /* Comment.Special */\n.highlight .kc { color: var(--jp-mirror-editor-keyword-color); font-weight: bold } /* Keyword.Constant */\n.highlight .kd { color: var(--jp-mirror-editor-keyword-color); font-weight: bold } /* Keyword.Declaration */\n.highlight .kn { color: var(--jp-mirror-editor-keyword-color); font-weight: bold } /* Keyword.Namespace */\n.highlight .kp { color: var(--jp-mirror-editor-keyword-color); font-weight: bold } /* Keyword.Pseudo */\n.highlight .kr { color: var(--jp-mirror-editor-keyword-color); font-weight: bold } /* Keyword.Reserved */\n.highlight .kt { color: var(--jp-mirror-editor-keyword-color); font-weight: bold } /* Keyword.Type */\n.highlight .m { color: var(--jp-mirror-editor-number-color) } /* Literal.Number */\n.highlight .s { color: var(--jp-mirror-editor-string-color) } /* Literal.String */\n.highlight .ow { color: var(--jp-mirror-editor-operator-color); font-weight: bold } /* Operator.Word */\n.highlight .w { color: var(--jp-mirror-editor-variable-color) } /* Text.Whitespace */\n.highlight .mb { color: var(--jp-mirror-editor-number-color) } /* Literal.Number.Bin */\n.highlight .mf { color: var(--jp-mirror-editor-number-color) } /* Literal.Number.Float */\n.highlight .mh { color: var(--jp-mirror-editor-number-color) } /* Literal.Number.Hex */\n.highlight .mi { color: var(--jp-mirror-editor-number-color) } /* Literal.Number.Integer */\n.highlight .mo { color: var(--jp-mirror-editor-number-color) } /* Literal.Number.Oct */\n.highlight .sa { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Affix */\n.highlight .sb { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Backtick */\n.highlight .sc { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Char */\n.highlight .dl { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Delimiter */\n.highlight .sd { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Doc */\n.highlight .s2 { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Double */\n.highlight .se { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Escape */\n.highlight .sh { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Heredoc */\n.highlight .si { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Interpol */\n.highlight .sx { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Other */\n.highlight .sr { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Regex */\n.highlight .s1 { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Single */\n.highlight .ss { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Symbol */\n.highlight .il { color: var(--jp-mirror-editor-number-color) } /* Literal.Number.Integer.Long */",""]);const n=i},645:r=>{r.exports=function(r){var o=[];return o.toString=function(){return this.map((function(o){var e=r(o);return o[2]?"@media ".concat(o[2]," {").concat(e,"}"):e})).join("")},o.i=function(r,e,t){"string"==typeof r&&(r=[[null,r,""]]);var i={};if(t)for(var n=0;n{var t,i=function(){var r={};return function(o){if(void 0===r[o]){var e=document.querySelector(o);if(window.HTMLIFrameElement&&e instanceof window.HTMLIFrameElement)try{e=e.contentDocument.head}catch(r){e=null}r[o]=e}return r[o]}}(),n=[];function l(r){for(var o=-1,e=0;e{e.r(o);var t=e(379),i=e.n(t),n=e(150);i()(n.Z,{insert:"head",singleton:!1}),n.Z.locals}}]); \ No newline at end of file diff --git a/doc/jupyterlite/_output/extensions/jupyterlab_pygments/static/remoteEntry.aa1060b2d1221f8e5688.js b/doc/jupyterlite/_output/extensions/jupyterlab_pygments/static/remoteEntry.aa1060b2d1221f8e5688.js new file mode 100644 index 000000000..aefb46acb --- /dev/null +++ b/doc/jupyterlite/_output/extensions/jupyterlab_pygments/static/remoteEntry.aa1060b2d1221f8e5688.js @@ -0,0 +1 @@ +var _JUPYTERLAB;(()=>{"use strict";var e,r,t={741:(e,r,t)=>{var n={"./index":()=>t.e(568).then((()=>()=>t(568))),"./extension":()=>t.e(568).then((()=>()=>t(568))),"./style":()=>t.e(747).then((()=>()=>t(747)))},o=(e,r)=>(t.R=r,r=t.o(n,e)?n[e]():Promise.resolve().then((()=>{throw new Error('Module "'+e+'" does not exist in container.')})),t.R=void 0,r),a=(e,r)=>{if(t.S){var n="default",o=t.S[n];if(o&&o!==e)throw new Error("Container initialization failed as it has already been initialized with a different share scope");return t.S[n]=e,t.I(n,r)}};t.d(r,{get:()=>o,init:()=>a})}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var a=n[e]={id:e,exports:{}};return t[e](a,a.exports,o),a.exports}o.m=t,o.c=n,o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((r,t)=>(o.f[t](e,r),r)),[])),o.u=e=>e+"."+{568:"1e2faa2ba0bbe59c4780",747:"8eb3ddccc7ec4987bff9"}[e]+".js?v="+{568:"1e2faa2ba0bbe59c4780",747:"8eb3ddccc7ec4987bff9"}[e],o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r="jupyterlab_pygments:",o.l=(t,n,a,i)=>{if(e[t])e[t].push(n);else{var l,u;if(void 0!==a)for(var d=document.getElementsByTagName("script"),s=0;s{l.onerror=l.onload=null,clearTimeout(f);var o=e[t];if(delete e[t],l.parentNode&&l.parentNode.removeChild(l),o&&o.forEach((e=>e(n))),r)return r(n)},f=setTimeout(p.bind(null,void 0,{type:"timeout",target:l}),12e4);l.onerror=p.bind(null,l.onerror),l.onload=p.bind(null,l.onload),u&&document.head.appendChild(l)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{o.S={};var e={},r={};o.I=(t,n)=>{n||(n=[]);var a=r[t];if(a||(a=r[t]={}),!(n.indexOf(a)>=0)){if(n.push(a),e[t])return e[t];o.o(o.S,t)||(o.S[t]={});var i=o.S[t],l="jupyterlab_pygments",u=[];return"default"===t&&((e,r,t,n)=>{var a=i[e]=i[e]||{},u=a[r];(!u||!u.loaded&&(1!=!u.eager?n:l>u.from))&&(a[r]={get:()=>o.e(568).then((()=>()=>o(568))),from:l,eager:!1})})("jupyterlab_pygments","0.2.2"),e[t]=u.length?Promise.all(u).then((()=>e[t]=1)):1}}})(),(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var r=o.g.document;if(!e&&r&&(r.currentScript&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");t.length&&(e=t[t.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e={761:0};o.f.j=(r,t)=>{var n=o.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else{var a=new Promise(((t,o)=>n=e[r]=[t,o]));t.push(n[2]=a);var i=o.p+o.u(r),l=new Error;o.l(i,(t=>{if(o.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var a=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;l.message="Loading chunk "+r+" failed.\n("+a+": "+i+")",l.name="ChunkLoadError",l.type=a,l.request=i,n[1](l)}}),"chunk-"+r,r)}};var r=(r,t)=>{var n,a,[i,l,u]=t,d=0;if(i.some((r=>0!==e[r]))){for(n in l)o.o(l,n)&&(o.m[n]=l[n]);u&&u(o)}for(r&&r(t);d`_.\n", + "\"\"\"\n", + "# category: area charts\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.stocks()\n", + "\n", + "alt.Chart(source).transform_filter(\n", + " 'datum.symbol===\"GOOG\"'\n", + ").mark_area(\n", + " line={'color':'darkgreen'},\n", + " color=alt.Gradient(\n", + " gradient='linear', \n", + " stops=[alt.GradientStop(color='white', offset=0), \n", + " alt.GradientStop(color='darkgreen', offset=1)], \n", + " x1=1, \n", + " x2=1, \n", + " y1=1, \n", + " y2=0\n", + " )\n", + ").encode(\n", + " alt.X('date:T'), \n", + " alt.Y('price:Q')\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/bar_and_line_with_dual_axis.ipynb b/doc/jupyterlite/_output/files/bar_and_line_with_dual_axis.ipynb new file mode 100644 index 000000000..7410f20f1 --- /dev/null +++ b/doc/jupyterlite/_output/files/bar_and_line_with_dual_axis.ipynb @@ -0,0 +1,61 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "95ef9ab9", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "94d687b6", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Bar Chart with Line on Dual Axis\n", + "--------------------------------\n", + "This example shows how to combine two plots and keep their axes.\n", + "\n", + "For a more polished version of this chart, see :ref:`gallery_wheat_wages`.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.wheat()\n", + "\n", + "base = alt.Chart(source).encode(x='year:O')\n", + "\n", + "bar = base.mark_bar().encode(y='wheat:Q')\n", + "\n", + "line = base.mark_line(color='red').encode(\n", + " y='wages:Q'\n", + ")\n", + "\n", + "(bar + line).properties(width=600)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/bar_chart_horizontal.ipynb b/doc/jupyterlite/_output/files/bar_chart_horizontal.ipynb new file mode 100644 index 000000000..8fad3803f --- /dev/null +++ b/doc/jupyterlite/_output/files/bar_chart_horizontal.ipynb @@ -0,0 +1,54 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "55262b42", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9242af2a", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Horizontal Bar Chart\n", + "--------------------\n", + "This example is a bar chart drawn horizontally by putting the quantitative value on the x axis.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.wheat()\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x='wheat:Q',\n", + " y=\"year:O\"\n", + ").properties(height=700)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/bar_chart_sorted.ipynb b/doc/jupyterlite/_output/files/bar_chart_sorted.ipynb new file mode 100644 index 000000000..17b378b7a --- /dev/null +++ b/doc/jupyterlite/_output/files/bar_chart_sorted.ipynb @@ -0,0 +1,54 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "9eb7c16d", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8fa022a9", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Sorted Bar Chart\n", + "================\n", + "This example shows a bar chart sorted by a calculated value.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x='sum(yield):Q',\n", + " y=alt.Y('site:N', sort='-x')\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/bar_chart_trellis_compact.ipynb b/doc/jupyterlite/_output/files/bar_chart_trellis_compact.ipynb new file mode 100644 index 000000000..149ff3be0 --- /dev/null +++ b/doc/jupyterlite/_output/files/bar_chart_trellis_compact.ipynb @@ -0,0 +1,89 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "4ac8c885", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "85957167", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Compact Trellis Grid of Bar Charts\n", + "==================================\n", + "This example shows a simple grid of bar charts to compare performance data..\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame(\n", + " [\n", + " {\"a\": \"a1\", \"b\": \"b1\", \"c\": \"x\", \"p\": \"0.14\"},\n", + " {\"a\": \"a1\", \"b\": \"b1\", \"c\": \"y\", \"p\": \"0.60\"},\n", + " {\"a\": \"a1\", \"b\": \"b1\", \"c\": \"z\", \"p\": \"0.03\"},\n", + " {\"a\": \"a1\", \"b\": \"b2\", \"c\": \"x\", \"p\": \"0.80\"},\n", + " {\"a\": \"a1\", \"b\": \"b2\", \"c\": \"y\", \"p\": \"0.38\"},\n", + " {\"a\": \"a1\", \"b\": \"b2\", \"c\": \"z\", \"p\": \"0.55\"},\n", + " {\"a\": \"a1\", \"b\": \"b3\", \"c\": \"x\", \"p\": \"0.11\"},\n", + " {\"a\": \"a1\", \"b\": \"b3\", \"c\": \"y\", \"p\": \"0.58\"},\n", + " {\"a\": \"a1\", \"b\": \"b3\", \"c\": \"z\", \"p\": \"0.79\"},\n", + " {\"a\": \"a2\", \"b\": \"b1\", \"c\": \"x\", \"p\": \"0.83\"},\n", + " {\"a\": \"a2\", \"b\": \"b1\", \"c\": \"y\", \"p\": \"0.87\"},\n", + " {\"a\": \"a2\", \"b\": \"b1\", \"c\": \"z\", \"p\": \"0.67\"},\n", + " {\"a\": \"a2\", \"b\": \"b2\", \"c\": \"x\", \"p\": \"0.97\"},\n", + " {\"a\": \"a2\", \"b\": \"b2\", \"c\": \"y\", \"p\": \"0.84\"},\n", + " {\"a\": \"a2\", \"b\": \"b2\", \"c\": \"z\", \"p\": \"0.90\"},\n", + " {\"a\": \"a2\", \"b\": \"b3\", \"c\": \"x\", \"p\": \"0.74\"},\n", + " {\"a\": \"a2\", \"b\": \"b3\", \"c\": \"y\", \"p\": \"0.64\"},\n", + " {\"a\": \"a2\", \"b\": \"b3\", \"c\": \"z\", \"p\": \"0.19\"},\n", + " {\"a\": \"a3\", \"b\": \"b1\", \"c\": \"x\", \"p\": \"0.57\"},\n", + " {\"a\": \"a3\", \"b\": \"b1\", \"c\": \"y\", \"p\": \"0.35\"},\n", + " {\"a\": \"a3\", \"b\": \"b1\", \"c\": \"z\", \"p\": \"0.49\"},\n", + " {\"a\": \"a3\", \"b\": \"b2\", \"c\": \"x\", \"p\": \"0.91\"},\n", + " {\"a\": \"a3\", \"b\": \"b2\", \"c\": \"y\", \"p\": \"0.38\"},\n", + " {\"a\": \"a3\", \"b\": \"b2\", \"c\": \"z\", \"p\": \"0.91\"},\n", + " {\"a\": \"a3\", \"b\": \"b3\", \"c\": \"x\", \"p\": \"0.99\"},\n", + " {\"a\": \"a3\", \"b\": \"b3\", \"c\": \"y\", \"p\": \"0.80\"},\n", + " {\"a\": \"a3\", \"b\": \"b3\", \"c\": \"z\", \"p\": \"0.37\"},\n", + " ]\n", + ")\n", + "\n", + "alt.Chart(source, width=60, height=alt.Step(8)).mark_bar().encode(\n", + " y=alt.Y(\"c:N\", axis=None),\n", + " x=alt.X(\"p:Q\", title=None, axis=alt.Axis(format=\"%\")),\n", + " color=alt.Color(\n", + " \"c:N\", title=\"settings\", legend=alt.Legend(orient=\"bottom\", titleOrient=\"left\")\n", + " ),\n", + " row=alt.Row(\"a:N\", title=\"Factor A\", header=alt.Header(labelAngle=0)),\n", + " column=alt.Column(\"b:N\", title=\"Factor B\"),\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/bar_chart_with_highlighted_bar.ipynb b/doc/jupyterlite/_output/files/bar_chart_with_highlighted_bar.ipynb new file mode 100644 index 000000000..67e511c44 --- /dev/null +++ b/doc/jupyterlite/_output/files/bar_chart_with_highlighted_bar.ipynb @@ -0,0 +1,60 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c0a106b3", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d4c9c2e3", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Bar Chart with Highlighted Bar\n", + "------------------------------\n", + "This example shows a basic bar chart with a single bar highlighted.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.wheat()\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x='year:O',\n", + " y=\"wheat:Q\",\n", + " # The highlight will be set on the result of a conditional statement\n", + " color=alt.condition(\n", + " alt.datum.year == 1810, # If the year is 1810 this test returns True,\n", + " alt.value('orange'), # which sets the bar orange.\n", + " alt.value('steelblue') # And if it's not true it sets the bar steelblue.\n", + " )\n", + ").properties(width=600)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/bar_chart_with_highlighted_segment.ipynb b/doc/jupyterlite/_output/files/bar_chart_with_highlighted_segment.ipynb new file mode 100644 index 000000000..cbfb6f911 --- /dev/null +++ b/doc/jupyterlite/_output/files/bar_chart_with_highlighted_segment.ipynb @@ -0,0 +1,69 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "9d7f568a", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5542ddab", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Bar Chart with Highlighted Segment\n", + "----------------------------------\n", + "This example shows a bar chart that highlights values beyond a threshold.\n", + "\"\"\"\n", + "import altair as alt\n", + "import pandas as pd\n", + "from vega_datasets import data\n", + "\n", + "source = data.wheat()\n", + "threshold = pd.DataFrame([{\"threshold\": 90}])\n", + "\n", + "bars = alt.Chart(source).mark_bar().encode(\n", + " x=\"year:O\",\n", + " y=\"wheat:Q\",\n", + ")\n", + "\n", + "highlight = alt.Chart(source).mark_bar(color=\"#e45755\").encode(\n", + " x='year:O',\n", + " y='baseline:Q',\n", + " y2='wheat:Q'\n", + ").transform_filter(\n", + " alt.datum.wheat > 90\n", + ").transform_calculate(\"baseline\", \"90\")\n", + "\n", + "rule = alt.Chart(threshold).mark_rule().encode(\n", + " y='threshold:Q'\n", + ")\n", + "\n", + "(bars + highlight + rule).properties(width=600)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/bar_chart_with_labels.ipynb b/doc/jupyterlite/_output/files/bar_chart_with_labels.ipynb new file mode 100644 index 000000000..8835d3738 --- /dev/null +++ b/doc/jupyterlite/_output/files/bar_chart_with_labels.ipynb @@ -0,0 +1,64 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "7f15a685", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cce85617", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Bar Chart with Labels\n", + "=====================\n", + "This example shows a basic horizontal bar chart with labels created with Altair.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.wheat()\n", + "\n", + "bars = alt.Chart(source).mark_bar().encode(\n", + " x='wheat:Q',\n", + " y=\"year:O\"\n", + ")\n", + "\n", + "text = bars.mark_text(\n", + " align='left',\n", + " baseline='middle',\n", + " dx=3 # Nudges text to right so it doesn't appear on top of the bar\n", + ").encode(\n", + " text='wheat:Q'\n", + ")\n", + "\n", + "(bars + text).properties(height=900)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/bar_chart_with_mean_line.ipynb b/doc/jupyterlite/_output/files/bar_chart_with_mean_line.ipynb new file mode 100644 index 000000000..de5661294 --- /dev/null +++ b/doc/jupyterlite/_output/files/bar_chart_with_mean_line.ipynb @@ -0,0 +1,60 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "ee3141f3", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dec8d1e1", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Bar Chart with Line at Mean\n", + "---------------------------\n", + "This example shows the mean value overlayed on a bar chart.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.wheat()\n", + "\n", + "bar = alt.Chart(source).mark_bar().encode(\n", + " x='year:O',\n", + " y='wheat:Q'\n", + ")\n", + "\n", + "rule = alt.Chart(source).mark_rule(color='red').encode(\n", + " y='mean(wheat):Q'\n", + ")\n", + "\n", + "(bar + rule).properties(width=600)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/bar_chart_with_negatives.ipynb b/doc/jupyterlite/_output/files/bar_chart_with_negatives.ipynb new file mode 100644 index 000000000..45fe5666d --- /dev/null +++ b/doc/jupyterlite/_output/files/bar_chart_with_negatives.ipynb @@ -0,0 +1,59 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "12f357e6", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "da9b466b", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Bar Chart with Negative Values\n", + "==============================\n", + "This example shows a bar chart with both positive and negative values.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.us_employment()\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x=\"month:T\",\n", + " y=\"nonfarm_change:Q\",\n", + " color=alt.condition(\n", + " alt.datum.nonfarm_change > 0,\n", + " alt.value(\"steelblue\"), # The positive color\n", + " alt.value(\"orange\") # The negative color\n", + " )\n", + ").properties(width=600)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/bar_rounded.ipynb b/doc/jupyterlite/_output/files/bar_rounded.ipynb new file mode 100644 index 000000000..f0a7ff89b --- /dev/null +++ b/doc/jupyterlite/_output/files/bar_rounded.ipynb @@ -0,0 +1,58 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "3a713f24", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8b6c2c53", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Bar Chart with rounded edges\n", + "----------------------------\n", + "This example shows how to create a bar chart with rounded edges.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.seattle_weather()\n", + "\n", + "alt.Chart(source).mark_bar(\n", + " cornerRadiusTopLeft=3,\n", + " cornerRadiusTopRight=3\n", + ").encode(\n", + " x='month(date):O',\n", + " y='count():Q',\n", + " color='weather:N'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/bar_with_rolling_mean.ipynb b/doc/jupyterlite/_output/files/bar_with_rolling_mean.ipynb new file mode 100644 index 000000000..84f2e9363 --- /dev/null +++ b/doc/jupyterlite/_output/files/bar_with_rolling_mean.ipynb @@ -0,0 +1,66 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "6d8408fb", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fad993e3", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Bar Chart with Rolling Mean\n", + "---------------------------\n", + "A bar chart overlayed with a rolling mean. In this example the average of values over the previous decade is displayed as a line.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.wheat()\n", + "\n", + "bar = alt.Chart(source).mark_bar().encode(\n", + " x='year:O',\n", + " y='wheat:Q'\n", + ")\n", + "\n", + "line = alt.Chart(source).mark_line(color='red').transform_window(\n", + " # The field to average\n", + " rolling_mean='mean(wheat)',\n", + " # The number of values before and after the current value to include.\n", + " frame=[-9, 0]\n", + ").encode(\n", + " x='year:O',\n", + " y='rolling_mean:Q'\n", + ")\n", + "\n", + "(bar + line).properties(width=600)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/beckers_barley_trellis_plot.ipynb b/doc/jupyterlite/_output/files/beckers_barley_trellis_plot.ipynb new file mode 100644 index 000000000..933790c58 --- /dev/null +++ b/doc/jupyterlite/_output/files/beckers_barley_trellis_plot.ipynb @@ -0,0 +1,72 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "01223d36", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f9e4ddd8", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Becker's Barley Trellis Plot\n", + "----------------------------\n", + "The example demonstrates the trellis charts created by Richard Becker, William Cleveland and others in the 1990s. Using the visualization technique below they identified an anomoly in a widely used agriculatural dataset, which they termed `\"The Morris Mistake.\" `_. It became their favored way of showcasing the power of this pioneering plot.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "alt.Chart(source, title=\"The Morris Mistake\").mark_point().encode(\n", + " alt.X(\n", + " 'yield:Q',\n", + " title=\"Barley Yield (bushels/acre)\",\n", + " scale=alt.Scale(zero=False),\n", + " axis=alt.Axis(grid=False)\n", + " ),\n", + " alt.Y(\n", + " 'variety:N',\n", + " title=\"\",\n", + " sort='-x',\n", + " axis=alt.Axis(grid=True)\n", + " ),\n", + " color=alt.Color('year:N', legend=alt.Legend(title=\"Year\")),\n", + " row=alt.Row(\n", + " 'site:N',\n", + " title=\"\",\n", + " sort=alt.EncodingSortField(field='yield', op='sum', order='descending'),\n", + " )\n", + ").properties(\n", + " height=alt.Step(20)\n", + ").configure_view(stroke=\"transparent\")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/beckers_barley_wrapped_facet.ipynb b/doc/jupyterlite/_output/files/beckers_barley_wrapped_facet.ipynb new file mode 100644 index 000000000..557e9ea6c --- /dev/null +++ b/doc/jupyterlite/_output/files/beckers_barley_wrapped_facet.ipynb @@ -0,0 +1,61 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "f2b419c6", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1d330389", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Becker's Barley Trellis Plot (wrapped facet)\n", + "--------------------------------------------\n", + "The example demonstrates the trellis charts created by Richard Becker, William Cleveland and others in the 1990s. \n", + "This is the Altair replicate of `the VegaLite version `_ \n", + "demonstrating the usage of `columns` argument to create wrapped facet.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley.url\n", + "\n", + "alt.Chart(source).mark_point().encode(\n", + " alt.X('median(yield):Q', scale=alt.Scale(zero=False)),\n", + " y='variety:O',\n", + " color='year:N',\n", + " facet=alt.Facet('site:O', columns=2),\n", + ").properties(\n", + " width=200,\n", + " height=100,\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/binned_heatmap.ipynb b/doc/jupyterlite/_output/files/binned_heatmap.ipynb new file mode 100644 index 000000000..fe5b894de --- /dev/null +++ b/doc/jupyterlite/_output/files/binned_heatmap.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "b7278f06", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "960c260e", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Binned Heatmap\n", + "--------------\n", + "This example shows how to make a heatmap from binned quantitative data.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.movies.url\n", + "\n", + "alt.Chart(source).mark_rect().encode(\n", + " alt.X('IMDB_Rating:Q', bin=alt.Bin(maxbins=60)),\n", + " alt.Y('Rotten_Tomatoes_Rating:Q', bin=alt.Bin(maxbins=40)),\n", + " alt.Color('count():Q', scale=alt.Scale(scheme='greenblue'))\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/binned_scatterplot.ipynb b/doc/jupyterlite/_output/files/binned_scatterplot.ipynb new file mode 100644 index 000000000..692012bac --- /dev/null +++ b/doc/jupyterlite/_output/files/binned_scatterplot.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c134a34a", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6594b656", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Binned Scatterplot\n", + "------------------\n", + "This example shows how to make a binned scatterplot.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.movies.url\n", + "\n", + "alt.Chart(source).mark_circle().encode(\n", + " alt.X('IMDB_Rating:Q', bin=True),\n", + " alt.Y('Rotten_Tomatoes_Rating:Q', bin=True),\n", + " size='count()'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/boxplot.ipynb b/doc/jupyterlite/_output/files/boxplot.ipynb new file mode 100644 index 000000000..cad0e8119 --- /dev/null +++ b/doc/jupyterlite/_output/files/boxplot.ipynb @@ -0,0 +1,57 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "4dc78a07", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "00f35613", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Boxplot with Min/Max Whiskers\n", + "------------------------------\n", + "This example shows how to make a boxplot using US Population data from 2000. \n", + "Note that the default value of the `extent` property is 1.5,\n", + "which represents the convention of extending the whiskers\n", + "to the furthest points within 1.5 * IQR from the first and third quartile.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.population.url\n", + "\n", + "alt.Chart(source).mark_boxplot(extent='min-max').encode(\n", + " x='age:O',\n", + " y='people:Q'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/bubble_plot.ipynb b/doc/jupyterlite/_output/files/bubble_plot.ipynb new file mode 100644 index 000000000..b4b920d0e --- /dev/null +++ b/doc/jupyterlite/_output/files/bubble_plot.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "28a86524", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "775a6c92", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Bubble Plot\n", + "-----------------\n", + "This example shows how to make a bubble plot.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "alt.Chart(source).mark_point().encode(\n", + " x='Horsepower',\n", + " y='Miles_per_Gallon',\n", + " size='Acceleration'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/bump_chart.ipynb b/doc/jupyterlite/_output/files/bump_chart.ipynb new file mode 100644 index 000000000..aa2a4875d --- /dev/null +++ b/doc/jupyterlite/_output/files/bump_chart.ipynb @@ -0,0 +1,68 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "4f42ed2b", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f41838df", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Bump Chart\n", + "----------\n", + "This example shows a bump chart. The data is first grouped into six-month\n", + "intervals using pandas. The ranks are computed by Altair using a \n", + "window transform.\n", + "\"\"\"\n", + "# category: line charts\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "import pandas as pd\n", + "\n", + "stocks = data.stocks()\n", + "source = stocks.groupby([pd.Grouper(key=\"date\", freq=\"6M\"),\"symbol\"]).mean().reset_index()\n", + "\n", + "alt.Chart(source).mark_line(point = True).encode(\n", + " x = alt.X(\"date:O\", timeUnit=\"yearmonth\", title=\"date\"),\n", + " y=\"rank:O\",\n", + " color=alt.Color(\"symbol:N\")\n", + ").transform_window(\n", + " rank=\"rank()\",\n", + " sort=[alt.SortField(\"price\", order=\"descending\")],\n", + " groupby=[\"date\"]\n", + ").properties(\n", + " title=\"Bump Chart for Stock Prices\",\n", + " width=600,\n", + " height=150,\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/candlestick_chart.ipynb b/doc/jupyterlite/_output/files/candlestick_chart.ipynb new file mode 100644 index 000000000..a18109ab5 --- /dev/null +++ b/doc/jupyterlite/_output/files/candlestick_chart.ipynb @@ -0,0 +1,83 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "2c010a35", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "170576db", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Candlestick Chart\n", + "=================\n", + "A candlestick chart inspired from `Protovis `_. \n", + "This example shows the performance of the Chicago Board Options Exchange `Volatility Index `_ (VIX) \n", + "in the summer of 2009. The thick bar represents the opening and closing prices, \n", + "while the thin bar shows intraday high and low prices; if the index closed higher on a given day, the bars are colored green rather than red.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.ohlc()\n", + "\n", + "open_close_color = alt.condition(\"datum.open <= datum.close\",\n", + " alt.value(\"#06982d\"),\n", + " alt.value(\"#ae1325\"))\n", + "\n", + "base = alt.Chart(source).encode(\n", + " alt.X('date:T',\n", + " axis=alt.Axis(\n", + " format='%m/%d', \n", + " labelAngle=-45, \n", + " title='Date in 2009'\n", + " )\n", + " ),\n", + " color=open_close_color\n", + ")\n", + "\n", + "rule = base.mark_rule().encode(\n", + " alt.Y(\n", + " 'low:Q',\n", + " title='Price',\n", + " scale=alt.Scale(zero=False),\n", + " ),\n", + " alt.Y2('high:Q')\n", + ")\n", + "\n", + "bar = base.mark_bar().encode(\n", + " alt.Y('open:Q'),\n", + " alt.Y2('close:Q')\n", + ")\n", + "\n", + "rule + bar" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/choropleth.ipynb b/doc/jupyterlite/_output/files/choropleth.ipynb new file mode 100644 index 000000000..faddf22dc --- /dev/null +++ b/doc/jupyterlite/_output/files/choropleth.ipynb @@ -0,0 +1,62 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "67797b9e", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "22e38ad5", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Choropleth Map\n", + "==============\n", + "A choropleth map of unemployment rate per county in the US\n", + "\"\"\"\n", + "# category: maps\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "counties = alt.topo_feature(data.us_10m.url, 'counties')\n", + "source = data.unemployment.url\n", + "\n", + "alt.Chart(counties).mark_geoshape().encode(\n", + " color='rate:Q'\n", + ").transform_lookup(\n", + " lookup='id',\n", + " from_=alt.LookupData(source, 'id', ['rate'])\n", + ").project(\n", + " type='albersUsa'\n", + ").properties(\n", + " width=500,\n", + " height=300\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/choropleth_repeat.ipynb b/doc/jupyterlite/_output/files/choropleth_repeat.ipynb new file mode 100644 index 000000000..5a7227f58 --- /dev/null +++ b/doc/jupyterlite/_output/files/choropleth_repeat.ipynb @@ -0,0 +1,67 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "5c716d06", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "37ed8bb4", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Repeated Choropleth Map\n", + "=======================\n", + "Three choropleths representing disjoint data from the same table.\n", + "\"\"\"\n", + "# category: maps\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "states = alt.topo_feature(data.us_10m.url, 'states')\n", + "source = data.population_engineers_hurricanes.url\n", + "variable_list = ['population', 'engineers', 'hurricanes']\n", + "\n", + "alt.Chart(states).mark_geoshape().encode(\n", + " alt.Color(alt.repeat('row'), type='quantitative')\n", + ").transform_lookup(\n", + " lookup='id',\n", + " from_=alt.LookupData(source, 'id', variable_list)\n", + ").properties(\n", + " width=500,\n", + " height=300\n", + ").project(\n", + " type='albersUsa'\n", + ").repeat(\n", + " row=variable_list\n", + ").resolve_scale(\n", + " color='independent'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/co2_concentration.ipynb b/doc/jupyterlite/_output/files/co2_concentration.ipynb new file mode 100644 index 000000000..f151c10c9 --- /dev/null +++ b/doc/jupyterlite/_output/files/co2_concentration.ipynb @@ -0,0 +1,104 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "a88b6aca", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "de6e77c8", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Atmospheric CO2 Concentration\n", + "-----------------------------\n", + "This example is a fully developed line chart that uses a window transformation.\n", + "It was inspired by `Gregor Aisch's work at datawrapper\n", + "`_.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.co2_concentration.url\n", + "\n", + "base = alt.Chart(\n", + " source,\n", + " title=\"Carbon Dioxide in the Atmosphere\"\n", + ").transform_calculate(\n", + " year=\"year(datum.Date)\"\n", + ").transform_calculate(\n", + " decade=\"floor(datum.year / 10)\"\n", + ").transform_calculate(\n", + " scaled_date=\"(datum.year % 10) + (month(datum.Date)/12)\"\n", + ").transform_window(\n", + " first_date='first_value(scaled_date)',\n", + " last_date='last_value(scaled_date)',\n", + " sort=[{\"field\": \"scaled_date\", \"order\": \"ascending\"}],\n", + " groupby=['decade'],\n", + " frame=[None, None]\n", + ").transform_calculate(\n", + " end=\"datum.first_date === datum.scaled_date ? 'first' : datum.last_date === datum.scaled_date ? 'last' : null\"\n", + ").encode(\n", + " x=alt.X(\n", + " \"scaled_date:Q\",\n", + " axis=alt.Axis(title=\"Year into Decade\", tickCount=11)\n", + " ),\n", + " y=alt.Y(\n", + " \"CO2:Q\",\n", + " title=\"CO2 concentration in ppm\",\n", + " scale=alt.Scale(zero=False)\n", + " )\n", + ")\n", + "\n", + "line = base.mark_line().encode(\n", + " color=alt.Color(\n", + " \"decade:O\",\n", + " scale=alt.Scale(scheme=\"magma\"),\n", + " legend=None\n", + " )\n", + ")\n", + "\n", + "text = base.encode(text=\"year:N\")\n", + "\n", + "start_year = text.transform_filter(\n", + " alt.datum.end == 'first'\n", + ").mark_text(baseline=\"top\")\n", + "\n", + "end_year = text.transform_filter(\n", + " alt.datum.end == 'last'\n", + ").mark_text(baseline=\"bottom\")\n", + "\n", + "(line + start_year + end_year).configure_text(\n", + " align=\"left\",\n", + " dx=1,\n", + " dy=3\n", + ").properties(width=600, height=375)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/comet_chart.ipynb b/doc/jupyterlite/_output/files/comet_chart.ipynb new file mode 100644 index 000000000..287283f41 --- /dev/null +++ b/doc/jupyterlite/_output/files/comet_chart.ipynb @@ -0,0 +1,71 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "dd7ab6bf", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6482b131", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Comet Chart Example\n", + "----------------------------\n", + "Inspired by `Zan Armstrong's comet chart `_\n", + "this plot uses ``mark_trail`` to visualize change of grouped data over time.\n", + "A more elaborate example and explanation of creating comet charts in Altair\n", + "is shown in `this blogpost `_.\n", + "\"\"\"\n", + "# category: other charts\n", + "\n", + "import altair as alt\n", + "import vega_datasets\n", + "\n", + "(\n", + " alt.Chart(vega_datasets.data.barley.url)\n", + " .transform_pivot(\"year\", value=\"yield\", groupby=[\"variety\", \"site\"])\n", + " .transform_fold([\"1931\", \"1932\"], as_=[\"year\", \"yield\"])\n", + " .transform_calculate(calculate=\"datum['1932'] - datum['1931']\", as_=\"delta\")\n", + " .mark_trail()\n", + " .encode(\n", + " x=alt.X('year:O', title=None), \n", + " y=alt.Y('variety:N', title='Variety'),\n", + " size=alt.Size('yield:Q', scale=alt.Scale(range=[0, 12]), legend=alt.Legend(values=[20, 60], title='Barley Yield (bushels/acre)')),\n", + " color=alt.Color('delta:Q', scale=alt.Scale(domainMid=0), legend=alt.Legend(title='Yield Delta (%)')),\n", + " tooltip=alt.Tooltip(['year:O', 'yield:Q']),\n", + " column=alt.Column('site:N', title='Site')\n", + "\n", + " )\n", + " .configure_view(stroke=None)\n", + " .configure_legend(orient='bottom', direction='horizontal')\n", + " .properties(title='Barley Yield comparison between 1932 and 1931')\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/connected_scatterplot.ipynb b/doc/jupyterlite/_output/files/connected_scatterplot.ipynb new file mode 100644 index 000000000..3e3eb86b6 --- /dev/null +++ b/doc/jupyterlite/_output/files/connected_scatterplot.ipynb @@ -0,0 +1,57 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "a0e7b96d", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5bea8669", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Connected Scatterplot (Lines with Custom Paths)\n", + "-----------------------------------------------\n", + "\n", + "This example show how the order encoding can be used to draw a custom path. The dataset tracks miles driven per capita along with gas prices annually from 1956 to 2010.\n", + "It is based on Hannah Fairfield's article 'Driving Shifts Into Reverse'. See https://archive.nytimes.com/www.nytimes.com/imagepages/2010/05/02/business/02metrics.html for the original.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.driving()\n", + "\n", + "alt.Chart(source).mark_line(point=True).encode(\n", + " alt.X('miles', scale=alt.Scale(zero=False)),\n", + " alt.Y('gas', scale=alt.Scale(zero=False)),\n", + " order='year'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/cumulative_count_chart.ipynb b/doc/jupyterlite/_output/files/cumulative_count_chart.ipynb new file mode 100644 index 000000000..48cc48034 --- /dev/null +++ b/doc/jupyterlite/_output/files/cumulative_count_chart.ipynb @@ -0,0 +1,60 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "d1c36785", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "09549d1e", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Cumulative Count Chart\n", + "----------------------\n", + "This example shows an area chart with cumulative count.\n", + "Adapted from https://vega.github.io/vega-lite/examples/area_cumulative_freq.html\n", + "\n", + "\"\"\"\n", + "# category: area charts\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.movies.url\n", + "\n", + "alt.Chart(source).transform_window(\n", + " cumulative_count=\"count()\",\n", + " sort=[{\"field\": \"IMDB_Rating\"}],\n", + ").mark_area().encode(\n", + " x=\"IMDB_Rating:Q\",\n", + " y=\"cumulative_count:Q\"\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/cumulative_wiki_donations.ipynb b/doc/jupyterlite/_output/files/cumulative_wiki_donations.ipynb new file mode 100644 index 000000000..d43c2f881 --- /dev/null +++ b/doc/jupyterlite/_output/files/cumulative_wiki_donations.ipynb @@ -0,0 +1,56 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "572c5044", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "903299f8", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Cumulative Wikipedia Donations\n", + "==============================\n", + "\n", + "This chart shows cumulative donations to Wikipedia over the past 10 years. Inspired by this `Reddit post `_ but using lines instead of areas.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "\n", + "source = \"https://frdata.wikimedia.org/donationdata-vs-day.csv\"\n", + "\n", + "alt.Chart(source).mark_line().encode(\n", + " alt.X('monthdate(date):T', title='Month', axis=alt.Axis(format='%B')),\n", + " alt.Y('max(ytdsum):Q', title='Cumulative Donations', stack=None),\n", + " alt.Color('year(date):O', legend=alt.Legend(title='Year')),\n", + " alt.Order('year(data):O')\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/density_facet.ipynb b/doc/jupyterlite/_output/files/density_facet.ipynb new file mode 100644 index 000000000..ae23660b3 --- /dev/null +++ b/doc/jupyterlite/_output/files/density_facet.ipynb @@ -0,0 +1,67 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "042d638d", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6f3a51b5", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Faceted Density Estimates\n", + "-------------------------\n", + "Density estimates of measurements for each iris flower feature\n", + "\"\"\"\n", + "# category: area charts\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.iris()\n", + "\n", + "alt.Chart(source).transform_fold(\n", + " ['petalWidth', \n", + " 'petalLength', \n", + " 'sepalWidth', \n", + " 'sepalLength'], \n", + " as_ = ['Measurement_type', 'value']\n", + ").transform_density(\n", + " density='value', \n", + " bandwidth=0.3, \n", + " groupby=['Measurement_type'], \n", + " extent= [0, 8]\n", + ").mark_area().encode(\n", + " alt.X('value:Q'), \n", + " alt.Y('density:Q'),\n", + " alt.Row('Measurement_type:N')\n", + ").properties(width=300, height=50)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/density_stack.ipynb b/doc/jupyterlite/_output/files/density_stack.ipynb new file mode 100644 index 000000000..8394ace00 --- /dev/null +++ b/doc/jupyterlite/_output/files/density_stack.ipynb @@ -0,0 +1,74 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "06243191", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ea86ce74", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Stacked Density Estimates\n", + "-------------------------\n", + "To plot a stacked graph of estimates, use a shared ``extent`` and a fixed\n", + "number of subdivision ``steps`` to ensure that the points for each area align\n", + "well. Density estimates of measurements for each iris flower feature are plot\n", + "in a stacked method. In addition, setting ``counts`` to true multiplies the\n", + "densities by the number of data points in each group, preserving proportional\n", + "differences.\n", + "\"\"\"\n", + "# category: area charts\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.iris()\n", + "\n", + "alt.Chart(source).transform_fold(\n", + " ['petalWidth', \n", + " 'petalLength', \n", + " 'sepalWidth', \n", + " 'sepalLength'], \n", + " as_ = ['Measurement_type', 'value']\n", + ").transform_density(\n", + " density='value', \n", + " bandwidth=0.3, \n", + " groupby=['Measurement_type'], \n", + " extent= [0, 8], \n", + " counts = True, \n", + " steps=200\n", + ").mark_area().encode(\n", + " alt.X('value:Q'), \n", + " alt.Y('density:Q', stack='zero'),\n", + " alt.Color('Measurement_type:N')\n", + ").properties(width=400, height=100)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/diverging_stacked_bar_chart.ipynb b/doc/jupyterlite/_output/files/diverging_stacked_bar_chart.ipynb new file mode 100644 index 000000000..0fb913379 --- /dev/null +++ b/doc/jupyterlite/_output/files/diverging_stacked_bar_chart.ipynb @@ -0,0 +1,406 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "9c6def90", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "feea5185", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Diverging Stacked Bar Chart\n", + "---------------------------\n", + "This example shows a diverging stacked bar chart for sentiments towards a set of eight questions, displayed as percentages with neutral responses straddling the 0% mark.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "\n", + "source = alt.pd.DataFrame([\n", + " {\n", + " \"question\": \"Question 1\",\n", + " \"type\": \"Strongly disagree\",\n", + " \"value\": 24,\n", + " \"percentage\": 0.7,\n", + " \"percentage_start\": -19.1,\n", + " \"percentage_end\": -18.4\n", + " },\n", + " {\n", + " \"question\": \"Question 1\",\n", + " \"type\": \"Disagree\",\n", + " \"value\": 294,\n", + " \"percentage\": 9.1,\n", + " \"percentage_start\": -18.4,\n", + " \"percentage_end\": -9.2\n", + " },\n", + " {\n", + " \"question\": \"Question 1\",\n", + " \"type\": \"Neither agree nor disagree\",\n", + " \"value\": 594,\n", + " \"percentage\": 18.5,\n", + " \"percentage_start\": -9.2,\n", + " \"percentage_end\": 9.2\n", + " },\n", + " {\n", + " \"question\": \"Question 1\",\n", + " \"type\": \"Agree\",\n", + " \"value\": 1927,\n", + " \"percentage\": 59.9,\n", + " \"percentage_start\": 9.2,\n", + " \"percentage_end\": 69.2\n", + " },\n", + " {\n", + " \"question\": \"Question 1\",\n", + " \"type\": \"Strongly agree\",\n", + " \"value\": 376,\n", + " \"percentage\": 11.7,\n", + " \"percentage_start\": 69.2,\n", + " \"percentage_end\": 80.9\n", + " },\n", + "\n", + " {\n", + " \"question\": \"Question 2\",\n", + " \"type\": \"Strongly disagree\",\n", + " \"value\": 2,\n", + " \"percentage\": 18.2,\n", + " \"percentage_start\": -36.4,\n", + " \"percentage_end\": -18.2\n", + " },\n", + " {\n", + " \"question\": \"Question 2\",\n", + " \"type\": \"Disagree\",\n", + " \"value\": 2,\n", + " \"percentage\": 18.2,\n", + " \"percentage_start\": -18.2,\n", + " \"percentage_end\": 0\n", + " },\n", + " {\n", + " \"question\": \"Question 2\",\n", + " \"type\": \"Neither agree nor disagree\",\n", + " \"value\": 0,\n", + " \"percentage\": 0,\n", + " \"percentage_start\": 0,\n", + " \"percentage_end\": 0\n", + " },\n", + " {\n", + " \"question\": \"Question 2\",\n", + " \"type\": \"Agree\",\n", + " \"value\": 7,\n", + " \"percentage\": 63.6,\n", + " \"percentage_start\": 0,\n", + " \"percentage_end\": 63.6\n", + " },\n", + " {\n", + " \"question\": \"Question 2\",\n", + " \"type\": \"Strongly agree\",\n", + " \"value\": 11,\n", + " \"percentage\": 0,\n", + " \"percentage_start\": 63.6,\n", + " \"percentage_end\": 63.6\n", + " },\n", + "\n", + " {\n", + " \"question\": \"Question 3\",\n", + " \"type\": \"Strongly disagree\",\n", + " \"value\": 2,\n", + " \"percentage\": 20,\n", + " \"percentage_start\": -30,\n", + " \"percentage_end\": -10\n", + " },\n", + " {\n", + " \"question\": \"Question 3\",\n", + " \"type\": \"Disagree\",\n", + " \"value\": 0,\n", + " \"percentage\": 0,\n", + " \"percentage_start\": -10,\n", + " \"percentage_end\": -10\n", + " },\n", + " {\n", + " \"question\": \"Question 3\",\n", + " \"type\": \"Neither agree nor disagree\",\n", + " \"value\": 2,\n", + " \"percentage\": 20,\n", + " \"percentage_start\": -10,\n", + " \"percentage_end\": 10\n", + " },\n", + " {\n", + " \"question\": \"Question 3\",\n", + " \"type\": \"Agree\",\n", + " \"value\": 4,\n", + " \"percentage\": 40,\n", + " \"percentage_start\": 10,\n", + " \"percentage_end\": 50\n", + " },\n", + " {\n", + " \"question\": \"Question 3\",\n", + " \"type\": \"Strongly agree\",\n", + " \"value\": 2,\n", + " \"percentage\": 20,\n", + " \"percentage_start\": 50,\n", + " \"percentage_end\": 70\n", + " },\n", + "\n", + " {\n", + " \"question\": \"Question 4\",\n", + " \"type\": \"Strongly disagree\",\n", + " \"value\": 0,\n", + " \"percentage\": 0,\n", + " \"percentage_start\": -15.6,\n", + " \"percentage_end\": -15.6\n", + " },\n", + " {\n", + " \"question\": \"Question 4\",\n", + " \"type\": \"Disagree\",\n", + " \"value\": 2,\n", + " \"percentage\": 12.5,\n", + " \"percentage_start\": -15.6,\n", + " \"percentage_end\": -3.1\n", + " },\n", + " {\n", + " \"question\": \"Question 4\",\n", + " \"type\": \"Neither agree nor disagree\",\n", + " \"value\": 1,\n", + " \"percentage\": 6.3,\n", + " \"percentage_start\": -3.1,\n", + " \"percentage_end\": 3.1\n", + " },\n", + " {\n", + " \"question\": \"Question 4\",\n", + " \"type\": \"Agree\",\n", + " \"value\": 7,\n", + " \"percentage\": 43.8,\n", + " \"percentage_start\": 3.1,\n", + " \"percentage_end\": 46.9\n", + " },\n", + " {\n", + " \"question\": \"Question 4\",\n", + " \"type\": \"Strongly agree\",\n", + " \"value\": 6,\n", + " \"percentage\": 37.5,\n", + " \"percentage_start\": 46.9,\n", + " \"percentage_end\": 84.4\n", + " },\n", + "\n", + " {\n", + " \"question\": \"Question 5\",\n", + " \"type\": \"Strongly disagree\",\n", + " \"value\": 0,\n", + " \"percentage\": 0,\n", + " \"percentage_start\": -10.4,\n", + " \"percentage_end\": -10.4\n", + " },\n", + " {\n", + " \"question\": \"Question 5\",\n", + " \"type\": \"Disagree\",\n", + " \"value\": 1,\n", + " \"percentage\": 4.2,\n", + " \"percentage_start\": -10.4,\n", + " \"percentage_end\": -6.3\n", + " },\n", + " {\n", + " \"question\": \"Question 5\",\n", + " \"type\": \"Neither agree nor disagree\",\n", + " \"value\": 3,\n", + " \"percentage\": 12.5,\n", + " \"percentage_start\": -6.3,\n", + " \"percentage_end\": 6.3\n", + " },\n", + " {\n", + " \"question\": \"Question 5\",\n", + " \"type\": \"Agree\",\n", + " \"value\": 16,\n", + " \"percentage\": 66.7,\n", + " \"percentage_start\": 6.3,\n", + " \"percentage_end\": 72.9\n", + " },\n", + " {\n", + " \"question\": \"Question 5\",\n", + " \"type\": \"Strongly agree\",\n", + " \"value\": 4,\n", + " \"percentage\": 16.7,\n", + " \"percentage_start\": 72.9,\n", + " \"percentage_end\": 89.6\n", + " },\n", + "\n", + " {\n", + " \"question\": \"Question 6\",\n", + " \"type\": \"Strongly disagree\",\n", + " \"value\": 1,\n", + " \"percentage\": 6.3,\n", + " \"percentage_start\": -18.8,\n", + " \"percentage_end\": -12.5\n", + " },\n", + " {\n", + " \"question\": \"Question 6\",\n", + " \"type\": \"Disagree\",\n", + " \"value\": 1,\n", + " \"percentage\": 6.3,\n", + " \"percentage_start\": -12.5,\n", + " \"percentage_end\": -6.3\n", + " },\n", + " {\n", + " \"question\": \"Question 6\",\n", + " \"type\": \"Neither agree nor disagree\",\n", + " \"value\": 2,\n", + " \"percentage\": 12.5,\n", + " \"percentage_start\": -6.3,\n", + " \"percentage_end\": 6.3\n", + " },\n", + " {\n", + " \"question\": \"Question 6\",\n", + " \"type\": \"Agree\",\n", + " \"value\": 9,\n", + " \"percentage\": 56.3,\n", + " \"percentage_start\": 6.3,\n", + " \"percentage_end\": 62.5\n", + " },\n", + " {\n", + " \"question\": \"Question 6\",\n", + " \"type\": \"Strongly agree\",\n", + " \"value\": 3,\n", + " \"percentage\": 18.8,\n", + " \"percentage_start\": 62.5,\n", + " \"percentage_end\": 81.3\n", + " },\n", + "\n", + " {\n", + " \"question\": \"Question 7\",\n", + " \"type\": \"Strongly disagree\",\n", + " \"value\": 0,\n", + " \"percentage\": 0,\n", + " \"percentage_start\": -10,\n", + " \"percentage_end\": -10\n", + " },\n", + " {\n", + " \"question\": \"Question 7\",\n", + " \"type\": \"Disagree\",\n", + " \"value\": 0,\n", + " \"percentage\": 0,\n", + " \"percentage_start\": -10,\n", + " \"percentage_end\": -10\n", + " },\n", + " {\n", + " \"question\": \"Question 7\",\n", + " \"type\": \"Neither agree nor disagree\",\n", + " \"value\": 1,\n", + " \"percentage\": 20,\n", + " \"percentage_start\": -10,\n", + " \"percentage_end\": 10\n", + " },\n", + " {\n", + " \"question\": \"Question 7\",\n", + " \"type\": \"Agree\",\n", + " \"value\": 4,\n", + " \"percentage\": 80,\n", + " \"percentage_start\": 10,\n", + " \"percentage_end\": 90\n", + " },\n", + " {\n", + " \"question\": \"Question 7\",\n", + " \"type\": \"Strongly agree\",\n", + " \"value\": 0,\n", + " \"percentage\": 0,\n", + " \"percentage_start\": 90,\n", + " \"percentage_end\": 90\n", + " },\n", + "\n", + " {\n", + " \"question\": \"Question 8\",\n", + " \"type\": \"Strongly disagree\",\n", + " \"value\": 0,\n", + " \"percentage\": 0,\n", + " \"percentage_start\": 0,\n", + " \"percentage_end\": 0\n", + " },\n", + " {\n", + " \"question\": \"Question 8\",\n", + " \"type\": \"Disagree\",\n", + " \"value\": 0,\n", + " \"percentage\": 0,\n", + " \"percentage_start\": 0,\n", + " \"percentage_end\": 0\n", + " },\n", + " {\n", + " \"question\": \"Question 8\",\n", + " \"type\": \"Neither agree nor disagree\",\n", + " \"value\": 0,\n", + " \"percentage\": 0,\n", + " \"percentage_start\": 0,\n", + " \"percentage_end\": 0\n", + " },\n", + " {\n", + " \"question\": \"Question 8\",\n", + " \"type\": \"Agree\",\n", + " \"value\": 0,\n", + " \"percentage\": 0,\n", + " \"percentage_start\": 0,\n", + " \"percentage_end\": 0\n", + " },\n", + " {\n", + " \"question\": \"Question 8\",\n", + " \"type\": \"Strongly agree\",\n", + " \"value\": 2,\n", + " \"percentage\": 100,\n", + " \"percentage_start\": 0,\n", + " \"percentage_end\": 100\n", + " }\n", + "])\n", + "\n", + "color_scale = alt.Scale(\n", + " domain=[\n", + " \"Strongly disagree\",\n", + " \"Disagree\",\n", + " \"Neither agree nor disagree\",\n", + " \"Agree\",\n", + " \"Strongly agree\"\n", + " ],\n", + " range=[\"#c30d24\", \"#f3a583\", \"#cccccc\", \"#94c6da\", \"#1770ab\"]\n", + ")\n", + "\n", + "y_axis = alt.Axis(\n", + " title='Question',\n", + " offset=5,\n", + " ticks=False,\n", + " minExtent=60,\n", + " domain=False\n", + ")\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x='percentage_start:Q',\n", + " x2='percentage_end:Q',\n", + " y=alt.Y('question:N', axis=y_axis),\n", + " color=alt.Color(\n", + " 'type:N',\n", + " legend=alt.Legend( title='Response'),\n", + " scale=color_scale,\n", + " )\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/donut_chart.ipynb b/doc/jupyterlite/_output/files/donut_chart.ipynb new file mode 100644 index 000000000..3eaef5b10 --- /dev/null +++ b/doc/jupyterlite/_output/files/donut_chart.ipynb @@ -0,0 +1,57 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "6578c679", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "78299cb7", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Donut Chart\n", + "-----------\n", + "This example shows how to make a Donut Chart using ``mark_arc``.\n", + "This is adapted from a corresponding Vega-Lite Example:\n", + "`Donut Chart `_.\n", + "\"\"\"\n", + "# category: circular plots\n", + "\n", + "import pandas as pd\n", + "import altair as alt\n", + "\n", + "source = pd.DataFrame({\"category\": [1, 2, 3, 4, 5, 6], \"value\": [4, 6, 10, 3, 7, 8]})\n", + "\n", + "alt.Chart(source).mark_arc(innerRadius=50).encode(\n", + " theta=alt.Theta(field=\"value\", type=\"quantitative\"),\n", + " color=alt.Color(field=\"category\", type=\"nominal\"),\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/dot_dash_plot.ipynb b/doc/jupyterlite/_output/files/dot_dash_plot.ipynb new file mode 100644 index 000000000..0eaa090f9 --- /dev/null +++ b/doc/jupyterlite/_output/files/dot_dash_plot.ipynb @@ -0,0 +1,79 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "45f09aa7", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3ae9d32d", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Dot Dash Plot\n", + "=============\n", + "How to make the dot-dash plot presented in Edward Tufte's `Visual Display of Quantitative Information `_. Based\n", + "on a JavaScript implementation by `g3o2 `_.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "# Configure the options common to all layers\n", + "brush = alt.selection(type='interval')\n", + "base = alt.Chart(source).add_selection(brush)\n", + "\n", + "# Configure the points\n", + "points = base.mark_point().encode(\n", + " x=alt.X('Miles_per_Gallon', title=''),\n", + " y=alt.Y('Horsepower', title=''),\n", + " color=alt.condition(brush, 'Origin', alt.value('grey'))\n", + ")\n", + "\n", + "# Configure the ticks\n", + "tick_axis = alt.Axis(labels=False, domain=False, ticks=False)\n", + "\n", + "x_ticks = base.mark_tick().encode(\n", + " alt.X('Miles_per_Gallon', axis=tick_axis),\n", + " alt.Y('Origin', title='', axis=tick_axis),\n", + " color=alt.condition(brush, 'Origin', alt.value('lightgrey'))\n", + ")\n", + "\n", + "y_ticks = base.mark_tick().encode(\n", + " alt.X('Origin', title='', axis=tick_axis),\n", + " alt.Y('Horsepower', axis=tick_axis),\n", + " color=alt.condition(brush, 'Origin', alt.value('lightgrey'))\n", + ")\n", + "\n", + "# Build the chart\n", + "y_ticks | (points & x_ticks)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/errorbars_with_ci.ipynb b/doc/jupyterlite/_output/files/errorbars_with_ci.ipynb new file mode 100644 index 000000000..461f621fb --- /dev/null +++ b/doc/jupyterlite/_output/files/errorbars_with_ci.ipynb @@ -0,0 +1,63 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "9232e83b", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d1b3aac2", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Error Bars showing Confidence Interval\n", + "======================================\n", + "This example shows how to show error bars using confidence intervals.\n", + "The confidence intervals are computed internally in vega by a non-parametric\n", + "`bootstrap of the mean `_.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "error_bars = alt.Chart(source).mark_errorbar(extent='ci').encode(\n", + " x=alt.X('yield:Q', scale=alt.Scale(zero=False)),\n", + " y=alt.Y('variety:N')\n", + ")\n", + "\n", + "points = alt.Chart(source).mark_point(filled=True, color='black').encode(\n", + " x=alt.X('yield:Q', aggregate='mean'),\n", + " y=alt.Y('variety:N'),\n", + ")\n", + "\n", + "error_bars + points" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/errorbars_with_std.ipynb b/doc/jupyterlite/_output/files/errorbars_with_std.ipynb new file mode 100644 index 000000000..ebeb3e13b --- /dev/null +++ b/doc/jupyterlite/_output/files/errorbars_with_std.ipynb @@ -0,0 +1,62 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "5b452a62", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "25e506ca", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Error Bar with Standard Deviation\n", + "---------------------------------\n", + "This example shows how to show error bars with standard deviation using crop yields data of different\n", + "in the years of 1930s.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "error_bars = alt.Chart(source).mark_errorbar(extent='stdev').encode(\n", + " x=alt.X('yield:Q', scale=alt.Scale(zero=False)),\n", + " y=alt.Y('variety:N')\n", + ")\n", + "\n", + "points = alt.Chart(source).mark_point(filled=True, color='black').encode(\n", + " x=alt.X('yield:Q', aggregate='mean'),\n", + " y=alt.Y('variety:N'),\n", + ")\n", + "\n", + "error_bars + points" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/falkensee.ipynb b/doc/jupyterlite/_output/files/falkensee.ipynb new file mode 100644 index 000000000..9b3bca605 --- /dev/null +++ b/doc/jupyterlite/_output/files/falkensee.ipynb @@ -0,0 +1,121 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "ce94634b", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "32b93301", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Falkensee\n", + "-----------------------\n", + "This example is a reproduction of the Falkensee plot found in the vega-lite examples.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "\n", + "source = [\n", + " {\"year\": \"1875\", \"population\": 1309},\n", + " {\"year\": \"1890\", \"population\": 1558},\n", + " {\"year\": \"1910\", \"population\": 4512},\n", + " {\"year\": \"1925\", \"population\": 8180},\n", + " {\"year\": \"1933\", \"population\": 15915},\n", + " {\"year\": \"1939\", \"population\": 24824},\n", + " {\"year\": \"1946\", \"population\": 28275},\n", + " {\"year\": \"1950\", \"population\": 29189},\n", + " {\"year\": \"1964\", \"population\": 29881},\n", + " {\"year\": \"1971\", \"population\": 26007},\n", + " {\"year\": \"1981\", \"population\": 24029},\n", + " {\"year\": \"1985\", \"population\": 23340},\n", + " {\"year\": \"1989\", \"population\": 22307},\n", + " {\"year\": \"1990\", \"population\": 22087},\n", + " {\"year\": \"1991\", \"population\": 22139},\n", + " {\"year\": \"1992\", \"population\": 22105},\n", + " {\"year\": \"1993\", \"population\": 22242},\n", + " {\"year\": \"1994\", \"population\": 22801},\n", + " {\"year\": \"1995\", \"population\": 24273},\n", + " {\"year\": \"1996\", \"population\": 25640},\n", + " {\"year\": \"1997\", \"population\": 27393},\n", + " {\"year\": \"1998\", \"population\": 29505},\n", + " {\"year\": \"1999\", \"population\": 32124},\n", + " {\"year\": \"2000\", \"population\": 33791},\n", + " {\"year\": \"2001\", \"population\": 35297},\n", + " {\"year\": \"2002\", \"population\": 36179},\n", + " {\"year\": \"2003\", \"population\": 36829},\n", + " {\"year\": \"2004\", \"population\": 37493},\n", + " {\"year\": \"2005\", \"population\": 38376},\n", + " {\"year\": \"2006\", \"population\": 39008},\n", + " {\"year\": \"2007\", \"population\": 39366},\n", + " {\"year\": \"2008\", \"population\": 39821},\n", + " {\"year\": \"2009\", \"population\": 40179},\n", + " {\"year\": \"2010\", \"population\": 40511},\n", + " {\"year\": \"2011\", \"population\": 40465},\n", + " {\"year\": \"2012\", \"population\": 40905},\n", + " {\"year\": \"2013\", \"population\": 41258},\n", + " {\"year\": \"2014\", \"population\": 41777}\n", + " ]\n", + "\n", + "source2 = [{\n", + " \"start\": \"1933\",\n", + " \"end\": \"1945\",\n", + " \"event\": \"Nazi Rule\"\n", + " },\n", + " {\n", + " \"start\": \"1948\",\n", + " \"end\": \"1989\",\n", + " \"event\": \"GDR (East Germany)\"\n", + " }]\n", + "\n", + "\n", + "source = alt.pd.DataFrame(source)\n", + "source2 = alt.pd.DataFrame(source2)\n", + "\n", + "\n", + "line = alt.Chart(source).mark_line(color='#333').encode(\n", + " alt.X('year:T', axis=alt.Axis(format='%Y')),\n", + " y='population'\n", + ").properties(\n", + " width=500,\n", + " height=300\n", + ")\n", + "\n", + "point = line.mark_point(color='#333')\n", + "\n", + "rect = alt.Chart(source2).mark_rect().encode(\n", + " x='start:T',\n", + " x2='end:T',\n", + " color='event:N'\n", + ")\n", + "\n", + "rect + line + point" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/filled_step_chart.ipynb b/doc/jupyterlite/_output/files/filled_step_chart.ipynb new file mode 100644 index 000000000..88d6552ef --- /dev/null +++ b/doc/jupyterlite/_output/files/filled_step_chart.ipynb @@ -0,0 +1,58 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "3de14624", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0cb1a57b", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Filled Step Chart\n", + "-----------------\n", + "This example shows Google's stock price over time as a step chart with its area filled in and its line emphasized.\n", + "\"\"\"\n", + "# category: line charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.stocks()\n", + "\n", + "alt.Chart(source).mark_area(\n", + " color=\"lightblue\",\n", + " interpolate='step-after',\n", + " line=True\n", + ").encode(\n", + " x='date',\n", + " y='price'\n", + ").transform_filter(alt.datum.symbol == 'GOOG')" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/gantt_chart.ipynb b/doc/jupyterlite/_output/files/gantt_chart.ipynb new file mode 100644 index 000000000..85f2ff93c --- /dev/null +++ b/doc/jupyterlite/_output/files/gantt_chart.ipynb @@ -0,0 +1,59 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "27b16e81", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4a8581d8", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Gantt Chart\n", + "-----------------\n", + "This example shows how to make a simple Gantt chart.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame([\n", + " {\"task\": \"A\", \"start\": 1, \"end\": 3},\n", + " {\"task\": \"B\", \"start\": 3, \"end\": 8},\n", + " {\"task\": \"C\", \"start\": 8, \"end\": 10}\n", + "])\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x='start',\n", + " x2='end',\n", + " y='task'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/gapminder_bubble_plot.ipynb b/doc/jupyterlite/_output/files/gapminder_bubble_plot.ipynb new file mode 100644 index 000000000..c3a312d48 --- /dev/null +++ b/doc/jupyterlite/_output/files/gapminder_bubble_plot.ipynb @@ -0,0 +1,57 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "a360db90", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "50bf1c9c", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Gapminder Bubble Plot\n", + "=====================\n", + "This example shows how to make a bubble plot showing the correlation between\n", + "health and income for 187 countries in the world (modified from an example\n", + "in Lisa Charlotte Rost's blog post `'One Chart, Twelve Charting Libraries' `_.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.gapminder_health_income.url\n", + "\n", + "alt.Chart(source).mark_circle().encode(\n", + " alt.X('income:Q', scale=alt.Scale(type='log')),\n", + " alt.Y('health:Q', scale=alt.Scale(zero=False)),\n", + " size='population:Q'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/grouped_bar_chart.ipynb b/doc/jupyterlite/_output/files/grouped_bar_chart.ipynb new file mode 100644 index 000000000..7ce17bceb --- /dev/null +++ b/doc/jupyterlite/_output/files/grouped_bar_chart.ipynb @@ -0,0 +1,56 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "fdac8eed", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5f062a88", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Grouped Bar Chart\n", + "-----------------\n", + "This example shows a grouped bar chart.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x='year:O',\n", + " y='sum(yield):Q',\n", + " color='year:N',\n", + " column='site:N'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/grouped_bar_chart2.ipynb b/doc/jupyterlite/_output/files/grouped_bar_chart2.ipynb new file mode 100644 index 000000000..6adab7e8e --- /dev/null +++ b/doc/jupyterlite/_output/files/grouped_bar_chart2.ipynb @@ -0,0 +1,59 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "e1a8e37a", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0d0e3111", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Grouped Bar Chart with xOffset\n", + "------------------------------\n", + "Like :ref:`gallery_grouped_bar_chart`, this example shows a grouped bar chart. Whereas :ref:`gallery_grouped_bar_chart` used the ``column`` encoding channel, this example uses the ``xOffset`` encoding channel. This is adapted from a corresponding Vega-Lite Example:\n", + "`Grouped Bar Chart `_.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame({\"Category\":list(\"AAABBBCCC\"),\n", + " \"Group\":list(\"xyzxyzxyz\"),\n", + " \"Value\":[0.1, 0.6, 0.9, 0.7, 0.2, 1.1, 0.6, 0.1, 0.2]})\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x=\"Category:N\",\n", + " y=\"Value:Q\",\n", + " xOffset=\"Group:N\",\n", + " color=\"Group:N\"\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/grouped_bar_chart_horizontal.ipynb b/doc/jupyterlite/_output/files/grouped_bar_chart_horizontal.ipynb new file mode 100644 index 000000000..47b66a694 --- /dev/null +++ b/doc/jupyterlite/_output/files/grouped_bar_chart_horizontal.ipynb @@ -0,0 +1,56 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "0562723b", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7714a54e", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Horizontal Grouped Bar Chart\n", + "----------------------------\n", + "This example shows a horizontal grouped bar chart.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x='sum(yield):Q',\n", + " y='year:O',\n", + " color='year:N',\n", + " row='site:N'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/grouped_bar_chart_with_error_bars.ipynb b/doc/jupyterlite/_output/files/grouped_bar_chart_with_error_bars.ipynb new file mode 100644 index 000000000..307187337 --- /dev/null +++ b/doc/jupyterlite/_output/files/grouped_bar_chart_with_error_bars.ipynb @@ -0,0 +1,64 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "25b7ea25", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e35993a8", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Grouped Bar Chart with Error Bars\n", + "---------------------------------\n", + "This example shows a grouped bar chart with error bars.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "bars = alt.Chart().mark_bar().encode(\n", + " x='year:O',\n", + " y=alt.Y('mean(yield):Q', title='Mean Yield'),\n", + " color='year:N',\n", + ")\n", + "\n", + "error_bars = alt.Chart().mark_errorbar(extent='ci').encode(\n", + " x='year:O',\n", + " y='yield:Q'\n", + ")\n", + "\n", + "alt.layer(bars, error_bars, data=source).facet(\n", + " column='site:N'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/hexbins.ipynb b/doc/jupyterlite/_output/files/hexbins.ipynb new file mode 100644 index 000000000..b404666a7 --- /dev/null +++ b/doc/jupyterlite/_output/files/hexbins.ipynb @@ -0,0 +1,82 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c69ff022", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "675cbfb5", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Hexbin Chart\n", + "-----------------\n", + "This example shows a hexbin chart.\n", + "\"\"\"\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.seattle_weather()\n", + "\n", + "# Size of the hexbins\n", + "size = 15\n", + "# Count of distinct x features\n", + "xFeaturesCount = 12\n", + "# Count of distinct y features\n", + "yFeaturesCount = 7\n", + "# Name of the x field\n", + "xField = 'date'\n", + "# Name of the y field\n", + "yField = 'date'\n", + "\n", + "# the shape of a hexagon\n", + "hexagon = \"M0,-2.3094010768L2,-1.1547005384 2,1.1547005384 0,2.3094010768 -2,1.1547005384 -2,-1.1547005384Z\"\n", + "\n", + "alt.Chart(source).mark_point(size=size**2, shape=hexagon).encode(\n", + " x=alt.X('xFeaturePos:Q', axis=alt.Axis(title='Month',\n", + " grid=False, tickOpacity=0, domainOpacity=0)),\n", + " y=alt.Y('day(' + yField + '):O', axis=alt.Axis(title='Weekday',\n", + " labelPadding=20, tickOpacity=0, domainOpacity=0)),\n", + " stroke=alt.value('black'),\n", + " strokeWidth=alt.value(0.2),\n", + " fill=alt.Color('mean(temp_max):Q', scale=alt.Scale(scheme='darkblue')),\n", + " tooltip=['month(' + xField + '):O', 'day(' + yField + '):O', 'mean(temp_max):Q']\n", + ").transform_calculate(\n", + " # This field is required for the hexagonal X-Offset\n", + " xFeaturePos='(day(datum.' + yField + ') % 2) / 2 + month(datum.' + xField + ')'\n", + ").properties(\n", + " # Exact scaling factors to make the hexbins fit\n", + " width=size * xFeaturesCount * 2,\n", + " height=size * yFeaturesCount * 1.7320508076, # 1.7320508076 is approx. sin(60°)*2\n", + ").configure_view(\n", + " strokeWidth=0\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/histogram_responsive.ipynb b/doc/jupyterlite/_output/files/histogram_responsive.ipynb new file mode 100644 index 000000000..c0e92409a --- /dev/null +++ b/doc/jupyterlite/_output/files/histogram_responsive.ipynb @@ -0,0 +1,74 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "117dd276", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d3c3e729", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Histogram with Responsive Bins\n", + "------------------------------\n", + "This shows an example of a histogram with bins that are responsive to a\n", + "selection domain. Click and drag on the bottom panel to see the bins\n", + "change on the top panel.\n", + "\"\"\"\n", + "# category: histograms\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.flights_5k.url\n", + "\n", + "brush = alt.selection_interval(encodings=['x'])\n", + "\n", + "base = alt.Chart(source).transform_calculate(\n", + " time=\"hours(datum.date) + minutes(datum.date) / 60\"\n", + ").mark_bar().encode(\n", + " y='count():Q'\n", + ").properties(\n", + " width=600,\n", + " height=100\n", + ")\n", + "\n", + "alt.vconcat(\n", + " base.encode(\n", + " alt.X('time:Q',\n", + " bin=alt.Bin(maxbins=30, extent=brush),\n", + " scale=alt.Scale(domain=brush)\n", + " )\n", + " ),\n", + " base.encode(\n", + " alt.X('time:Q', bin=alt.Bin(maxbins=30)),\n", + " ).add_selection(brush)\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/histogram_with_a_global_mean_overlay.ipynb b/doc/jupyterlite/_output/files/histogram_with_a_global_mean_overlay.ipynb new file mode 100644 index 000000000..2cd1d41e6 --- /dev/null +++ b/doc/jupyterlite/_output/files/histogram_with_a_global_mean_overlay.ipynb @@ -0,0 +1,63 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "d8de57bd", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3ebb6979", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Histogram with a Global Mean Overlay\n", + "------------------------------------\n", + "This example shows a histogram with a global mean overlay.\n", + "\"\"\"\n", + "# category: histograms\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.movies.url\n", + "\n", + "base = alt.Chart(source)\n", + "\n", + "bar = base.mark_bar().encode(\n", + " x=alt.X('IMDB_Rating:Q', bin=True, axis=None),\n", + " y='count()'\n", + ")\n", + "\n", + "rule = base.mark_rule(color='red').encode(\n", + " x='mean(IMDB_Rating):Q',\n", + " size=alt.value(5)\n", + ")\n", + "\n", + "bar + rule" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/horizon_graph.ipynb b/doc/jupyterlite/_output/files/horizon_graph.ipynb new file mode 100644 index 000000000..db8f560dc --- /dev/null +++ b/doc/jupyterlite/_output/files/horizon_graph.ipynb @@ -0,0 +1,80 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "f4d5c2bb", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0bf68c27", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Horizon Graph\n", + "-------------\n", + "This example shows how to make a Horizon Graph with 2 layers. (See https://idl.cs.washington.edu/papers/horizon/ for more details on Horizon Graphs.)\n", + "\"\"\"\n", + "# category: area charts\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame([\n", + " {\"x\": 1, \"y\": 28}, {\"x\": 2, \"y\": 55},\n", + " {\"x\": 3, \"y\": 43}, {\"x\": 4, \"y\": 91},\n", + " {\"x\": 5, \"y\": 81}, {\"x\": 6, \"y\": 53},\n", + " {\"x\": 7, \"y\": 19}, {\"x\": 8, \"y\": 87},\n", + " {\"x\": 9, \"y\": 52}, {\"x\": 10, \"y\": 48},\n", + " {\"x\": 11, \"y\": 24}, {\"x\": 12, \"y\": 49},\n", + " {\"x\": 13, \"y\": 87}, {\"x\": 14, \"y\": 66},\n", + " {\"x\": 15, \"y\": 17}, {\"x\": 16, \"y\": 27},\n", + " {\"x\": 17, \"y\": 68}, {\"x\": 18, \"y\": 16},\n", + " {\"x\": 19, \"y\": 49}, {\"x\": 20, \"y\": 15}\n", + "])\n", + "\n", + "area1 = alt.Chart(source).mark_area(\n", + " clip=True,\n", + " interpolate='monotone'\n", + ").encode(\n", + " alt.X('x', scale=alt.Scale(zero=False, nice=False)),\n", + " alt.Y('y', scale=alt.Scale(domain=[0, 50]), title='y'),\n", + " opacity=alt.value(0.6)\n", + ").properties(\n", + " width=500,\n", + " height=75\n", + ")\n", + "\n", + "area2 = area1.encode(\n", + " alt.Y('ny:Q', scale=alt.Scale(domain=[0, 50]))\n", + ").transform_calculate(\n", + " \"ny\", alt.datum.y - 50\n", + ")\n", + "\n", + "area1 + area2" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/horizontal_stacked_bar_chart.ipynb b/doc/jupyterlite/_output/files/horizontal_stacked_bar_chart.ipynb new file mode 100644 index 000000000..c8078c440 --- /dev/null +++ b/doc/jupyterlite/_output/files/horizontal_stacked_bar_chart.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "63cc3f01", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2e9e9c4d", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Horizontal Stacked Bar Chart\n", + "============================\n", + "This is an example of a horizontal stacked bar chart using data which contains crop yields over different regions and different years in the 1930s.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x='sum(yield)',\n", + " y='variety',\n", + " color='site'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/image_tooltip.ipynb b/doc/jupyterlite/_output/files/image_tooltip.ipynb new file mode 100644 index 000000000..582fe2e7d --- /dev/null +++ b/doc/jupyterlite/_output/files/image_tooltip.ipynb @@ -0,0 +1,60 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "d41a1000", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ab06bd34", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Image tooltip\n", + "-------------\n", + "This example shows how to render images in tooltips.\n", + "Either URLs or local file paths can be used to reference\n", + "the images.\n", + "\"\"\"\n", + "# category: other charts\n", + "\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame.from_records(\n", + " [{'a': 1, 'b': 1, 'image': 'https://altair-viz.github.io/_static/altair-logo-light.png'},\n", + " {'a': 2, 'b': 2, 'image': 'https://avatars.githubusercontent.com/u/11796929?s=200&v=4'}]\n", + ")\n", + "alt.Chart(source).mark_circle(size=200).encode(\n", + " x='a',\n", + " y='b',\n", + " tooltip=['image'] # Must be a list for the image to render\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/interactive_brush.ipynb b/doc/jupyterlite/_output/files/interactive_brush.ipynb new file mode 100644 index 000000000..072ad25fa --- /dev/null +++ b/doc/jupyterlite/_output/files/interactive_brush.ipynb @@ -0,0 +1,58 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c895e01a", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b55702ef", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Interactive Rectangular Brush\n", + "=============================\n", + "This example shows how to add a simple rectangular brush to a scatter plot.\n", + "By clicking and dragging on the plot, you can highlight points within the\n", + "range.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "brush = alt.selection(type='interval')\n", + "\n", + "alt.Chart(source).mark_point().encode(\n", + " x='Horsepower:Q',\n", + " y='Miles_per_Gallon:Q',\n", + " color=alt.condition(brush, 'Cylinders:O', alt.value('grey')),\n", + ").add_selection(brush)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/interactive_cross_highlight.ipynb b/doc/jupyterlite/_output/files/interactive_cross_highlight.ipynb new file mode 100644 index 000000000..a6ec9f0c4 --- /dev/null +++ b/doc/jupyterlite/_output/files/interactive_cross_highlight.ipynb @@ -0,0 +1,88 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "92ce890e", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3a95be8f", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Interactive Chart with Cross-Highlight\n", + "======================================\n", + "This example shows an interactive chart where selections in one portion of\n", + "the chart affect what is shown in other panels. Click on the bar chart to\n", + "see a detail of the distribution in the upper panel.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.movies.url\n", + "\n", + "pts = alt.selection(type=\"single\", encodings=['x'])\n", + "\n", + "rect = alt.Chart(data.movies.url).mark_rect().encode(\n", + " alt.X('IMDB_Rating:Q', bin=True),\n", + " alt.Y('Rotten_Tomatoes_Rating:Q', bin=True),\n", + " alt.Color('count()',\n", + " scale=alt.Scale(scheme='greenblue'),\n", + " legend=alt.Legend(title='Total Records')\n", + " )\n", + ")\n", + "\n", + "circ = rect.mark_point().encode(\n", + " alt.ColorValue('grey'),\n", + " alt.Size('count()',\n", + " legend=alt.Legend(title='Records in Selection')\n", + " )\n", + ").transform_filter(\n", + " pts\n", + ")\n", + "\n", + "bar = alt.Chart(source).mark_bar().encode(\n", + " x='Major_Genre:N',\n", + " y='count()',\n", + " color=alt.condition(pts, alt.ColorValue(\"steelblue\"), alt.ColorValue(\"grey\"))\n", + ").properties(\n", + " width=550,\n", + " height=200\n", + ").add_selection(pts)\n", + "\n", + "alt.vconcat(\n", + " rect + circ,\n", + " bar\n", + ").resolve_legend(\n", + " color=\"independent\",\n", + " size=\"independent\"\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/interactive_layered_crossfilter.ipynb b/doc/jupyterlite/_output/files/interactive_layered_crossfilter.ipynb new file mode 100644 index 000000000..b8ed51133 --- /dev/null +++ b/doc/jupyterlite/_output/files/interactive_layered_crossfilter.ipynb @@ -0,0 +1,84 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "cb75d2ad", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "10d16b18", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Interactive Crossfilter\n", + "=======================\n", + "This example shows a multi-panel view of the same data, where you can interactively\n", + "select a portion of the data in any of the panels to highlight that portion in any\n", + "of the other panels.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = alt.UrlData(\n", + " data.flights_2k.url,\n", + " format={'parse': {'date': 'date'}}\n", + ")\n", + "\n", + "brush = alt.selection(type='interval', encodings=['x'])\n", + "\n", + "# Define the base chart, with the common parts of the\n", + "# background and highlights\n", + "base = alt.Chart().mark_bar().encode(\n", + " x=alt.X(alt.repeat('column'), type='quantitative', bin=alt.Bin(maxbins=20)),\n", + " y='count()'\n", + ").properties(\n", + " width=160,\n", + " height=130\n", + ")\n", + "\n", + "# gray background with selection\n", + "background = base.encode(\n", + " color=alt.value('#ddd')\n", + ").add_selection(brush)\n", + "\n", + "# blue highlights on the transformed data\n", + "highlight = base.transform_filter(brush)\n", + "\n", + "# layer the two charts & repeat\n", + "alt.layer(\n", + " background,\n", + " highlight,\n", + " data=source\n", + ").transform_calculate(\n", + " \"time\",\n", + " \"hours(datum.date)\"\n", + ").repeat(column=[\"distance\", \"delay\", \"time\"])" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/interactive_legend.ipynb b/doc/jupyterlite/_output/files/interactive_legend.ipynb new file mode 100644 index 000000000..e5145cb0c --- /dev/null +++ b/doc/jupyterlite/_output/files/interactive_legend.ipynb @@ -0,0 +1,63 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "5fcdf63e", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e92c89e1", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Interactive Legend\n", + "------------------\n", + "The following shows how to create a chart with an interactive legend, by\n", + "binding the selection to ``\"legend\"``. Such a binding only works with\n", + "``selection_single`` or ``selection_multi`` when projected over a single\n", + "field or encoding.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.unemployment_across_industries.url\n", + "\n", + "selection = alt.selection_multi(fields=['series'], bind='legend')\n", + "\n", + "alt.Chart(source).mark_area().encode(\n", + " alt.X('yearmonth(date):T', axis=alt.Axis(domain=False, format='%Y', tickSize=0)),\n", + " alt.Y('sum(count):Q', stack='center', axis=None),\n", + " alt.Color('series:N', scale=alt.Scale(scheme='category20b')),\n", + " opacity=alt.condition(selection, alt.value(1), alt.value(0.2))\n", + ").add_selection(\n", + " selection\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/interactive_scatter_plot.ipynb b/doc/jupyterlite/_output/files/interactive_scatter_plot.ipynb new file mode 100644 index 000000000..101e518be --- /dev/null +++ b/doc/jupyterlite/_output/files/interactive_scatter_plot.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "1658b069", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f5b9241a", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Simple Interactive Colored Scatterplot\n", + "--------------------------------------\n", + "This example shows how to make an interactive scatterplot.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "alt.Chart(source).mark_circle().encode(\n", + " x='Horsepower',\n", + " y='Miles_per_Gallon',\n", + " color='Origin',\n", + ").interactive()" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/interval_selection.ipynb b/doc/jupyterlite/_output/files/interval_selection.ipynb new file mode 100644 index 000000000..89091fcc2 --- /dev/null +++ b/doc/jupyterlite/_output/files/interval_selection.ipynb @@ -0,0 +1,71 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "29ed1729", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9a2146dc", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Interval Selection Example\n", + "==========================\n", + "\n", + "This is an example of creating a stacked chart for which the domain of the\n", + "top chart can be selected by interacting with the bottom chart.\n", + "\"\"\"\n", + "# category: area charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.sp500.url\n", + "\n", + "brush = alt.selection(type='interval', encodings=['x'])\n", + "\n", + "base = alt.Chart(source).mark_area().encode(\n", + " x = 'date:T',\n", + " y = 'price:Q'\n", + ").properties(\n", + " width=600,\n", + " height=200\n", + ")\n", + "\n", + "upper = base.encode(\n", + " alt.X('date:T', scale=alt.Scale(domain=brush))\n", + ")\n", + "\n", + "lower = base.properties(\n", + " height=60\n", + ").add_selection(brush)\n", + "\n", + "upper & lower" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/iowa_electricity.ipynb b/doc/jupyterlite/_output/files/iowa_electricity.ipynb new file mode 100644 index 000000000..5087bb915 --- /dev/null +++ b/doc/jupyterlite/_output/files/iowa_electricity.ipynb @@ -0,0 +1,66 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "6c746af3", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "177496e9", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Iowa's renewable energy boom\n", + "----------------------------\n", + "This example is a fully developed stacked chart using the sample dataset of Iowa's electricity sources.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.iowa_electricity()\n", + "\n", + "alt.Chart(source, title=\"Iowa's renewable energy boom\").mark_area().encode(\n", + " x=alt.X(\n", + " \"year:T\",\n", + " title=\"Year\"\n", + " ),\n", + " y=alt.Y(\n", + " \"net_generation:Q\",\n", + " stack=\"normalize\",\n", + " title=\"Share of net generation\",\n", + " axis=alt.Axis(format=\".0%\"),\n", + " ),\n", + " color=alt.Color(\n", + " \"source:N\",\n", + " legend=alt.Legend(title=\"Electricity source\"),\n", + " )\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/isotype.ipynb b/doc/jupyterlite/_output/files/isotype.ipynb new file mode 100644 index 000000000..ce66f4718 --- /dev/null +++ b/doc/jupyterlite/_output/files/isotype.ipynb @@ -0,0 +1,117 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "f8516d4e", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "674375c2", + "metadata": {}, + "outputs": [], + "source": [ + "'''\n", + "Isotype Visualization\n", + "=====================\n", + "Isotype Visualization shows the distribution of animals across UK and US.\n", + "Inspired by `Only An Ocean Between, 1943 `_. Population Live Stock, p.13.\n", + "This is adapted from Vega-Lite example https://vega.github.io/editor/#/examples/vega-lite/isotype_bar_chart\n", + "'''\n", + "# category: case studies\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame([\n", + " {'country': 'Great Britain', 'animal': 'cattle'},\n", + " {'country': 'Great Britain', 'animal': 'cattle'},\n", + " {'country': 'Great Britain', 'animal': 'cattle'},\n", + " {'country': 'Great Britain', 'animal': 'pigs'},\n", + " {'country': 'Great Britain', 'animal': 'pigs'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'pigs'},\n", + " {'country': 'United States', 'animal': 'pigs'},\n", + " {'country': 'United States', 'animal': 'pigs'},\n", + " {'country': 'United States', 'animal': 'pigs'},\n", + " {'country': 'United States', 'animal': 'pigs'},\n", + " {'country': 'United States', 'animal': 'pigs'},\n", + " {'country': 'United States', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'sheep'}\n", + " ])\n", + "\n", + "domains = ['person', 'cattle', 'pigs', 'sheep']\n", + "\n", + "shape_scale = alt.Scale(\n", + " domain=domains,\n", + " range=[\n", + " 'M1.7 -1.7h-0.8c0.3 -0.2 0.6 -0.5 0.6 -0.9c0 -0.6 -0.4 -1 -1 -1c-0.6 0 -1 0.4 -1 1c0 0.4 0.2 0.7 0.6 0.9h-0.8c-0.4 0 -0.7 0.3 -0.7 0.6v1.9c0 0.3 0.3 0.6 0.6 0.6h0.2c0 0 0 0.1 0 0.1v1.9c0 0.3 0.2 0.6 0.3 0.6h1.3c0.2 0 0.3 -0.3 0.3 -0.6v-1.8c0 0 0 -0.1 0 -0.1h0.2c0.3 0 0.6 -0.3 0.6 -0.6v-2c0.2 -0.3 -0.1 -0.6 -0.4 -0.6z',\n", + " 'M4 -2c0 0 0.9 -0.7 1.1 -0.8c0.1 -0.1 -0.1 0.5 -0.3 0.7c-0.2 0.2 1.1 1.1 1.1 1.2c0 0.2 -0.2 0.8 -0.4 0.7c-0.1 0 -0.8 -0.3 -1.3 -0.2c-0.5 0.1 -1.3 1.6 -1.5 2c-0.3 0.4 -0.6 0.4 -0.6 0.4c0 0.1 0.3 1.7 0.4 1.8c0.1 0.1 -0.4 0.1 -0.5 0c0 0 -0.6 -1.9 -0.6 -1.9c-0.1 0 -0.3 -0.1 -0.3 -0.1c0 0.1 -0.5 1.4 -0.4 1.6c0.1 0.2 0.1 0.3 0.1 0.3c0 0 -0.4 0 -0.4 0c0 0 -0.2 -0.1 -0.1 -0.3c0 -0.2 0.3 -1.7 0.3 -1.7c0 0 -2.8 -0.9 -2.9 -0.8c-0.2 0.1 -0.4 0.6 -0.4 1c0 0.4 0.5 1.9 0.5 1.9l-0.5 0l-0.6 -2l0 -0.6c0 0 -1 0.8 -1 1c0 0.2 -0.2 1.3 -0.2 1.3c0 0 0.3 0.3 0.2 0.3c0 0 -0.5 0 -0.5 0c0 0 -0.2 -0.2 -0.1 -0.4c0 -0.1 0.2 -1.6 0.2 -1.6c0 0 0.5 -0.4 0.5 -0.5c0 -0.1 0 -2.7 -0.2 -2.7c-0.1 0 -0.4 2 -0.4 2c0 0 0 0.2 -0.2 0.5c-0.1 0.4 -0.2 1.1 -0.2 1.1c0 0 -0.2 -0.1 -0.2 -0.2c0 -0.1 -0.1 -0.7 0 -0.7c0.1 -0.1 0.3 -0.8 0.4 -1.4c0 -0.6 0.2 -1.3 0.4 -1.5c0.1 -0.2 0.6 -0.4 0.6 -0.4z',\n", + " 'M1.2 -2c0 0 0.7 0 1.2 0.5c0.5 0.5 0.4 0.6 0.5 0.6c0.1 0 0.7 0 0.8 0.1c0.1 0 0.2 0.2 0.2 0.2c0 0 -0.6 0.2 -0.6 0.3c0 0.1 0.4 0.9 0.6 0.9c0.1 0 0.6 0 0.6 0.1c0 0.1 0 0.7 -0.1 0.7c-0.1 0 -1.2 0.4 -1.5 0.5c-0.3 0.1 -1.1 0.5 -1.1 0.7c-0.1 0.2 0.4 1.2 0.4 1.2l-0.4 0c0 0 -0.4 -0.8 -0.4 -0.9c0 -0.1 -0.1 -0.3 -0.1 -0.3l-0.2 0l-0.5 1.3l-0.4 0c0 0 -0.1 -0.4 0 -0.6c0.1 -0.1 0.3 -0.6 0.3 -0.7c0 0 -0.8 0 -1.5 -0.1c-0.7 -0.1 -1.2 -0.3 -1.2 -0.2c0 0.1 -0.4 0.6 -0.5 0.6c0 0 0.3 0.9 0.3 0.9l-0.4 0c0 0 -0.4 -0.5 -0.4 -0.6c0 -0.1 -0.2 -0.6 -0.2 -0.5c0 0 -0.4 0.4 -0.6 0.4c-0.2 0.1 -0.4 0.1 -0.4 0.1c0 0 -0.1 0.6 -0.1 0.6l-0.5 0l0 -1c0 0 0.5 -0.4 0.5 -0.5c0 -0.1 -0.7 -1.2 -0.6 -1.4c0.1 -0.1 0.1 -1.1 0.1 -1.1c0 0 -0.2 0.1 -0.2 0.1c0 0 0 0.9 0 1c0 0.1 -0.2 0.3 -0.3 0.3c-0.1 0 0 -0.5 0 -0.9c0 -0.4 0 -0.4 0.2 -0.6c0.2 -0.2 0.6 -0.3 0.8 -0.8c0.3 -0.5 1 -0.6 1 -0.6z',\n", + " 'M-4.1 -0.5c0.2 0 0.2 0.2 0.5 0.2c0.3 0 0.3 -0.2 0.5 -0.2c0.2 0 0.2 0.2 0.4 0.2c0.2 0 0.2 -0.2 0.5 -0.2c0.2 0 0.2 0.2 0.4 0.2c0.2 0 0.2 -0.2 0.4 -0.2c0.1 0 0.2 0.2 0.4 0.1c0.2 0 0.2 -0.2 0.4 -0.3c0.1 0 0.1 -0.1 0.4 0c0.3 0 0.3 -0.4 0.6 -0.4c0.3 0 0.6 -0.3 0.7 -0.2c0.1 0.1 1.4 1 1.3 1.4c-0.1 0.4 -0.3 0.3 -0.4 0.3c-0.1 0 -0.5 -0.4 -0.7 -0.2c-0.3 0.2 -0.1 0.4 -0.2 0.6c-0.1 0.1 -0.2 0.2 -0.3 0.4c0 0.2 0.1 0.3 0 0.5c-0.1 0.2 -0.3 0.2 -0.3 0.5c0 0.3 -0.2 0.3 -0.3 0.6c-0.1 0.2 0 0.3 -0.1 0.5c-0.1 0.2 -0.1 0.2 -0.2 0.3c-0.1 0.1 0.3 1.1 0.3 1.1l-0.3 0c0 0 -0.3 -0.9 -0.3 -1c0 -0.1 -0.1 -0.2 -0.3 -0.2c-0.2 0 -0.3 0.1 -0.4 0.4c0 0.3 -0.2 0.8 -0.2 0.8l-0.3 0l0.3 -1c0 0 0.1 -0.6 -0.2 -0.5c-0.3 0.1 -0.2 -0.1 -0.4 -0.1c-0.2 -0.1 -0.3 0.1 -0.4 0c-0.2 -0.1 -0.3 0.1 -0.5 0c-0.2 -0.1 -0.1 0 -0.3 0.3c-0.2 0.3 -0.4 0.3 -0.4 0.3l0.2 1.1l-0.3 0l-0.2 -1.1c0 0 -0.4 -0.6 -0.5 -0.4c-0.1 0.3 -0.1 0.4 -0.3 0.4c-0.1 -0.1 -0.2 1.1 -0.2 1.1l-0.3 0l0.2 -1.1c0 0 -0.3 -0.1 -0.3 -0.5c0 -0.3 0.1 -0.5 0.1 -0.7c0.1 -0.2 -0.1 -1 -0.2 -1.1c-0.1 -0.2 -0.2 -0.8 -0.2 -0.8c0 0 -0.1 -0.5 0.4 -0.8z'\n", + " ]\n", + ")\n", + "\n", + "color_scale = alt.Scale(\n", + " domain=domains,\n", + " range=['rgb(162,160,152)', 'rgb(194,81,64)', 'rgb(93,93,93)', 'rgb(91,131,149)']\n", + ")\n", + "\n", + "alt.Chart(source).mark_point(filled=True, opacity=1, size=100).encode(\n", + " alt.X('x:O', axis=None),\n", + " alt.Y('animal:O', axis=None),\n", + " alt.Row('country:N', header=alt.Header(title='')),\n", + " alt.Shape('animal:N', legend=None, scale=shape_scale),\n", + " alt.Color('animal:N', legend=None, scale=color_scale),\n", + ").transform_window(\n", + " x='rank()',\n", + " groupby=['country', 'animal']\n", + ").properties(width=550, height=140)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/isotype_emoji.ipynb b/doc/jupyterlite/_output/files/isotype_emoji.ipynb new file mode 100644 index 000000000..d8d8c8a89 --- /dev/null +++ b/doc/jupyterlite/_output/files/isotype_emoji.ipynb @@ -0,0 +1,102 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "3dca6f8b", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c982ca92", + "metadata": {}, + "outputs": [], + "source": [ + "'''\n", + "Isotype Visualization with Emoji\n", + "================================\n", + "Isotype Visualization shows the distribution of animals across UK and US, using unicode emoji\n", + "marks rather than custom SVG paths (see https://altair-viz.github.io/gallery/isotype.html).\n", + "This is adapted from Vega-Lite example https://vega.github.io/vega-lite/examples/isotype_bar_chart_emoji.html.\n", + "'''\n", + "# category: case studies\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame([\n", + " {'country': 'Great Britain', 'animal': 'cattle'},\n", + " {'country': 'Great Britain', 'animal': 'cattle'},\n", + " {'country': 'Great Britain', 'animal': 'cattle'},\n", + " {'country': 'Great Britain', 'animal': 'pigs'},\n", + " {'country': 'Great Britain', 'animal': 'pigs'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'pigs'},\n", + " {'country': 'United States', 'animal': 'pigs'},\n", + " {'country': 'United States', 'animal': 'pigs'},\n", + " {'country': 'United States', 'animal': 'pigs'},\n", + " {'country': 'United States', 'animal': 'pigs'},\n", + " {'country': 'United States', 'animal': 'pigs'},\n", + " {'country': 'United States', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'sheep'}\n", + " ])\n", + "\n", + "\n", + "alt.Chart(source).mark_text(size=45, baseline='middle').encode(\n", + " alt.X('x:O', axis=None),\n", + " alt.Y('animal:O', axis=None),\n", + " alt.Row('country:N', header=alt.Header(title='')),\n", + " alt.Text('emoji:N')\n", + ").transform_calculate(\n", + " emoji=\"{'cattle': '🐄', 'pigs': '🐖', 'sheep': '🐏'}[datum.animal]\"\n", + ").transform_window(\n", + " x='rank()',\n", + " groupby=['country', 'animal']\n", + ").properties(width=550, height=140)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/isotype_grid.ipynb b/doc/jupyterlite/_output/files/isotype_grid.ipynb new file mode 100644 index 000000000..2f02ed519 --- /dev/null +++ b/doc/jupyterlite/_output/files/isotype_grid.ipynb @@ -0,0 +1,77 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "68a9899e", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1c515a61", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Isotype Grid\n", + "------------\n", + "This example is a grid of isotype figures.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "data = pd.DataFrame([dict(id=i) for i in range(1, 101)])\n", + "\n", + "person = (\n", + " \"M1.7 -1.7h-0.8c0.3 -0.2 0.6 -0.5 0.6 -0.9c0 -0.6 \"\n", + " \"-0.4 -1 -1 -1c-0.6 0 -1 0.4 -1 1c0 0.4 0.2 0.7 0.6 \"\n", + " \"0.9h-0.8c-0.4 0 -0.7 0.3 -0.7 0.6v1.9c0 0.3 0.3 0.6 \"\n", + " \"0.6 0.6h0.2c0 0 0 0.1 0 0.1v1.9c0 0.3 0.2 0.6 0.3 \"\n", + " \"0.6h1.3c0.2 0 0.3 -0.3 0.3 -0.6v-1.8c0 0 0 -0.1 0 \"\n", + " \"-0.1h0.2c0.3 0 0.6 -0.3 0.6 -0.6v-2c0.2 -0.3 -0.1 \"\n", + " \"-0.6 -0.4 -0.6z\"\n", + ")\n", + "\n", + "alt.Chart(data).transform_calculate(\n", + " row=\"ceil(datum.id/10)\"\n", + ").transform_calculate(\n", + " col=\"datum.id - datum.row*10\"\n", + ").mark_point(\n", + " filled=True,\n", + " size=50\n", + ").encode(\n", + " x=alt.X(\"col:O\", axis=None),\n", + " y=alt.Y(\"row:O\", axis=None),\n", + " shape=alt.ShapeValue(person)\n", + ").properties(\n", + " width=400,\n", + " height=400\n", + ").configure_view(\n", + " strokeWidth=0\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/jitter_chart.ipynb b/doc/jupyterlite/_output/files/jitter_chart.ipynb new file mode 100644 index 000000000..54da41153 --- /dev/null +++ b/doc/jupyterlite/_output/files/jitter_chart.ipynb @@ -0,0 +1,60 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "4dd3aee4", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "60ebd3e9", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Jitter Chart\n", + "------------\n", + "In this chart, we encode the ``Cylinders`` column from the ``cars`` dataset in the ``y``-channel. Because most cars (all but seven) in this dataset have 4, 6, or 8 cylinders, the default presentation of this data would show most of the data concentrated on three horizontal lines. Furthermore, in that default presentation, it would be difficult to gauge the relative frequencies with which different values occur (because there would be so much overlap). To compensate for this, we use the ``yOffset`` channel to incorporate a random offset (jittering). This is adapted from a corresponding Vega-Lite Example:\n", + "`Dot Plot with Jittering `_.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "alt.Chart(source).mark_point().encode(\n", + " x='Horsepower:Q',\n", + " y='Cylinders:O',\n", + " yOffset='randomCalc:Q'\n", + ").transform_calculate(\n", + " randomCalc='random()'\n", + ").properties(\n", + " height=alt.Step(50)\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/layer_line_color_rule.ipynb b/doc/jupyterlite/_output/files/layer_line_color_rule.ipynb new file mode 100644 index 000000000..b691a284f --- /dev/null +++ b/doc/jupyterlite/_output/files/layer_line_color_rule.ipynb @@ -0,0 +1,67 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c85b094a", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "65306655", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Line Chart with Layered Aggregates\n", + "----------------------------------\n", + "This example shows how to make a multi-series line chart of the daily closing\n", + "stock prices for AAPL, AMZN, GOOG, IBM, and MSFT between 2000 and 2010, along\n", + "with a layered rule showing the average values.\n", + "\"\"\"\n", + "# category: line charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.stocks()\n", + "\n", + "base = alt.Chart(source).properties(width=550)\n", + "\n", + "line = base.mark_line().encode(\n", + " x='date',\n", + " y='price',\n", + " color='symbol'\n", + ")\n", + "\n", + "rule = base.mark_rule().encode(\n", + " y='average(price)',\n", + " color='symbol',\n", + " size=alt.value(2)\n", + ")\n", + "\n", + "line + rule" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/layered_area_chart.ipynb b/doc/jupyterlite/_output/files/layered_area_chart.ipynb new file mode 100644 index 000000000..1aaf6b563 --- /dev/null +++ b/doc/jupyterlite/_output/files/layered_area_chart.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "8d2fd35b", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2616b174", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Layered Area Chart\n", + "------------------\n", + "This example shows a layered area chart.\n", + "\"\"\"\n", + "# category: area charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.iowa_electricity()\n", + "\n", + "alt.Chart(source).mark_area(opacity=0.3).encode(\n", + " x=\"year:T\",\n", + " y=alt.Y(\"net_generation:Q\", stack=None),\n", + " color=\"source:N\"\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/layered_bar_chart.ipynb b/doc/jupyterlite/_output/files/layered_bar_chart.ipynb new file mode 100644 index 000000000..2f863da00 --- /dev/null +++ b/doc/jupyterlite/_output/files/layered_bar_chart.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "467e69f8", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ceae5c12", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Layered Bar Chart\n", + "-----------------\n", + "This example shows a segmented bar chart that is layered rather than stacked. \n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.iowa_electricity()\n", + "\n", + "alt.Chart(source).mark_bar(opacity=0.7).encode(\n", + " x='year:O',\n", + " y=alt.Y('net_generation:Q', stack=None),\n", + " color=\"source\",\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/layered_chart_bar_mark.ipynb b/doc/jupyterlite/_output/files/layered_chart_bar_mark.ipynb new file mode 100644 index 000000000..2c59a4b7f --- /dev/null +++ b/doc/jupyterlite/_output/files/layered_chart_bar_mark.ipynb @@ -0,0 +1,71 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "58e12561", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d91deb43", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Bar and Tick Chart\n", + "------------------\n", + "How to layer a tick chart on top of a bar chart.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame({\n", + " 'project': ['a', 'b', 'c', 'd', 'e', 'f', 'g'],\n", + " 'score': [25, 57, 23, 19, 8, 47, 8],\n", + " 'goal': [25, 47, 30, 27, 38, 19, 4]\n", + "})\n", + "\n", + "bar = alt.Chart(source).mark_bar().encode(\n", + " x='project',\n", + " y='score'\n", + ").properties(\n", + " width=alt.Step(40) # controls width of bar.\n", + ")\n", + "\n", + "tick = alt.Chart(source).mark_tick(\n", + " color='red',\n", + " thickness=2,\n", + " size=40 * 0.9, # controls width of tick.\n", + ").encode(\n", + " x='project',\n", + " y='goal'\n", + ")\n", + "\n", + "bar + tick" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/layered_chart_with_dual_axis.ipynb b/doc/jupyterlite/_output/files/layered_chart_with_dual_axis.ipynb new file mode 100644 index 000000000..883bd9764 --- /dev/null +++ b/doc/jupyterlite/_output/files/layered_chart_with_dual_axis.ipynb @@ -0,0 +1,69 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "29fed018", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e5931012", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Layered chart with Dual-Axis\n", + "----------------------------\n", + "This example shows how to create a second independent y axis.\n", + "\"\"\"\n", + "# category: other charts\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.seattle_weather()\n", + "\n", + "base = alt.Chart(source).encode(\n", + " alt.X('month(date):T', axis=alt.Axis(title=None))\n", + ")\n", + "\n", + "area = base.mark_area(opacity=0.3, color='#57A44C').encode(\n", + " alt.Y('average(temp_max)',\n", + " axis=alt.Axis(title='Avg. Temperature (°C)', titleColor='#57A44C')),\n", + " alt.Y2('average(temp_min)')\n", + ")\n", + "\n", + "line = base.mark_line(stroke='#5276A7', interpolate='monotone').encode(\n", + " alt.Y('average(precipitation)',\n", + " axis=alt.Axis(title='Precipitation (inches)', titleColor='#5276A7'))\n", + ")\n", + "\n", + "alt.layer(area, line).resolve_scale(\n", + " y = 'independent'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/layered_heatmap_text.ipynb b/doc/jupyterlite/_output/files/layered_heatmap_text.ipynb new file mode 100644 index 000000000..32785b753 --- /dev/null +++ b/doc/jupyterlite/_output/files/layered_heatmap_text.ipynb @@ -0,0 +1,80 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c02b6fb5", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "924c6a98", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Text over a Heatmap\n", + "-------------------\n", + "\n", + "An example of a layered chart of text over a heatmap using the cars dataset.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "# Configure common options\n", + "base = alt.Chart(source).transform_aggregate(\n", + " num_cars='count()',\n", + " groupby=['Origin', 'Cylinders']\n", + ").encode(\n", + " alt.X('Cylinders:O', scale=alt.Scale(paddingInner=0)),\n", + " alt.Y('Origin:O', scale=alt.Scale(paddingInner=0)),\n", + ")\n", + "\n", + "# Configure heatmap\n", + "heatmap = base.mark_rect().encode(\n", + " color=alt.Color('num_cars:Q',\n", + " scale=alt.Scale(scheme='viridis'),\n", + " legend=alt.Legend(direction='horizontal')\n", + " )\n", + ")\n", + "\n", + "# Configure text\n", + "text = base.mark_text(baseline='middle').encode(\n", + " text='num_cars:Q',\n", + " color=alt.condition(\n", + " alt.datum.num_cars > 100,\n", + " alt.value('black'),\n", + " alt.value('white')\n", + " )\n", + ")\n", + "\n", + "# Draw the chart\n", + "heatmap + text" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/layered_histogram.ipynb b/doc/jupyterlite/_output/files/layered_histogram.ipynb new file mode 100644 index 000000000..99abef955 --- /dev/null +++ b/doc/jupyterlite/_output/files/layered_histogram.ipynb @@ -0,0 +1,68 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "35e9413f", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7f7d1ba9", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Layered Histogram\n", + "=================\n", + "This example shows how to use opacity to make a layered histogram in Altair.\n", + "\"\"\"\n", + "# category: histograms\n", + "import pandas as pd\n", + "import altair as alt\n", + "import numpy as np\n", + "np.random.seed(42)\n", + "\n", + "# Generating Data\n", + "source = pd.DataFrame({\n", + " 'Trial A': np.random.normal(0, 0.8, 1000),\n", + " 'Trial B': np.random.normal(-2, 1, 1000),\n", + " 'Trial C': np.random.normal(3, 2, 1000)\n", + "})\n", + "\n", + "alt.Chart(source).transform_fold(\n", + " ['Trial A', 'Trial B', 'Trial C'],\n", + " as_=['Experiment', 'Measurement']\n", + ").mark_bar(\n", + " opacity=0.3,\n", + " binSpacing=0\n", + ").encode(\n", + " alt.X('Measurement:Q', bin=alt.Bin(maxbins=100)),\n", + " alt.Y('count()', stack=None),\n", + " alt.Color('Experiment:N')\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/line_chart_with_color_datum.ipynb b/doc/jupyterlite/_output/files/line_chart_with_color_datum.ipynb new file mode 100644 index 000000000..3ebbccb7a --- /dev/null +++ b/doc/jupyterlite/_output/files/line_chart_with_color_datum.ipynb @@ -0,0 +1,60 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "5fccee34", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a44e072e", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Line Chart with datum for color\n", + "-------------------------------\n", + "An example of using ``datum`` and ``repeat`` to color a multi-series line chart.\n", + "This is adapted from this corresponding Vega-Lite Example:\n", + "`Repeat and Layer to Show Different Movie Measures `_.\n", + "\"\"\"\n", + "# category: line charts\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.movies()\n", + "\n", + "alt.Chart(source).mark_line().encode(\n", + " x=alt.X(\"IMDB_Rating\", bin=True),\n", + " y=alt.Y(\n", + " alt.repeat(\"layer\"), aggregate=\"mean\", title=\"Mean of US and Worldwide Gross\"\n", + " ),\n", + " color=alt.datum(alt.repeat(\"layer\")),\n", + ").repeat(layer=[\"US_Gross\", \"Worldwide_Gross\"])" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/line_chart_with_cumsum.ipynb b/doc/jupyterlite/_output/files/line_chart_with_cumsum.ipynb new file mode 100644 index 000000000..aa9a0ae12 --- /dev/null +++ b/doc/jupyterlite/_output/files/line_chart_with_cumsum.ipynb @@ -0,0 +1,63 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "cd7546a3", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4afe4382", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Line Chart with Cumulative Sum\n", + "------------------------------\n", + "This chart creates a simple line chart from the cumulative sum of a fields.\n", + "\"\"\"\n", + "# category: line charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.wheat()\n", + "\n", + "alt.Chart(source).mark_line().transform_window(\n", + " # Sort the data chronologically\n", + " sort=[{'field': 'year'}],\n", + " # Include all previous records before the current record and none after\n", + " # (This is the default value so you could skip it and it would still work.)\n", + " frame=[None, 0],\n", + " # What to add up as you go\n", + " cumulative_wheat='sum(wheat)'\n", + ").encode(\n", + " x='year:O',\n", + " # Plot the calculated field created by the transformation\n", + " y='cumulative_wheat:Q'\n", + ").properties(width=600)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/line_chart_with_datum.ipynb b/doc/jupyterlite/_output/files/line_chart_with_datum.ipynb new file mode 100644 index 000000000..3cfe313b1 --- /dev/null +++ b/doc/jupyterlite/_output/files/line_chart_with_datum.ipynb @@ -0,0 +1,71 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "6f6c1fe4", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "221bb7c8", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Line Chart with datum\n", + "---------------------------------\n", + "An example of using ``datum`` to highlight certain values, including a ``DateTime`` value.\n", + "This is adapted from two corresponding Vega-Lite Examples:\n", + "`Highlight a Specific Value `_.\n", + "\"\"\"\n", + "# category: line charts\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.stocks()\n", + "\n", + "lines = (\n", + " alt.Chart(source)\n", + " .mark_line()\n", + " .encode(x=\"date\", y=\"price\", color=\"symbol\")\n", + ")\n", + "\n", + "xrule = (\n", + " alt.Chart()\n", + " .mark_rule(color=\"cyan\", strokeWidth=2)\n", + " .encode(x=alt.datum(alt.DateTime(year=2006, month=\"November\")))\n", + ")\n", + "\n", + "yrule = (\n", + " alt.Chart().mark_rule(strokeDash=[12, 6], size=2).encode(y=alt.datum(350))\n", + ")\n", + "\n", + "\n", + "lines + yrule + xrule" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/line_chart_with_generator.ipynb b/doc/jupyterlite/_output/files/line_chart_with_generator.ipynb new file mode 100644 index 000000000..c22563b44 --- /dev/null +++ b/doc/jupyterlite/_output/files/line_chart_with_generator.ipynb @@ -0,0 +1,60 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "058911cc", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "967af987", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Line Chart with Sequence Generator\n", + "----------------------------------\n", + "This examples shows how to create multiple lines using the sequence generator.\n", + "\"\"\"\n", + "# category: line charts\n", + "\n", + "import altair as alt\n", + "\n", + "source = alt.sequence(start=0, stop=12.7, step=0.1, as_='x')\n", + "\n", + "alt.Chart(source).mark_line().transform_calculate(\n", + " sin='sin(datum.x)',\n", + " cos='cos(datum.x)'\n", + ").transform_fold(\n", + " ['sin', 'cos']\n", + ").encode(\n", + " x='x:Q', \n", + " y='value:Q', \n", + " color='key:N'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/line_chart_with_points.ipynb b/doc/jupyterlite/_output/files/line_chart_with_points.ipynb new file mode 100644 index 000000000..1b2d668fe --- /dev/null +++ b/doc/jupyterlite/_output/files/line_chart_with_points.ipynb @@ -0,0 +1,63 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "afdfa59f", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "daac5073", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Line Chart with Points\n", + "----------------------\n", + "This chart shows a simple line chart with points marking each value. Use\n", + "``point=True`` for points with default appearance or customize it with\n", + "``OverlayMarkDef()``.\n", + "\"\"\"\n", + "# category: line charts\n", + "import altair as alt\n", + "import numpy as np\n", + "import pandas as pd\n", + "\n", + "x = np.arange(100)\n", + "source = pd.DataFrame({\n", + " 'x': x,\n", + " 'f(x)': np.sin(x / 5)\n", + "})\n", + "\n", + "alt.Chart(source).mark_line(\n", + " point=alt.OverlayMarkDef(color=\"red\")\n", + ").encode(\n", + " x='x',\n", + " y='f(x)'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/line_percent.ipynb b/doc/jupyterlite/_output/files/line_percent.ipynb new file mode 100644 index 000000000..c01545733 --- /dev/null +++ b/doc/jupyterlite/_output/files/line_percent.ipynb @@ -0,0 +1,57 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "ff292a63", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4f683fca", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Line Chart with Percent axis\n", + "----------------------------\n", + "This example shows how to format the tick labels of the y-axis of a chart as percentages.\n", + "\"\"\"\n", + "# category: line charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.jobs.url\n", + "\n", + "alt.Chart(source).mark_line().encode(\n", + " alt.X('year:O'),\n", + " alt.Y('perc:Q', axis=alt.Axis(format='%')),\n", + " color='sex:N'\n", + ").transform_filter(\n", + " alt.datum.job == 'Welder'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/line_with_ci.ipynb b/doc/jupyterlite/_output/files/line_with_ci.ipynb new file mode 100644 index 000000000..b83af3f97 --- /dev/null +++ b/doc/jupyterlite/_output/files/line_with_ci.ipynb @@ -0,0 +1,61 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "1b39aec5", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2dd2997f", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Line Chart with Confidence Interval Band\n", + "----------------------------------------\n", + "How to make a line chart with a bootstrapped 95% confidence interval band.\n", + "\"\"\"\n", + "# category: line charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "line = alt.Chart(source).mark_line().encode(\n", + " x='Year',\n", + " y='mean(Miles_per_Gallon)'\n", + ")\n", + "\n", + "band = alt.Chart(source).mark_errorband(extent='ci').encode(\n", + " x='Year',\n", + " y=alt.Y('Miles_per_Gallon', title='Miles/Gallon'),\n", + ")\n", + "\n", + "band + line" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/line_with_log_scale.ipynb b/doc/jupyterlite/_output/files/line_with_log_scale.ipynb new file mode 100644 index 000000000..be3544b1a --- /dev/null +++ b/doc/jupyterlite/_output/files/line_with_log_scale.ipynb @@ -0,0 +1,57 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "629b7f9b", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ee25f1cc", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Line Chart with Logarithmic Scale\n", + "---------------------------------\n", + "How to make a line chart on a `Logarithmic scale `_.\n", + "\"\"\"\n", + "# category: line charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.population()\n", + "\n", + "alt.Chart(source).mark_line().encode(\n", + " x='year:O',\n", + " y=alt.Y(\n", + " 'sum(people)',\n", + " scale=alt.Scale(type=\"log\") # Here the scale is applied\n", + " )\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/london_tube.ipynb b/doc/jupyterlite/_output/files/london_tube.ipynb new file mode 100644 index 000000000..10d02ee69 --- /dev/null +++ b/doc/jupyterlite/_output/files/london_tube.ipynb @@ -0,0 +1,98 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "b29f1ebe", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1887b587", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "London Tube Lines\n", + "=================\n", + "This example shows the London tube lines against the background of the\n", + "borough boundaries. It is based on the vega-lite example at\n", + "https://vega.github.io/vega-lite/examples/geo_layer_line_london.html.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "boroughs = alt.topo_feature(data.londonBoroughs.url, 'boroughs')\n", + "tubelines = alt.topo_feature(data.londonTubeLines.url, 'line')\n", + "centroids = data.londonCentroids.url\n", + "\n", + "background = alt.Chart(boroughs).mark_geoshape(\n", + " stroke='white',\n", + " strokeWidth=2\n", + ").encode(\n", + " color=alt.value('#eee'),\n", + ").properties(\n", + " width=700,\n", + " height=500\n", + ")\n", + "\n", + "labels = alt.Chart(centroids).mark_text().encode(\n", + " longitude='cx:Q',\n", + " latitude='cy:Q',\n", + " text='bLabel:N',\n", + " size=alt.value(8),\n", + " opacity=alt.value(0.6)\n", + ").transform_calculate(\n", + " \"bLabel\", \"indexof (datum.name,' ') > 0 ? substring(datum.name,0,indexof(datum.name, ' ')) : datum.name\"\n", + ")\n", + "\n", + "line_scale = alt.Scale(domain=[\"Bakerloo\", \"Central\", \"Circle\", \"District\", \"DLR\",\n", + " \"Hammersmith & City\", \"Jubilee\", \"Metropolitan\", \"Northern\",\n", + " \"Piccadilly\", \"Victoria\", \"Waterloo & City\"],\n", + " range=[\"rgb(137,78,36)\", \"rgb(220,36,30)\", \"rgb(255,206,0)\",\n", + " \"rgb(1,114,41)\", \"rgb(0,175,173)\", \"rgb(215,153,175)\",\n", + " \"rgb(106,114,120)\", \"rgb(114,17,84)\", \"rgb(0,0,0)\",\n", + " \"rgb(0,24,168)\", \"rgb(0,160,226)\", \"rgb(106,187,170)\"])\n", + "\n", + "lines = alt.Chart(tubelines).mark_geoshape(\n", + " filled=False,\n", + " strokeWidth=2\n", + ").encode(\n", + " alt.Color(\n", + " 'id:N',\n", + " legend=alt.Legend(\n", + " title=None,\n", + " orient='bottom-right',\n", + " offset=0\n", + " ),\n", + " scale=line_scale\n", + " )\n", + ")\n", + "\n", + "background + labels + lines" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/multi_series_line.ipynb b/doc/jupyterlite/_output/files/multi_series_line.ipynb new file mode 100644 index 000000000..c6e169b39 --- /dev/null +++ b/doc/jupyterlite/_output/files/multi_series_line.ipynb @@ -0,0 +1,57 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "da5370d5", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c2f689e0", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Multi Series Line Chart\n", + "-----------------------\n", + "\n", + "This example shows how to make a multi series line chart of the daily closing stock prices for AAPL, AMZN, GOOG, IBM, and MSFT between 2000 and 2010.\n", + "\"\"\"\n", + "# category: line charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.stocks()\n", + "\n", + "alt.Chart(source).mark_line().encode(\n", + " x='date',\n", + " y='price',\n", + " color='symbol',\n", + " strokeDash='symbol',\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/multifeature_scatter_plot.ipynb b/doc/jupyterlite/_output/files/multifeature_scatter_plot.ipynb new file mode 100644 index 000000000..28421d832 --- /dev/null +++ b/doc/jupyterlite/_output/files/multifeature_scatter_plot.ipynb @@ -0,0 +1,56 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "791f6722", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "34450e5a", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Multifeature Scatter Plot\n", + "=========================\n", + "This example shows how to make a scatter plot with multiple feature encodings.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.iris()\n", + "\n", + "alt.Chart(source).mark_circle().encode(\n", + " alt.X('sepalLength', scale=alt.Scale(zero=False)),\n", + " alt.Y('sepalWidth', scale=alt.Scale(zero=False, padding=1)),\n", + " color='species',\n", + " size='petalWidth'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/multiline_highlight.ipynb b/doc/jupyterlite/_output/files/multiline_highlight.ipynb new file mode 100644 index 000000000..abee0e240 --- /dev/null +++ b/doc/jupyterlite/_output/files/multiline_highlight.ipynb @@ -0,0 +1,75 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "51d5b73a", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9dc2b624", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Multi-Line Highlight\n", + "====================\n", + "This multi-line chart uses an invisible Voronoi tessellation to handle mouseover to\n", + "identify the nearest point and then highlight the line on which the point falls.\n", + "It is adapted from the Vega-Lite example found at\n", + "https://bl.ocks.org/amitkaps/fe4238e716db53930b2f1a70d3401701\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.stocks()\n", + "\n", + "highlight = alt.selection(type='single', on='mouseover',\n", + " fields=['symbol'], nearest=True)\n", + "\n", + "base = alt.Chart(source).encode(\n", + " x='date:T',\n", + " y='price:Q',\n", + " color='symbol:N'\n", + ")\n", + "\n", + "points = base.mark_circle().encode(\n", + " opacity=alt.value(0)\n", + ").add_selection(\n", + " highlight\n", + ").properties(\n", + " width=600\n", + ")\n", + "\n", + "lines = base.mark_line().encode(\n", + " size=alt.condition(~highlight, alt.value(1), alt.value(3))\n", + ")\n", + "\n", + "points + lines" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/multiline_tooltip.ipynb b/doc/jupyterlite/_output/files/multiline_tooltip.ipynb new file mode 100644 index 000000000..aab4d19df --- /dev/null +++ b/doc/jupyterlite/_output/files/multiline_tooltip.ipynb @@ -0,0 +1,106 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "e449beda", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bad9c4db", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Multi-Line Tooltip\n", + "==================\n", + "This example shows how you can use selections and layers to create a\n", + "tooltip-like behavior tied to the x position of the cursor.\n", + "If you are looking for more standard tooltips, it is recommended to use the\n", + "tooltip encoding channel as shown in the\n", + "`Scatter Plot With Tooltips `_\n", + "example.\n", + "\n", + "The following example employs a little trick to isolate the x-position of the\n", + "cursor: we add some transparent points with only an x encoding (no y encoding)\n", + "and tie a *nearest* selection to these, tied to the \"x\" field.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "import pandas as pd\n", + "import numpy as np\n", + "\n", + "np.random.seed(42)\n", + "source = pd.DataFrame(np.cumsum(np.random.randn(100, 3), 0).round(2),\n", + " columns=['A', 'B', 'C'], index=pd.RangeIndex(100, name='x'))\n", + "source = source.reset_index().melt('x', var_name='category', value_name='y')\n", + "\n", + "# Create a selection that chooses the nearest point & selects based on x-value\n", + "nearest = alt.selection(type='single', nearest=True, on='mouseover',\n", + " fields=['x'], empty='none')\n", + "\n", + "# The basic line\n", + "line = alt.Chart(source).mark_line(interpolate='basis').encode(\n", + " x='x:Q',\n", + " y='y:Q',\n", + " color='category:N'\n", + ")\n", + "\n", + "# Transparent selectors across the chart. This is what tells us\n", + "# the x-value of the cursor\n", + "selectors = alt.Chart(source).mark_point().encode(\n", + " x='x:Q',\n", + " opacity=alt.value(0),\n", + ").add_selection(\n", + " nearest\n", + ")\n", + "\n", + "# Draw points on the line, and highlight based on selection\n", + "points = line.mark_point().encode(\n", + " opacity=alt.condition(nearest, alt.value(1), alt.value(0))\n", + ")\n", + "\n", + "# Draw text labels near the points, and highlight based on selection\n", + "text = line.mark_text(align='left', dx=5, dy=-5).encode(\n", + " text=alt.condition(nearest, 'y:Q', alt.value(' '))\n", + ")\n", + "\n", + "# Draw a rule at the location of the selection\n", + "rules = alt.Chart(source).mark_rule(color='gray').encode(\n", + " x='x:Q',\n", + ").transform_filter(\n", + " nearest\n", + ")\n", + "\n", + "# Put the five layers into a chart and bind the data\n", + "alt.layer(\n", + " line, selectors, points, rules, text\n", + ").properties(\n", + " width=600, height=300\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/multiple_interactions.ipynb b/doc/jupyterlite/_output/files/multiple_interactions.ipynb new file mode 100644 index 000000000..babdcba12 --- /dev/null +++ b/doc/jupyterlite/_output/files/multiple_interactions.ipynb @@ -0,0 +1,129 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "cbea7525", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4db81a93", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Multiple Interactions\n", + "=====================\n", + "This example shows how multiple user inputs can be layered onto a chart. The four inputs have functionality as follows:\n", + "\n", + "* Dropdown: Filters the movies by genre\n", + "* Radio Buttons: Highlights certain films by Worldwide Gross\n", + "* Mouse Drag and Scroll: Zooms the x and y scales to allow for panning.\n", + "\n", + "\n", + "\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "movies = alt.UrlData(\n", + " data.movies.url,\n", + " format=alt.DataFormat(parse={\"Release_Date\":\"date\"})\n", + ")\n", + "ratings = ['G', 'NC-17', 'PG', 'PG-13', 'R']\n", + "genres = ['Action', 'Adventure', 'Black Comedy', 'Comedy',\n", + " 'Concert/Performance', 'Documentary', 'Drama', 'Horror', 'Musical',\n", + " 'Romantic Comedy', 'Thriller/Suspense', 'Western']\n", + "\n", + "base = alt.Chart(movies, width=200, height=200).mark_point(filled=True).transform_calculate(\n", + " Rounded_IMDB_Rating = \"floor(datum.IMDB_Rating)\",\n", + " Hundred_Million_Production = \"datum.Production_Budget > 100000000.0 ? 100 : 10\",\n", + " Release_Year = \"year(datum.Release_Date)\"\n", + ").transform_filter(\n", + " alt.datum.IMDB_Rating > 0\n", + ").transform_filter(\n", + " alt.FieldOneOfPredicate(field='MPAA_Rating', oneOf=ratings)\n", + ").encode(\n", + " x=alt.X('Worldwide_Gross:Q', scale=alt.Scale(domain=(100000,10**9), clamp=True)),\n", + " y='IMDB_Rating:Q',\n", + " tooltip=\"Title:N\"\n", + ")\n", + "\n", + "# A slider filter\n", + "year_slider = alt.binding_range(min=1969, max=2018, step=1)\n", + "slider_selection = alt.selection_single(bind=year_slider, fields=['Release_Year'], name=\"Release Year_\")\n", + "\n", + "\n", + "filter_year = base.add_selection(\n", + " slider_selection\n", + ").transform_filter(\n", + " slider_selection\n", + ").properties(title=\"Slider Filtering\")\n", + "\n", + "# A dropdown filter\n", + "genre_dropdown = alt.binding_select(options=genres)\n", + "genre_select = alt.selection_single(fields=['Major_Genre'], bind=genre_dropdown, name=\"Genre\")\n", + "\n", + "filter_genres = base.add_selection(\n", + " genre_select\n", + ").transform_filter(\n", + " genre_select\n", + ").properties(title=\"Dropdown Filtering\")\n", + "\n", + "#color changing marks\n", + "rating_radio = alt.binding_radio(options=ratings)\n", + "\n", + "rating_select = alt.selection_single(fields=['MPAA_Rating'], bind=rating_radio, name=\"Rating\")\n", + "rating_color_condition = alt.condition(rating_select,\n", + " alt.Color('MPAA_Rating:N', legend=None),\n", + " alt.value('lightgray'))\n", + "\n", + "highlight_ratings = base.add_selection(\n", + " rating_select\n", + ").encode(\n", + " color=rating_color_condition\n", + ").properties(title=\"Radio Button Highlighting\")\n", + "\n", + "# Boolean selection for format changes\n", + "input_checkbox = alt.binding_checkbox()\n", + "checkbox_selection = alt.selection_single(bind=input_checkbox, name=\"Big Budget Films\")\n", + "\n", + "size_checkbox_condition = alt.condition(checkbox_selection,\n", + " alt.SizeValue(25),\n", + " alt.Size('Hundred_Million_Production:Q')\n", + " )\n", + "\n", + "budget_sizing = base.add_selection(\n", + " checkbox_selection\n", + ").encode(\n", + " size=size_checkbox_condition\n", + ").properties(title=\"Checkbox Formatting\")\n", + "\n", + "( filter_year | filter_genres) & (highlight_ratings | budget_sizing )" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/multiple_marks.ipynb b/doc/jupyterlite/_output/files/multiple_marks.ipynb new file mode 100644 index 000000000..2525ec0b9 --- /dev/null +++ b/doc/jupyterlite/_output/files/multiple_marks.ipynb @@ -0,0 +1,56 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "db7531ef", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3352d8dd", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Multiple Marks\n", + "==============\n", + "This example demonstrates creating a single chart with multiple markers\n", + "representing the same data.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.stocks()\n", + "\n", + "alt.Chart(source).mark_line(point=True).encode(\n", + " x='date:T',\n", + " y='price:Q',\n", + " color='symbol:N'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/natural_disasters.ipynb b/doc/jupyterlite/_output/files/natural_disasters.ipynb new file mode 100644 index 000000000..9a707012a --- /dev/null +++ b/doc/jupyterlite/_output/files/natural_disasters.ipynb @@ -0,0 +1,68 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "b2ef1651", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "07f16166", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Natural Disasters\n", + "-----------------\n", + "This example shows a visualization of global deaths from natural disasters.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.disasters.url\n", + "\n", + "alt.Chart(source).mark_circle(\n", + " opacity=0.8,\n", + " stroke='black',\n", + " strokeWidth=1\n", + ").encode(\n", + " alt.X('Year:O', axis=alt.Axis(labelAngle=0)),\n", + " alt.Y('Entity:N'),\n", + " alt.Size('Deaths:Q',\n", + " scale=alt.Scale(range=[0, 4000]),\n", + " legend=alt.Legend(title='Annual Global Deaths')\n", + " ),\n", + " alt.Color('Entity:N', legend=None)\n", + ").properties(\n", + " width=450,\n", + " height=320\n", + ").transform_filter(\n", + " alt.datum.Entity != 'All natural disasters'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/normalized_stacked_area_chart.ipynb b/doc/jupyterlite/_output/files/normalized_stacked_area_chart.ipynb new file mode 100644 index 000000000..33d75c150 --- /dev/null +++ b/doc/jupyterlite/_output/files/normalized_stacked_area_chart.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "e00dc65c", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "43118995", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Normalized Stacked Area Chart\n", + "-----------------------------\n", + "This example shows how to make a normalized stacked area chart.\n", + "\"\"\"\n", + "# category: area charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.iowa_electricity()\n", + "\n", + "alt.Chart(source).mark_area().encode(\n", + " x=\"year:T\",\n", + " y=alt.Y(\"net_generation:Q\", stack=\"normalize\"),\n", + " color=\"source:N\"\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/normalized_stacked_bar_chart.ipynb b/doc/jupyterlite/_output/files/normalized_stacked_bar_chart.ipynb new file mode 100644 index 000000000..b2c643707 --- /dev/null +++ b/doc/jupyterlite/_output/files/normalized_stacked_bar_chart.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "ff450abb", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5b0f6a48", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Normalized Stacked Bar Chart\n", + "----------------------------\n", + "This is an example of a normalized stacked bar chart using data which contains crop yields over different regions and different years in the 1930s.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x=alt.X('sum(yield)', stack=\"normalize\"),\n", + " y='variety',\n", + " color='site'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/normed_parallel_coordinates.ipynb b/doc/jupyterlite/_output/files/normed_parallel_coordinates.ipynb new file mode 100644 index 000000000..ee7d14a1a --- /dev/null +++ b/doc/jupyterlite/_output/files/normed_parallel_coordinates.ipynb @@ -0,0 +1,80 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "51e3da73", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "507efa06", + "metadata": { + "lines_to_next_cell": 3 + }, + "outputs": [], + "source": [ + "\"\"\"\n", + "Normalized Parallel Coordinates Example\n", + "---------------------------------------\n", + "A `Parallel Coordinates `_\n", + "chart is a chart that lets you visualize the individual data points by drawing\n", + "a single line for each of them.\n", + "\n", + "Such a chart can be created in Altair by first transforming the data into a\n", + "suitable representation.\n", + "\n", + "This example shows a modified parallel coordinates chart with the Iris dataset,\n", + "where the y-axis shows the value after min-max rather than the raw value. It's a\n", + "simplified Altair version of `the VegaLite version `_\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "from altair import datum\n", + "\n", + "source = data.iris()\n", + "\n", + "alt.Chart(source).transform_window(\n", + " index='count()'\n", + ").transform_fold(\n", + " ['petalLength', 'petalWidth', 'sepalLength', 'sepalWidth']\n", + ").transform_joinaggregate(\n", + " min='min(value)', \n", + " max='max(value)',\n", + " groupby=['key']\n", + ").transform_calculate(\n", + " minmax_value=(datum.value-datum.min)/(datum.max-datum.min), \n", + " mid=(datum.min+datum.max)/2\n", + ").mark_line().encode(\n", + " x='key:N',\n", + " y='minmax_value:Q',\n", + " color='species:N',\n", + " detail='index:N',\n", + " opacity=alt.value(0.5)\n", + ").properties(width=500)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/one_dot_per_zipcode.ipynb b/doc/jupyterlite/_output/files/one_dot_per_zipcode.ipynb new file mode 100644 index 000000000..7ceacf699 --- /dev/null +++ b/doc/jupyterlite/_output/files/one_dot_per_zipcode.ipynb @@ -0,0 +1,64 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "30de3228", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2d14c35d", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "One Dot Per Zipcode\n", + "-----------------------\n", + "This example shows a geographical plot with one dot per zipcode.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "# Since the data is more than 5,000 rows we'll import it from a URL\n", + "source = data.zipcodes.url\n", + "\n", + "alt.Chart(source).transform_calculate(\n", + " \"leading digit\", alt.expr.substring(alt.datum.zip_code, 0, 1)\n", + ").mark_circle(size=3).encode(\n", + " longitude='longitude:Q',\n", + " latitude='latitude:Q',\n", + " color='leading digit:N',\n", + " tooltip='zip_code:N'\n", + ").project(\n", + " type='albersUsa'\n", + ").properties(\n", + " width=650,\n", + " height=400\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/pacman_chart.ipynb b/doc/jupyterlite/_output/files/pacman_chart.ipynb new file mode 100644 index 000000000..96ee9443e --- /dev/null +++ b/doc/jupyterlite/_output/files/pacman_chart.ipynb @@ -0,0 +1,56 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c6ae208f", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1d18faca", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Pacman Chart\n", + "------------\n", + "Chart made using ``mark_arc`` and constant values.\n", + "This could also be made using \n", + "``alt.Chart(source).mark_arc(color = \"gold\", theta = (5/8)*np.pi, theta2 = (19/8)*np.pi,radius=100)``.\n", + "\"\"\"\n", + "# category: circular plots\n", + "\n", + "import numpy as np\n", + "import altair as alt\n", + "\n", + "alt.Chart().mark_arc(color=\"gold\").encode(\n", + " theta=alt.datum((5 / 8) * np.pi, scale=None),\n", + " theta2=alt.datum((19 / 8) * np.pi),\n", + " radius=alt.datum(100, scale=None),\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/parallel_coordinates.ipynb b/doc/jupyterlite/_output/files/parallel_coordinates.ipynb new file mode 100644 index 000000000..7d5448fa0 --- /dev/null +++ b/doc/jupyterlite/_output/files/parallel_coordinates.ipynb @@ -0,0 +1,67 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "6f4bfbca", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8ae7611d", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Parallel Coordinates Example\n", + "----------------------------\n", + "A `Parallel Coordinates `_\n", + "chart is a chart that lets you visualize the individual data points by drawing\n", + "a single line for each of them.\n", + "Such a chart can be created in Altair by first transforming the data into a\n", + "suitable representation.\n", + "This example shows a parallel coordinates chart with the Iris dataset.\n", + "\"\"\"\n", + "# category: other charts\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.iris()\n", + "\n", + "alt.Chart(source).transform_window(\n", + " index='count()' \n", + ").transform_fold(\n", + " ['petalLength', 'petalWidth', 'sepalLength', 'sepalWidth']\n", + ").mark_line().encode(\n", + " x='key:N',\n", + " y='value:Q',\n", + " color='species:N',\n", + " detail='index:N',\n", + " opacity=alt.value(0.5)\n", + ").properties(width=500)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/percentage_of_total.ipynb b/doc/jupyterlite/_output/files/percentage_of_total.ipynb new file mode 100644 index 000000000..9a316c8a0 --- /dev/null +++ b/doc/jupyterlite/_output/files/percentage_of_total.ipynb @@ -0,0 +1,60 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "203e6c29", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cae82cc6", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Calculating Percentage of Total\n", + "-------------------------------\n", + "This chart demonstrates how to use a joinaggregate transform to display\n", + "data values as a percentage of total.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame({'Activity': ['Sleeping', 'Eating', 'TV', 'Work', 'Exercise'],\n", + " 'Time': [8, 2, 4, 8, 2]})\n", + "\n", + "alt.Chart(source).transform_joinaggregate(\n", + " TotalTime='sum(Time)',\n", + ").transform_calculate(\n", + " PercentOfTotal=\"datum.Time / datum.TotalTime\"\n", + ").mark_bar().encode(\n", + " alt.X('PercentOfTotal:Q', axis=alt.Axis(format='.0%')),\n", + " y='Activity:N'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/pie_chart.ipynb b/doc/jupyterlite/_output/files/pie_chart.ipynb new file mode 100644 index 000000000..0fb49d113 --- /dev/null +++ b/doc/jupyterlite/_output/files/pie_chart.ipynb @@ -0,0 +1,57 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c314a332", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c8c51454", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Pie Chart\n", + "---------\n", + "This example shows how to make a Pie Chart using ``mark_arc``.\n", + "This is adapted from a corresponding Vega-Lite Example:\n", + "`Pie Chart `_.\n", + "\"\"\"\n", + "# category: circular plots\n", + "\n", + "import pandas as pd\n", + "import altair as alt\n", + "\n", + "source = pd.DataFrame({\"category\": [1, 2, 3, 4, 5, 6], \"value\": [4, 6, 10, 3, 7, 8]})\n", + "\n", + "alt.Chart(source).mark_arc().encode(\n", + " theta=alt.Theta(field=\"value\", type=\"quantitative\"),\n", + " color=alt.Color(field=\"category\", type=\"nominal\"),\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/pie_chart_with_labels.ipynb b/doc/jupyterlite/_output/files/pie_chart_with_labels.ipynb new file mode 100644 index 000000000..e03bf753c --- /dev/null +++ b/doc/jupyterlite/_output/files/pie_chart_with_labels.ipynb @@ -0,0 +1,63 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "2e32a83b", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "135ee5ec", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Pie Chart with Labels\n", + "---------------------\n", + "This example shows how to layer text over arc marks (``mark_arc``) to label pie charts.\n", + "This is adapted from a corresponding Vega-Lite Example:\n", + "`Pie Chart with Labels `_.\n", + "\"\"\"\n", + "# category: circular plots\n", + "\n", + "import pandas as pd\n", + "import altair as alt\n", + "\n", + "source = pd.DataFrame(\n", + " {\"category\": [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\"], \"value\": [4, 6, 10, 3, 7, 8]}\n", + ")\n", + "\n", + "base = alt.Chart(source).encode(\n", + " theta=alt.Theta(\"value:Q\", stack=True), color=alt.Color(\"category:N\", legend=None)\n", + ")\n", + "\n", + "pie = base.mark_arc(outerRadius=120)\n", + "text = base.mark_text(radius=140, size=20).encode(text=\"category:N\")\n", + "\n", + "pie + text" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/poly_fit_regression.ipynb b/doc/jupyterlite/_output/files/poly_fit_regression.ipynb new file mode 100644 index 000000000..4b81a8ee1 --- /dev/null +++ b/doc/jupyterlite/_output/files/poly_fit_regression.ipynb @@ -0,0 +1,75 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "ae0ca7c1", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7dc9afc8", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Polynomial Fit Plot with Regression Transform\n", + "=============================================\n", + "This example shows how to overlay data with multiple fitted polynomials using\n", + "the regression transform.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "\n", + "import numpy as np\n", + "import pandas as pd\n", + "import altair as alt\n", + "\n", + "# Generate some random data\n", + "rng = np.random.RandomState(1)\n", + "x = rng.rand(40) ** 2\n", + "y = 10 - 1.0 / (x + 0.1) + rng.randn(40)\n", + "source = pd.DataFrame({\"x\": x, \"y\": y})\n", + "\n", + "# Define the degree of the polynomial fits\n", + "degree_list = [1, 3, 5]\n", + "\n", + "base = alt.Chart(source).mark_circle(color=\"black\").encode(\n", + " alt.X(\"x\"), alt.Y(\"y\")\n", + ")\n", + "\n", + "polynomial_fit = [\n", + " base.transform_regression(\n", + " \"x\", \"y\", method=\"poly\", order=order, as_=[\"x\", str(order)]\n", + " )\n", + " .mark_line()\n", + " .transform_fold([str(order)], as_=[\"degree\", \"y\"])\n", + " .encode(alt.Color(\"degree:N\"))\n", + " for order in degree_list\n", + "]\n", + "\n", + "alt.layer(base, *polynomial_fit)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/pyramid.ipynb b/doc/jupyterlite/_output/files/pyramid.ipynb new file mode 100644 index 000000000..d1b145bbc --- /dev/null +++ b/doc/jupyterlite/_output/files/pyramid.ipynb @@ -0,0 +1,58 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "e177764e", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8ab4fbd8", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Pyramid Pie Chart\n", + "-----------------\n", + "Altair reproduction of http://robslink.com/SAS/democd91/pyramid_pie.htm\n", + "\"\"\"\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "category = ['Sky', 'Shady side of a pyramid', 'Sunny side of a pyramid']\n", + "color = [\"#416D9D\", \"#674028\", \"#DEAC58\"]\n", + "df = pd.DataFrame({'category': category, 'value': [75, 10, 15]})\n", + "\n", + "alt.Chart(df).mark_arc(outerRadius=80).encode(\n", + " alt.Theta('value:Q', scale=alt.Scale(range=[2.356, 8.639])),\n", + " alt.Color('category:N',\n", + " scale=alt.Scale(domain=category, range=color),\n", + " legend=alt.Legend(title=None, orient='none', legendX=160, legendY=50)),\n", + " order='value:Q'\n", + ").properties(width=150, height=150).configure_view(strokeOpacity=0)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/radial_chart.ipynb b/doc/jupyterlite/_output/files/radial_chart.ipynb new file mode 100644 index 000000000..1455c4370 --- /dev/null +++ b/doc/jupyterlite/_output/files/radial_chart.ipynb @@ -0,0 +1,64 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "ee66f6f1", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c60be8b9", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Radial Chart\n", + "------------\n", + "This radial plot uses both angular and radial extent to convey multiple dimensions of data.\n", + "This is adapted from a corresponding Vega-Lite Example:\n", + "`Radial Plot `_.\n", + "\"\"\"\n", + "# category: circular plots\n", + "\n", + "import pandas as pd\n", + "import altair as alt\n", + "\n", + "source = pd.DataFrame({\"values\": [12, 23, 47, 6, 52, 19]})\n", + "\n", + "base = alt.Chart(source).encode(\n", + " theta=alt.Theta(\"values:Q\", stack=True),\n", + " radius=alt.Radius(\"values\", scale=alt.Scale(type=\"sqrt\", zero=True, rangeMin=20)),\n", + " color=\"values:N\",\n", + ")\n", + "\n", + "c1 = base.mark_arc(innerRadius=20, stroke=\"#fff\")\n", + "\n", + "c2 = base.mark_text(radiusOffset=10).encode(text=\"values:Q\")\n", + "\n", + "c1 + c2" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/ranged_dot_plot.ipynb b/doc/jupyterlite/_output/files/ranged_dot_plot.ipynb new file mode 100644 index 000000000..c363e5beb --- /dev/null +++ b/doc/jupyterlite/_output/files/ranged_dot_plot.ipynb @@ -0,0 +1,82 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "aad04f0a", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2e532b30", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Ranged Dot Plot\n", + "-----------------\n", + "This example shows a ranged dot plot that uses 'layer' to convey changing life expectancy for the five most populous countries (between 1955 and 2000).\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.countries.url\n", + "\n", + "chart = alt.layer(\n", + " data=source\n", + ").transform_filter(\n", + " filter={\"field\": 'country',\n", + " \"oneOf\": [\"China\", \"India\", \"United States\", \"Indonesia\", \"Brazil\"]}\n", + ").transform_filter(\n", + " filter={'field': 'year',\n", + " \"oneOf\": [1955, 2000]}\n", + ")\n", + "\n", + "chart += alt.Chart().mark_line(color='#db646f').encode(\n", + " x='life_expect:Q',\n", + " y='country:N',\n", + " detail='country:N'\n", + ")\n", + "# Add points for life expectancy in 1955 & 2000\n", + "chart += alt.Chart().mark_point(\n", + " size=100,\n", + " opacity=1,\n", + " filled=True\n", + ").encode(\n", + " x='life_expect:Q',\n", + " y='country:N',\n", + " color=alt.Color('year:O',\n", + " scale=alt.Scale(\n", + " domain=['1955', '2000'],\n", + " range=['#e6959c', '#911a24']\n", + " )\n", + " )\n", + ").interactive()\n", + "\n", + "chart" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/ridgeline_plot.ipynb b/doc/jupyterlite/_output/files/ridgeline_plot.ipynb new file mode 100644 index 000000000..9160720fd --- /dev/null +++ b/doc/jupyterlite/_output/files/ridgeline_plot.ipynb @@ -0,0 +1,102 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "7f1b4ad6", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f2b6b1c3", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Ridgeline plot Example\n", + "----------------------\n", + "A `Ridgeline plot `_\n", + "chart is a chart that lets you visualize distribution of a numeric value for \n", + "several groups.\n", + "\n", + "Such a chart can be created in Altair by first transforming the data into a\n", + "suitable representation.\n", + "\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.seattle_weather.url\n", + "\n", + "step = 20\n", + "overlap = 1\n", + "\n", + "alt.Chart(source, height=step).transform_timeunit(\n", + " Month='month(date)'\n", + ").transform_joinaggregate(\n", + " mean_temp='mean(temp_max)', groupby=['Month']\n", + ").transform_bin(\n", + " ['bin_max', 'bin_min'], 'temp_max'\n", + ").transform_aggregate(\n", + " value='count()', groupby=['Month', 'mean_temp', 'bin_min', 'bin_max']\n", + ").transform_impute(\n", + " impute='value', groupby=['Month', 'mean_temp'], key='bin_min', value=0\n", + ").mark_area(\n", + " interpolate='monotone',\n", + " fillOpacity=0.8,\n", + " stroke='lightgray',\n", + " strokeWidth=0.5\n", + ").encode(\n", + " alt.X('bin_min:Q', bin='binned', title='Maximum Daily Temperature (C)'),\n", + " alt.Y(\n", + " 'value:Q',\n", + " scale=alt.Scale(range=[step, -step * overlap]),\n", + " axis=None\n", + " ),\n", + " alt.Fill(\n", + " 'mean_temp:Q',\n", + " legend=None,\n", + " scale=alt.Scale(domain=[30, 5], scheme='redyellowblue')\n", + " )\n", + ").facet(\n", + " row=alt.Row(\n", + " 'Month:T',\n", + " title=None,\n", + " header=alt.Header(labelAngle=0, labelAlign='right', format='%B')\n", + " )\n", + ").properties(\n", + " title='Seattle Weather',\n", + " bounds='flush'\n", + ").configure_facet(\n", + " spacing=0\n", + ").configure_view(\n", + " stroke=None\n", + ").configure_title(\n", + " anchor='end'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/scatter_href.ipynb b/doc/jupyterlite/_output/files/scatter_href.ipynb new file mode 100644 index 000000000..cd09be91d --- /dev/null +++ b/doc/jupyterlite/_output/files/scatter_href.ipynb @@ -0,0 +1,62 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "48a613d6", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "521314f6", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Scatter Plot with Href\n", + "----------------------\n", + "This example shows a scatter plot with an ``href`` encoding constructed from\n", + "the car name. With this encoding, you can click on any of the points to open\n", + "a google search for the car name.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "alt.Chart(source).transform_calculate(\n", + " url='https://www.google.com/search?q=' + alt.datum.Name\n", + ").mark_point().encode(\n", + " x='Horsepower:Q',\n", + " y='Miles_per_Gallon:Q',\n", + " color='Origin:N',\n", + " href='url:N',\n", + " tooltip=['Name:N', 'url:N']\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/scatter_linked_brush.ipynb b/doc/jupyterlite/_output/files/scatter_linked_brush.ipynb new file mode 100644 index 000000000..bf17bdcc5 --- /dev/null +++ b/doc/jupyterlite/_output/files/scatter_linked_brush.ipynb @@ -0,0 +1,64 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "b743c609", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4f9b2d3e", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Multi-panel Scatter Plot with Linked Brushing\n", + "---------------------------------------------\n", + "This is an example of using an interval selection to control the color of\n", + "points across multiple panels.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "brush = alt.selection(type='interval', resolve='global')\n", + "\n", + "base = alt.Chart(source).mark_point().encode(\n", + " y='Miles_per_Gallon',\n", + " color=alt.condition(brush, 'Origin', alt.ColorValue('gray')),\n", + ").add_selection(\n", + " brush\n", + ").properties(\n", + " width=250,\n", + " height=250\n", + ")\n", + "\n", + "base.encode(x='Horsepower') | base.encode(x='Acceleration')" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/scatter_linked_table.ipynb b/doc/jupyterlite/_output/files/scatter_linked_table.ipynb new file mode 100644 index 000000000..e1fda2a1e --- /dev/null +++ b/doc/jupyterlite/_output/files/scatter_linked_table.ipynb @@ -0,0 +1,88 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "14144cb1", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b16d79f4", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Brushing Scatter Plot to show data on a table\n", + "---------------------------------------------\n", + "A scatter plot of the cars dataset, with data tables for horsepower, MPG, and origin. \n", + "The tables update to reflect the selection on the scatter plot.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "# Brush for selection\n", + "brush = alt.selection(type='interval')\n", + "\n", + "# Scatter Plot\n", + "points = alt.Chart(source).mark_point().encode(\n", + " x='Horsepower:Q',\n", + " y='Miles_per_Gallon:Q',\n", + " color=alt.condition(brush, 'Cylinders:O', alt.value('grey'))\n", + ").add_selection(brush)\n", + "\n", + "# Base chart for data tables\n", + "ranked_text = alt.Chart(source).mark_text().encode(\n", + " y=alt.Y('row_number:O',axis=None)\n", + ").transform_window(\n", + " row_number='row_number()'\n", + ").transform_filter(\n", + " brush\n", + ").transform_window(\n", + " rank='rank(row_number)'\n", + ").transform_filter(\n", + " alt.datum.rank<20\n", + ")\n", + "\n", + "# Data Tables\n", + "horsepower = ranked_text.encode(text='Horsepower:N').properties(title='Horsepower')\n", + "mpg = ranked_text.encode(text='Miles_per_Gallon:N').properties(title='MPG')\n", + "origin = ranked_text.encode(text='Origin:N').properties(title='Origin')\n", + "text = alt.hconcat(horsepower, mpg, origin) # Combine data tables\n", + "\n", + "# Build chart\n", + "alt.hconcat(\n", + " points,\n", + " text\n", + ").resolve_legend(\n", + " color=\"independent\"\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/scatter_marginal_hist.ipynb b/doc/jupyterlite/_output/files/scatter_marginal_hist.ipynb new file mode 100644 index 000000000..05c0c8660 --- /dev/null +++ b/doc/jupyterlite/_output/files/scatter_marginal_hist.ipynb @@ -0,0 +1,89 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "ff860614", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5a13f68a", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Facetted Scatterplot with marginal histograms\n", + "---------------------------------------------\n", + "This example demonstrates how to generate a facetted scatterplot,\n", + "with marginal facetted histograms, and how to share their respective\n", + "- x,some y-limits.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.iris()\n", + "\n", + "base = alt.Chart(source)\n", + "\n", + "xscale = alt.Scale(domain=(4.0, 8.0))\n", + "yscale = alt.Scale(domain=(1.9, 4.55))\n", + "\n", + "bar_args = {'opacity': .3, 'binSpacing': 0}\n", + "\n", + "points = base.mark_circle().encode(\n", + " alt.X('sepalLength', scale=xscale),\n", + " alt.Y('sepalWidth', scale=yscale),\n", + " color='species',\n", + ")\n", + "\n", + "top_hist = base.mark_bar(**bar_args).encode(\n", + " alt.X('sepalLength:Q',\n", + " # when using bins, the axis scale is set through\n", + " # the bin extent, so we do not specify the scale here\n", + " # (which would be ignored anyway)\n", + " bin=alt.Bin(maxbins=20, extent=xscale.domain),\n", + " stack=None,\n", + " title=''\n", + " ),\n", + " alt.Y('count()', stack=None, title=''),\n", + " alt.Color('species:N'),\n", + ").properties(height=60)\n", + "\n", + "right_hist = base.mark_bar(**bar_args).encode(\n", + " alt.Y('sepalWidth:Q',\n", + " bin=alt.Bin(maxbins=20, extent=yscale.domain),\n", + " stack=None,\n", + " title='',\n", + " ),\n", + " alt.X('count()', stack=None, title=''),\n", + " alt.Color('species:N'),\n", + ").properties(width=60)\n", + "\n", + "top_hist & (points | right_hist)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/scatter_matrix.ipynb b/doc/jupyterlite/_output/files/scatter_matrix.ipynb new file mode 100644 index 000000000..fe66ac6b3 --- /dev/null +++ b/doc/jupyterlite/_output/files/scatter_matrix.ipynb @@ -0,0 +1,62 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "2010b0d3", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "31da6d80", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Scatter Matrix\n", + "--------------\n", + "An example of using a RepeatChart to construct a multi-panel scatter plot\n", + "with linked panning and zooming.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "alt.Chart(source).mark_circle().encode(\n", + " alt.X(alt.repeat(\"column\"), type='quantitative'),\n", + " alt.Y(alt.repeat(\"row\"), type='quantitative'),\n", + " color='Origin:N'\n", + ").properties(\n", + " width=150,\n", + " height=150\n", + ").repeat(\n", + " row=['Horsepower', 'Acceleration', 'Miles_per_Gallon'],\n", + " column=['Miles_per_Gallon', 'Acceleration', 'Horsepower']\n", + ").interactive()" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/scatter_qq.ipynb b/doc/jupyterlite/_output/files/scatter_qq.ipynb new file mode 100644 index 000000000..18777d96b --- /dev/null +++ b/doc/jupyterlite/_output/files/scatter_qq.ipynb @@ -0,0 +1,63 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "d1e6c219", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "98d4f6c5", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Quantile-Quantile Plot\n", + "----------------------\n", + "A quantile-quantile plot comparing input data to theoretical distributions.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.normal_2d.url\n", + "\n", + "base = alt.Chart(source).transform_quantile(\n", + " 'u',\n", + " step=0.01,\n", + " as_ = ['p', 'v']\n", + ").transform_calculate(\n", + " uniform = 'quantileUniform(datum.p)',\n", + " normal = 'quantileNormal(datum.p)'\n", + ").mark_point().encode(\n", + " alt.Y('v:Q')\n", + ")\n", + "\n", + "base.encode(x='uniform:Q') | base.encode(x='normal:Q')" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/scatter_tooltips.ipynb b/doc/jupyterlite/_output/files/scatter_tooltips.ipynb new file mode 100644 index 000000000..7fe818ff9 --- /dev/null +++ b/doc/jupyterlite/_output/files/scatter_tooltips.ipynb @@ -0,0 +1,59 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "e2b2e263", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "177730ce", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Simple Scatter Plot with Tooltips\n", + "---------------------------------\n", + "A scatter plot of the cars dataset, with tooltips showing selected column\n", + "values when you hover over points. We make the points larger so that it is\n", + "easier to hover over them.\n", + "\"\"\"\n", + "# category: simple charts\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "alt.Chart(source).mark_circle(size=60).encode(\n", + " x='Horsepower',\n", + " y='Miles_per_Gallon',\n", + " color='Origin',\n", + " tooltip=['Name', 'Origin', 'Horsepower', 'Miles_per_Gallon']\n", + ").interactive()" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/scatter_with_histogram.ipynb b/doc/jupyterlite/_output/files/scatter_with_histogram.ipynb new file mode 100644 index 000000000..70a6be660 --- /dev/null +++ b/doc/jupyterlite/_output/files/scatter_with_histogram.ipynb @@ -0,0 +1,99 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "8ea862e5", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7c14b78a", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Scatter Plot and Histogram with Interval Selection\n", + "==================================================\n", + "\n", + "This example shows how to link a scatter plot and a histogram\n", + "together such that an interval selection in the histogram will\n", + "plot the selected values in the scatter plot.\n", + "\n", + "Note that both subplots need to know about the `mbin` field created\n", + "by the `transform_bin` method. In order to achieve this, the data is\n", + "not passed to the `Chart()` instances creating the subplots, but\n", + "directly in the `hconcat()` function, which joins the two plots together.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "\n", + "import altair as alt\n", + "import pandas as pd\n", + "import numpy as np\n", + "\n", + "x = np.random.normal(size=100)\n", + "y = np.random.normal(size=100)\n", + "\n", + "m = np.random.normal(15, 1, size=100)\n", + "\n", + "source = pd.DataFrame({\"x\": x, \"y\":y, \"m\":m})\n", + "\n", + "# interval selection in the scatter plot\n", + "pts = alt.selection(type=\"interval\", encodings=[\"x\"])\n", + "\n", + "# left panel: scatter plot\n", + "points = alt.Chart().mark_point(filled=True, color=\"black\").encode(\n", + " x='x',\n", + " y='y'\n", + ").transform_filter(\n", + " pts\n", + ").properties(\n", + " width=300,\n", + " height=300\n", + ")\n", + "\n", + "# right panel: histogram\n", + "mag = alt.Chart().mark_bar().encode(\n", + " x='mbin:N',\n", + " y=\"count()\",\n", + " color=alt.condition(pts, alt.value(\"black\"), alt.value(\"lightgray\"))\n", + ").properties(\n", + " width=300,\n", + " height=300\n", + ").add_selection(pts)\n", + "\n", + "# build the chart:\n", + "alt.hconcat(\n", + " points,\n", + " mag,\n", + " data=source\n", + ").transform_bin(\n", + " \"mbin\",\n", + " field=\"m\",\n", + " bin=alt.Bin(maxbins=20)\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/scatter_with_labels.ipynb b/doc/jupyterlite/_output/files/scatter_with_labels.ipynb new file mode 100644 index 000000000..2581bafb4 --- /dev/null +++ b/doc/jupyterlite/_output/files/scatter_with_labels.ipynb @@ -0,0 +1,68 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "fe3f69ee", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d0b425df", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Simple Scatter Plot with Labels\n", + "===============================\n", + "This example shows a basic scatter plot with labels created with Altair.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame({\n", + " 'x': [1, 3, 5, 7, 9],\n", + " 'y': [1, 3, 5, 7, 9],\n", + " 'label': ['A', 'B', 'C', 'D', 'E']\n", + "})\n", + "\n", + "points = alt.Chart(source).mark_point().encode(\n", + " x='x:Q',\n", + " y='y:Q'\n", + ")\n", + "\n", + "text = points.mark_text(\n", + " align='left',\n", + " baseline='middle',\n", + " dx=7\n", + ").encode(\n", + " text='label'\n", + ")\n", + "\n", + "points + text" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/scatter_with_layered_histogram.ipynb b/doc/jupyterlite/_output/files/scatter_with_layered_histogram.ipynb new file mode 100644 index 000000000..dd5902f38 --- /dev/null +++ b/doc/jupyterlite/_output/files/scatter_with_layered_histogram.ipynb @@ -0,0 +1,99 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "4e578263", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9c9a41f6", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Interactive Scatter Plot and Linked Layered Histogram\n", + "=====================================================\n", + "\n", + "This example shows how to link a scatter plot and a histogram\n", + "together such that clicking on a point in the scatter plot will\n", + "isolate the distribution corresponding to that point, and vice versa.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "\n", + "import altair as alt\n", + "import pandas as pd\n", + "import numpy as np\n", + "\n", + "# generate fake data\n", + "source = pd.DataFrame({'gender': ['M']*1000 + ['F']*1000,\n", + " 'height':np.concatenate((np.random.normal(69, 7, 1000),\n", + " np.random.normal(64, 6, 1000))),\n", + " 'weight': np.concatenate((np.random.normal(195.8, 144, 1000),\n", + " np.random.normal(167, 100, 1000))),\n", + " 'age': np.concatenate((np.random.normal(45, 8, 1000),\n", + " np.random.normal(51, 6, 1000)))\n", + " })\n", + "\n", + "selector = alt.selection_single(empty='all', fields=['gender'])\n", + "\n", + "color_scale = alt.Scale(domain=['M', 'F'],\n", + " range=['#1FC3AA', '#8624F5'])\n", + "\n", + "base = alt.Chart(source).properties(\n", + " width=250,\n", + " height=250\n", + ").add_selection(selector)\n", + "\n", + "points = base.mark_point(filled=True, size=200).encode(\n", + " x=alt.X('mean(height):Q',\n", + " scale=alt.Scale(domain=[0,84])),\n", + " y=alt.Y('mean(weight):Q',\n", + " scale=alt.Scale(domain=[0,250])),\n", + " color=alt.condition(selector,\n", + " 'gender:N',\n", + " alt.value('lightgray'),\n", + " scale=color_scale),\n", + ")\n", + "\n", + "hists = base.mark_bar(opacity=0.5, thickness=100).encode(\n", + " x=alt.X('age',\n", + " bin=alt.Bin(step=5), # step keeps bin size the same\n", + " scale=alt.Scale(domain=[0,100])),\n", + " y=alt.Y('count()',\n", + " stack=None,\n", + " scale=alt.Scale(domain=[0,350])),\n", + " color=alt.Color('gender:N',\n", + " scale=color_scale)\n", + ").transform_filter(\n", + " selector\n", + ")\n", + "\n", + "\n", + "points | hists" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/scatter_with_loess.ipynb b/doc/jupyterlite/_output/files/scatter_with_loess.ipynb new file mode 100644 index 000000000..12c0b56d5 --- /dev/null +++ b/doc/jupyterlite/_output/files/scatter_with_loess.ipynb @@ -0,0 +1,70 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "962df83e", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e3b9e274", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Scatter Plot with LOESS Lines\n", + "-----------------------------\n", + "This example shows how to add a trend line to a scatter plot using \n", + "the LOESS transform (LOcally Estimated Scatterplot Smoothing).\n", + "\"\"\"\n", + "# category: scatter plots\n", + "\n", + "import altair as alt\n", + "import pandas as pd\n", + "import numpy as np\n", + "\n", + "np.random.seed(1)\n", + "\n", + "source = pd.DataFrame({\n", + " 'x': np.arange(100),\n", + " 'A': np.random.randn(100).cumsum(),\n", + " 'B': np.random.randn(100).cumsum(),\n", + " 'C': np.random.randn(100).cumsum(),\n", + "})\n", + "\n", + "base = alt.Chart(source).mark_circle(opacity=0.5).transform_fold(\n", + " fold=['A', 'B', 'C'], \n", + " as_=['category', 'y']\n", + ").encode(\n", + " alt.X('x:Q'), \n", + " alt.Y('y:Q'), \n", + " alt.Color('category:N')\n", + ")\n", + "\n", + "base + base.transform_loess('x', 'y', groupby=['category']).mark_line(size=4)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/scatter_with_minimap.ipynb b/doc/jupyterlite/_output/files/scatter_with_minimap.ipynb new file mode 100644 index 000000000..c16ad3dd8 --- /dev/null +++ b/doc/jupyterlite/_output/files/scatter_with_minimap.ipynb @@ -0,0 +1,88 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c76b4349", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0037700e", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Scatter Plot with Minimap\n", + "-------------------------\n", + "This example shows how to create a miniature version of a plot\n", + "such that creating a selection in the miniature version\n", + "adjusts the axis limits in another, more detailed view.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.seattle_weather()\n", + "\n", + "zoom = alt.selection_interval(encodings=[\"x\", \"y\"])\n", + "\n", + "minimap = (\n", + " alt.Chart(source)\n", + " .mark_point()\n", + " .add_selection(zoom)\n", + " .encode(\n", + " x=\"date:T\",\n", + " y=\"temp_max:Q\",\n", + " color=alt.condition(zoom, \"weather\", alt.value(\"lightgray\")),\n", + " )\n", + " .properties(\n", + " width=200,\n", + " height=200,\n", + " title=\"Minimap -- click and drag to zoom in the detail view\",\n", + " )\n", + ")\n", + "\n", + "detail = (\n", + " alt.Chart(source)\n", + " .mark_point()\n", + " .encode(\n", + " x=alt.X(\n", + " \"date:T\", scale=alt.Scale(domain={\"param\": zoom.name, \"encoding\": \"x\"})\n", + " ),\n", + " y=alt.Y(\n", + " \"temp_max:Q\",\n", + " scale=alt.Scale(domain={\"param\": zoom.name, \"encoding\": \"y\"}),\n", + " ),\n", + " color=\"weather\",\n", + " )\n", + " .properties(width=600, height=400, title=\"Seattle weather -- detail view\")\n", + ")\n", + "\n", + "detail | minimap" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/scatter_with_rolling_mean.ipynb b/doc/jupyterlite/_output/files/scatter_with_rolling_mean.ipynb new file mode 100644 index 000000000..6bf4eed0f --- /dev/null +++ b/doc/jupyterlite/_output/files/scatter_with_rolling_mean.ipynb @@ -0,0 +1,70 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "d463dba7", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b754c1d3", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Scatter Plot with Rolling Mean\n", + "------------------------------\n", + "A scatter plot with a rolling mean overlay. In this example a 30 day window\n", + "is used to calculate the mean of the maximum temperature around each date.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.seattle_weather()\n", + "\n", + "line = alt.Chart(source).mark_line(\n", + " color='red', \n", + " size=3\n", + ").transform_window(\n", + " rolling_mean='mean(temp_max)',\n", + " frame=[-15, 15]\n", + ").encode(\n", + " x='date:T',\n", + " y='rolling_mean:Q'\n", + ")\n", + "\n", + "points = alt.Chart(source).mark_point().encode(\n", + " x='date:T', \n", + " y=alt.Y('temp_max:Q', \n", + " axis=alt.Axis(title='Max Temp'))\n", + ")\n", + "\n", + "points + line" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/seattle_weather_interactive.ipynb b/doc/jupyterlite/_output/files/seattle_weather_interactive.ipynb new file mode 100644 index 000000000..044cf0ca4 --- /dev/null +++ b/doc/jupyterlite/_output/files/seattle_weather_interactive.ipynb @@ -0,0 +1,99 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "3d268313", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2c2be931", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Seattle Weather Interactive\n", + "===========================\n", + "This chart provides an interactive exploration of Seattle weather over the\n", + "course of the year. It includes a one-axis brush selection to easily\n", + "see the distribution of weather types in a particular date range.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.seattle_weather()\n", + "\n", + "scale = alt.Scale(domain=['sun', 'fog', 'drizzle', 'rain', 'snow'],\n", + " range=['#e7ba52', '#a7a7a7', '#aec7e8', '#1f77b4', '#9467bd'])\n", + "color = alt.Color('weather:N', scale=scale)\n", + "\n", + "# We create two selections:\n", + "# - a brush that is active on the top panel\n", + "# - a multi-click that is active on the bottom panel\n", + "brush = alt.selection_interval(encodings=['x'])\n", + "click = alt.selection_multi(encodings=['color'])\n", + "\n", + "# Top panel is scatter plot of temperature vs time\n", + "points = alt.Chart().mark_point().encode(\n", + " alt.X('monthdate(date):T', title='Date'),\n", + " alt.Y('temp_max:Q',\n", + " title='Maximum Daily Temperature (C)',\n", + " scale=alt.Scale(domain=[-5, 40])\n", + " ),\n", + " color=alt.condition(brush, color, alt.value('lightgray')),\n", + " size=alt.Size('precipitation:Q', scale=alt.Scale(range=[5, 200]))\n", + ").properties(\n", + " width=550,\n", + " height=300\n", + ").add_selection(\n", + " brush\n", + ").transform_filter(\n", + " click\n", + ")\n", + "\n", + "# Bottom panel is a bar chart of weather type\n", + "bars = alt.Chart().mark_bar().encode(\n", + " x='count()',\n", + " y='weather:N',\n", + " color=alt.condition(click, color, alt.value('lightgray')),\n", + ").transform_filter(\n", + " brush\n", + ").properties(\n", + " width=550,\n", + ").add_selection(\n", + " click\n", + ")\n", + "\n", + "alt.vconcat(\n", + " points,\n", + " bars,\n", + " data=source,\n", + " title=\"Seattle Weather: 2012-2015\"\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/select_detail.ipynb b/doc/jupyterlite/_output/files/select_detail.ipynb new file mode 100644 index 000000000..bcd229037 --- /dev/null +++ b/doc/jupyterlite/_output/files/select_detail.ipynb @@ -0,0 +1,104 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "8e8e9483", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d1a40992", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Selection Detail Example\n", + "========================\n", + "This example shows a selection that links two views of data: the left panel\n", + "contains one point per object, and the right panel contains one line per\n", + "object. Clicking on either the points or lines will select the corresponding\n", + "objects in both views of the data.\n", + "\n", + "The challenge lies in expressing such hierarchical data in a way that Altair\n", + "can handle. We do this by merging the data into a \"long form\" dataframe, and\n", + "aggregating identical metadata for the final plot.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "import pandas as pd\n", + "import numpy as np\n", + "\n", + "np.random.seed(0)\n", + "\n", + "n_objects = 20\n", + "n_times = 50\n", + "\n", + "# Create one (x, y) pair of metadata per object\n", + "locations = pd.DataFrame({\n", + " 'id': range(n_objects),\n", + " 'x': np.random.randn(n_objects),\n", + " 'y': np.random.randn(n_objects)\n", + "})\n", + "\n", + "# Create a 50-element time-series for each object\n", + "timeseries = pd.DataFrame(np.random.randn(n_times, n_objects).cumsum(0),\n", + " columns=locations['id'],\n", + " index=pd.RangeIndex(0, n_times, name='time'))\n", + "\n", + "# Melt the wide-form timeseries into a long-form view\n", + "timeseries = timeseries.reset_index().melt('time')\n", + "\n", + "# Merge the (x, y) metadata into the long-form view\n", + "timeseries['id'] = timeseries['id'].astype(int) # make merge not complain\n", + "data = pd.merge(timeseries, locations, on='id')\n", + "\n", + "# Data is prepared, now make a chart\n", + "\n", + "selector = alt.selection_single(empty='all', fields=['id'])\n", + "\n", + "base = alt.Chart(data).properties(\n", + " width=250,\n", + " height=250\n", + ").add_selection(selector)\n", + "\n", + "points = base.mark_point(filled=True, size=200).encode(\n", + " x='mean(x)',\n", + " y='mean(y)',\n", + " color=alt.condition(selector, 'id:O', alt.value('lightgray'), legend=None),\n", + ")\n", + "\n", + "timeseries = base.mark_line().encode(\n", + " x='time',\n", + " y=alt.Y('value', scale=alt.Scale(domain=(-15, 15))),\n", + " color=alt.Color('id:O', legend=None)\n", + ").transform_filter(\n", + " selector\n", + ")\n", + "\n", + "points | timeseries" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/select_mark_area.ipynb b/doc/jupyterlite/_output/files/select_mark_area.ipynb new file mode 100644 index 000000000..4b3f85a6f --- /dev/null +++ b/doc/jupyterlite/_output/files/select_mark_area.ipynb @@ -0,0 +1,69 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "5f64ac54", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f2191ca0", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Using Selection Interval with mark_area\n", + "=========================================\n", + "\n", + "Because area is considered one object, just using the plain \n", + "selector will select the entire area instead of just one part of it.\n", + "\n", + "This example shows how to use two areas, one on top of the other, and a\n", + "`transform_filter` to fake out this effect.\n", + "\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.unemployment_across_industries.url\n", + "\n", + "base = alt.Chart(source).mark_area(\n", + " color='goldenrod',\n", + " opacity=0.3\n", + ").encode(\n", + " x='yearmonth(date):T',\n", + " y='sum(count):Q',\n", + ")\n", + "\n", + "brush = alt.selection_interval(encodings=['x'],empty='all')\n", + "background = base.add_selection(brush)\n", + "selected = base.transform_filter(brush).mark_area(color='goldenrod')\n", + "\n", + "background + selected" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/selection_histogram.ipynb b/doc/jupyterlite/_output/files/selection_histogram.ipynb new file mode 100644 index 000000000..10767ffff --- /dev/null +++ b/doc/jupyterlite/_output/files/selection_histogram.ipynb @@ -0,0 +1,71 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "f774b1e7", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "439e9921", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Selection Histogram\n", + "===================\n", + "This chart shows an example of using an interval selection to filter the\n", + "contents of an attached histogram, allowing the user to see the proportion\n", + "of items in each category within the selection.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "brush = alt.selection(type='interval')\n", + "\n", + "points = alt.Chart(source).mark_point().encode(\n", + " x='Horsepower:Q',\n", + " y='Miles_per_Gallon:Q',\n", + " color=alt.condition(brush, 'Origin:N', alt.value('lightgray'))\n", + ").add_selection(\n", + " brush\n", + ")\n", + "\n", + "bars = alt.Chart(source).mark_bar().encode(\n", + " y='Origin:N',\n", + " color='Origin:N',\n", + " x='count(Origin):Q'\n", + ").transform_filter(\n", + " brush\n", + ")\n", + "\n", + "points & bars" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/selection_layer_bar_month.ipynb b/doc/jupyterlite/_output/files/selection_layer_bar_month.ipynb new file mode 100644 index 000000000..4530fee6c --- /dev/null +++ b/doc/jupyterlite/_output/files/selection_layer_bar_month.ipynb @@ -0,0 +1,69 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "b0b82935", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dfed5997", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Interactive Average\n", + "===================\n", + "The plot below uses an interval selection, which causes the chart to include an interactive brush\n", + "(shown in grey). The brush selection parameterizes the red guideline, which visualizes the average\n", + "value within the selected interval.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.seattle_weather()\n", + "brush = alt.selection(type='interval', encodings=['x'])\n", + "\n", + "bars = alt.Chart().mark_bar().encode(\n", + " x='month(date):O',\n", + " y='mean(precipitation):Q',\n", + " opacity=alt.condition(brush, alt.OpacityValue(1), alt.OpacityValue(0.7)),\n", + ").add_selection(\n", + " brush\n", + ")\n", + "\n", + "line = alt.Chart().mark_rule(color='firebrick').encode(\n", + " y='mean(precipitation):Q',\n", + " size=alt.SizeValue(3)\n", + ").transform_filter(\n", + " brush\n", + ")\n", + "\n", + "alt.layer(bars, line, data=source)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/simple_bar_chart.ipynb b/doc/jupyterlite/_output/files/simple_bar_chart.ipynb new file mode 100644 index 000000000..5b174e4e8 --- /dev/null +++ b/doc/jupyterlite/_output/files/simple_bar_chart.ipynb @@ -0,0 +1,57 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "ea2e1729", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "60af34dd", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Simple Bar Chart\n", + "================\n", + "This example shows a basic bar chart created with Altair.\n", + "\"\"\"\n", + "# category: simple charts\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame({\n", + " 'a': ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'],\n", + " 'b': [28, 55, 43, 91, 81, 53, 19, 87, 52]\n", + "})\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x='a',\n", + " y='b'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/simple_heatmap.ipynb b/doc/jupyterlite/_output/files/simple_heatmap.ipynb new file mode 100644 index 000000000..3fb52338b --- /dev/null +++ b/doc/jupyterlite/_output/files/simple_heatmap.ipynb @@ -0,0 +1,63 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "47f7728c", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "554c739a", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Simple Heatmap\n", + "--------------\n", + "This example shows a simple heatmap for showing gridded data.\n", + "\"\"\"\n", + "# category: simple charts\n", + "import altair as alt\n", + "import numpy as np\n", + "import pandas as pd\n", + "\n", + "# Compute x^2 + y^2 across a 2D grid\n", + "x, y = np.meshgrid(range(-5, 5), range(-5, 5))\n", + "z = x ** 2 + y ** 2\n", + "\n", + "# Convert this grid to columnar data expected by Altair\n", + "source = pd.DataFrame({'x': x.ravel(),\n", + " 'y': y.ravel(),\n", + " 'z': z.ravel()})\n", + "\n", + "alt.Chart(source).mark_rect().encode(\n", + " x='x:O',\n", + " y='y:O',\n", + " color='z:Q'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/simple_histogram.ipynb b/doc/jupyterlite/_output/files/simple_histogram.ipynb new file mode 100644 index 000000000..916cb9a66 --- /dev/null +++ b/doc/jupyterlite/_output/files/simple_histogram.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "1ca789d2", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "05f81b90", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Simple Histogram\n", + "----------------\n", + "This example shows how to make a basic histogram, based on the vega-lite docs\n", + "https://vega.github.io/vega-lite/examples/histogram.html\n", + "\"\"\"\n", + "# category: simple charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.movies.url\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " alt.X(\"IMDB_Rating:Q\", bin=True),\n", + " y='count()',\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/simple_line_chart.ipynb b/doc/jupyterlite/_output/files/simple_line_chart.ipynb new file mode 100644 index 000000000..585b6e5b6 --- /dev/null +++ b/doc/jupyterlite/_output/files/simple_line_chart.ipynb @@ -0,0 +1,61 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "37f80e01", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8db2c762", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Simple Line Chart\n", + "-----------------\n", + "This chart shows the most basic line chart, made from a dataframe with two\n", + "columns.\n", + "\"\"\"\n", + "# category: simple charts\n", + "\n", + "import altair as alt\n", + "import numpy as np\n", + "import pandas as pd\n", + "\n", + "x = np.arange(100)\n", + "source = pd.DataFrame({\n", + " 'x': x,\n", + " 'f(x)': np.sin(x / 5)\n", + "})\n", + "\n", + "alt.Chart(source).mark_line().encode(\n", + " x='x',\n", + " y='f(x)'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/simple_scatter_with_errorbars.ipynb b/doc/jupyterlite/_output/files/simple_scatter_with_errorbars.ipynb new file mode 100644 index 000000000..84af88253 --- /dev/null +++ b/doc/jupyterlite/_output/files/simple_scatter_with_errorbars.ipynb @@ -0,0 +1,82 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "a937e248", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "239f26b4", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Simple Scatter Plot with Errorbars\n", + "----------------------------------\n", + "A simple scatter plot of a data set with errorbars.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "import altair as alt\n", + "import pandas as pd\n", + "import numpy as np\n", + "\n", + "# generate some data points with uncertainties\n", + "np.random.seed(0)\n", + "x = [1, 2, 3, 4, 5]\n", + "y = np.random.normal(10, 0.5, size=len(x))\n", + "yerr = 0.2\n", + "\n", + "# set up data frame\n", + "source = pd.DataFrame({\"x\": x, \"y\": y, \"yerr\": yerr})\n", + "\n", + "# the base chart\n", + "base = alt.Chart(source).transform_calculate(\n", + " ymin=\"datum.y-datum.yerr\",\n", + " ymax=\"datum.y+datum.yerr\"\n", + ")\n", + "\n", + "# generate the points\n", + "points = base.mark_point(\n", + " filled=True,\n", + " size=50,\n", + " color='black'\n", + ").encode(\n", + " x=alt.X('x', scale=alt.Scale(domain=(0, 6))),\n", + " y=alt.Y('y', scale=alt.Scale(zero=False))\n", + ")\n", + "\n", + "# generate the error bars\n", + "errorbars = base.mark_errorbar().encode(\n", + " x=\"x\",\n", + " y=\"ymin:Q\",\n", + " y2=\"ymax:Q\"\n", + ")\n", + "\n", + "points + errorbars" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/simple_stacked_area_chart.ipynb b/doc/jupyterlite/_output/files/simple_stacked_area_chart.ipynb new file mode 100644 index 000000000..0bd11c743 --- /dev/null +++ b/doc/jupyterlite/_output/files/simple_stacked_area_chart.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "734cffc6", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "18583b8a", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Simple Stacked Area Chart\n", + "-------------------------\n", + "This example shows how to make a simple stacked area chart.\n", + "\"\"\"\n", + "# category: simple charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.iowa_electricity()\n", + "\n", + "alt.Chart(source).mark_area().encode(\n", + " x=\"year:T\",\n", + " y=\"net_generation:Q\",\n", + " color=\"source:N\"\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/slider_cutoff.ipynb b/doc/jupyterlite/_output/files/slider_cutoff.ipynb new file mode 100644 index 000000000..7e5d6b461 --- /dev/null +++ b/doc/jupyterlite/_output/files/slider_cutoff.ipynb @@ -0,0 +1,69 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "caee913b", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e1dee815", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Slider Cutoff\n", + "=============\n", + "This example shows how to bind a variable parameter to a slider, and how to use the corresponding bound value to color data points. This example is based on an example from the Altair 4 documentation for Interactions, in which the interactivity was accomplished using a selection. The version below has been simplified significantly through the use of a variable parameter. Variable parameters were added in Altair 5.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "import pandas as pd\n", + "import numpy as np\n", + "\n", + "rand = np.random.RandomState(42)\n", + "\n", + "df = pd.DataFrame({\n", + " 'xval': range(100),\n", + " 'yval': rand.randn(100).cumsum()\n", + "})\n", + "\n", + "slider = alt.binding_range(min=0, max=100, step=1)\n", + "cutoff = alt.parameter(bind=slider, value=50)\n", + "\n", + "alt.Chart(df).mark_point().encode(\n", + " x='xval',\n", + " y='yval',\n", + " color=alt.condition(\n", + " alt.datum.xval < cutoff,\n", + " alt.value('red'), alt.value('blue')\n", + " )\n", + ").add_parameter(\n", + " cutoff\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/slope_graph.ipynb b/doc/jupyterlite/_output/files/slope_graph.ipynb new file mode 100644 index 000000000..182f5fe1a --- /dev/null +++ b/doc/jupyterlite/_output/files/slope_graph.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c89d94f5", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "253f68bf", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Slope Graph\n", + "-----------------------\n", + "This example shows how to make Slope Graph.\n", + "\"\"\"\n", + "# category: line charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "alt.Chart(source).mark_line().encode(\n", + " x='year:O',\n", + " y='median(yield)',\n", + " color='site'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/sorted_error_bars_with_ci.ipynb b/doc/jupyterlite/_output/files/sorted_error_bars_with_ci.ipynb new file mode 100644 index 000000000..98cb197d5 --- /dev/null +++ b/doc/jupyterlite/_output/files/sorted_error_bars_with_ci.ipynb @@ -0,0 +1,75 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "63156cde", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "30d1c717", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Sorted Error Bars showing Confidence Interval\n", + "=============================================\n", + "This example shows how to show error bars using confidence intervals, while also sorting the y-axis based on x-axis values. \n", + "\"\"\"\n", + "# category: other charts\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "points = alt.Chart(source).mark_point(\n", + " filled=True,\n", + " color='black'\n", + ").encode(\n", + " x=alt.X('mean(yield)', title='Barley Yield'),\n", + " y=alt.Y(\n", + " 'variety',\n", + " sort=alt.EncodingSortField(\n", + " field='yield',\n", + " op='mean',\n", + " order='descending'\n", + " )\n", + " )\n", + ").properties(\n", + " width=400,\n", + " height=250\n", + ")\n", + "\n", + "error_bars = points.mark_rule().encode(\n", + " x='ci0(yield)',\n", + " x2='ci1(yield)',\n", + ")\n", + "\n", + "points + error_bars" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/stacked_bar_chart.ipynb b/doc/jupyterlite/_output/files/stacked_bar_chart.ipynb new file mode 100644 index 000000000..f8d1372e5 --- /dev/null +++ b/doc/jupyterlite/_output/files/stacked_bar_chart.ipynb @@ -0,0 +1,56 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "8e9666cc", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d0ca8a9a", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Stacked Bar Chart\n", + "-----------------\n", + "\n", + "This is an example of a stacked bar chart using data which contains crop yields over different regions and different years in the 1930s.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x='variety',\n", + " y='sum(yield)',\n", + " color='site'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/stacked_bar_chart_sorted_segments.ipynb b/doc/jupyterlite/_output/files/stacked_bar_chart_sorted_segments.ipynb new file mode 100644 index 000000000..34f9fe24b --- /dev/null +++ b/doc/jupyterlite/_output/files/stacked_bar_chart_sorted_segments.ipynb @@ -0,0 +1,60 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "be173c1b", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8041d8ed", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Stacked Bar Chart with Sorted Segments\n", + "--------------------------------------\n", + "This is an example of a stacked-bar chart with the segments of each bar resorted.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x='sum(yield)',\n", + " y='variety',\n", + " color='site',\n", + " order=alt.Order(\n", + " # Sort the segments of the bars by this field\n", + " 'site',\n", + " sort='ascending'\n", + " )\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/stacked_bar_chart_with_text.ipynb b/doc/jupyterlite/_output/files/stacked_bar_chart_with_text.ipynb new file mode 100644 index 000000000..ff45e5cc7 --- /dev/null +++ b/doc/jupyterlite/_output/files/stacked_bar_chart_with_text.ipynb @@ -0,0 +1,66 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "f44c32a5", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fe404a55", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Stacked Bar Chart with Text Overlay\n", + "===================================\n", + "This example shows how to overlay text on a stacked bar chart. For both the\n", + "bar and text marks, we use the ``stack`` argument in the ``x`` encoding to\n", + "cause the values to be stacked horizontally.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source=data.barley()\n", + "\n", + "bars = alt.Chart(source).mark_bar().encode(\n", + " x=alt.X('sum(yield):Q', stack='zero'),\n", + " y=alt.Y('variety:N'),\n", + " color=alt.Color('site')\n", + ")\n", + "\n", + "text = alt.Chart(source).mark_text(dx=-15, dy=3, color='white').encode(\n", + " x=alt.X('sum(yield):Q', stack='zero'),\n", + " y=alt.Y('variety:N'),\n", + " detail='site:N',\n", + " text=alt.Text('sum(yield):Q', format='.1f')\n", + ")\n", + "\n", + "bars + text" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/stem_and_leaf.ipynb b/doc/jupyterlite/_output/files/stem_and_leaf.ipynb new file mode 100644 index 000000000..ac916ab60 --- /dev/null +++ b/doc/jupyterlite/_output/files/stem_and_leaf.ipynb @@ -0,0 +1,78 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "01eaeff1", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6d2dbf92", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Stem and Leaf Plot\n", + "------------------\n", + "This example shows how to make a stem and leaf plot.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "import pandas as pd\n", + "import numpy as np\n", + "np.random.seed(42)\n", + "\n", + "# Generating random data\n", + "source = pd.DataFrame({'samples': np.random.normal(50, 15, 100).astype(int).astype(str)})\n", + "\n", + "# Splitting stem and leaf\n", + "source['stem'] = source['samples'].str[:-1]\n", + "source['leaf'] = source['samples'].str[-1]\n", + "\n", + "source = source.sort_values(by=['stem', 'leaf'])\n", + "\n", + "# Determining leaf position\n", + "source['position'] = source.groupby('stem').cumcount().add(1)\n", + "\n", + "# Creating stem and leaf plot\n", + "alt.Chart(source).mark_text(\n", + " align='left',\n", + " baseline='middle',\n", + " dx=-5\n", + ").encode(\n", + " alt.X('position:Q', title='',\n", + " axis=alt.Axis(ticks=False, labels=False, grid=False)\n", + " ),\n", + " alt.Y('stem:N', title='', axis=alt.Axis(tickSize=0)),\n", + " text='leaf:N',\n", + ").configure_axis(\n", + " labelFontSize=20\n", + ").configure_text(\n", + " fontSize=20\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/step_chart.ipynb b/doc/jupyterlite/_output/files/step_chart.ipynb new file mode 100644 index 000000000..eeb8baf9d --- /dev/null +++ b/doc/jupyterlite/_output/files/step_chart.ipynb @@ -0,0 +1,61 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "ebd38f14", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1779040e", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Step Chart\n", + "----------\n", + "This example shows Google's stock price over time.\n", + "This uses the \"step-after\" interpolation scheme.\n", + "The full list of interpolation options includes 'linear',\n", + "'linear-closed', 'step', 'step-before', 'step-after', 'basis',\n", + "'basis-open', 'basis-closed', 'cardinal', 'cardinal-open',\n", + "'cardinal-closed', 'bundle', and 'monotone'.\n", + "\"\"\"\n", + "# category: line charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.stocks()\n", + "\n", + "alt.Chart(source).mark_line(interpolate='step-after').encode(\n", + " x='date',\n", + " y='price'\n", + ").transform_filter(\n", + " alt.datum.symbol == 'GOOG'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/streamgraph.ipynb b/doc/jupyterlite/_output/files/streamgraph.ipynb new file mode 100644 index 000000000..b432a5cc5 --- /dev/null +++ b/doc/jupyterlite/_output/files/streamgraph.ipynb @@ -0,0 +1,59 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "0cfe1eed", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "efbb45a3", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Streamgraph\n", + "-----------------\n", + "This example shows the streamgraph from vega-lite examples.\n", + "\"\"\"\n", + "# category: area charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.unemployment_across_industries.url\n", + "\n", + "alt.Chart(source).mark_area().encode(\n", + " alt.X('yearmonth(date):T',\n", + " axis=alt.Axis(format='%Y', domain=False, tickSize=0)\n", + " ),\n", + " alt.Y('sum(count):Q', stack='center', axis=None),\n", + " alt.Color('series:N',\n", + " scale=alt.Scale(scheme='category20b')\n", + " )\n", + ").interactive()" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/strip_plot.ipynb b/doc/jupyterlite/_output/files/strip_plot.ipynb new file mode 100644 index 000000000..ac206eec0 --- /dev/null +++ b/doc/jupyterlite/_output/files/strip_plot.ipynb @@ -0,0 +1,54 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c0ecf32b", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a055a5c9", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Simple Strip Plot\n", + "-----------------\n", + "A simple example of how to make a strip plot. \n", + "\"\"\"\n", + "# category: simple charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "alt.Chart(source).mark_tick().encode(\n", + " x='Horsepower:Q',\n", + " y='Cylinders:O'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/stripplot.ipynb b/doc/jupyterlite/_output/files/stripplot.ipynb new file mode 100644 index 000000000..4eed81cba --- /dev/null +++ b/doc/jupyterlite/_output/files/stripplot.ipynb @@ -0,0 +1,79 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "9e0359df", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "27bab372", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Stripplot\n", + "---------\n", + "This example shows how to make a Stripplot.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.movies.url\n", + "\n", + "stripplot = alt.Chart(source, width=40).mark_circle(size=8).encode(\n", + " x=alt.X(\n", + " 'jitter:Q',\n", + " title=None,\n", + " axis=alt.Axis(values=[0], ticks=True, grid=False, labels=False),\n", + " scale=alt.Scale(),\n", + " ),\n", + " y=alt.Y('IMDB_Rating:Q'),\n", + " color=alt.Color('Major_Genre:N', legend=None),\n", + " column=alt.Column(\n", + " 'Major_Genre:N',\n", + " header=alt.Header(\n", + " labelAngle=-90,\n", + " titleOrient='top',\n", + " labelOrient='bottom',\n", + " labelAlign='right',\n", + " labelPadding=3,\n", + " ),\n", + " ),\n", + ").transform_calculate(\n", + " # Generate Gaussian jitter with a Box-Muller transform\n", + " jitter='sqrt(-2*log(random()))*cos(2*PI*random())'\n", + ").configure_facet(\n", + " spacing=0\n", + ").configure_view(\n", + " stroke=None\n", + ")\n", + "\n", + "stripplot" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/table_bubble_plot_github.ipynb b/doc/jupyterlite/_output/files/table_bubble_plot_github.ipynb new file mode 100644 index 000000000..2e0cdf507 --- /dev/null +++ b/doc/jupyterlite/_output/files/table_bubble_plot_github.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "db7f1fe5", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "71756246", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Table Bubble Plot (Github Punch Card)\n", + "-------------------------------------\n", + "This example shows github contributions by the day of week and hour of the day.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.github.url\n", + "\n", + "alt.Chart(source).mark_circle().encode(\n", + " x='hours(time):O',\n", + " y='day(time):O',\n", + " size='sum(count):Q'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/top_k_items.ipynb b/doc/jupyterlite/_output/files/top_k_items.ipynb new file mode 100644 index 000000000..bdf200ab0 --- /dev/null +++ b/doc/jupyterlite/_output/files/top_k_items.ipynb @@ -0,0 +1,66 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "7ddd9895", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "201c2bf3", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Top K Items\n", + "-----------\n", + "This example shows how to use the window and transformation filter to display\n", + "the Top items of a long list of items in decreasing order.\n", + "Here we sort the top 10 highest ranking movies of IMDB.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.movies.url\n", + "\n", + "# Top 10 movies by IMBD rating\n", + "alt.Chart(\n", + " source,\n", + ").mark_bar().encode(\n", + " x=alt.X('Title:N', sort='-y'),\n", + " y=alt.Y('IMDB_Rating:Q'),\n", + " color=alt.Color('IMDB_Rating:Q')\n", + " \n", + ").transform_window(\n", + " rank='rank(IMDB_Rating)',\n", + " sort=[alt.SortField('IMDB_Rating', order='descending')]\n", + ").transform_filter(\n", + " (alt.datum.rank < 10)\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/top_k_letters.ipynb b/doc/jupyterlite/_output/files/top_k_letters.ipynb new file mode 100644 index 000000000..07157fb98 --- /dev/null +++ b/doc/jupyterlite/_output/files/top_k_letters.ipynb @@ -0,0 +1,79 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "951e67af", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "78dcd45e", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Top K Letters\n", + "-------------\n", + "This example shows how to use a window transform in order to display only the\n", + "top K categories by number of entries. In this case, we rank the characters in\n", + "the first paragraph of Dickens' *A Tale of Two Cities* by number of occurances.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "import pandas as pd\n", + "import numpy as np\n", + "\n", + "# Excerpt from A Tale of Two Cities; public domain text\n", + "text = \"\"\"\n", + "It was the best of times, it was the worst of times, it was the age of wisdom,\n", + "it was the age of foolishness, it was the epoch of belief, it was the epoch of\n", + "incredulity, it was the season of Light, it was the season of Darkness, it was\n", + "the spring of hope, it was the winter of despair, we had everything before us,\n", + "we had nothing before us, we were all going direct to Heaven, we were all going\n", + "direct the other way - in short, the period was so far like the present period,\n", + "that some of its noisiest authorities insisted on its being received, for good\n", + "or for evil, in the superlative degree of comparison only.\n", + "\"\"\"\n", + "\n", + "source = pd.DataFrame(\n", + " {'letters': np.array([c for c in text if c.isalpha()])}\n", + ")\n", + "\n", + "alt.Chart(source).transform_aggregate(\n", + " count='count()',\n", + " groupby=['letters']\n", + ").transform_window(\n", + " rank='rank(count)',\n", + " sort=[alt.SortField('count', order='descending')]\n", + ").transform_filter(\n", + " alt.datum.rank < 10\n", + ").mark_bar().encode(\n", + " y=alt.Y('letters:N', sort='-x'),\n", + " x='count:Q',\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/top_k_with_others.ipynb b/doc/jupyterlite/_output/files/top_k_with_others.ipynb new file mode 100644 index 000000000..83e26bd4b --- /dev/null +++ b/doc/jupyterlite/_output/files/top_k_with_others.ipynb @@ -0,0 +1,70 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "d3431ceb", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7e67b73f", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Top-K plot with Others\n", + "----------------------\n", + "This example shows how to use aggregate, window, and calculate transfromations\n", + "to display the top-k directors by average worldwide gross while grouping the \n", + "remaining directors as 'All Others'.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.movies.url\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x=alt.X(\"aggregate_gross:Q\", aggregate=\"mean\", title=None),\n", + " y=alt.Y(\n", + " \"ranked_director:N\",\n", + " sort=alt.Sort(op=\"mean\", field=\"aggregate_gross\", order=\"descending\"),\n", + " title=None,\n", + " ),\n", + ").transform_aggregate(\n", + " aggregate_gross='mean(Worldwide_Gross)',\n", + " groupby=[\"Director\"],\n", + ").transform_window(\n", + " rank='row_number()',\n", + " sort=[alt.SortField(\"aggregate_gross\", order=\"descending\")],\n", + ").transform_calculate(\n", + " ranked_director=\"datum.rank < 10 ? datum.Director : 'All Others'\"\n", + ").properties(\n", + " title=\"Top Directors by Average Worldwide Gross\",\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/trail_marker.ipynb b/doc/jupyterlite/_output/files/trail_marker.ipynb new file mode 100644 index 000000000..49bbea91c --- /dev/null +++ b/doc/jupyterlite/_output/files/trail_marker.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c4170f39", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7b72668b", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Line Chart with Varying Size\n", + "----------------------------\n", + "This is example of using the ``trail`` marker to vary the size of a line.\n", + "\"\"\"\n", + "# category: line charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.wheat()\n", + "\n", + "alt.Chart(source).mark_trail().encode(\n", + " x='year:T',\n", + " y='wheat:Q',\n", + " size='wheat:Q'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/trellis_area.ipynb b/doc/jupyterlite/_output/files/trellis_area.ipynb new file mode 100644 index 000000000..61a4d88d9 --- /dev/null +++ b/doc/jupyterlite/_output/files/trellis_area.ipynb @@ -0,0 +1,58 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "d488d2fb", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ce4bce2d", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Trellis Area Chart\n", + "------------------\n", + "This example shows small multiples of an area chart.\n", + "\"\"\"\n", + "# category: area charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.iowa_electricity()\n", + "\n", + "alt.Chart(source).mark_area().encode(\n", + " x=\"year:T\",\n", + " y=\"net_generation:Q\",\n", + " color=\"source:N\",\n", + " row=\"source:N\"\n", + ").properties(\n", + " height=100\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/trellis_area_sort_array.ipynb b/doc/jupyterlite/_output/files/trellis_area_sort_array.ipynb new file mode 100644 index 000000000..bf90b2eeb --- /dev/null +++ b/doc/jupyterlite/_output/files/trellis_area_sort_array.ipynb @@ -0,0 +1,60 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "123879b6", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fd0063dd", + "metadata": {}, + "outputs": [], + "source": [ + "'''\n", + "Trellis Area Sort Chart\n", + "-----------------------\n", + "This example shows small multiples of an area chart.\n", + "Stock prices of four large companies\n", + "sorted by `['MSFT', 'AAPL', 'IBM', 'AMZN']`\n", + "'''\n", + "# category: area charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.stocks()\n", + "\n", + "alt.Chart(source).transform_filter(\n", + " alt.datum.symbol != 'GOOG'\n", + ").mark_area().encode(\n", + " x='date:T',\n", + " y='price:Q',\n", + " color='symbol:N',\n", + " row=alt.Row('symbol:N', sort=['MSFT', 'AAPL', 'IBM', 'AMZN'])\n", + ").properties(height=50, width=400)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/trellis_histogram.ipynb b/doc/jupyterlite/_output/files/trellis_histogram.ipynb new file mode 100644 index 000000000..a2bd6a150 --- /dev/null +++ b/doc/jupyterlite/_output/files/trellis_histogram.ipynb @@ -0,0 +1,56 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "f13abd10", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1640fe3b", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Trellis Histogram\n", + "-----------------\n", + "This example shows how to make a basic trellis histogram.\n", + "https://vega.github.io/vega-lite/examples/trellis_bar_histogram.html\n", + "\"\"\"\n", + "# category: histograms\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " alt.X(\"Horsepower:Q\", bin=True),\n", + " y='count()',\n", + " row='Origin'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/trellis_scatter_plot.ipynb b/doc/jupyterlite/_output/files/trellis_scatter_plot.ipynb new file mode 100644 index 000000000..c18484ee5 --- /dev/null +++ b/doc/jupyterlite/_output/files/trellis_scatter_plot.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "d3a208fa", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "01eab722", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Trellis Scatter Plot\n", + "-----------------------\n", + "This example shows how to make a trellis scatter plot.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "alt.Chart(source).mark_point().encode(\n", + " x='Horsepower:Q',\n", + " y='Miles_per_Gallon:Q',\n", + " row='Origin:N'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/trellis_stacked_bar_chart.ipynb b/doc/jupyterlite/_output/files/trellis_stacked_bar_chart.ipynb new file mode 100644 index 000000000..84e65979d --- /dev/null +++ b/doc/jupyterlite/_output/files/trellis_stacked_bar_chart.ipynb @@ -0,0 +1,56 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "e7d698a3", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "25d90000", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Trellis Stacked Bar Chart\n", + "=========================\n", + "This is an example of a horizontal stacked bar chart using data which contains crop yields over different regions and different years in the 1930s.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " column='year',\n", + " x='yield',\n", + " y='variety',\n", + " color='site'\n", + ").properties(width=220)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/us_employment.ipynb b/doc/jupyterlite/_output/files/us_employment.ipynb new file mode 100644 index 000000000..91bed1ab5 --- /dev/null +++ b/doc/jupyterlite/_output/files/us_employment.ipynb @@ -0,0 +1,97 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "b1bbc45d", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "72273761", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "The U.S. employment crash during the Great Recession\n", + "----------------------------------------------------\n", + "This example is a fully developed bar chart with negative values using the sample dataset of U.S. employment changes during the Great Recession.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "import pandas as pd\n", + "from vega_datasets import data\n", + "\n", + "source = data.us_employment()\n", + "presidents = pd.DataFrame([\n", + " {\n", + " \"start\": \"2006-01-01\",\n", + " \"end\": \"2009-01-19\",\n", + " \"president\": \"Bush\"\n", + " },\n", + " {\n", + " \"start\": \"2009-01-20\",\n", + " \"end\": \"2015-12-31\",\n", + " \"president\": \"Obama\"\n", + " }\n", + "])\n", + "\n", + "bars = alt.Chart(\n", + " source,\n", + " title=\"The U.S. employment crash during the Great Recession\"\n", + ").mark_bar().encode(\n", + " x=alt.X(\"month:T\", title=\"\"),\n", + " y=alt.Y(\"nonfarm_change:Q\", title=\"Change in non-farm employment (in thousands)\"),\n", + " color=alt.condition(\n", + " alt.datum.nonfarm_change > 0,\n", + " alt.value(\"steelblue\"),\n", + " alt.value(\"orange\")\n", + " )\n", + ")\n", + "\n", + "rule = alt.Chart(presidents).mark_rule(\n", + " color=\"black\",\n", + " strokeWidth=2\n", + ").encode(\n", + " x='end:T'\n", + ").transform_filter(alt.datum.president == \"Bush\")\n", + "\n", + "text = alt.Chart(presidents).mark_text(\n", + " align='left',\n", + " baseline='middle',\n", + " dx=7,\n", + " dy=-135,\n", + " size=11\n", + ").encode(\n", + " x='start:T',\n", + " x2='end:T',\n", + " text='president',\n", + " color=alt.value('#000000')\n", + ")\n", + "\n", + "(bars + rule + text).properties(width=600)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/us_incomebrackets_by_state_facet.ipynb b/doc/jupyterlite/_output/files/us_incomebrackets_by_state_facet.ipynb new file mode 100644 index 000000000..aa0f4ce29 --- /dev/null +++ b/doc/jupyterlite/_output/files/us_incomebrackets_by_state_facet.ipynb @@ -0,0 +1,68 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "7419ecc6", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "10426131", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "US Income by State: Wrapped Facet\n", + "---------------------------------\n", + "This example shows how to create a map of income in the US by state,\n", + "faceted over income brackets \n", + "\"\"\"\n", + "# category: maps\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "states = alt.topo_feature(data.us_10m.url, 'states')\n", + "source = data.income.url\n", + "\n", + "alt.Chart(source).mark_geoshape().encode(\n", + " shape='geo:G',\n", + " color='pct:Q',\n", + " tooltip=['name:N', 'pct:Q'],\n", + " facet=alt.Facet('group:N', columns=2),\n", + ").transform_lookup(\n", + " lookup='id',\n", + " from_=alt.LookupData(data=states, key='id'),\n", + " as_='geo'\n", + ").properties(\n", + " width=300,\n", + " height=175,\n", + ").project(\n", + " type='albersUsa'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/us_population_over_time.ipynb b/doc/jupyterlite/_output/files/us_population_over_time.ipynb new file mode 100644 index 000000000..5ff2565a4 --- /dev/null +++ b/doc/jupyterlite/_output/files/us_population_over_time.ipynb @@ -0,0 +1,75 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "e42f3f92", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e9185e8e", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "US Population Over Time\n", + "=======================\n", + "This chart visualizes the age distribution of the US population over time.\n", + "It uses a slider widget that is bound to the year to visualize the age\n", + "distribution over time.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.population.url\n", + "\n", + "pink_blue = alt.Scale(domain=('Male', 'Female'),\n", + " range=[\"steelblue\", \"salmon\"])\n", + "\n", + "slider = alt.binding_range(min=1900, max=2000, step=10)\n", + "select_year = alt.selection_single(name=\"year\", fields=['year'],\n", + " bind=slider, init={'year': 2000})\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x=alt.X('sex:N', title=None),\n", + " y=alt.Y('people:Q', scale=alt.Scale(domain=(0, 12000000))),\n", + " color=alt.Color('sex:N', scale=pink_blue),\n", + " column='age:O'\n", + ").properties(\n", + " width=20\n", + ").add_selection(\n", + " select_year\n", + ").transform_calculate(\n", + " \"sex\", alt.expr.if_(alt.datum.sex == 1, \"Male\", \"Female\")\n", + ").transform_filter(\n", + " select_year\n", + ").configure_facet(\n", + " spacing=8\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/us_population_over_time_facet.ipynb b/doc/jupyterlite/_output/files/us_population_over_time_facet.ipynb new file mode 100644 index 000000000..5adf4a30f --- /dev/null +++ b/doc/jupyterlite/_output/files/us_population_over_time_facet.ipynb @@ -0,0 +1,64 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "8190e554", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c6a42101", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "US Population: Wrapped Facet\n", + "============================\n", + "This chart visualizes the age distribution of the US population over time,\n", + "using a wrapped faceting of the data by decade.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.population.url\n", + "\n", + "alt.Chart(source).mark_area().encode(\n", + " x='age:O',\n", + " y=alt.Y(\n", + " 'sum(people):Q',\n", + " title='Population',\n", + " axis=alt.Axis(format='~s')\n", + " ),\n", + " facet=alt.Facet('year:O', columns=5),\n", + ").properties(\n", + " title='US Age Distribution By Year',\n", + " width=90,\n", + " height=80\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/us_population_pyramid_over_time.ipynb b/doc/jupyterlite/_output/files/us_population_pyramid_over_time.ipynb new file mode 100644 index 000000000..7983547fd --- /dev/null +++ b/doc/jupyterlite/_output/files/us_population_pyramid_over_time.ipynb @@ -0,0 +1,94 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "e7ce4442", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d2fc8aab", + "metadata": {}, + "outputs": [], + "source": [ + "'''\n", + "US Population Pyramid Over Time\n", + "===============================\n", + "A population pyramid shows the distribution of age groups within a population.\n", + "It uses a slider widget that is bound to the year to visualize the age\n", + "distribution over time.\n", + "'''\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.population.url\n", + "\n", + "slider = alt.binding_range(min=1850, max=2000, step=10)\n", + "select_year = alt.selection_single(name='year', fields=['year'],\n", + " bind=slider, init={'year': 2000})\n", + "\n", + "base = alt.Chart(source).add_selection(\n", + " select_year\n", + ").transform_filter(\n", + " select_year\n", + ").transform_calculate(\n", + " gender=alt.expr.if_(alt.datum.sex == 1, 'Male', 'Female')\n", + ").properties(\n", + " width=250\n", + ")\n", + "\n", + "\n", + "color_scale = alt.Scale(domain=['Male', 'Female'],\n", + " range=['#1f77b4', '#e377c2'])\n", + "\n", + "left = base.transform_filter(\n", + " alt.datum.gender == 'Female'\n", + ").encode(\n", + " y=alt.Y('age:O', axis=None),\n", + " x=alt.X('sum(people):Q',\n", + " title='population',\n", + " sort=alt.SortOrder('descending')),\n", + " color=alt.Color('gender:N', scale=color_scale, legend=None)\n", + ").mark_bar().properties(title='Female')\n", + "\n", + "middle = base.encode(\n", + " y=alt.Y('age:O', axis=None),\n", + " text=alt.Text('age:Q'),\n", + ").mark_text().properties(width=20)\n", + "\n", + "right = base.transform_filter(\n", + " alt.datum.gender == 'Male'\n", + ").encode(\n", + " y=alt.Y('age:O', axis=None),\n", + " x=alt.X('sum(people):Q', title='population'),\n", + " color=alt.Color('gender:N', scale=color_scale, legend=None)\n", + ").mark_bar().properties(title='Male')\n", + "\n", + "alt.concat(left, middle, right, spacing=5)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/us_state_capitals.ipynb b/doc/jupyterlite/_output/files/us_state_capitals.ipynb new file mode 100644 index 000000000..1eaf3a8eb --- /dev/null +++ b/doc/jupyterlite/_output/files/us_state_capitals.ipynb @@ -0,0 +1,82 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "f0ad6703", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5a04ceda", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "U.S. state capitals overlayed on a map of the U.S\n", + "-------------------------------------------------\n", + "This is a layered geographic visualization that shows US capitals\n", + "overlayed on a map.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "states = alt.topo_feature(data.us_10m.url, 'states')\n", + "capitals = data.us_state_capitals.url\n", + "\n", + "# US states background\n", + "background = alt.Chart(states).mark_geoshape(\n", + " fill='lightgray',\n", + " stroke='white'\n", + ").properties(\n", + " title='US State Capitols',\n", + " width=650,\n", + " height=400\n", + ").project('albersUsa')\n", + "\n", + "# Points and text\n", + "hover = alt.selection(type='single', on='mouseover', nearest=True,\n", + " fields=['lat', 'lon'])\n", + "\n", + "base = alt.Chart(capitals).encode(\n", + " longitude='lon:Q',\n", + " latitude='lat:Q',\n", + ")\n", + "\n", + "text = base.mark_text(dy=-5, align='right').encode( \n", + " alt.Text('city', type='nominal'),\n", + " opacity=alt.condition(~hover, alt.value(0), alt.value(1))\n", + ")\n", + "\n", + "points = base.mark_point().encode(\n", + " color=alt.value('black'),\n", + " size=alt.condition(~hover, alt.value(30), alt.value(100))\n", + ").add_selection(hover)\n", + "\n", + "background + points + text" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/violin_plot.ipynb b/doc/jupyterlite/_output/files/violin_plot.ipynb new file mode 100644 index 000000000..705c842e6 --- /dev/null +++ b/doc/jupyterlite/_output/files/violin_plot.ipynb @@ -0,0 +1,78 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "9cbb945a", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b22ed1b5", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Violin Plot\n", + "-----------\n", + "This example shows how to make a Violin Plot using Altair's density transform.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "alt.Chart(data.cars()).transform_density(\n", + " 'Miles_per_Gallon',\n", + " as_=['Miles_per_Gallon', 'density'],\n", + " extent=[5, 50],\n", + " groupby=['Origin']\n", + ").mark_area(orient='horizontal').encode(\n", + " y='Miles_per_Gallon:Q',\n", + " color='Origin:N',\n", + " x=alt.X(\n", + " 'density:Q',\n", + " stack='center',\n", + " impute=None,\n", + " title=None,\n", + " axis=alt.Axis(labels=False, values=[0],grid=False, ticks=True),\n", + " ),\n", + " column=alt.Column(\n", + " 'Origin:N',\n", + " header=alt.Header(\n", + " titleOrient='bottom',\n", + " labelOrient='bottom',\n", + " labelPadding=0,\n", + " ),\n", + " )\n", + ").properties(\n", + " width=100\n", + ").configure_facet(\n", + " spacing=0\n", + ").configure_view(\n", + " stroke=None\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/weather_heatmap.ipynb b/doc/jupyterlite/_output/files/weather_heatmap.ipynb new file mode 100644 index 000000000..5fd87095d --- /dev/null +++ b/doc/jupyterlite/_output/files/weather_heatmap.ipynb @@ -0,0 +1,63 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "37047da6", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1f01629a", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Seattle Weather Heatmap\n", + "-----------------------\n", + "This example shows the 2010 daily high temperature (F) in Seattle, WA.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "# Since the data is more than 5,000 rows we'll import it from a URL\n", + "source = data.seattle_temps.url\n", + "\n", + "alt.Chart(\n", + " source,\n", + " title=\"2010 Daily High Temperature (F) in Seattle, WA\"\n", + ").mark_rect().encode(\n", + " x='date(date):O',\n", + " y='month(date):O',\n", + " color=alt.Color('max(temp):Q', scale=alt.Scale(scheme=\"inferno\")),\n", + " tooltip=[\n", + " alt.Tooltip('monthdate(date):T', title='Date'),\n", + " alt.Tooltip('max(temp):Q', title='Max Temp')\n", + " ]\n", + ").properties(width=550)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/wheat_wages.ipynb b/doc/jupyterlite/_output/files/wheat_wages.ipynb new file mode 100644 index 000000000..62986e2db --- /dev/null +++ b/doc/jupyterlite/_output/files/wheat_wages.ipynb @@ -0,0 +1,97 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "def0b19a", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2bd07dc6", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Wheat and Wages\n", + "---------------\n", + "A recreation of William Playfair's classic chart visualizing\n", + "the price of wheat, the wages of a mechanic, and the reigning British monarch.\n", + "\n", + "This is a more polished version of the simpler chart in :ref:`gallery_bar_and_line_with_dual_axis`.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "\n", + "base_wheat = alt.Chart(data.wheat.url).transform_calculate(\n", + " year_end=\"+datum.year + 5\")\n", + "\n", + "base_monarchs = alt.Chart(data.monarchs.url).transform_calculate(\n", + " offset=\"((!datum.commonwealth && datum.index % 2) ? -1: 1) * 2 + 95\",\n", + " off2=\"((!datum.commonwealth && datum.index % 2) ? -1: 1) + 95\",\n", + " y=\"95\",\n", + " x=\"+datum.start + (+datum.end - +datum.start)/2\"\n", + ")\n", + "\n", + "bars = base_wheat.mark_bar(**{\"fill\": \"#aaa\", \"stroke\": \"#999\"}).encode(\n", + " x=alt.X(\"year:Q\", axis=alt.Axis(format='d', tickCount=5)),\n", + " y=alt.Y(\"wheat:Q\", axis=alt.Axis(zindex=1)),\n", + " x2=alt.X2(\"year_end\")\n", + ")\n", + "\n", + "area = base_wheat.mark_area(**{\"color\": \"#a4cedb\", \"opacity\": 0.7}).encode(\n", + " x=alt.X(\"year:Q\"),\n", + " y=alt.Y(\"wages:Q\")\n", + ")\n", + "\n", + "area_line_1 = area.mark_line(**{\"color\": \"#000\", \"opacity\": 0.7})\n", + "area_line_2 = area.mark_line(**{\"yOffset\": -2, \"color\": \"#EE8182\"})\n", + "\n", + "top_bars = base_monarchs.mark_bar(stroke=\"#000\").encode(\n", + " x=alt.X(\"start:Q\"),\n", + " x2=alt.X2(\"end\"),\n", + " y=alt.Y(\"y:Q\"),\n", + " y2=alt.Y2(\"offset\"),\n", + " fill=alt.Fill(\"commonwealth:N\", legend=None, scale=alt.Scale(range=[\"black\", \"white\"]))\n", + ")\n", + "\n", + "top_text = base_monarchs.mark_text(**{\"yOffset\": 14, \"fontSize\": 9, \"fontStyle\": \"italic\"}).encode(\n", + " x=alt.X(\"x:Q\"),\n", + " y=alt.Y(\"off2:Q\"),\n", + " text=alt.Text(\"name:N\")\n", + ")\n", + "\n", + "(bars + area + area_line_1 + area_line_2 + top_bars + top_text).properties(\n", + " width=900, height=400\n", + ").configure_axis(\n", + " title=None, gridColor=\"white\", gridOpacity=0.25, domain=False\n", + ").configure_view(\n", + " stroke=\"transparent\"\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/wilkinson-dot-plot.ipynb b/doc/jupyterlite/_output/files/wilkinson-dot-plot.ipynb new file mode 100644 index 000000000..046c15ff6 --- /dev/null +++ b/doc/jupyterlite/_output/files/wilkinson-dot-plot.ipynb @@ -0,0 +1,66 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "8bc6c129", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "39481723", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Wilkinson Dot Plot\n", + "------------------\n", + "An example of a `Wilkinson Dot Plot `_\n", + "\"\"\"\n", + "# category: other charts\n", + "\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame(\n", + " {\"data\":[1,1,1,1,1,1,1,1,1,1,\n", + " 2,2,2,\n", + " 3,3,\n", + " 4,4,4,4,4,4]\n", + " }\n", + ")\n", + "\n", + "alt.Chart(source).mark_circle(opacity=1).transform_window(\n", + " id='rank()', \n", + " groupby=['data']\n", + ").encode(\n", + " alt.X('data:O'), \n", + " alt.Y('id:O', \n", + " axis=None, \n", + " sort='descending')\n", + ").properties(height=100)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/wind_vector_map.ipynb b/doc/jupyterlite/_output/files/wind_vector_map.ipynb new file mode 100644 index 000000000..af0d2e402 --- /dev/null +++ b/doc/jupyterlite/_output/files/wind_vector_map.ipynb @@ -0,0 +1,63 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "f6bd2b86", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6c857ace", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Wind Vector Map\n", + "---------------\n", + "An example showing a vector array map showing wind speed and direction using ``wedge``\n", + "as shape for ``mark_point`` and ``angle`` encoding for the wind direction.\n", + "This is adapted from this corresponding Vega-Lite Example:\n", + "`Wind Vector Map `_.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.windvectors()\n", + "\n", + "alt.Chart(source).mark_point(shape=\"wedge\", filled=True).encode(\n", + " latitude=\"latitude\",\n", + " longitude=\"longitude\",\n", + " color=alt.Color(\n", + " \"dir\", scale=alt.Scale(domain=[0, 360], scheme=\"rainbow\"), legend=None\n", + " ),\n", + " angle=alt.Angle(\"dir\", scale=alt.Scale(domain=[0, 360], range=[180, 540])),\n", + " size=alt.Size(\"speed\", scale=alt.Scale(rangeMax=500)),\n", + ").project(\"equalEarth\")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/window_rank.ipynb b/doc/jupyterlite/_output/files/window_rank.ipynb new file mode 100644 index 000000000..36e978b87 --- /dev/null +++ b/doc/jupyterlite/_output/files/window_rank.ipynb @@ -0,0 +1,81 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "edac8f31", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f67d0212", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Window Rank Line Chart\n", + "----------------------\n", + "This example shows the Group F rankings in the 2018 World Cup after each matchday. \n", + "A window transformation is used to rank each after each match day, sorting by points and difference.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame(\n", + " [\n", + " {\"team\": \"Germany\", \"matchday\": 1, \"point\": 0, \"diff\": -1},\n", + " {\"team\": \"Germany\", \"matchday\": 2, \"point\": 3, \"diff\": 0},\n", + " {\"team\": \"Germany\", \"matchday\": 3, \"point\": 3, \"diff\": -2},\n", + " {\"team\": \"Mexico\", \"matchday\": 1, \"point\": 3, \"diff\": 1},\n", + " {\"team\": \"Mexico\", \"matchday\": 2, \"point\": 6, \"diff\": 2},\n", + " {\"team\": \"Mexico\", \"matchday\": 3, \"point\": 6, \"diff\": -1},\n", + " {\"team\": \"South Korea\", \"matchday\": 1, \"point\": 0, \"diff\": -1},\n", + " {\"team\": \"South Korea\", \"matchday\": 2, \"point\": 0, \"diff\": -2},\n", + " {\"team\": \"South Korea\", \"matchday\": 3, \"point\": 3, \"diff\": 0},\n", + " {\"team\": \"Sweden\", \"matchday\": 1, \"point\": 3, \"diff\": 1},\n", + " {\"team\": \"Sweden\", \"matchday\": 2, \"point\": 3, \"diff\": 0},\n", + " {\"team\": \"Sweden\", \"matchday\": 3, \"point\": 6, \"diff\": 3},\n", + " ]\n", + ")\n", + "\n", + "color_scale = alt.Scale(\n", + " domain=[\"Germany\", \"Mexico\", \"South Korea\", \"Sweden\"],\n", + " range=[\"#000000\", \"#127153\", \"#C91A3C\", \"#0C71AB\"],\n", + ")\n", + "\n", + "alt.Chart(source).mark_line().encode(\n", + " x=\"matchday:O\", y=\"rank:O\", color=alt.Color(\"team:N\", scale=color_scale)\n", + ").transform_window(\n", + " rank=\"rank()\",\n", + " sort=[\n", + " alt.SortField(\"point\", order=\"descending\"),\n", + " alt.SortField(\"diff\", order=\"descending\"),\n", + " ],\n", + " groupby=[\"matchday\"],\n", + ").properties(title=\"World Cup 2018: Group F Rankings\")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/world_map.ipynb b/doc/jupyterlite/_output/files/world_map.ipynb new file mode 100644 index 000000000..7c4b75f81 --- /dev/null +++ b/doc/jupyterlite/_output/files/world_map.ipynb @@ -0,0 +1,66 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "96d5d3bb", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "77320784", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "World Map\n", + "---------\n", + "\n", + "This example shows how to create a world map using data generators for\n", + "different background layers.\n", + "\"\"\"\n", + "# category: maps\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "# Data generators for the background\n", + "sphere = alt.sphere()\n", + "graticule = alt.graticule()\n", + "\n", + "# Source of land data\n", + "source = alt.topo_feature(data.world_110m.url, 'countries')\n", + "\n", + "# Layering and configuring the components \n", + "alt.layer(\n", + " alt.Chart(sphere).mark_geoshape(fill='lightblue'), \n", + " alt.Chart(graticule).mark_geoshape(stroke='white', strokeWidth=0.5), \n", + " alt.Chart(source).mark_geoshape(fill='ForestGreen', stroke='black')\n", + ").project(\n", + " 'naturalEarth1'\n", + ").properties(width=600, height=400).configure_view(stroke=None)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/files/world_projections.ipynb b/doc/jupyterlite/_output/files/world_projections.ipynb new file mode 100644 index 000000000..39b2b64b7 --- /dev/null +++ b/doc/jupyterlite/_output/files/world_projections.ipynb @@ -0,0 +1,65 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "253cfb3c", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a51a4fa9", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "World Projections\n", + "-----------------\n", + "This example shows a map of the countries of the world using four available\n", + "geographic projections. For more details on the projections available in\n", + "Altair, see https://vega.github.io/vega-lite/docs/projection.html\n", + "\"\"\"\n", + "# category: maps\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = alt.topo_feature(data.world_110m.url, 'countries')\n", + "\n", + "base = alt.Chart(source).mark_geoshape(\n", + " fill='#666666',\n", + " stroke='white'\n", + ").properties(\n", + " width=300,\n", + " height=180\n", + ")\n", + "\n", + "projections = ['equirectangular', 'mercator', 'orthographic', 'gnomonic']\n", + "charts = [base.project(proj).properties(title=proj)\n", + " for proj in projections]\n", + "\n", + "alt.concat(*charts, columns=2)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/index.html b/doc/jupyterlite/_output/index.html new file mode 100644 index 000000000..a61062f5c --- /dev/null +++ b/doc/jupyterlite/_output/index.html @@ -0,0 +1,68 @@ + + + + + + + + + + + diff --git a/doc/jupyterlite/_output/jupyter-lite.ipynb b/doc/jupyterlite/_output/jupyter-lite.ipynb new file mode 100644 index 000000000..c4a492241 --- /dev/null +++ b/doc/jupyterlite/_output/jupyter-lite.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "dea14a34-4803-44da-ae14-88b2c87a6f12", + "metadata": {}, + "source": [ + "# jupyter-lite.ipynb\n", + "\n", + "This notebook is the preferred source of site-specific runtime [configuration](https://jupyterlite.readthedocs.io/en/latest/configuring.html) for a JupyterLite app, and will override any configuration in [`jupyter-lite.json`](./jupyter-lite.json)." + ] + }, + { + "cell_type": "markdown", + "id": "6d19715a-0a8c-4600-9ff1-e82ba667e2d3", + "metadata": {}, + "source": [ + "## Editing Configuration\n", + "\n", + "The configuration is stored in this Notebook's metadata under the `jupyter-lite` key. To edit the configuration in JupyterLab.\n", + "\n", + "- open the _Property Inspector_ sidebar\n", + "- expand the _Advanced Tools_ section\n", + "- edit the `jupyter-lite` metadata sub-key\n", + "- press the \"check\" icon\n", + "- save the notebook" + ] + } + ], + "metadata": { + "jupyter-lite": { + "jupyter-config-data": {}, + "jupyter-lite-schema-version": 0 + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.10" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/jupyter-lite.json b/doc/jupyterlite/_output/jupyter-lite.json new file mode 100644 index 000000000..2c71a6a20 --- /dev/null +++ b/doc/jupyterlite/_output/jupyter-lite.json @@ -0,0 +1,24 @@ +{ + "jupyter-config-data": { + "appName": "JupyterLite", + "appUrl": "./lab", + "appVersion": "0.1.0-beta.5", + "baseUrl": "./", + "faviconUrl": "./lab/favicon.ico", + "federated_extensions": [ + { + "extension": "./extension", + "liteExtension": false, + "load": "static/remoteEntry.aa1060b2d1221f8e5688.js", + "name": "jupyterlab_pygments", + "style": "./style" + } + ], + "fullLabextensionsUrl": "./extensions", + "fullMathjaxUrl": "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js", + "fullStaticUrl": "./build", + "licensesUrl": "./lab/api/licenses", + "mathjaxConfig": "TeX-AMS_CHTML-full,Safe" + }, + "jupyter-lite-schema-version": 0 +} \ No newline at end of file diff --git a/doc/jupyterlite/_output/jupyterlite.schema.v0.json b/doc/jupyterlite/_output/jupyterlite.schema.v0.json new file mode 100644 index 000000000..6317aa70e --- /dev/null +++ b/doc/jupyterlite/_output/jupyterlite.schema.v0.json @@ -0,0 +1,324 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "https://jupyterlite.readthedocs.org/en/latest/schema-v0.html#", + "title": "JupyterLite Schema v0", + "description": "a schema for user-serviceable customizaton of a JupyterLite", + "$ref": "#/definitions/top", + "definitions": { + "top": { + "title": "JupyterLite Configuration", + "description": "a user-serviceable file for customizing a JupyterLite site", + "properties": { + "jupyter-lite-schema-version": { + "type": "integer", + "description": "version of the schema to which the instance conforms", + "enum": [0] + }, + "jupyter-config-data": { + "$ref": "#/definitions/jupyter-config-data" + } + } + }, + "jupyterlab-settings-overrides": { + "title": "JupyterLab Settings Overrides", + "description": "A map of config objects keyed by `@org/pkg:plugin` which override the default settings. See https://jupyterlab.readthedocs.io/en/stable/user/directories.html#overridesjson", + "type": "object", + "patternProperties": { + "^(@[a-z0-9-~][a-z0-9-._~]*/)?[a-z0-9-~][a-z0-9-._~]*:(.*)$": { + "description": "A valid configuration which must conform to the plugin's defined schema", + "type": "object" + } + } + }, + "jupyter-config-data": { + "title": "Jupyter Config Data", + "description": "contents of a jupyter-config-data ` + + + diff --git a/doc/jupyterlite/_output/lab/jupyter-lite.ipynb b/doc/jupyterlite/_output/lab/jupyter-lite.ipynb new file mode 100644 index 000000000..c4a492241 --- /dev/null +++ b/doc/jupyterlite/_output/lab/jupyter-lite.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "dea14a34-4803-44da-ae14-88b2c87a6f12", + "metadata": {}, + "source": [ + "# jupyter-lite.ipynb\n", + "\n", + "This notebook is the preferred source of site-specific runtime [configuration](https://jupyterlite.readthedocs.io/en/latest/configuring.html) for a JupyterLite app, and will override any configuration in [`jupyter-lite.json`](./jupyter-lite.json)." + ] + }, + { + "cell_type": "markdown", + "id": "6d19715a-0a8c-4600-9ff1-e82ba667e2d3", + "metadata": {}, + "source": [ + "## Editing Configuration\n", + "\n", + "The configuration is stored in this Notebook's metadata under the `jupyter-lite` key. To edit the configuration in JupyterLab.\n", + "\n", + "- open the _Property Inspector_ sidebar\n", + "- expand the _Advanced Tools_ section\n", + "- edit the `jupyter-lite` metadata sub-key\n", + "- press the \"check\" icon\n", + "- save the notebook" + ] + } + ], + "metadata": { + "jupyter-lite": { + "jupyter-config-data": {}, + "jupyter-lite-schema-version": 0 + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.10" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/lab/jupyter-lite.json b/doc/jupyterlite/_output/lab/jupyter-lite.json new file mode 100644 index 000000000..222730a35 --- /dev/null +++ b/doc/jupyterlite/_output/lab/jupyter-lite.json @@ -0,0 +1,7 @@ +{ + "jupyter-lite-schema-version": 0, + "jupyter-config-data": { + "settingsUrl": "../build/schemas", + "themesUrl": "./build/themes" + } +} diff --git a/doc/jupyterlite/_output/lab/package.json b/doc/jupyterlite/_output/lab/package.json new file mode 100644 index 000000000..5f8df7b1e --- /dev/null +++ b/doc/jupyterlite/_output/lab/package.json @@ -0,0 +1,260 @@ +{ + "name": "@jupyterlite/app-lab", + "version": "0.1.0-beta.5", + "private": true, + "resolutions": { + "@jupyterlab/application": "~3.3.2", + "@jupyterlab/application-extension": "~3.3.2", + "@jupyterlab/apputils": "~3.3.2", + "@jupyterlab/apputils-extension": "~3.3.2", + "@jupyterlab/celltags-extension": "~3.3.2", + "@jupyterlab/codeeditor": "~3.3.2", + "@jupyterlab/codemirror": "~3.3.2", + "@jupyterlab/codemirror-extension": "~3.3.2", + "@jupyterlab/completer": "~3.3.2", + "@jupyterlab/completer-extension": "~3.3.2", + "@jupyterlab/console": "~3.3.2", + "@jupyterlab/console-extension": "~3.3.2", + "@jupyterlab/coreutils": "~5.3.2", + "@jupyterlab/csvviewer-extension": "~3.3.2", + "@jupyterlab/docmanager": "~3.3.2", + "@jupyterlab/docmanager-extension": "~3.3.2", + "@jupyterlab/docprovider": "~3.3.2", + "@jupyterlab/documentsearch": "~3.3.2", + "@jupyterlab/filebrowser": "~3.3.2", + "@jupyterlab/filebrowser-extension": "~3.3.2", + "@jupyterlab/fileeditor": "~3.3.2", + "@jupyterlab/fileeditor-extension": "~3.3.2", + "@jupyterlab/help-extension": "~3.3.2", + "@jupyterlab/htmlviewer-extension": "~3.3.2", + "@jupyterlab/imageviewer": "~3.3.2", + "@jupyterlab/imageviewer-extension": "~3.3.2", + "@jupyterlab/inspector": "~3.3.2", + "@jupyterlab/inspector-extension": "~3.3.2", + "@jupyterlab/javascript-extension": "~3.3.2", + "@jupyterlab/json-extension": "~3.3.2", + "@jupyterlab/launcher": "~3.3.2", + "@jupyterlab/launcher-extension": "~3.3.2", + "@jupyterlab/logconsole": "~3.3.2", + "@jupyterlab/logconsole-extension": "~3.3.2", + "@jupyterlab/mainmenu": "~3.3.2", + "@jupyterlab/mainmenu-extension": "~3.3.2", + "@jupyterlab/markdownviewer": "~3.3.2", + "@jupyterlab/markdownviewer-extension": "~3.3.2", + "@jupyterlab/mathjax2-extension": "~3.3.2", + "@jupyterlab/notebook": "~3.3.2", + "@jupyterlab/notebook-extension": "~3.3.2", + "@jupyterlab/outputarea": "~3.3.2", + "@jupyterlab/pdf-extension": "~3.3.2", + "@jupyterlab/rendermime": "~3.3.2", + "@jupyterlab/rendermime-extension": "~3.3.2", + "@jupyterlab/rendermime-interfaces": "~3.3.2", + "@jupyterlab/running-extension": "~3.3.2", + "@jupyterlab/services": "~6.3.2", + "@jupyterlab/settingeditor": "~3.3.2", + "@jupyterlab/settingeditor-extension": "~3.3.2", + "@jupyterlab/settingregistry": "~3.3.2", + "@jupyterlab/shared-models": "~3.3.2", + "@jupyterlab/shortcuts-extension": "~3.3.2", + "@jupyterlab/statedb": "~3.3.2", + "@jupyterlab/statusbar": "~3.3.2", + "@jupyterlab/statusbar-extension": "~3.3.2", + "@jupyterlab/theme-dark-extension": "~3.3.2", + "@jupyterlab/theme-light-extension": "~3.3.2", + "@jupyterlab/toc-extension": "~5.3.2", + "@jupyterlab/tooltip": "~3.3.2", + "@jupyterlab/tooltip-extension": "~3.3.2", + "@jupyterlab/translation": "~3.3.2", + "@jupyterlab/translation-extension": "~3.3.2", + "@jupyterlab/ui-components": "~3.3.2", + "@jupyterlab/ui-components-extension": "~3.3.2", + "@jupyterlab/vega5-extension": "~3.3.2", + "@jupyterlite/application-extension": "~0.1.0-beta.5", + "@jupyterlite/iframe-extension": "~0.1.0-beta.5", + "@jupyterlite/javascript-kernel": "~0.1.0-beta.5", + "@jupyterlite/javascript-kernel-extension": "~0.1.0-beta.5", + "@jupyterlite/kernel": "~0.1.0-beta.5", + "@jupyterlite/licenses": "~0.1.0-beta.5", + "@jupyterlite/localforage": "~0.1.0-beta.5", + "@jupyterlite/pyolite-kernel-extension": "~0.1.0-beta.5", + "@jupyterlite/server": "~0.1.0-beta.5", + "@jupyterlite/server-extension": "~0.1.0-beta.5", + "@jupyterlite/types": "~0.1.0-beta.5", + "@jupyterlite/ui-components": "~0.1.0-beta.5", + "@lumino/algorithm": "~1.9.1", + "@lumino/application": "~1.28.1", + "@lumino/commands": "~1.20.0", + "@lumino/coreutils": "~1.12.0", + "@lumino/disposable": "~1.10.1", + "@lumino/domutils": "~1.8.1", + "@lumino/dragdrop": "~1.14.0", + "@lumino/messaging": "~1.10.1", + "@lumino/properties": "~1.8.1", + "@lumino/signaling": "~1.10.1", + "@lumino/virtualdom": "~1.14.1", + "@lumino/widgets": "~1.31.1", + "es6-promise": "^4.2.8", + "react": "^17.0.2", + "react-dom": "^17.0.2", + "yjs": "^13.5.28" + }, + "dependencies": { + "@jupyterlab/application": "~3.3.2", + "@jupyterlab/application-extension": "~3.3.2", + "@jupyterlab/apputils-extension": "~3.3.2", + "@jupyterlab/celltags-extension": "~3.3.2", + "@jupyterlab/codemirror-extension": "~3.3.2", + "@jupyterlab/completer-extension": "~3.3.2", + "@jupyterlab/console-extension": "~3.3.2", + "@jupyterlab/csvviewer-extension": "~3.3.2", + "@jupyterlab/docmanager-extension": "~3.3.2", + "@jupyterlab/filebrowser-extension": "~3.3.2", + "@jupyterlab/fileeditor-extension": "~3.3.2", + "@jupyterlab/help-extension": "~3.3.2", + "@jupyterlab/htmlviewer-extension": "~3.3.2", + "@jupyterlab/imageviewer-extension": "~3.3.2", + "@jupyterlab/inspector-extension": "~3.3.2", + "@jupyterlab/javascript-extension": "~3.3.2", + "@jupyterlab/json-extension": "~3.3.2", + "@jupyterlab/launcher-extension": "~3.3.2", + "@jupyterlab/logconsole-extension": "~3.3.2", + "@jupyterlab/mainmenu-extension": "~3.3.2", + "@jupyterlab/markdownviewer-extension": "~3.3.2", + "@jupyterlab/mathjax2-extension": "~3.3.2", + "@jupyterlab/notebook-extension": "~3.3.2", + "@jupyterlab/pdf-extension": "~3.3.2", + "@jupyterlab/rendermime-extension": "~3.3.2", + "@jupyterlab/running-extension": "~3.3.2", + "@jupyterlab/settingeditor-extension": "~3.3.2", + "@jupyterlab/shortcuts-extension": "~3.3.2", + "@jupyterlab/statusbar-extension": "~3.3.2", + "@jupyterlab/theme-dark-extension": "~3.3.2", + "@jupyterlab/theme-light-extension": "~3.3.2", + "@jupyterlab/toc-extension": "~5.3.2", + "@jupyterlab/tooltip-extension": "~3.3.2", + "@jupyterlab/translation-extension": "~3.3.2", + "@jupyterlab/ui-components-extension": "~3.3.2", + "@jupyterlab/vega5-extension": "~3.3.2", + "@jupyterlite/application-extension": "^0.1.0-beta.5", + "@jupyterlite/iframe-extension": "^0.1.0-beta.5", + "@jupyterlite/javascript-kernel-extension": "^0.1.0-beta.5", + "@jupyterlite/licenses": "^0.1.0-beta.5", + "@jupyterlite/localforage": "^0.1.0-beta.5", + "@jupyterlite/pyolite-kernel-extension": "^0.1.0-beta.5", + "@jupyterlite/server": "^0.1.0-beta.5", + "@jupyterlite/server-extension": "^0.1.0-beta.5", + "@jupyterlite/types": "^0.1.0-beta.5", + "@jupyterlite/ui-components": "^0.1.0-beta.5", + "es6-promise": "~4.2.8", + "react": "^17.0.1", + "react-dom": "^17.0.1", + "yjs": "^13.5.6" + }, + "jupyterlab": { + "extensions": [ + "@jupyterlab/application-extension", + "@jupyterlab/apputils-extension", + "@jupyterlab/celltags-extension", + "@jupyterlab/codemirror-extension", + "@jupyterlab/completer-extension", + "@jupyterlab/console-extension", + "@jupyterlab/csvviewer-extension", + "@jupyterlab/docmanager-extension", + "@jupyterlab/filebrowser-extension", + "@jupyterlab/fileeditor-extension", + "@jupyterlab/help-extension", + "@jupyterlab/htmlviewer-extension", + "@jupyterlab/imageviewer-extension", + "@jupyterlab/inspector-extension", + "@jupyterlab/json-extension", + "@jupyterlab/javascript-extension", + "@jupyterlab/launcher-extension", + "@jupyterlab/logconsole-extension", + "@jupyterlab/mainmenu-extension", + "@jupyterlab/markdownviewer-extension", + "@jupyterlab/mathjax2-extension", + "@jupyterlab/notebook-extension", + "@jupyterlab/pdf-extension", + "@jupyterlab/rendermime-extension", + "@jupyterlab/running-extension", + "@jupyterlab/settingeditor-extension", + "@jupyterlab/shortcuts-extension", + "@jupyterlab/statusbar-extension", + "@jupyterlab/theme-dark-extension", + "@jupyterlab/theme-light-extension", + "@jupyterlab/toc-extension", + "@jupyterlab/tooltip-extension", + "@jupyterlab/translation-extension", + "@jupyterlab/ui-components-extension", + "@jupyterlab/vega5-extension", + "@jupyterlite/application-extension", + "@jupyterlite/iframe-extension", + "@jupyterlite/javascript-kernel-extension", + "@jupyterlite/server-extension" + ], + "singletonPackages": [ + "@jupyterlab/application", + "@jupyterlab/apputils", + "@jupyterlab/codeeditor", + "@jupyterlab/codemirror", + "@jupyterlab/completer", + "@jupyterlab/console", + "@jupyterlab/coreutils", + "@jupyterlab/docmanager", + "@jupyterlab/docprovider", + "@jupyterlab/documentsearch", + "@jupyterlab/filebrowser", + "@jupyterlab/fileeditor", + "@jupyterlab/imageviewer", + "@jupyterlab/inspector", + "@jupyterlab/launcher", + "@jupyterlab/logconsole", + "@jupyterlab/mainmenu", + "@jupyterlab/markdownviewer", + "@jupyterlab/notebook", + "@jupyterlab/outputarea", + "@jupyterlab/rendermime", + "@jupyterlab/rendermime-interfaces", + "@jupyterlab/services", + "@jupyterlab/settingeditor", + "@jupyterlab/settingregistry", + "@jupyterlab/shared-models", + "@jupyterlab/statedb", + "@jupyterlab/statusbar", + "@jupyterlab/tooltip", + "@jupyterlab/translation", + "@jupyterlab/ui-components", + "@jupyterlite/kernel", + "@jupyterlite/licenses", + "@jupyterlite/localforage", + "@jupyterlite/javascript-kernel", + "@jupyterlite/types", + "@lumino/algorithm", + "@lumino/application", + "@lumino/commands", + "@lumino/coreutils", + "@lumino/disposable", + "@lumino/domutils", + "@lumino/dragdrop", + "@lumino/messaging", + "@lumino/properties", + "@lumino/signaling", + "@lumino/virtualdom", + "@lumino/widgets", + "react", + "react-dom", + "yjs" + ], + "mimeExtensions": { + "@jupyterlab/javascript-extension": "", + "@jupyterlab/json-extension": "", + "@jupyterlab/vega5-extension": "" + }, + "linkedPackages": {} + }, + "jupyterlite": { + "pages": [ + "index" + ] + } +} diff --git a/doc/jupyterlite/_output/lab/tree/index.html b/doc/jupyterlite/_output/lab/tree/index.html new file mode 100644 index 000000000..961e460b8 --- /dev/null +++ b/doc/jupyterlite/_output/lab/tree/index.html @@ -0,0 +1,14 @@ + + + + + + diff --git a/doc/jupyterlite/_output/lab/workspaces/index.html b/doc/jupyterlite/_output/lab/workspaces/index.html new file mode 100644 index 000000000..1358c2119 --- /dev/null +++ b/doc/jupyterlite/_output/lab/workspaces/index.html @@ -0,0 +1,14 @@ + + + + + + diff --git a/doc/jupyterlite/_output/package.json b/doc/jupyterlite/_output/package.json new file mode 100644 index 000000000..ebed6ab71 --- /dev/null +++ b/doc/jupyterlite/_output/package.json @@ -0,0 +1,48 @@ +{ + "name": "@jupyterlite/app", + "version": "0.1.0-beta.5", + "homepage": "https://github.com/jupyterlite/jupyterlite", + "bugs": { + "url": "https://github.com/jupyterlite/jupyterlite/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/jupyterlite/jupyterlite" + }, + "license": "BSD-3-Clause", + "author": "JupyterLite Contributors", + "scripts": { + "build": "webpack", + "build:prod": "yarn clean && yarn build --mode=production", + "clean": "rimraf build **/build", + "watch": "webpack --config webpack.config.watch.js" + }, + "devDependencies": { + "@jupyterlab/builder": "^3.3.2", + "css-loader": "^6.6.0", + "file-loader": "^6.2.0", + "fs-extra": "^9.0.1", + "glob": "^7.2.0", + "handlebars": "^4.5.3", + "html-webpack-plugin": "^5.5.0", + "ignore-loader": "^0.1.2", + "json-loader": "^0.5.7", + "mini-css-extract-plugin": "^2.5.3", + "raw-loader": "^4.0.2", + "rimraf": "^3.0.2", + "style-loader": "^3.3.1", + "svg-url-loader": "^7.1.1", + "url-loader": "^4.1.1", + "webpack": "^5.68.0", + "webpack-bundle-analyzer": "^4.5.0", + "webpack-cli": "^4.9.2", + "webpack-merge": "^5.8.0" + }, + "jupyterlite": { + "apps": [ + "lab", + "repl", + "retro" + ] + } +} diff --git a/doc/jupyterlite/_output/piplite.schema.v0.json b/doc/jupyterlite/_output/piplite.schema.v0.json new file mode 100644 index 000000000..4019df2fe --- /dev/null +++ b/doc/jupyterlite/_output/piplite.schema.v0.json @@ -0,0 +1,113 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "https://jupyterlite.readthedocs.org/en/latest/piplite-schema-v0.html#", + "title": "PipLite Schema v0", + "description": "a schema for the warehouse-like API index", + "$ref": "#/definitions/top", + "definitions": { + "top": { + "type": "object", + "patternProperties": { + ".*": { + "$ref": "#/definitions/a-piplite-project" + } + } + }, + "a-piplite-project": { + "type": "object", + "description": "a piplite-installable project, with one or more historical releases", + "properties": { + "releases": { + "patternProperties": { + ".*": { + "type": "array", + "items": { + "$ref": "#/definitions/a-piplite-distribution" + } + } + } + } + } + }, + "a-piplite-distribution": { + "type": "object", + "properties": { + "comment_text": { + "type": "string" + }, + "digests": { + "type": "object", + "properties": { + "md5": { + "$ref": "#/definitions/an-md5-digest" + }, + "sha256": { + "$ref": "#/definitions/a-sha256-digest" + } + } + }, + "downloads": { + "type": "number" + }, + "filename": { + "type": "string" + }, + "has_sig": { + "type": "boolean" + }, + "md5_digest": { + "$ref": "#/definitions/an-md5-digest" + }, + "packagetype": { + "type": "string", + "enum": ["bdist_wheel"] + }, + "python_version": { + "type": "string" + }, + "requires_python": { + "$ref": "#/definitions/string-or-null" + }, + "size": { + "type": "number" + }, + "upload_time": { + "type": "string", + "format": "date-time" + }, + "upload_time_iso_8601": { + "type": "string", + "format": "date-time" + }, + "url": { + "type": "string", + "format": "uri" + }, + "yanked": { + "type": "boolean" + }, + "yanked_reason": { + "$ref": "#/definitions/string-or-null" + } + } + }, + "string-or-null": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "an-md5-digest": { + "type": "string", + "pattern": "[a-f0-9]{32}" + }, + "a-sha256-digest": { + "type": "string", + "pattern": "[a-f0-9]{64}" + } + } +} diff --git a/doc/jupyterlite/_output/repl/index.html b/doc/jupyterlite/_output/repl/index.html new file mode 100644 index 000000000..dec65b170 --- /dev/null +++ b/doc/jupyterlite/_output/repl/index.html @@ -0,0 +1,34 @@ + + + + JupyterLite + + + + + + + diff --git a/doc/jupyterlite/_output/repl/jupyter-lite.ipynb b/doc/jupyterlite/_output/repl/jupyter-lite.ipynb new file mode 100644 index 000000000..c4a492241 --- /dev/null +++ b/doc/jupyterlite/_output/repl/jupyter-lite.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "dea14a34-4803-44da-ae14-88b2c87a6f12", + "metadata": {}, + "source": [ + "# jupyter-lite.ipynb\n", + "\n", + "This notebook is the preferred source of site-specific runtime [configuration](https://jupyterlite.readthedocs.io/en/latest/configuring.html) for a JupyterLite app, and will override any configuration in [`jupyter-lite.json`](./jupyter-lite.json)." + ] + }, + { + "cell_type": "markdown", + "id": "6d19715a-0a8c-4600-9ff1-e82ba667e2d3", + "metadata": {}, + "source": [ + "## Editing Configuration\n", + "\n", + "The configuration is stored in this Notebook's metadata under the `jupyter-lite` key. To edit the configuration in JupyterLab.\n", + "\n", + "- open the _Property Inspector_ sidebar\n", + "- expand the _Advanced Tools_ section\n", + "- edit the `jupyter-lite` metadata sub-key\n", + "- press the \"check\" icon\n", + "- save the notebook" + ] + } + ], + "metadata": { + "jupyter-lite": { + "jupyter-config-data": {}, + "jupyter-lite-schema-version": 0 + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.10" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/repl/jupyter-lite.json b/doc/jupyterlite/_output/repl/jupyter-lite.json new file mode 100644 index 000000000..222730a35 --- /dev/null +++ b/doc/jupyterlite/_output/repl/jupyter-lite.json @@ -0,0 +1,7 @@ +{ + "jupyter-lite-schema-version": 0, + "jupyter-config-data": { + "settingsUrl": "../build/schemas", + "themesUrl": "./build/themes" + } +} diff --git a/doc/jupyterlite/_output/repl/package.json b/doc/jupyterlite/_output/repl/package.json new file mode 100644 index 000000000..33bbdc047 --- /dev/null +++ b/doc/jupyterlite/_output/repl/package.json @@ -0,0 +1,210 @@ +{ + "name": "@jupyterlite/app-repl", + "version": "0.1.0-beta.5", + "private": true, + "resolutions": { + "@jupyterlab/application": "~3.3.2", + "@jupyterlab/application-extension": "~3.3.2", + "@jupyterlab/apputils": "~3.3.2", + "@jupyterlab/apputils-extension": "~3.3.2", + "@jupyterlab/codeeditor": "~3.3.2", + "@jupyterlab/codemirror": "~3.3.2", + "@jupyterlab/codemirror-extension": "~3.3.2", + "@jupyterlab/completer": "~3.3.2", + "@jupyterlab/completer-extension": "~3.3.2", + "@jupyterlab/console": "~3.3.2", + "@jupyterlab/console-extension": "~3.3.2", + "@jupyterlab/coreutils": "~5.3.2", + "@jupyterlab/docmanager": "~3.3.2", + "@jupyterlab/docmanager-extension": "~3.3.2", + "@jupyterlab/docprovider": "~3.3.2", + "@jupyterlab/documentsearch": "~3.3.2", + "@jupyterlab/filebrowser": "~3.3.2", + "@jupyterlab/fileeditor": "~3.3.2", + "@jupyterlab/imageviewer": "~3.3.2", + "@jupyterlab/imageviewer-extension": "~3.3.2", + "@jupyterlab/inspector": "~3.3.2", + "@jupyterlab/inspector-extension": "~3.3.2", + "@jupyterlab/javascript-extension": "~3.3.2", + "@jupyterlab/json-extension": "~3.3.2", + "@jupyterlab/launcher": "~3.3.2", + "@jupyterlab/logconsole": "~3.3.2", + "@jupyterlab/mainmenu": "~3.3.2", + "@jupyterlab/markdownviewer": "~3.3.2", + "@jupyterlab/markdownviewer-extension": "~3.3.2", + "@jupyterlab/mathjax2-extension": "~3.3.2", + "@jupyterlab/notebook": "~3.3.2", + "@jupyterlab/outputarea": "~3.3.2", + "@jupyterlab/pdf-extension": "~3.3.2", + "@jupyterlab/rendermime": "~3.3.2", + "@jupyterlab/rendermime-extension": "~3.3.2", + "@jupyterlab/rendermime-interfaces": "~3.3.2", + "@jupyterlab/services": "~6.3.2", + "@jupyterlab/settingregistry": "~3.3.2", + "@jupyterlab/shared-models": "~3.3.2", + "@jupyterlab/shortcuts-extension": "~3.3.2", + "@jupyterlab/statedb": "~3.3.2", + "@jupyterlab/statusbar": "~3.3.2", + "@jupyterlab/theme-dark-extension": "~3.3.2", + "@jupyterlab/theme-light-extension": "~3.3.2", + "@jupyterlab/tooltip": "~3.3.2", + "@jupyterlab/tooltip-extension": "~3.3.2", + "@jupyterlab/translation": "~3.3.2", + "@jupyterlab/translation-extension": "~3.3.2", + "@jupyterlab/ui-components": "~3.3.2", + "@jupyterlab/vega5-extension": "~3.3.2", + "@jupyterlite/application": "~0.1.0-beta.5", + "@jupyterlite/application-extension": "~0.1.0-beta.5", + "@jupyterlite/iframe-extension": "~0.1.0-beta.5", + "@jupyterlite/javascript-kernel": "~0.1.0-beta.5", + "@jupyterlite/javascript-kernel-extension": "~0.1.0-beta.5", + "@jupyterlite/kernel": "~0.1.0-beta.5", + "@jupyterlite/pyolite-kernel-extension": "~0.1.0-beta.5", + "@jupyterlite/server": "~0.1.0-beta.5", + "@jupyterlite/server-extension": "~0.1.0-beta.5", + "@jupyterlite/ui-components": "~0.1.0-beta.5", + "@lumino/algorithm": "~1.9.1", + "@lumino/application": "~1.28.1", + "@lumino/commands": "~1.20.0", + "@lumino/coreutils": "~1.12.0", + "@lumino/disposable": "~1.10.1", + "@lumino/domutils": "~1.8.1", + "@lumino/dragdrop": "~1.14.0", + "@lumino/messaging": "~1.10.1", + "@lumino/properties": "~1.8.1", + "@lumino/signaling": "~1.10.1", + "@lumino/virtualdom": "~1.14.1", + "@lumino/widgets": "~1.31.1", + "@retrolab/application-extension": "~0.3.20", + "es6-promise": "^4.2.8", + "react": "^17.0.2", + "react-dom": "^17.0.2", + "yjs": "^13.5.28" + }, + "dependencies": { + "@jupyterlab/application": "~3.3.2", + "@jupyterlab/application-extension": "~3.3.2", + "@jupyterlab/apputils-extension": "~3.3.2", + "@jupyterlab/codemirror-extension": "~3.3.2", + "@jupyterlab/completer-extension": "~3.3.2", + "@jupyterlab/console-extension": "~3.3.2", + "@jupyterlab/docmanager-extension": "~3.3.2", + "@jupyterlab/imageviewer-extension": "~3.3.2", + "@jupyterlab/inspector-extension": "~3.3.2", + "@jupyterlab/javascript-extension": "~3.3.2", + "@jupyterlab/json-extension": "~3.3.2", + "@jupyterlab/markdownviewer-extension": "~3.3.2", + "@jupyterlab/mathjax2-extension": "~3.3.2", + "@jupyterlab/pdf-extension": "~3.3.2", + "@jupyterlab/rendermime-extension": "~3.3.2", + "@jupyterlab/shortcuts-extension": "~3.3.2", + "@jupyterlab/theme-dark-extension": "~3.3.2", + "@jupyterlab/theme-light-extension": "~3.3.2", + "@jupyterlab/tooltip-extension": "~3.3.2", + "@jupyterlab/translation-extension": "~3.3.2", + "@jupyterlab/vega5-extension": "~3.3.2", + "@jupyterlite/application": "^0.1.0-beta.5", + "@jupyterlite/application-extension": "^0.1.0-beta.5", + "@jupyterlite/iframe-extension": "^0.1.0-beta.5", + "@jupyterlite/javascript-kernel-extension": "^0.1.0-beta.5", + "@jupyterlite/pyolite-kernel-extension": "^0.1.0-beta.5", + "@jupyterlite/server": "^0.1.0-beta.5", + "@jupyterlite/server-extension": "^0.1.0-beta.5", + "@jupyterlite/ui-components": "^0.1.0-beta.5", + "@retrolab/application-extension": "^0.3.20", + "es6-promise": "~4.2.8", + "react": "^17.0.1", + "react-dom": "^17.0.1", + "yjs": "^13.5.6" + }, + "jupyterlab": { + "extensions": [ + "@jupyterlab/application-extension", + "@jupyterlab/apputils-extension", + "@jupyterlab/codemirror-extension", + "@jupyterlab/completer-extension", + "@jupyterlab/console-extension", + "@jupyterlab/docmanager-extension", + "@jupyterlab/imageviewer-extension", + "@jupyterlab/inspector-extension", + "@jupyterlab/json-extension", + "@jupyterlab/javascript-extension", + "@jupyterlab/markdownviewer-extension", + "@jupyterlab/mathjax2-extension", + "@jupyterlab/pdf-extension", + "@jupyterlab/rendermime-extension", + "@jupyterlab/shortcuts-extension", + "@jupyterlab/theme-dark-extension", + "@jupyterlab/theme-light-extension", + "@jupyterlab/tooltip-extension", + "@jupyterlab/translation-extension", + "@jupyterlab/vega5-extension", + "@jupyterlite/application-extension", + "@jupyterlite/repl-extension", + "@jupyterlite/iframe-extension", + "@jupyterlite/javascript-kernel-extension", + "@jupyterlite/server-extension", + "@retrolab/application-extension" + ], + "singletonPackages": [ + "@jupyterlab/application", + "@jupyterlab/apputils", + "@jupyterlab/codeeditor", + "@jupyterlab/codemirror", + "@jupyterlab/completer", + "@jupyterlab/console", + "@jupyterlab/coreutils", + "@jupyterlab/docmanager", + "@jupyterlab/docprovider", + "@jupyterlab/documentsearch", + "@jupyterlab/filebrowser", + "@jupyterlab/fileeditor", + "@jupyterlab/imageviewer", + "@jupyterlab/inspector", + "@jupyterlab/launcher", + "@jupyterlab/logconsole", + "@jupyterlab/mainmenu", + "@jupyterlab/markdownviewer", + "@jupyterlab/notebook", + "@jupyterlab/outputarea", + "@jupyterlab/rendermime", + "@jupyterlab/rendermime-interfaces", + "@jupyterlab/services", + "@jupyterlab/settingregistry", + "@jupyterlab/shared-models", + "@jupyterlab/statedb", + "@jupyterlab/statusbar", + "@jupyterlab/tooltip", + "@jupyterlab/translation", + "@jupyterlab/ui-components", + "@jupyterlite/kernel", + "@jupyterlite/javascript-kernel", + "@lumino/algorithm", + "@lumino/application", + "@lumino/commands", + "@lumino/coreutils", + "@lumino/disposable", + "@lumino/domutils", + "@lumino/dragdrop", + "@lumino/messaging", + "@lumino/properties", + "@lumino/signaling", + "@lumino/virtualdom", + "@lumino/widgets", + "react", + "react-dom", + "yjs" + ], + "mimeExtensions": { + "@jupyterlab/javascript-extension": "", + "@jupyterlab/json-extension": "", + "@jupyterlab/vega5-extension": "" + }, + "linkedPackages": {} + }, + "jupyterlite": { + "pages": [ + "index" + ] + } +} diff --git a/doc/jupyterlite/_output/retro/consoles/favicon.ico b/doc/jupyterlite/_output/retro/consoles/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..97fcfd5436556489c4cf455979de2bf23236456c GIT binary patch literal 1150 zcmZQzU<5(|0R|wcz>vYhz#zuJz@P!dKp~(AL>x#lFaYHg1R)sA2NK_3UHbp#>=d#v zOz*`GrvKz%n7!oa1?i!O{_8VT{y*N44#ziUX~6x8ZvUljj{mPuPxyazvLsy1-4$;C zzdb(#$M@Ix!R65PUz?`z|JSF-|G&S!ied(?@IluPQg?lZD$!G=AW(; literal 0 HcmV?d00001 diff --git a/doc/jupyterlite/_output/retro/consoles/index.html b/doc/jupyterlite/_output/retro/consoles/index.html new file mode 100644 index 000000000..1e8dd73e0 --- /dev/null +++ b/doc/jupyterlite/_output/retro/consoles/index.html @@ -0,0 +1,35 @@ + + + + JupyterLite Retro - Console + + + + + + + diff --git a/doc/jupyterlite/_output/retro/consoles/jupyter-lite.ipynb b/doc/jupyterlite/_output/retro/consoles/jupyter-lite.ipynb new file mode 100644 index 000000000..c4a492241 --- /dev/null +++ b/doc/jupyterlite/_output/retro/consoles/jupyter-lite.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "dea14a34-4803-44da-ae14-88b2c87a6f12", + "metadata": {}, + "source": [ + "# jupyter-lite.ipynb\n", + "\n", + "This notebook is the preferred source of site-specific runtime [configuration](https://jupyterlite.readthedocs.io/en/latest/configuring.html) for a JupyterLite app, and will override any configuration in [`jupyter-lite.json`](./jupyter-lite.json)." + ] + }, + { + "cell_type": "markdown", + "id": "6d19715a-0a8c-4600-9ff1-e82ba667e2d3", + "metadata": {}, + "source": [ + "## Editing Configuration\n", + "\n", + "The configuration is stored in this Notebook's metadata under the `jupyter-lite` key. To edit the configuration in JupyterLab.\n", + "\n", + "- open the _Property Inspector_ sidebar\n", + "- expand the _Advanced Tools_ section\n", + "- edit the `jupyter-lite` metadata sub-key\n", + "- press the \"check\" icon\n", + "- save the notebook" + ] + } + ], + "metadata": { + "jupyter-lite": { + "jupyter-config-data": {}, + "jupyter-lite-schema-version": 0 + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.10" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/retro/consoles/jupyter-lite.json b/doc/jupyterlite/_output/retro/consoles/jupyter-lite.json new file mode 100644 index 000000000..c9b76eb04 --- /dev/null +++ b/doc/jupyterlite/_output/retro/consoles/jupyter-lite.json @@ -0,0 +1,8 @@ +{ + "jupyter-lite-schema-version": 0, + "jupyter-config-data": { + "retroPage": "consoles", + "faviconUrl": "./favicon.ico", + "fullStaticUrl": "../../build" + } +} diff --git a/doc/jupyterlite/_output/retro/edit/favicon.ico b/doc/jupyterlite/_output/retro/edit/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..8167018cd005ff4a24d8287c620539e23c69aac9 GIT binary patch literal 1150 zcmeHGu?@m75Ih7usc1=q#Ar}3g9{1u5G9Vze%<}~9qSED z_*E4+*VxQ}1%Nd{icIFY0Mu3#9X}t*S|qcPXdmjkckEEPihH)7%2nLouWvxzmEyD; z_Z}H)ul%aFKJ%B}O15MDW@wjZiljJOvMuwx&zB)}Yvgo9FK{i_b#L8MN~r!Z`{GSC cvToVotH@v7c?w*vZ?LC+B96p?o;l#&8_znXx&QzG literal 0 HcmV?d00001 diff --git a/doc/jupyterlite/_output/retro/edit/index.html b/doc/jupyterlite/_output/retro/edit/index.html new file mode 100644 index 000000000..d4ef2bb7c --- /dev/null +++ b/doc/jupyterlite/_output/retro/edit/index.html @@ -0,0 +1,35 @@ + + + + JupyterLite Retro - Edit + + + + + + + diff --git a/doc/jupyterlite/_output/retro/edit/jupyter-lite.ipynb b/doc/jupyterlite/_output/retro/edit/jupyter-lite.ipynb new file mode 100644 index 000000000..c4a492241 --- /dev/null +++ b/doc/jupyterlite/_output/retro/edit/jupyter-lite.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "dea14a34-4803-44da-ae14-88b2c87a6f12", + "metadata": {}, + "source": [ + "# jupyter-lite.ipynb\n", + "\n", + "This notebook is the preferred source of site-specific runtime [configuration](https://jupyterlite.readthedocs.io/en/latest/configuring.html) for a JupyterLite app, and will override any configuration in [`jupyter-lite.json`](./jupyter-lite.json)." + ] + }, + { + "cell_type": "markdown", + "id": "6d19715a-0a8c-4600-9ff1-e82ba667e2d3", + "metadata": {}, + "source": [ + "## Editing Configuration\n", + "\n", + "The configuration is stored in this Notebook's metadata under the `jupyter-lite` key. To edit the configuration in JupyterLab.\n", + "\n", + "- open the _Property Inspector_ sidebar\n", + "- expand the _Advanced Tools_ section\n", + "- edit the `jupyter-lite` metadata sub-key\n", + "- press the \"check\" icon\n", + "- save the notebook" + ] + } + ], + "metadata": { + "jupyter-lite": { + "jupyter-config-data": {}, + "jupyter-lite-schema-version": 0 + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.10" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/retro/edit/jupyter-lite.json b/doc/jupyterlite/_output/retro/edit/jupyter-lite.json new file mode 100644 index 000000000..b8a225849 --- /dev/null +++ b/doc/jupyterlite/_output/retro/edit/jupyter-lite.json @@ -0,0 +1,8 @@ +{ + "jupyter-lite-schema-version": 0, + "jupyter-config-data": { + "retroPage": "edit", + "faviconUrl": "./favicon.ico", + "fullStaticUrl": "../../build" + } +} diff --git a/doc/jupyterlite/_output/retro/favicon.ico b/doc/jupyterlite/_output/retro/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..2d1bcff7ca0ed6c77fdf1b016986f9137a43d31a GIT binary patch literal 32038 zcmeI4U5FG{7ROsAA|fG?5JY4_k?9XRYJ%itpLE5Qd5}CTSqV$nU6$YuB0hvnSGNw% z5*9HcG7rljAx|Of2kb(SAVHR88S)UqAR>zoOCCg)ARz>&t7k?;dw>7xx;=NQtGcVF zKWDlc&eW}2_nxnN>fUqDJvFJ+medQWmtRit+nf6R3#ru4RoYv-{|oj1pzih8{rmA$ z>X)ykQb&*0?z2BjrJnyZmCAA}6nlX!-e20#FZiogt6PGQF1WkXh4N{j-~(lMcd%XX zp0?w_-+`wNviJo^c=^??1z);#+$d~?5U`?YYa`~5LEYVy==z5f1&y%TDiN>!_!faaOK zz)`@=Gc(@YMTPaV`5WePw!nPgxXgFuS>S8nAt2ijsI0nKwNcw{$&x9S_k(v1u;)56 z=S5xBc20fQ%SXQWMDyQeKsFskr&YcBUKXx)_{ccree}EA0o@>9cZD+!56sA4(YRvcV_c;7|FUkpY1j9noOLR1dbFTv@I&_u>sHrgHu!^A=)D5GXX^9L zO2c@VXT7=(f@ZH|N$@uA6%w5!I*DrogP03!nwkqWC&uNs({`Hcp?AjMG3$@k22We+K#J_PrGf7)ViZ3WZF61JvUb#7=|1Zp*z<@#RZPFS3Rl1{Bx& zE%V~J@q$|vaDPs9dZspNI}CF2K5U1t6YzSC>pY-+?sveCfZ{h=_XH}dPS4b4KJAp% z=Y(+dQvQYSH6& zyudZ0JU&&EPkcv}(^KH8;k+Um-IjqhXFEE2CtX^A5LTJ9&JynXT3Z)210ufdf^#%=BL9M%57^x`)52zg|A zS2TQDPi?#McxoX7d!23Y_5p3po<#b8m?@Osr~YuJu=G+C58bNIK?B_!gzkCdu-BKe zcoUCNw9-@V1pTx|J_Qz7BhR9jp7R{ZPsx3eF`0yyZ#M+T)x0O_Vxqw z)(zhKd|10d)WKH{8<^v&_hUXiQ*Brq;P({IIB#+%50tvUPw!OjytA|u`#B>X#jA}k zH@&=*_jWE_baQt7FqWA=a_IO^;@R*=d}hDie{(iB!(_YKozlc|}f7BjLd$nQXKj$b13N3ho?lW72VNEc;`Pz-6VHZ-4KYT+_?2Qv=h<@} z%oQs=j|C}4hJ7n;{60WDq!w$X?8mQ`BI8${3{J(1AKEcU`f5BB^ZXe3-bI$&f$4Hn zJi-+h6pQ4&%PTes4aMs3`!>M2NIeGoX}VB}6$8yWWy!E$%V3pdgT$E^ZxOGXhUUp^ zF^?r2CLKbbVZT=9LvQ zMXuKIbK0n_>F48az^8iAZaaQ184i84dVXQ)-lruUSu(XMw|egBJQSaIesS<>`{x(+ zafm!W3e{J*PW>}7Pv>#UT{u57{Oh`Ue#hBb!8>E~&KS(N=o(e7@f@n#hA|}G|AhAb z`Ca#OXLBWUe!BQAHvh~!H}&6*sIteuC*SIL1>17}jCSBGUl9#kcik@6&#!BF0p9sS zOa1#Y8d(BYaBvphhx6;8E||ADGjLnx4k3vA(kJc(~tW# z`5RNU{0&d9-Z;7EC=Xr!MnCk@ibgFTNZ&;1mt6a;2jyuU1!e$~rTnr8g+GKrn&>a`&h=QT)?OPD|7olnKSR;BkN3d*@Ig7j-GjKXsbTzyAgHjXGc09z{zu2mOBJO67NWe|e94FLO8z_n~;`w=J-5$`k*Y59etBx_}q))DJym zi%Y*C_SQFBkE>(xB;I&iRiR>fntb>PkIPWkh=V=?G<=-~5itr16V zRQ3NcZmnM?d>n@upyS?zuQ`02t7)fliP+)?d}}o+P+4`*xvCgF*PGZGaYOk>>zhx+ zvv}{+7QmzY+PF6VBl6usCgP{%jK=MfdyCA)l}uRQe%5hb zIxbyccXm$h8he#2?eIh{?>_J;HWk3*E-=o&Iy%$&d({pSNB%5S3_4ZZ%63_of9>j!QznRL|!36W;!!X}4TdcfCF2#w> zByX53l2Nh-pJ^Qp)@|1NQId7Dj$tBKW2`;VNura)1`-=cY#_0L#0C-@NNganfy4$9 z8%S&*v4O+}n%lrA#e~9S9rgI97yl+UtQhfTeODCQSByU_{wIy>6vw(wfX-G$t@1_N&h7y__Q}eEax-{u^-b>Dyp1;VA3Pm2 z$$vqY572S(wTmnJ2W<<=!NIPlb*>qd+uXOC|6*iP?vTL|d3D@7%D+)glIhp$t8%Th zMlsfRBl+@eKr(c~4>V%uztwUr+%LR*By!f2yVeP9^;HgCEuRH>$*n`)zU9A(epm7z z$z?>3H~rkk==?`=BbjICSg&r@=C8r$KS~Gkm*8t8^IvWIMF%69|7`1El=I(>9!B~5 z2crXBNA>#`TL**q{)x5W@i2V + + + + + + diff --git a/doc/jupyterlite/_output/retro/jupyter-lite.ipynb b/doc/jupyterlite/_output/retro/jupyter-lite.ipynb new file mode 100644 index 000000000..c4a492241 --- /dev/null +++ b/doc/jupyterlite/_output/retro/jupyter-lite.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "dea14a34-4803-44da-ae14-88b2c87a6f12", + "metadata": {}, + "source": [ + "# jupyter-lite.ipynb\n", + "\n", + "This notebook is the preferred source of site-specific runtime [configuration](https://jupyterlite.readthedocs.io/en/latest/configuring.html) for a JupyterLite app, and will override any configuration in [`jupyter-lite.json`](./jupyter-lite.json)." + ] + }, + { + "cell_type": "markdown", + "id": "6d19715a-0a8c-4600-9ff1-e82ba667e2d3", + "metadata": {}, + "source": [ + "## Editing Configuration\n", + "\n", + "The configuration is stored in this Notebook's metadata under the `jupyter-lite` key. To edit the configuration in JupyterLab.\n", + "\n", + "- open the _Property Inspector_ sidebar\n", + "- expand the _Advanced Tools_ section\n", + "- edit the `jupyter-lite` metadata sub-key\n", + "- press the \"check\" icon\n", + "- save the notebook" + ] + } + ], + "metadata": { + "jupyter-lite": { + "jupyter-config-data": {}, + "jupyter-lite-schema-version": 0 + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.10" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/retro/jupyter-lite.json b/doc/jupyterlite/_output/retro/jupyter-lite.json new file mode 100644 index 000000000..59bf929b0 --- /dev/null +++ b/doc/jupyterlite/_output/retro/jupyter-lite.json @@ -0,0 +1,8 @@ +{ + "jupyter-lite-schema-version": 0, + "jupyter-config-data": { + "fullStaticUrl": "../build", + "settingsUrl": "../../build/schemas", + "themesUrl": "./build/themes" + } +} diff --git a/doc/jupyterlite/_output/retro/notebooks/favicon.ico b/doc/jupyterlite/_output/retro/notebooks/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..4537e2d989843ae1a96a0548aa0a7066a22e2698 GIT binary patch literal 1150 zcmd6kJxT;Y5QX2WpqU$)xPggaBK}}1>McBhsCWizK|@m`1#e)g;lhS0Vx(Z8XsF1B zf@t|QGc63$HWTg)-xU2`y`G|5YVo$);ya`5F=+Oz;Y!U7Un(3%^tjC*nw^$zt$lCLQe;7 z68RSTXM;T!>A8mbS(zU-$nVo*u$!1+qs)I$$1A@12wJ$KD_DZdiXRr{6L1H)bNs;% z_xMoD7kliL`IDM&zEXNy)YY0_ + + + JupyterLite Retro - Notebook + + + + + + + + diff --git a/doc/jupyterlite/_output/retro/notebooks/jupyter-lite.ipynb b/doc/jupyterlite/_output/retro/notebooks/jupyter-lite.ipynb new file mode 100644 index 000000000..c4a492241 --- /dev/null +++ b/doc/jupyterlite/_output/retro/notebooks/jupyter-lite.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "dea14a34-4803-44da-ae14-88b2c87a6f12", + "metadata": {}, + "source": [ + "# jupyter-lite.ipynb\n", + "\n", + "This notebook is the preferred source of site-specific runtime [configuration](https://jupyterlite.readthedocs.io/en/latest/configuring.html) for a JupyterLite app, and will override any configuration in [`jupyter-lite.json`](./jupyter-lite.json)." + ] + }, + { + "cell_type": "markdown", + "id": "6d19715a-0a8c-4600-9ff1-e82ba667e2d3", + "metadata": {}, + "source": [ + "## Editing Configuration\n", + "\n", + "The configuration is stored in this Notebook's metadata under the `jupyter-lite` key. To edit the configuration in JupyterLab.\n", + "\n", + "- open the _Property Inspector_ sidebar\n", + "- expand the _Advanced Tools_ section\n", + "- edit the `jupyter-lite` metadata sub-key\n", + "- press the \"check\" icon\n", + "- save the notebook" + ] + } + ], + "metadata": { + "jupyter-lite": { + "jupyter-config-data": {}, + "jupyter-lite-schema-version": 0 + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.10" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/retro/notebooks/jupyter-lite.json b/doc/jupyterlite/_output/retro/notebooks/jupyter-lite.json new file mode 100644 index 000000000..72488009d --- /dev/null +++ b/doc/jupyterlite/_output/retro/notebooks/jupyter-lite.json @@ -0,0 +1,8 @@ +{ + "jupyter-lite-schema-version": 0, + "jupyter-config-data": { + "retroPage": "notebooks", + "faviconUrl": "./favicon.ico", + "fullStaticUrl": "../../build" + } +} diff --git a/doc/jupyterlite/_output/retro/package.json b/doc/jupyterlite/_output/retro/package.json new file mode 100644 index 000000000..6a4793ddc --- /dev/null +++ b/doc/jupyterlite/_output/retro/package.json @@ -0,0 +1,230 @@ +{ + "name": "@jupyterlite/app-retro", + "version": "0.1.0-beta.5", + "private": true, + "resolutions": { + "@jupyterlab/application": "~3.3.2", + "@jupyterlab/application-extension": "~3.3.2", + "@jupyterlab/apputils": "~3.3.2", + "@jupyterlab/apputils-extension": "~3.3.2", + "@jupyterlab/celltags": "~3.3.2", + "@jupyterlab/codeeditor": "~3.3.2", + "@jupyterlab/codemirror": "~3.3.2", + "@jupyterlab/codemirror-extension": "~3.3.2", + "@jupyterlab/completer": "~3.3.2", + "@jupyterlab/completer-extension": "~3.3.2", + "@jupyterlab/console": "~3.3.2", + "@jupyterlab/console-extension": "~3.3.2", + "@jupyterlab/coreutils": "~5.3.2", + "@jupyterlab/docmanager": "~3.3.2", + "@jupyterlab/docmanager-extension": "~3.3.2", + "@jupyterlab/docprovider": "~3.3.2", + "@jupyterlab/documentsearch": "~3.3.2", + "@jupyterlab/filebrowser": "~3.3.2", + "@jupyterlab/filebrowser-extension": "~3.3.2", + "@jupyterlab/fileeditor": "~3.3.2", + "@jupyterlab/fileeditor-extension": "~3.3.2", + "@jupyterlab/imageviewer": "~3.3.2", + "@jupyterlab/inspector": "~3.3.2", + "@jupyterlab/javascript-extension": "~3.3.2", + "@jupyterlab/json-extension": "~3.3.2", + "@jupyterlab/launcher": "~3.3.2", + "@jupyterlab/logconsole": "~3.3.2", + "@jupyterlab/mainmenu": "~3.3.2", + "@jupyterlab/mainmenu-extension": "~3.3.2", + "@jupyterlab/markdownviewer": "~3.3.2", + "@jupyterlab/mathjax2-extension": "~3.3.2", + "@jupyterlab/notebook": "~3.3.2", + "@jupyterlab/notebook-extension": "~3.3.2", + "@jupyterlab/outputarea": "~3.3.2", + "@jupyterlab/rendermime": "~3.3.2", + "@jupyterlab/rendermime-extension": "~3.3.2", + "@jupyterlab/rendermime-interfaces": "~3.3.2", + "@jupyterlab/services": "~6.3.2", + "@jupyterlab/settingeditor": "~3.3.2", + "@jupyterlab/settingregistry": "~3.3.2", + "@jupyterlab/shared-models": "~3.3.2", + "@jupyterlab/shortcuts-extension": "~3.3.2", + "@jupyterlab/statedb": "~3.3.2", + "@jupyterlab/statusbar": "~3.3.2", + "@jupyterlab/theme-dark-extension": "~3.3.2", + "@jupyterlab/theme-light-extension": "~3.3.2", + "@jupyterlab/tooltip": "~3.3.2", + "@jupyterlab/tooltip-extension": "~3.3.2", + "@jupyterlab/translation": "~3.3.2", + "@jupyterlab/translation-extension": "~3.3.2", + "@jupyterlab/ui-components": "~3.3.2", + "@jupyterlite/application-extension": "~0.1.0-beta.5", + "@jupyterlite/iframe-extension": "~0.1.0-beta.5", + "@jupyterlite/javascript-kernel": "~0.1.0-beta.5", + "@jupyterlite/javascript-kernel-extension": "~0.1.0-beta.5", + "@jupyterlite/kernel": "~0.1.0-beta.5", + "@jupyterlite/localforage": "~0.1.0-beta.5", + "@jupyterlite/pyolite-kernel-extension": "~0.1.0-beta.5", + "@jupyterlite/retro-application-extension": "~0.1.0-beta.5", + "@jupyterlite/server": "~0.1.0-beta.5", + "@jupyterlite/server-extension": "~0.1.0-beta.5", + "@jupyterlite/types": "~0.1.0-beta.5", + "@lumino/algorithm": "~1.9.1", + "@lumino/application": "~1.28.1", + "@lumino/commands": "~1.20.0", + "@lumino/coreutils": "~1.12.0", + "@lumino/disposable": "~1.10.1", + "@lumino/domutils": "~1.8.1", + "@lumino/dragdrop": "~1.14.0", + "@lumino/messaging": "~1.10.1", + "@lumino/properties": "~1.8.1", + "@lumino/signaling": "~1.10.1", + "@lumino/virtualdom": "~1.14.1", + "@lumino/widgets": "~1.31.1", + "@retrolab/application": "~0.3.20", + "@retrolab/application-extension": "~0.3.20", + "@retrolab/docmanager-extension": "~0.3.20", + "@retrolab/help-extension": "~0.3.20", + "@retrolab/notebook-extension": "~0.3.20", + "@retrolab/tree-extension": "~0.3.20", + "@retrolab/ui-components": "~0.3.20", + "es6-promise": "^4.2.8", + "react": "^17.0.2", + "react-dom": "^17.0.2", + "yjs": "^13.5.28" + }, + "dependencies": { + "@jupyterlab/application-extension": "~3.3.2", + "@jupyterlab/apputils-extension": "~3.3.2", + "@jupyterlab/celltags": "~3.3.2", + "@jupyterlab/codemirror-extension": "~3.3.2", + "@jupyterlab/completer-extension": "~3.3.2", + "@jupyterlab/console-extension": "~3.3.2", + "@jupyterlab/coreutils": "~5.3.2", + "@jupyterlab/docmanager-extension": "~3.3.2", + "@jupyterlab/filebrowser-extension": "~3.3.2", + "@jupyterlab/fileeditor-extension": "~3.3.2", + "@jupyterlab/javascript-extension": "~3.3.2", + "@jupyterlab/json-extension": "~3.3.2", + "@jupyterlab/mainmenu-extension": "~3.3.2", + "@jupyterlab/mathjax2-extension": "~3.3.2", + "@jupyterlab/notebook-extension": "~3.3.2", + "@jupyterlab/rendermime-extension": "~3.3.2", + "@jupyterlab/shortcuts-extension": "~3.3.2", + "@jupyterlab/theme-dark-extension": "~3.3.2", + "@jupyterlab/theme-light-extension": "~3.3.2", + "@jupyterlab/tooltip-extension": "~3.3.2", + "@jupyterlab/translation-extension": "~3.3.2", + "@jupyterlite/application-extension": "^0.1.0-beta.5", + "@jupyterlite/iframe-extension": "^0.1.0-beta.5", + "@jupyterlite/javascript-kernel-extension": "^0.1.0-beta.5", + "@jupyterlite/localforage": "^0.1.0-beta.5", + "@jupyterlite/pyolite-kernel-extension": "^0.1.0-beta.5", + "@jupyterlite/retro-application-extension": "^0.1.0-beta.5", + "@jupyterlite/server": "^0.1.0-beta.5", + "@jupyterlite/server-extension": "^0.1.0-beta.5", + "@jupyterlite/types": "^0.1.0-beta.5", + "@retrolab/application": "^0.3.20", + "@retrolab/application-extension": "^0.3.20", + "@retrolab/docmanager-extension": "^0.3.20", + "@retrolab/help-extension": "^0.3.20", + "@retrolab/notebook-extension": "^0.3.20", + "@retrolab/tree-extension": "^0.3.20", + "@retrolab/ui-components": "^0.3.20", + "es6-promise": "~4.2.8", + "react": "^17.0.1", + "react-dom": "^17.0.1" + }, + "jupyterlab": { + "extensions": [ + "@retrolab/application-extension", + "@retrolab/docmanager-extension", + "@retrolab/help-extension", + "@retrolab/notebook-extension", + "@retrolab/tree-extension", + "@jupyterlab/application-extension", + "@jupyterlab/apputils-extension", + "@jupyterlab/codemirror-extension", + "@jupyterlab/completer-extension", + "@jupyterlab/console-extension", + "@jupyterlab/docmanager-extension", + "@jupyterlab/filebrowser-extension", + "@jupyterlab/fileeditor-extension", + "@jupyterlab/javascript-extension", + "@jupyterlab/json-extension", + "@jupyterlab/mainmenu-extension", + "@jupyterlab/mathjax2-extension", + "@jupyterlab/notebook-extension", + "@jupyterlab/rendermime-extension", + "@jupyterlab/shortcuts-extension", + "@jupyterlab/theme-dark-extension", + "@jupyterlab/theme-light-extension", + "@jupyterlab/tooltip-extension", + "@jupyterlab/translation-extension", + "@jupyterlab/vega5-extension", + "@jupyterlite/application-extension", + "@jupyterlite/iframe-extension", + "@jupyterlite/javascript-kernel-extension", + "@jupyterlite/retro-application-extension", + "@jupyterlite/server-extension" + ], + "singletonPackages": [ + "@jupyterlab/application", + "@jupyterlab/apputils", + "@jupyterlab/codeeditor", + "@jupyterlab/codemirror", + "@jupyterlab/completer", + "@jupyterlab/console", + "@jupyterlab/coreutils", + "@jupyterlab/docmanager", + "@jupyterlab/docprovider", + "@jupyterlab/documentsearch", + "@jupyterlab/filebrowser", + "@jupyterlab/fileeditor", + "@jupyterlab/imageviewer", + "@jupyterlab/inspector", + "@jupyterlab/launcher", + "@jupyterlab/logconsole", + "@jupyterlab/mainmenu", + "@jupyterlab/markdownviewer", + "@jupyterlab/notebook", + "@jupyterlab/outputarea", + "@jupyterlab/rendermime", + "@jupyterlab/rendermime-interfaces", + "@jupyterlab/services", + "@jupyterlab/settingeditor", + "@jupyterlab/settingregistry", + "@jupyterlab/shared-models", + "@jupyterlab/statedb", + "@jupyterlab/statusbar", + "@jupyterlab/tooltip", + "@jupyterlab/translation", + "@jupyterlab/ui-components", + "@jupyterlite/kernel", + "@jupyterlite/localforage", + "@jupyterlite/javascript-kernel", + "@jupyterlite/types", + "@lumino/algorithm", + "@lumino/application", + "@lumino/commands", + "@lumino/coreutils", + "@lumino/disposable", + "@lumino/domutils", + "@lumino/dragdrop", + "@lumino/messaging", + "@lumino/properties", + "@lumino/signaling", + "@lumino/virtualdom", + "@lumino/widgets", + "react", + "react-dom", + "yjs" + ], + "mimeExtensions": {}, + "linkedPackages": {} + }, + "jupyterlite": { + "pages": [ + "consoles/index", + "edit/index", + "notebooks/index", + "tree/index" + ] + } +} diff --git a/doc/jupyterlite/_output/retro/tree/index.html b/doc/jupyterlite/_output/retro/tree/index.html new file mode 100644 index 000000000..08b5244ee --- /dev/null +++ b/doc/jupyterlite/_output/retro/tree/index.html @@ -0,0 +1,35 @@ + + + + JupyterLite Retro - Tree + + + + + + + diff --git a/doc/jupyterlite/_output/retro/tree/jupyter-lite.ipynb b/doc/jupyterlite/_output/retro/tree/jupyter-lite.ipynb new file mode 100644 index 000000000..c4a492241 --- /dev/null +++ b/doc/jupyterlite/_output/retro/tree/jupyter-lite.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "dea14a34-4803-44da-ae14-88b2c87a6f12", + "metadata": {}, + "source": [ + "# jupyter-lite.ipynb\n", + "\n", + "This notebook is the preferred source of site-specific runtime [configuration](https://jupyterlite.readthedocs.io/en/latest/configuring.html) for a JupyterLite app, and will override any configuration in [`jupyter-lite.json`](./jupyter-lite.json)." + ] + }, + { + "cell_type": "markdown", + "id": "6d19715a-0a8c-4600-9ff1-e82ba667e2d3", + "metadata": {}, + "source": [ + "## Editing Configuration\n", + "\n", + "The configuration is stored in this Notebook's metadata under the `jupyter-lite` key. To edit the configuration in JupyterLab.\n", + "\n", + "- open the _Property Inspector_ sidebar\n", + "- expand the _Advanced Tools_ section\n", + "- edit the `jupyter-lite` metadata sub-key\n", + "- press the \"check\" icon\n", + "- save the notebook" + ] + } + ], + "metadata": { + "jupyter-lite": { + "jupyter-config-data": {}, + "jupyter-lite-schema-version": 0 + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.10" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/_output/retro/tree/jupyter-lite.json b/doc/jupyterlite/_output/retro/tree/jupyter-lite.json new file mode 100644 index 000000000..b7f616ec5 --- /dev/null +++ b/doc/jupyterlite/_output/retro/tree/jupyter-lite.json @@ -0,0 +1,7 @@ +{ + "jupyter-lite-schema-version": 0, + "jupyter-config-data": { + "retroPage": "tree", + "fullStaticUrl": "../../build" + } +} diff --git a/doc/jupyterlite/_output/tree/index.html b/doc/jupyterlite/_output/tree/index.html new file mode 100644 index 000000000..3a954bbbf --- /dev/null +++ b/doc/jupyterlite/_output/tree/index.html @@ -0,0 +1,14 @@ + + + + + + diff --git a/doc/jupyterlite/file_prefix b/doc/jupyterlite/file_prefix new file mode 100644 index 000000000..c8f8314ec --- /dev/null +++ b/doc/jupyterlite/file_prefix @@ -0,0 +1,8 @@ +# %% +# Running this cell is required to get the examples to work in this online +# notebook until there is a way to preinstall packages +# You have to wait until it has executed before you click to run the next cell +import micropip +micropip.install(['altair', 'vega_datasets']) + +# %% diff --git a/doc/jupyterlite/files/airport_connections.ipynb b/doc/jupyterlite/files/airport_connections.ipynb new file mode 100644 index 000000000..2e144871b --- /dev/null +++ b/doc/jupyterlite/files/airport_connections.ipynb @@ -0,0 +1,109 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c0be97fa", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b0e532bc", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Connections Among U.S. Airports Interactive\n", + "-------------------------------------------\n", + "This example shows all the connections between major U.S. airports. Lookup transformations \n", + "are used to find the coordinates of each airport and connecting airports. Connections \n", + "are displayed on mouseover via a single selection.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "# Since these data are each more than 5,000 rows we'll import from the URLs\n", + "airports = data.airports.url\n", + "flights_airport = data.flights_airport.url\n", + "\n", + "states = alt.topo_feature(data.us_10m.url, feature=\"states\")\n", + "\n", + "# Create mouseover selection\n", + "select_city = alt.selection_single(\n", + " on=\"mouseover\", nearest=True, fields=[\"origin\"], empty=\"none\"\n", + ")\n", + "\n", + "# Define which attributes to lookup from airports.csv\n", + "lookup_data = alt.LookupData(\n", + " airports, key=\"iata\", fields=[\"state\", \"latitude\", \"longitude\"]\n", + ")\n", + "\n", + "background = alt.Chart(states).mark_geoshape(\n", + " fill=\"lightgray\", \n", + " stroke=\"white\"\n", + ").properties(\n", + " width=750, \n", + " height=500\n", + ").project(\"albersUsa\")\n", + "\n", + "connections = alt.Chart(flights_airport).mark_rule(opacity=0.35).encode(\n", + " latitude=\"latitude:Q\",\n", + " longitude=\"longitude:Q\",\n", + " latitude2=\"lat2:Q\",\n", + " longitude2=\"lon2:Q\"\n", + ").transform_lookup(\n", + " lookup=\"origin\", \n", + " from_=lookup_data\n", + ").transform_lookup(\n", + " lookup=\"destination\", \n", + " from_=lookup_data, \n", + " as_=[\"state\", \"lat2\", \"lon2\"]\n", + ").transform_filter(\n", + " select_city\n", + ")\n", + "\n", + "points = alt.Chart(flights_airport).mark_circle().encode(\n", + " latitude=\"latitude:Q\",\n", + " longitude=\"longitude:Q\",\n", + " size=alt.Size(\"routes:Q\", scale=alt.Scale(range=[0, 1000]), legend=None),\n", + " order=alt.Order(\"routes:Q\", sort=\"descending\"),\n", + " tooltip=[\"origin:N\", \"routes:Q\"]\n", + ").transform_aggregate(\n", + " routes=\"count()\", \n", + " groupby=[\"origin\"]\n", + ").transform_lookup(\n", + " lookup=\"origin\", \n", + " from_=lookup_data\n", + ").transform_filter(\n", + " (alt.datum.state != \"PR\") & (alt.datum.state != \"VI\")\n", + ").add_selection(\n", + " select_city\n", + ")\n", + "\n", + "(background + connections + points).configure_view(stroke=None)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/airports.ipynb b/doc/jupyterlite/files/airports.ipynb new file mode 100644 index 000000000..634fe5419 --- /dev/null +++ b/doc/jupyterlite/files/airports.ipynb @@ -0,0 +1,72 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "517bc9fd", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "629bc5c7", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Locations of US Airports\n", + "========================\n", + "This is a layered geographic visualization that shows the positions of US\n", + "airports on a background of US states.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "airports = data.airports()\n", + "states = alt.topo_feature(data.us_10m.url, feature='states')\n", + "\n", + "# US states background\n", + "background = alt.Chart(states).mark_geoshape(\n", + " fill='lightgray',\n", + " stroke='white'\n", + ").properties(\n", + " width=500,\n", + " height=300\n", + ").project('albersUsa')\n", + "\n", + "# airport positions on background\n", + "points = alt.Chart(airports).mark_circle(\n", + " size=10,\n", + " color='steelblue'\n", + ").encode(\n", + " longitude='longitude:Q',\n", + " latitude='latitude:Q',\n", + " tooltip=['name', 'city', 'state']\n", + ")\n", + "\n", + "background + points" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/airports_count.ipynb b/doc/jupyterlite/files/airports_count.ipynb new file mode 100644 index 000000000..c7bb29583 --- /dev/null +++ b/doc/jupyterlite/files/airports_count.ipynb @@ -0,0 +1,78 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "3da614cb", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "12ab0295", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Locations of US Airports\n", + "========================\n", + "This is a layered geographic visualization that shows the positions of US\n", + "airports on a background of US states.\n", + "\"\"\"\n", + "# category: maps\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "airports = data.airports.url\n", + "states = alt.topo_feature(data.us_10m.url, feature='states')\n", + "\n", + "# US states background\n", + "background = alt.Chart(states).mark_geoshape(\n", + " fill='lightgray',\n", + " stroke='white'\n", + ").properties(\n", + " width=500,\n", + " height=300\n", + ").project('albersUsa')\n", + "\n", + "# airport positions on background\n", + "points = alt.Chart(airports).transform_aggregate(\n", + " latitude='mean(latitude)',\n", + " longitude='mean(longitude)',\n", + " count='count()',\n", + " groupby=['state']\n", + ").mark_circle().encode(\n", + " longitude='longitude:Q',\n", + " latitude='latitude:Q',\n", + " size=alt.Size('count:Q', title='Number of Airports'),\n", + " color=alt.value('steelblue'),\n", + " tooltip=['state:N','count:Q']\n", + ").properties(\n", + " title='Number of airports in US'\n", + ")\n", + "\n", + "background + points" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/anscombe_plot.ipynb b/doc/jupyterlite/files/anscombe_plot.ipynb new file mode 100644 index 000000000..05b87e279 --- /dev/null +++ b/doc/jupyterlite/files/anscombe_plot.ipynb @@ -0,0 +1,59 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "bfde1e70", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9021da38", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Anscombe's Quartet\n", + "------------------\n", + "\n", + "This example shows how to use the column channel to make a trellis plot. Anscombe's Quartet is a famous dataset constructed by Francis Anscombe. Common summary statistics are identical for each subset of the data, despite the subsets having vastly different characteristics.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.anscombe()\n", + "\n", + "alt.Chart(source).mark_circle().encode(\n", + " alt.X('X', scale=alt.Scale(zero=False)),\n", + " alt.Y('Y', scale=alt.Scale(zero=False)),\n", + " alt.Facet('Series', columns=2),\n", + ").properties(\n", + " width=180,\n", + " height=180,\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/area_chart_gradient.ipynb b/doc/jupyterlite/files/area_chart_gradient.ipynb new file mode 100644 index 000000000..da3fa9283 --- /dev/null +++ b/doc/jupyterlite/files/area_chart_gradient.ipynb @@ -0,0 +1,69 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "ad68b6b4", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "221401f6", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Area Chart with Gradient\n", + "------------------------\n", + "This example shows how to make an area chart with a gradient fill. \n", + "For more information about gradient options see the Vega-Lite `Gradient documentation `_.\n", + "\"\"\"\n", + "# category: area charts\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.stocks()\n", + "\n", + "alt.Chart(source).transform_filter(\n", + " 'datum.symbol===\"GOOG\"'\n", + ").mark_area(\n", + " line={'color':'darkgreen'},\n", + " color=alt.Gradient(\n", + " gradient='linear', \n", + " stops=[alt.GradientStop(color='white', offset=0), \n", + " alt.GradientStop(color='darkgreen', offset=1)], \n", + " x1=1, \n", + " x2=1, \n", + " y1=1, \n", + " y2=0\n", + " )\n", + ").encode(\n", + " alt.X('date:T'), \n", + " alt.Y('price:Q')\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/bar_and_line_with_dual_axis.ipynb b/doc/jupyterlite/files/bar_and_line_with_dual_axis.ipynb new file mode 100644 index 000000000..7410f20f1 --- /dev/null +++ b/doc/jupyterlite/files/bar_and_line_with_dual_axis.ipynb @@ -0,0 +1,61 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "95ef9ab9", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "94d687b6", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Bar Chart with Line on Dual Axis\n", + "--------------------------------\n", + "This example shows how to combine two plots and keep their axes.\n", + "\n", + "For a more polished version of this chart, see :ref:`gallery_wheat_wages`.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.wheat()\n", + "\n", + "base = alt.Chart(source).encode(x='year:O')\n", + "\n", + "bar = base.mark_bar().encode(y='wheat:Q')\n", + "\n", + "line = base.mark_line(color='red').encode(\n", + " y='wages:Q'\n", + ")\n", + "\n", + "(bar + line).properties(width=600)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/bar_chart_horizontal.ipynb b/doc/jupyterlite/files/bar_chart_horizontal.ipynb new file mode 100644 index 000000000..8fad3803f --- /dev/null +++ b/doc/jupyterlite/files/bar_chart_horizontal.ipynb @@ -0,0 +1,54 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "55262b42", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9242af2a", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Horizontal Bar Chart\n", + "--------------------\n", + "This example is a bar chart drawn horizontally by putting the quantitative value on the x axis.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.wheat()\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x='wheat:Q',\n", + " y=\"year:O\"\n", + ").properties(height=700)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/bar_chart_sorted.ipynb b/doc/jupyterlite/files/bar_chart_sorted.ipynb new file mode 100644 index 000000000..17b378b7a --- /dev/null +++ b/doc/jupyterlite/files/bar_chart_sorted.ipynb @@ -0,0 +1,54 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "9eb7c16d", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8fa022a9", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Sorted Bar Chart\n", + "================\n", + "This example shows a bar chart sorted by a calculated value.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x='sum(yield):Q',\n", + " y=alt.Y('site:N', sort='-x')\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/bar_chart_trellis_compact.ipynb b/doc/jupyterlite/files/bar_chart_trellis_compact.ipynb new file mode 100644 index 000000000..149ff3be0 --- /dev/null +++ b/doc/jupyterlite/files/bar_chart_trellis_compact.ipynb @@ -0,0 +1,89 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "4ac8c885", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "85957167", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Compact Trellis Grid of Bar Charts\n", + "==================================\n", + "This example shows a simple grid of bar charts to compare performance data..\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame(\n", + " [\n", + " {\"a\": \"a1\", \"b\": \"b1\", \"c\": \"x\", \"p\": \"0.14\"},\n", + " {\"a\": \"a1\", \"b\": \"b1\", \"c\": \"y\", \"p\": \"0.60\"},\n", + " {\"a\": \"a1\", \"b\": \"b1\", \"c\": \"z\", \"p\": \"0.03\"},\n", + " {\"a\": \"a1\", \"b\": \"b2\", \"c\": \"x\", \"p\": \"0.80\"},\n", + " {\"a\": \"a1\", \"b\": \"b2\", \"c\": \"y\", \"p\": \"0.38\"},\n", + " {\"a\": \"a1\", \"b\": \"b2\", \"c\": \"z\", \"p\": \"0.55\"},\n", + " {\"a\": \"a1\", \"b\": \"b3\", \"c\": \"x\", \"p\": \"0.11\"},\n", + " {\"a\": \"a1\", \"b\": \"b3\", \"c\": \"y\", \"p\": \"0.58\"},\n", + " {\"a\": \"a1\", \"b\": \"b3\", \"c\": \"z\", \"p\": \"0.79\"},\n", + " {\"a\": \"a2\", \"b\": \"b1\", \"c\": \"x\", \"p\": \"0.83\"},\n", + " {\"a\": \"a2\", \"b\": \"b1\", \"c\": \"y\", \"p\": \"0.87\"},\n", + " {\"a\": \"a2\", \"b\": \"b1\", \"c\": \"z\", \"p\": \"0.67\"},\n", + " {\"a\": \"a2\", \"b\": \"b2\", \"c\": \"x\", \"p\": \"0.97\"},\n", + " {\"a\": \"a2\", \"b\": \"b2\", \"c\": \"y\", \"p\": \"0.84\"},\n", + " {\"a\": \"a2\", \"b\": \"b2\", \"c\": \"z\", \"p\": \"0.90\"},\n", + " {\"a\": \"a2\", \"b\": \"b3\", \"c\": \"x\", \"p\": \"0.74\"},\n", + " {\"a\": \"a2\", \"b\": \"b3\", \"c\": \"y\", \"p\": \"0.64\"},\n", + " {\"a\": \"a2\", \"b\": \"b3\", \"c\": \"z\", \"p\": \"0.19\"},\n", + " {\"a\": \"a3\", \"b\": \"b1\", \"c\": \"x\", \"p\": \"0.57\"},\n", + " {\"a\": \"a3\", \"b\": \"b1\", \"c\": \"y\", \"p\": \"0.35\"},\n", + " {\"a\": \"a3\", \"b\": \"b1\", \"c\": \"z\", \"p\": \"0.49\"},\n", + " {\"a\": \"a3\", \"b\": \"b2\", \"c\": \"x\", \"p\": \"0.91\"},\n", + " {\"a\": \"a3\", \"b\": \"b2\", \"c\": \"y\", \"p\": \"0.38\"},\n", + " {\"a\": \"a3\", \"b\": \"b2\", \"c\": \"z\", \"p\": \"0.91\"},\n", + " {\"a\": \"a3\", \"b\": \"b3\", \"c\": \"x\", \"p\": \"0.99\"},\n", + " {\"a\": \"a3\", \"b\": \"b3\", \"c\": \"y\", \"p\": \"0.80\"},\n", + " {\"a\": \"a3\", \"b\": \"b3\", \"c\": \"z\", \"p\": \"0.37\"},\n", + " ]\n", + ")\n", + "\n", + "alt.Chart(source, width=60, height=alt.Step(8)).mark_bar().encode(\n", + " y=alt.Y(\"c:N\", axis=None),\n", + " x=alt.X(\"p:Q\", title=None, axis=alt.Axis(format=\"%\")),\n", + " color=alt.Color(\n", + " \"c:N\", title=\"settings\", legend=alt.Legend(orient=\"bottom\", titleOrient=\"left\")\n", + " ),\n", + " row=alt.Row(\"a:N\", title=\"Factor A\", header=alt.Header(labelAngle=0)),\n", + " column=alt.Column(\"b:N\", title=\"Factor B\"),\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/bar_chart_with_highlighted_bar.ipynb b/doc/jupyterlite/files/bar_chart_with_highlighted_bar.ipynb new file mode 100644 index 000000000..67e511c44 --- /dev/null +++ b/doc/jupyterlite/files/bar_chart_with_highlighted_bar.ipynb @@ -0,0 +1,60 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c0a106b3", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d4c9c2e3", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Bar Chart with Highlighted Bar\n", + "------------------------------\n", + "This example shows a basic bar chart with a single bar highlighted.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.wheat()\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x='year:O',\n", + " y=\"wheat:Q\",\n", + " # The highlight will be set on the result of a conditional statement\n", + " color=alt.condition(\n", + " alt.datum.year == 1810, # If the year is 1810 this test returns True,\n", + " alt.value('orange'), # which sets the bar orange.\n", + " alt.value('steelblue') # And if it's not true it sets the bar steelblue.\n", + " )\n", + ").properties(width=600)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/bar_chart_with_highlighted_segment.ipynb b/doc/jupyterlite/files/bar_chart_with_highlighted_segment.ipynb new file mode 100644 index 000000000..cbfb6f911 --- /dev/null +++ b/doc/jupyterlite/files/bar_chart_with_highlighted_segment.ipynb @@ -0,0 +1,69 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "9d7f568a", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5542ddab", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Bar Chart with Highlighted Segment\n", + "----------------------------------\n", + "This example shows a bar chart that highlights values beyond a threshold.\n", + "\"\"\"\n", + "import altair as alt\n", + "import pandas as pd\n", + "from vega_datasets import data\n", + "\n", + "source = data.wheat()\n", + "threshold = pd.DataFrame([{\"threshold\": 90}])\n", + "\n", + "bars = alt.Chart(source).mark_bar().encode(\n", + " x=\"year:O\",\n", + " y=\"wheat:Q\",\n", + ")\n", + "\n", + "highlight = alt.Chart(source).mark_bar(color=\"#e45755\").encode(\n", + " x='year:O',\n", + " y='baseline:Q',\n", + " y2='wheat:Q'\n", + ").transform_filter(\n", + " alt.datum.wheat > 90\n", + ").transform_calculate(\"baseline\", \"90\")\n", + "\n", + "rule = alt.Chart(threshold).mark_rule().encode(\n", + " y='threshold:Q'\n", + ")\n", + "\n", + "(bars + highlight + rule).properties(width=600)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/bar_chart_with_labels.ipynb b/doc/jupyterlite/files/bar_chart_with_labels.ipynb new file mode 100644 index 000000000..8835d3738 --- /dev/null +++ b/doc/jupyterlite/files/bar_chart_with_labels.ipynb @@ -0,0 +1,64 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "7f15a685", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cce85617", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Bar Chart with Labels\n", + "=====================\n", + "This example shows a basic horizontal bar chart with labels created with Altair.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.wheat()\n", + "\n", + "bars = alt.Chart(source).mark_bar().encode(\n", + " x='wheat:Q',\n", + " y=\"year:O\"\n", + ")\n", + "\n", + "text = bars.mark_text(\n", + " align='left',\n", + " baseline='middle',\n", + " dx=3 # Nudges text to right so it doesn't appear on top of the bar\n", + ").encode(\n", + " text='wheat:Q'\n", + ")\n", + "\n", + "(bars + text).properties(height=900)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/bar_chart_with_mean_line.ipynb b/doc/jupyterlite/files/bar_chart_with_mean_line.ipynb new file mode 100644 index 000000000..de5661294 --- /dev/null +++ b/doc/jupyterlite/files/bar_chart_with_mean_line.ipynb @@ -0,0 +1,60 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "ee3141f3", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dec8d1e1", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Bar Chart with Line at Mean\n", + "---------------------------\n", + "This example shows the mean value overlayed on a bar chart.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.wheat()\n", + "\n", + "bar = alt.Chart(source).mark_bar().encode(\n", + " x='year:O',\n", + " y='wheat:Q'\n", + ")\n", + "\n", + "rule = alt.Chart(source).mark_rule(color='red').encode(\n", + " y='mean(wheat):Q'\n", + ")\n", + "\n", + "(bar + rule).properties(width=600)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/bar_chart_with_negatives.ipynb b/doc/jupyterlite/files/bar_chart_with_negatives.ipynb new file mode 100644 index 000000000..45fe5666d --- /dev/null +++ b/doc/jupyterlite/files/bar_chart_with_negatives.ipynb @@ -0,0 +1,59 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "12f357e6", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "da9b466b", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Bar Chart with Negative Values\n", + "==============================\n", + "This example shows a bar chart with both positive and negative values.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.us_employment()\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x=\"month:T\",\n", + " y=\"nonfarm_change:Q\",\n", + " color=alt.condition(\n", + " alt.datum.nonfarm_change > 0,\n", + " alt.value(\"steelblue\"), # The positive color\n", + " alt.value(\"orange\") # The negative color\n", + " )\n", + ").properties(width=600)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/bar_rounded.ipynb b/doc/jupyterlite/files/bar_rounded.ipynb new file mode 100644 index 000000000..f0a7ff89b --- /dev/null +++ b/doc/jupyterlite/files/bar_rounded.ipynb @@ -0,0 +1,58 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "3a713f24", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8b6c2c53", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Bar Chart with rounded edges\n", + "----------------------------\n", + "This example shows how to create a bar chart with rounded edges.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.seattle_weather()\n", + "\n", + "alt.Chart(source).mark_bar(\n", + " cornerRadiusTopLeft=3,\n", + " cornerRadiusTopRight=3\n", + ").encode(\n", + " x='month(date):O',\n", + " y='count():Q',\n", + " color='weather:N'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/bar_with_rolling_mean.ipynb b/doc/jupyterlite/files/bar_with_rolling_mean.ipynb new file mode 100644 index 000000000..84f2e9363 --- /dev/null +++ b/doc/jupyterlite/files/bar_with_rolling_mean.ipynb @@ -0,0 +1,66 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "6d8408fb", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fad993e3", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Bar Chart with Rolling Mean\n", + "---------------------------\n", + "A bar chart overlayed with a rolling mean. In this example the average of values over the previous decade is displayed as a line.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.wheat()\n", + "\n", + "bar = alt.Chart(source).mark_bar().encode(\n", + " x='year:O',\n", + " y='wheat:Q'\n", + ")\n", + "\n", + "line = alt.Chart(source).mark_line(color='red').transform_window(\n", + " # The field to average\n", + " rolling_mean='mean(wheat)',\n", + " # The number of values before and after the current value to include.\n", + " frame=[-9, 0]\n", + ").encode(\n", + " x='year:O',\n", + " y='rolling_mean:Q'\n", + ")\n", + "\n", + "(bar + line).properties(width=600)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/beckers_barley_trellis_plot.ipynb b/doc/jupyterlite/files/beckers_barley_trellis_plot.ipynb new file mode 100644 index 000000000..933790c58 --- /dev/null +++ b/doc/jupyterlite/files/beckers_barley_trellis_plot.ipynb @@ -0,0 +1,72 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "01223d36", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f9e4ddd8", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Becker's Barley Trellis Plot\n", + "----------------------------\n", + "The example demonstrates the trellis charts created by Richard Becker, William Cleveland and others in the 1990s. Using the visualization technique below they identified an anomoly in a widely used agriculatural dataset, which they termed `\"The Morris Mistake.\" `_. It became their favored way of showcasing the power of this pioneering plot.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "alt.Chart(source, title=\"The Morris Mistake\").mark_point().encode(\n", + " alt.X(\n", + " 'yield:Q',\n", + " title=\"Barley Yield (bushels/acre)\",\n", + " scale=alt.Scale(zero=False),\n", + " axis=alt.Axis(grid=False)\n", + " ),\n", + " alt.Y(\n", + " 'variety:N',\n", + " title=\"\",\n", + " sort='-x',\n", + " axis=alt.Axis(grid=True)\n", + " ),\n", + " color=alt.Color('year:N', legend=alt.Legend(title=\"Year\")),\n", + " row=alt.Row(\n", + " 'site:N',\n", + " title=\"\",\n", + " sort=alt.EncodingSortField(field='yield', op='sum', order='descending'),\n", + " )\n", + ").properties(\n", + " height=alt.Step(20)\n", + ").configure_view(stroke=\"transparent\")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/beckers_barley_wrapped_facet.ipynb b/doc/jupyterlite/files/beckers_barley_wrapped_facet.ipynb new file mode 100644 index 000000000..557e9ea6c --- /dev/null +++ b/doc/jupyterlite/files/beckers_barley_wrapped_facet.ipynb @@ -0,0 +1,61 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "f2b419c6", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1d330389", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Becker's Barley Trellis Plot (wrapped facet)\n", + "--------------------------------------------\n", + "The example demonstrates the trellis charts created by Richard Becker, William Cleveland and others in the 1990s. \n", + "This is the Altair replicate of `the VegaLite version `_ \n", + "demonstrating the usage of `columns` argument to create wrapped facet.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley.url\n", + "\n", + "alt.Chart(source).mark_point().encode(\n", + " alt.X('median(yield):Q', scale=alt.Scale(zero=False)),\n", + " y='variety:O',\n", + " color='year:N',\n", + " facet=alt.Facet('site:O', columns=2),\n", + ").properties(\n", + " width=200,\n", + " height=100,\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/binned_heatmap.ipynb b/doc/jupyterlite/files/binned_heatmap.ipynb new file mode 100644 index 000000000..fe5b894de --- /dev/null +++ b/doc/jupyterlite/files/binned_heatmap.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "b7278f06", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "960c260e", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Binned Heatmap\n", + "--------------\n", + "This example shows how to make a heatmap from binned quantitative data.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.movies.url\n", + "\n", + "alt.Chart(source).mark_rect().encode(\n", + " alt.X('IMDB_Rating:Q', bin=alt.Bin(maxbins=60)),\n", + " alt.Y('Rotten_Tomatoes_Rating:Q', bin=alt.Bin(maxbins=40)),\n", + " alt.Color('count():Q', scale=alt.Scale(scheme='greenblue'))\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/binned_scatterplot.ipynb b/doc/jupyterlite/files/binned_scatterplot.ipynb new file mode 100644 index 000000000..692012bac --- /dev/null +++ b/doc/jupyterlite/files/binned_scatterplot.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c134a34a", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6594b656", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Binned Scatterplot\n", + "------------------\n", + "This example shows how to make a binned scatterplot.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.movies.url\n", + "\n", + "alt.Chart(source).mark_circle().encode(\n", + " alt.X('IMDB_Rating:Q', bin=True),\n", + " alt.Y('Rotten_Tomatoes_Rating:Q', bin=True),\n", + " size='count()'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/boxplot.ipynb b/doc/jupyterlite/files/boxplot.ipynb new file mode 100644 index 000000000..cad0e8119 --- /dev/null +++ b/doc/jupyterlite/files/boxplot.ipynb @@ -0,0 +1,57 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "4dc78a07", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "00f35613", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Boxplot with Min/Max Whiskers\n", + "------------------------------\n", + "This example shows how to make a boxplot using US Population data from 2000. \n", + "Note that the default value of the `extent` property is 1.5,\n", + "which represents the convention of extending the whiskers\n", + "to the furthest points within 1.5 * IQR from the first and third quartile.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.population.url\n", + "\n", + "alt.Chart(source).mark_boxplot(extent='min-max').encode(\n", + " x='age:O',\n", + " y='people:Q'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/bubble_plot.ipynb b/doc/jupyterlite/files/bubble_plot.ipynb new file mode 100644 index 000000000..b4b920d0e --- /dev/null +++ b/doc/jupyterlite/files/bubble_plot.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "28a86524", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "775a6c92", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Bubble Plot\n", + "-----------------\n", + "This example shows how to make a bubble plot.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "alt.Chart(source).mark_point().encode(\n", + " x='Horsepower',\n", + " y='Miles_per_Gallon',\n", + " size='Acceleration'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/bump_chart.ipynb b/doc/jupyterlite/files/bump_chart.ipynb new file mode 100644 index 000000000..aa2a4875d --- /dev/null +++ b/doc/jupyterlite/files/bump_chart.ipynb @@ -0,0 +1,68 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "4f42ed2b", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f41838df", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Bump Chart\n", + "----------\n", + "This example shows a bump chart. The data is first grouped into six-month\n", + "intervals using pandas. The ranks are computed by Altair using a \n", + "window transform.\n", + "\"\"\"\n", + "# category: line charts\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "import pandas as pd\n", + "\n", + "stocks = data.stocks()\n", + "source = stocks.groupby([pd.Grouper(key=\"date\", freq=\"6M\"),\"symbol\"]).mean().reset_index()\n", + "\n", + "alt.Chart(source).mark_line(point = True).encode(\n", + " x = alt.X(\"date:O\", timeUnit=\"yearmonth\", title=\"date\"),\n", + " y=\"rank:O\",\n", + " color=alt.Color(\"symbol:N\")\n", + ").transform_window(\n", + " rank=\"rank()\",\n", + " sort=[alt.SortField(\"price\", order=\"descending\")],\n", + " groupby=[\"date\"]\n", + ").properties(\n", + " title=\"Bump Chart for Stock Prices\",\n", + " width=600,\n", + " height=150,\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/candlestick_chart.ipynb b/doc/jupyterlite/files/candlestick_chart.ipynb new file mode 100644 index 000000000..a18109ab5 --- /dev/null +++ b/doc/jupyterlite/files/candlestick_chart.ipynb @@ -0,0 +1,83 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "2c010a35", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "170576db", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Candlestick Chart\n", + "=================\n", + "A candlestick chart inspired from `Protovis `_. \n", + "This example shows the performance of the Chicago Board Options Exchange `Volatility Index `_ (VIX) \n", + "in the summer of 2009. The thick bar represents the opening and closing prices, \n", + "while the thin bar shows intraday high and low prices; if the index closed higher on a given day, the bars are colored green rather than red.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.ohlc()\n", + "\n", + "open_close_color = alt.condition(\"datum.open <= datum.close\",\n", + " alt.value(\"#06982d\"),\n", + " alt.value(\"#ae1325\"))\n", + "\n", + "base = alt.Chart(source).encode(\n", + " alt.X('date:T',\n", + " axis=alt.Axis(\n", + " format='%m/%d', \n", + " labelAngle=-45, \n", + " title='Date in 2009'\n", + " )\n", + " ),\n", + " color=open_close_color\n", + ")\n", + "\n", + "rule = base.mark_rule().encode(\n", + " alt.Y(\n", + " 'low:Q',\n", + " title='Price',\n", + " scale=alt.Scale(zero=False),\n", + " ),\n", + " alt.Y2('high:Q')\n", + ")\n", + "\n", + "bar = base.mark_bar().encode(\n", + " alt.Y('open:Q'),\n", + " alt.Y2('close:Q')\n", + ")\n", + "\n", + "rule + bar" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/choropleth.ipynb b/doc/jupyterlite/files/choropleth.ipynb new file mode 100644 index 000000000..faddf22dc --- /dev/null +++ b/doc/jupyterlite/files/choropleth.ipynb @@ -0,0 +1,62 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "67797b9e", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "22e38ad5", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Choropleth Map\n", + "==============\n", + "A choropleth map of unemployment rate per county in the US\n", + "\"\"\"\n", + "# category: maps\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "counties = alt.topo_feature(data.us_10m.url, 'counties')\n", + "source = data.unemployment.url\n", + "\n", + "alt.Chart(counties).mark_geoshape().encode(\n", + " color='rate:Q'\n", + ").transform_lookup(\n", + " lookup='id',\n", + " from_=alt.LookupData(source, 'id', ['rate'])\n", + ").project(\n", + " type='albersUsa'\n", + ").properties(\n", + " width=500,\n", + " height=300\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/choropleth_repeat.ipynb b/doc/jupyterlite/files/choropleth_repeat.ipynb new file mode 100644 index 000000000..5a7227f58 --- /dev/null +++ b/doc/jupyterlite/files/choropleth_repeat.ipynb @@ -0,0 +1,67 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "5c716d06", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "37ed8bb4", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Repeated Choropleth Map\n", + "=======================\n", + "Three choropleths representing disjoint data from the same table.\n", + "\"\"\"\n", + "# category: maps\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "states = alt.topo_feature(data.us_10m.url, 'states')\n", + "source = data.population_engineers_hurricanes.url\n", + "variable_list = ['population', 'engineers', 'hurricanes']\n", + "\n", + "alt.Chart(states).mark_geoshape().encode(\n", + " alt.Color(alt.repeat('row'), type='quantitative')\n", + ").transform_lookup(\n", + " lookup='id',\n", + " from_=alt.LookupData(source, 'id', variable_list)\n", + ").properties(\n", + " width=500,\n", + " height=300\n", + ").project(\n", + " type='albersUsa'\n", + ").repeat(\n", + " row=variable_list\n", + ").resolve_scale(\n", + " color='independent'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/co2_concentration.ipynb b/doc/jupyterlite/files/co2_concentration.ipynb new file mode 100644 index 000000000..f151c10c9 --- /dev/null +++ b/doc/jupyterlite/files/co2_concentration.ipynb @@ -0,0 +1,104 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "a88b6aca", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "de6e77c8", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Atmospheric CO2 Concentration\n", + "-----------------------------\n", + "This example is a fully developed line chart that uses a window transformation.\n", + "It was inspired by `Gregor Aisch's work at datawrapper\n", + "`_.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.co2_concentration.url\n", + "\n", + "base = alt.Chart(\n", + " source,\n", + " title=\"Carbon Dioxide in the Atmosphere\"\n", + ").transform_calculate(\n", + " year=\"year(datum.Date)\"\n", + ").transform_calculate(\n", + " decade=\"floor(datum.year / 10)\"\n", + ").transform_calculate(\n", + " scaled_date=\"(datum.year % 10) + (month(datum.Date)/12)\"\n", + ").transform_window(\n", + " first_date='first_value(scaled_date)',\n", + " last_date='last_value(scaled_date)',\n", + " sort=[{\"field\": \"scaled_date\", \"order\": \"ascending\"}],\n", + " groupby=['decade'],\n", + " frame=[None, None]\n", + ").transform_calculate(\n", + " end=\"datum.first_date === datum.scaled_date ? 'first' : datum.last_date === datum.scaled_date ? 'last' : null\"\n", + ").encode(\n", + " x=alt.X(\n", + " \"scaled_date:Q\",\n", + " axis=alt.Axis(title=\"Year into Decade\", tickCount=11)\n", + " ),\n", + " y=alt.Y(\n", + " \"CO2:Q\",\n", + " title=\"CO2 concentration in ppm\",\n", + " scale=alt.Scale(zero=False)\n", + " )\n", + ")\n", + "\n", + "line = base.mark_line().encode(\n", + " color=alt.Color(\n", + " \"decade:O\",\n", + " scale=alt.Scale(scheme=\"magma\"),\n", + " legend=None\n", + " )\n", + ")\n", + "\n", + "text = base.encode(text=\"year:N\")\n", + "\n", + "start_year = text.transform_filter(\n", + " alt.datum.end == 'first'\n", + ").mark_text(baseline=\"top\")\n", + "\n", + "end_year = text.transform_filter(\n", + " alt.datum.end == 'last'\n", + ").mark_text(baseline=\"bottom\")\n", + "\n", + "(line + start_year + end_year).configure_text(\n", + " align=\"left\",\n", + " dx=1,\n", + " dy=3\n", + ").properties(width=600, height=375)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/comet_chart.ipynb b/doc/jupyterlite/files/comet_chart.ipynb new file mode 100644 index 000000000..287283f41 --- /dev/null +++ b/doc/jupyterlite/files/comet_chart.ipynb @@ -0,0 +1,71 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "dd7ab6bf", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6482b131", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Comet Chart Example\n", + "----------------------------\n", + "Inspired by `Zan Armstrong's comet chart `_\n", + "this plot uses ``mark_trail`` to visualize change of grouped data over time.\n", + "A more elaborate example and explanation of creating comet charts in Altair\n", + "is shown in `this blogpost `_.\n", + "\"\"\"\n", + "# category: other charts\n", + "\n", + "import altair as alt\n", + "import vega_datasets\n", + "\n", + "(\n", + " alt.Chart(vega_datasets.data.barley.url)\n", + " .transform_pivot(\"year\", value=\"yield\", groupby=[\"variety\", \"site\"])\n", + " .transform_fold([\"1931\", \"1932\"], as_=[\"year\", \"yield\"])\n", + " .transform_calculate(calculate=\"datum['1932'] - datum['1931']\", as_=\"delta\")\n", + " .mark_trail()\n", + " .encode(\n", + " x=alt.X('year:O', title=None), \n", + " y=alt.Y('variety:N', title='Variety'),\n", + " size=alt.Size('yield:Q', scale=alt.Scale(range=[0, 12]), legend=alt.Legend(values=[20, 60], title='Barley Yield (bushels/acre)')),\n", + " color=alt.Color('delta:Q', scale=alt.Scale(domainMid=0), legend=alt.Legend(title='Yield Delta (%)')),\n", + " tooltip=alt.Tooltip(['year:O', 'yield:Q']),\n", + " column=alt.Column('site:N', title='Site')\n", + "\n", + " )\n", + " .configure_view(stroke=None)\n", + " .configure_legend(orient='bottom', direction='horizontal')\n", + " .properties(title='Barley Yield comparison between 1932 and 1931')\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/connected_scatterplot.ipynb b/doc/jupyterlite/files/connected_scatterplot.ipynb new file mode 100644 index 000000000..3e3eb86b6 --- /dev/null +++ b/doc/jupyterlite/files/connected_scatterplot.ipynb @@ -0,0 +1,57 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "a0e7b96d", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5bea8669", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Connected Scatterplot (Lines with Custom Paths)\n", + "-----------------------------------------------\n", + "\n", + "This example show how the order encoding can be used to draw a custom path. The dataset tracks miles driven per capita along with gas prices annually from 1956 to 2010.\n", + "It is based on Hannah Fairfield's article 'Driving Shifts Into Reverse'. See https://archive.nytimes.com/www.nytimes.com/imagepages/2010/05/02/business/02metrics.html for the original.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.driving()\n", + "\n", + "alt.Chart(source).mark_line(point=True).encode(\n", + " alt.X('miles', scale=alt.Scale(zero=False)),\n", + " alt.Y('gas', scale=alt.Scale(zero=False)),\n", + " order='year'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/cumulative_count_chart.ipynb b/doc/jupyterlite/files/cumulative_count_chart.ipynb new file mode 100644 index 000000000..48cc48034 --- /dev/null +++ b/doc/jupyterlite/files/cumulative_count_chart.ipynb @@ -0,0 +1,60 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "d1c36785", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "09549d1e", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Cumulative Count Chart\n", + "----------------------\n", + "This example shows an area chart with cumulative count.\n", + "Adapted from https://vega.github.io/vega-lite/examples/area_cumulative_freq.html\n", + "\n", + "\"\"\"\n", + "# category: area charts\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.movies.url\n", + "\n", + "alt.Chart(source).transform_window(\n", + " cumulative_count=\"count()\",\n", + " sort=[{\"field\": \"IMDB_Rating\"}],\n", + ").mark_area().encode(\n", + " x=\"IMDB_Rating:Q\",\n", + " y=\"cumulative_count:Q\"\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/cumulative_wiki_donations.ipynb b/doc/jupyterlite/files/cumulative_wiki_donations.ipynb new file mode 100644 index 000000000..d43c2f881 --- /dev/null +++ b/doc/jupyterlite/files/cumulative_wiki_donations.ipynb @@ -0,0 +1,56 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "572c5044", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "903299f8", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Cumulative Wikipedia Donations\n", + "==============================\n", + "\n", + "This chart shows cumulative donations to Wikipedia over the past 10 years. Inspired by this `Reddit post `_ but using lines instead of areas.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "\n", + "source = \"https://frdata.wikimedia.org/donationdata-vs-day.csv\"\n", + "\n", + "alt.Chart(source).mark_line().encode(\n", + " alt.X('monthdate(date):T', title='Month', axis=alt.Axis(format='%B')),\n", + " alt.Y('max(ytdsum):Q', title='Cumulative Donations', stack=None),\n", + " alt.Color('year(date):O', legend=alt.Legend(title='Year')),\n", + " alt.Order('year(data):O')\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/density_facet.ipynb b/doc/jupyterlite/files/density_facet.ipynb new file mode 100644 index 000000000..ae23660b3 --- /dev/null +++ b/doc/jupyterlite/files/density_facet.ipynb @@ -0,0 +1,67 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "042d638d", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6f3a51b5", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Faceted Density Estimates\n", + "-------------------------\n", + "Density estimates of measurements for each iris flower feature\n", + "\"\"\"\n", + "# category: area charts\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.iris()\n", + "\n", + "alt.Chart(source).transform_fold(\n", + " ['petalWidth', \n", + " 'petalLength', \n", + " 'sepalWidth', \n", + " 'sepalLength'], \n", + " as_ = ['Measurement_type', 'value']\n", + ").transform_density(\n", + " density='value', \n", + " bandwidth=0.3, \n", + " groupby=['Measurement_type'], \n", + " extent= [0, 8]\n", + ").mark_area().encode(\n", + " alt.X('value:Q'), \n", + " alt.Y('density:Q'),\n", + " alt.Row('Measurement_type:N')\n", + ").properties(width=300, height=50)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/density_stack.ipynb b/doc/jupyterlite/files/density_stack.ipynb new file mode 100644 index 000000000..8394ace00 --- /dev/null +++ b/doc/jupyterlite/files/density_stack.ipynb @@ -0,0 +1,74 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "06243191", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ea86ce74", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Stacked Density Estimates\n", + "-------------------------\n", + "To plot a stacked graph of estimates, use a shared ``extent`` and a fixed\n", + "number of subdivision ``steps`` to ensure that the points for each area align\n", + "well. Density estimates of measurements for each iris flower feature are plot\n", + "in a stacked method. In addition, setting ``counts`` to true multiplies the\n", + "densities by the number of data points in each group, preserving proportional\n", + "differences.\n", + "\"\"\"\n", + "# category: area charts\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.iris()\n", + "\n", + "alt.Chart(source).transform_fold(\n", + " ['petalWidth', \n", + " 'petalLength', \n", + " 'sepalWidth', \n", + " 'sepalLength'], \n", + " as_ = ['Measurement_type', 'value']\n", + ").transform_density(\n", + " density='value', \n", + " bandwidth=0.3, \n", + " groupby=['Measurement_type'], \n", + " extent= [0, 8], \n", + " counts = True, \n", + " steps=200\n", + ").mark_area().encode(\n", + " alt.X('value:Q'), \n", + " alt.Y('density:Q', stack='zero'),\n", + " alt.Color('Measurement_type:N')\n", + ").properties(width=400, height=100)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/diverging_stacked_bar_chart.ipynb b/doc/jupyterlite/files/diverging_stacked_bar_chart.ipynb new file mode 100644 index 000000000..0fb913379 --- /dev/null +++ b/doc/jupyterlite/files/diverging_stacked_bar_chart.ipynb @@ -0,0 +1,406 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "9c6def90", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "feea5185", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Diverging Stacked Bar Chart\n", + "---------------------------\n", + "This example shows a diverging stacked bar chart for sentiments towards a set of eight questions, displayed as percentages with neutral responses straddling the 0% mark.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "\n", + "source = alt.pd.DataFrame([\n", + " {\n", + " \"question\": \"Question 1\",\n", + " \"type\": \"Strongly disagree\",\n", + " \"value\": 24,\n", + " \"percentage\": 0.7,\n", + " \"percentage_start\": -19.1,\n", + " \"percentage_end\": -18.4\n", + " },\n", + " {\n", + " \"question\": \"Question 1\",\n", + " \"type\": \"Disagree\",\n", + " \"value\": 294,\n", + " \"percentage\": 9.1,\n", + " \"percentage_start\": -18.4,\n", + " \"percentage_end\": -9.2\n", + " },\n", + " {\n", + " \"question\": \"Question 1\",\n", + " \"type\": \"Neither agree nor disagree\",\n", + " \"value\": 594,\n", + " \"percentage\": 18.5,\n", + " \"percentage_start\": -9.2,\n", + " \"percentage_end\": 9.2\n", + " },\n", + " {\n", + " \"question\": \"Question 1\",\n", + " \"type\": \"Agree\",\n", + " \"value\": 1927,\n", + " \"percentage\": 59.9,\n", + " \"percentage_start\": 9.2,\n", + " \"percentage_end\": 69.2\n", + " },\n", + " {\n", + " \"question\": \"Question 1\",\n", + " \"type\": \"Strongly agree\",\n", + " \"value\": 376,\n", + " \"percentage\": 11.7,\n", + " \"percentage_start\": 69.2,\n", + " \"percentage_end\": 80.9\n", + " },\n", + "\n", + " {\n", + " \"question\": \"Question 2\",\n", + " \"type\": \"Strongly disagree\",\n", + " \"value\": 2,\n", + " \"percentage\": 18.2,\n", + " \"percentage_start\": -36.4,\n", + " \"percentage_end\": -18.2\n", + " },\n", + " {\n", + " \"question\": \"Question 2\",\n", + " \"type\": \"Disagree\",\n", + " \"value\": 2,\n", + " \"percentage\": 18.2,\n", + " \"percentage_start\": -18.2,\n", + " \"percentage_end\": 0\n", + " },\n", + " {\n", + " \"question\": \"Question 2\",\n", + " \"type\": \"Neither agree nor disagree\",\n", + " \"value\": 0,\n", + " \"percentage\": 0,\n", + " \"percentage_start\": 0,\n", + " \"percentage_end\": 0\n", + " },\n", + " {\n", + " \"question\": \"Question 2\",\n", + " \"type\": \"Agree\",\n", + " \"value\": 7,\n", + " \"percentage\": 63.6,\n", + " \"percentage_start\": 0,\n", + " \"percentage_end\": 63.6\n", + " },\n", + " {\n", + " \"question\": \"Question 2\",\n", + " \"type\": \"Strongly agree\",\n", + " \"value\": 11,\n", + " \"percentage\": 0,\n", + " \"percentage_start\": 63.6,\n", + " \"percentage_end\": 63.6\n", + " },\n", + "\n", + " {\n", + " \"question\": \"Question 3\",\n", + " \"type\": \"Strongly disagree\",\n", + " \"value\": 2,\n", + " \"percentage\": 20,\n", + " \"percentage_start\": -30,\n", + " \"percentage_end\": -10\n", + " },\n", + " {\n", + " \"question\": \"Question 3\",\n", + " \"type\": \"Disagree\",\n", + " \"value\": 0,\n", + " \"percentage\": 0,\n", + " \"percentage_start\": -10,\n", + " \"percentage_end\": -10\n", + " },\n", + " {\n", + " \"question\": \"Question 3\",\n", + " \"type\": \"Neither agree nor disagree\",\n", + " \"value\": 2,\n", + " \"percentage\": 20,\n", + " \"percentage_start\": -10,\n", + " \"percentage_end\": 10\n", + " },\n", + " {\n", + " \"question\": \"Question 3\",\n", + " \"type\": \"Agree\",\n", + " \"value\": 4,\n", + " \"percentage\": 40,\n", + " \"percentage_start\": 10,\n", + " \"percentage_end\": 50\n", + " },\n", + " {\n", + " \"question\": \"Question 3\",\n", + " \"type\": \"Strongly agree\",\n", + " \"value\": 2,\n", + " \"percentage\": 20,\n", + " \"percentage_start\": 50,\n", + " \"percentage_end\": 70\n", + " },\n", + "\n", + " {\n", + " \"question\": \"Question 4\",\n", + " \"type\": \"Strongly disagree\",\n", + " \"value\": 0,\n", + " \"percentage\": 0,\n", + " \"percentage_start\": -15.6,\n", + " \"percentage_end\": -15.6\n", + " },\n", + " {\n", + " \"question\": \"Question 4\",\n", + " \"type\": \"Disagree\",\n", + " \"value\": 2,\n", + " \"percentage\": 12.5,\n", + " \"percentage_start\": -15.6,\n", + " \"percentage_end\": -3.1\n", + " },\n", + " {\n", + " \"question\": \"Question 4\",\n", + " \"type\": \"Neither agree nor disagree\",\n", + " \"value\": 1,\n", + " \"percentage\": 6.3,\n", + " \"percentage_start\": -3.1,\n", + " \"percentage_end\": 3.1\n", + " },\n", + " {\n", + " \"question\": \"Question 4\",\n", + " \"type\": \"Agree\",\n", + " \"value\": 7,\n", + " \"percentage\": 43.8,\n", + " \"percentage_start\": 3.1,\n", + " \"percentage_end\": 46.9\n", + " },\n", + " {\n", + " \"question\": \"Question 4\",\n", + " \"type\": \"Strongly agree\",\n", + " \"value\": 6,\n", + " \"percentage\": 37.5,\n", + " \"percentage_start\": 46.9,\n", + " \"percentage_end\": 84.4\n", + " },\n", + "\n", + " {\n", + " \"question\": \"Question 5\",\n", + " \"type\": \"Strongly disagree\",\n", + " \"value\": 0,\n", + " \"percentage\": 0,\n", + " \"percentage_start\": -10.4,\n", + " \"percentage_end\": -10.4\n", + " },\n", + " {\n", + " \"question\": \"Question 5\",\n", + " \"type\": \"Disagree\",\n", + " \"value\": 1,\n", + " \"percentage\": 4.2,\n", + " \"percentage_start\": -10.4,\n", + " \"percentage_end\": -6.3\n", + " },\n", + " {\n", + " \"question\": \"Question 5\",\n", + " \"type\": \"Neither agree nor disagree\",\n", + " \"value\": 3,\n", + " \"percentage\": 12.5,\n", + " \"percentage_start\": -6.3,\n", + " \"percentage_end\": 6.3\n", + " },\n", + " {\n", + " \"question\": \"Question 5\",\n", + " \"type\": \"Agree\",\n", + " \"value\": 16,\n", + " \"percentage\": 66.7,\n", + " \"percentage_start\": 6.3,\n", + " \"percentage_end\": 72.9\n", + " },\n", + " {\n", + " \"question\": \"Question 5\",\n", + " \"type\": \"Strongly agree\",\n", + " \"value\": 4,\n", + " \"percentage\": 16.7,\n", + " \"percentage_start\": 72.9,\n", + " \"percentage_end\": 89.6\n", + " },\n", + "\n", + " {\n", + " \"question\": \"Question 6\",\n", + " \"type\": \"Strongly disagree\",\n", + " \"value\": 1,\n", + " \"percentage\": 6.3,\n", + " \"percentage_start\": -18.8,\n", + " \"percentage_end\": -12.5\n", + " },\n", + " {\n", + " \"question\": \"Question 6\",\n", + " \"type\": \"Disagree\",\n", + " \"value\": 1,\n", + " \"percentage\": 6.3,\n", + " \"percentage_start\": -12.5,\n", + " \"percentage_end\": -6.3\n", + " },\n", + " {\n", + " \"question\": \"Question 6\",\n", + " \"type\": \"Neither agree nor disagree\",\n", + " \"value\": 2,\n", + " \"percentage\": 12.5,\n", + " \"percentage_start\": -6.3,\n", + " \"percentage_end\": 6.3\n", + " },\n", + " {\n", + " \"question\": \"Question 6\",\n", + " \"type\": \"Agree\",\n", + " \"value\": 9,\n", + " \"percentage\": 56.3,\n", + " \"percentage_start\": 6.3,\n", + " \"percentage_end\": 62.5\n", + " },\n", + " {\n", + " \"question\": \"Question 6\",\n", + " \"type\": \"Strongly agree\",\n", + " \"value\": 3,\n", + " \"percentage\": 18.8,\n", + " \"percentage_start\": 62.5,\n", + " \"percentage_end\": 81.3\n", + " },\n", + "\n", + " {\n", + " \"question\": \"Question 7\",\n", + " \"type\": \"Strongly disagree\",\n", + " \"value\": 0,\n", + " \"percentage\": 0,\n", + " \"percentage_start\": -10,\n", + " \"percentage_end\": -10\n", + " },\n", + " {\n", + " \"question\": \"Question 7\",\n", + " \"type\": \"Disagree\",\n", + " \"value\": 0,\n", + " \"percentage\": 0,\n", + " \"percentage_start\": -10,\n", + " \"percentage_end\": -10\n", + " },\n", + " {\n", + " \"question\": \"Question 7\",\n", + " \"type\": \"Neither agree nor disagree\",\n", + " \"value\": 1,\n", + " \"percentage\": 20,\n", + " \"percentage_start\": -10,\n", + " \"percentage_end\": 10\n", + " },\n", + " {\n", + " \"question\": \"Question 7\",\n", + " \"type\": \"Agree\",\n", + " \"value\": 4,\n", + " \"percentage\": 80,\n", + " \"percentage_start\": 10,\n", + " \"percentage_end\": 90\n", + " },\n", + " {\n", + " \"question\": \"Question 7\",\n", + " \"type\": \"Strongly agree\",\n", + " \"value\": 0,\n", + " \"percentage\": 0,\n", + " \"percentage_start\": 90,\n", + " \"percentage_end\": 90\n", + " },\n", + "\n", + " {\n", + " \"question\": \"Question 8\",\n", + " \"type\": \"Strongly disagree\",\n", + " \"value\": 0,\n", + " \"percentage\": 0,\n", + " \"percentage_start\": 0,\n", + " \"percentage_end\": 0\n", + " },\n", + " {\n", + " \"question\": \"Question 8\",\n", + " \"type\": \"Disagree\",\n", + " \"value\": 0,\n", + " \"percentage\": 0,\n", + " \"percentage_start\": 0,\n", + " \"percentage_end\": 0\n", + " },\n", + " {\n", + " \"question\": \"Question 8\",\n", + " \"type\": \"Neither agree nor disagree\",\n", + " \"value\": 0,\n", + " \"percentage\": 0,\n", + " \"percentage_start\": 0,\n", + " \"percentage_end\": 0\n", + " },\n", + " {\n", + " \"question\": \"Question 8\",\n", + " \"type\": \"Agree\",\n", + " \"value\": 0,\n", + " \"percentage\": 0,\n", + " \"percentage_start\": 0,\n", + " \"percentage_end\": 0\n", + " },\n", + " {\n", + " \"question\": \"Question 8\",\n", + " \"type\": \"Strongly agree\",\n", + " \"value\": 2,\n", + " \"percentage\": 100,\n", + " \"percentage_start\": 0,\n", + " \"percentage_end\": 100\n", + " }\n", + "])\n", + "\n", + "color_scale = alt.Scale(\n", + " domain=[\n", + " \"Strongly disagree\",\n", + " \"Disagree\",\n", + " \"Neither agree nor disagree\",\n", + " \"Agree\",\n", + " \"Strongly agree\"\n", + " ],\n", + " range=[\"#c30d24\", \"#f3a583\", \"#cccccc\", \"#94c6da\", \"#1770ab\"]\n", + ")\n", + "\n", + "y_axis = alt.Axis(\n", + " title='Question',\n", + " offset=5,\n", + " ticks=False,\n", + " minExtent=60,\n", + " domain=False\n", + ")\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x='percentage_start:Q',\n", + " x2='percentage_end:Q',\n", + " y=alt.Y('question:N', axis=y_axis),\n", + " color=alt.Color(\n", + " 'type:N',\n", + " legend=alt.Legend( title='Response'),\n", + " scale=color_scale,\n", + " )\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/donut_chart.ipynb b/doc/jupyterlite/files/donut_chart.ipynb new file mode 100644 index 000000000..3eaef5b10 --- /dev/null +++ b/doc/jupyterlite/files/donut_chart.ipynb @@ -0,0 +1,57 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "6578c679", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "78299cb7", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Donut Chart\n", + "-----------\n", + "This example shows how to make a Donut Chart using ``mark_arc``.\n", + "This is adapted from a corresponding Vega-Lite Example:\n", + "`Donut Chart `_.\n", + "\"\"\"\n", + "# category: circular plots\n", + "\n", + "import pandas as pd\n", + "import altair as alt\n", + "\n", + "source = pd.DataFrame({\"category\": [1, 2, 3, 4, 5, 6], \"value\": [4, 6, 10, 3, 7, 8]})\n", + "\n", + "alt.Chart(source).mark_arc(innerRadius=50).encode(\n", + " theta=alt.Theta(field=\"value\", type=\"quantitative\"),\n", + " color=alt.Color(field=\"category\", type=\"nominal\"),\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/dot_dash_plot.ipynb b/doc/jupyterlite/files/dot_dash_plot.ipynb new file mode 100644 index 000000000..0eaa090f9 --- /dev/null +++ b/doc/jupyterlite/files/dot_dash_plot.ipynb @@ -0,0 +1,79 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "45f09aa7", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3ae9d32d", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Dot Dash Plot\n", + "=============\n", + "How to make the dot-dash plot presented in Edward Tufte's `Visual Display of Quantitative Information `_. Based\n", + "on a JavaScript implementation by `g3o2 `_.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "# Configure the options common to all layers\n", + "brush = alt.selection(type='interval')\n", + "base = alt.Chart(source).add_selection(brush)\n", + "\n", + "# Configure the points\n", + "points = base.mark_point().encode(\n", + " x=alt.X('Miles_per_Gallon', title=''),\n", + " y=alt.Y('Horsepower', title=''),\n", + " color=alt.condition(brush, 'Origin', alt.value('grey'))\n", + ")\n", + "\n", + "# Configure the ticks\n", + "tick_axis = alt.Axis(labels=False, domain=False, ticks=False)\n", + "\n", + "x_ticks = base.mark_tick().encode(\n", + " alt.X('Miles_per_Gallon', axis=tick_axis),\n", + " alt.Y('Origin', title='', axis=tick_axis),\n", + " color=alt.condition(brush, 'Origin', alt.value('lightgrey'))\n", + ")\n", + "\n", + "y_ticks = base.mark_tick().encode(\n", + " alt.X('Origin', title='', axis=tick_axis),\n", + " alt.Y('Horsepower', axis=tick_axis),\n", + " color=alt.condition(brush, 'Origin', alt.value('lightgrey'))\n", + ")\n", + "\n", + "# Build the chart\n", + "y_ticks | (points & x_ticks)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/errorbars_with_ci.ipynb b/doc/jupyterlite/files/errorbars_with_ci.ipynb new file mode 100644 index 000000000..461f621fb --- /dev/null +++ b/doc/jupyterlite/files/errorbars_with_ci.ipynb @@ -0,0 +1,63 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "9232e83b", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d1b3aac2", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Error Bars showing Confidence Interval\n", + "======================================\n", + "This example shows how to show error bars using confidence intervals.\n", + "The confidence intervals are computed internally in vega by a non-parametric\n", + "`bootstrap of the mean `_.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "error_bars = alt.Chart(source).mark_errorbar(extent='ci').encode(\n", + " x=alt.X('yield:Q', scale=alt.Scale(zero=False)),\n", + " y=alt.Y('variety:N')\n", + ")\n", + "\n", + "points = alt.Chart(source).mark_point(filled=True, color='black').encode(\n", + " x=alt.X('yield:Q', aggregate='mean'),\n", + " y=alt.Y('variety:N'),\n", + ")\n", + "\n", + "error_bars + points" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/errorbars_with_std.ipynb b/doc/jupyterlite/files/errorbars_with_std.ipynb new file mode 100644 index 000000000..ebeb3e13b --- /dev/null +++ b/doc/jupyterlite/files/errorbars_with_std.ipynb @@ -0,0 +1,62 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "5b452a62", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "25e506ca", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Error Bar with Standard Deviation\n", + "---------------------------------\n", + "This example shows how to show error bars with standard deviation using crop yields data of different\n", + "in the years of 1930s.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "error_bars = alt.Chart(source).mark_errorbar(extent='stdev').encode(\n", + " x=alt.X('yield:Q', scale=alt.Scale(zero=False)),\n", + " y=alt.Y('variety:N')\n", + ")\n", + "\n", + "points = alt.Chart(source).mark_point(filled=True, color='black').encode(\n", + " x=alt.X('yield:Q', aggregate='mean'),\n", + " y=alt.Y('variety:N'),\n", + ")\n", + "\n", + "error_bars + points" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/falkensee.ipynb b/doc/jupyterlite/files/falkensee.ipynb new file mode 100644 index 000000000..9b3bca605 --- /dev/null +++ b/doc/jupyterlite/files/falkensee.ipynb @@ -0,0 +1,121 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "ce94634b", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "32b93301", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Falkensee\n", + "-----------------------\n", + "This example is a reproduction of the Falkensee plot found in the vega-lite examples.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "\n", + "source = [\n", + " {\"year\": \"1875\", \"population\": 1309},\n", + " {\"year\": \"1890\", \"population\": 1558},\n", + " {\"year\": \"1910\", \"population\": 4512},\n", + " {\"year\": \"1925\", \"population\": 8180},\n", + " {\"year\": \"1933\", \"population\": 15915},\n", + " {\"year\": \"1939\", \"population\": 24824},\n", + " {\"year\": \"1946\", \"population\": 28275},\n", + " {\"year\": \"1950\", \"population\": 29189},\n", + " {\"year\": \"1964\", \"population\": 29881},\n", + " {\"year\": \"1971\", \"population\": 26007},\n", + " {\"year\": \"1981\", \"population\": 24029},\n", + " {\"year\": \"1985\", \"population\": 23340},\n", + " {\"year\": \"1989\", \"population\": 22307},\n", + " {\"year\": \"1990\", \"population\": 22087},\n", + " {\"year\": \"1991\", \"population\": 22139},\n", + " {\"year\": \"1992\", \"population\": 22105},\n", + " {\"year\": \"1993\", \"population\": 22242},\n", + " {\"year\": \"1994\", \"population\": 22801},\n", + " {\"year\": \"1995\", \"population\": 24273},\n", + " {\"year\": \"1996\", \"population\": 25640},\n", + " {\"year\": \"1997\", \"population\": 27393},\n", + " {\"year\": \"1998\", \"population\": 29505},\n", + " {\"year\": \"1999\", \"population\": 32124},\n", + " {\"year\": \"2000\", \"population\": 33791},\n", + " {\"year\": \"2001\", \"population\": 35297},\n", + " {\"year\": \"2002\", \"population\": 36179},\n", + " {\"year\": \"2003\", \"population\": 36829},\n", + " {\"year\": \"2004\", \"population\": 37493},\n", + " {\"year\": \"2005\", \"population\": 38376},\n", + " {\"year\": \"2006\", \"population\": 39008},\n", + " {\"year\": \"2007\", \"population\": 39366},\n", + " {\"year\": \"2008\", \"population\": 39821},\n", + " {\"year\": \"2009\", \"population\": 40179},\n", + " {\"year\": \"2010\", \"population\": 40511},\n", + " {\"year\": \"2011\", \"population\": 40465},\n", + " {\"year\": \"2012\", \"population\": 40905},\n", + " {\"year\": \"2013\", \"population\": 41258},\n", + " {\"year\": \"2014\", \"population\": 41777}\n", + " ]\n", + "\n", + "source2 = [{\n", + " \"start\": \"1933\",\n", + " \"end\": \"1945\",\n", + " \"event\": \"Nazi Rule\"\n", + " },\n", + " {\n", + " \"start\": \"1948\",\n", + " \"end\": \"1989\",\n", + " \"event\": \"GDR (East Germany)\"\n", + " }]\n", + "\n", + "\n", + "source = alt.pd.DataFrame(source)\n", + "source2 = alt.pd.DataFrame(source2)\n", + "\n", + "\n", + "line = alt.Chart(source).mark_line(color='#333').encode(\n", + " alt.X('year:T', axis=alt.Axis(format='%Y')),\n", + " y='population'\n", + ").properties(\n", + " width=500,\n", + " height=300\n", + ")\n", + "\n", + "point = line.mark_point(color='#333')\n", + "\n", + "rect = alt.Chart(source2).mark_rect().encode(\n", + " x='start:T',\n", + " x2='end:T',\n", + " color='event:N'\n", + ")\n", + "\n", + "rect + line + point" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/filled_step_chart.ipynb b/doc/jupyterlite/files/filled_step_chart.ipynb new file mode 100644 index 000000000..88d6552ef --- /dev/null +++ b/doc/jupyterlite/files/filled_step_chart.ipynb @@ -0,0 +1,58 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "3de14624", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0cb1a57b", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Filled Step Chart\n", + "-----------------\n", + "This example shows Google's stock price over time as a step chart with its area filled in and its line emphasized.\n", + "\"\"\"\n", + "# category: line charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.stocks()\n", + "\n", + "alt.Chart(source).mark_area(\n", + " color=\"lightblue\",\n", + " interpolate='step-after',\n", + " line=True\n", + ").encode(\n", + " x='date',\n", + " y='price'\n", + ").transform_filter(alt.datum.symbol == 'GOOG')" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/gantt_chart.ipynb b/doc/jupyterlite/files/gantt_chart.ipynb new file mode 100644 index 000000000..85f2ff93c --- /dev/null +++ b/doc/jupyterlite/files/gantt_chart.ipynb @@ -0,0 +1,59 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "27b16e81", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4a8581d8", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Gantt Chart\n", + "-----------------\n", + "This example shows how to make a simple Gantt chart.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame([\n", + " {\"task\": \"A\", \"start\": 1, \"end\": 3},\n", + " {\"task\": \"B\", \"start\": 3, \"end\": 8},\n", + " {\"task\": \"C\", \"start\": 8, \"end\": 10}\n", + "])\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x='start',\n", + " x2='end',\n", + " y='task'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/gapminder_bubble_plot.ipynb b/doc/jupyterlite/files/gapminder_bubble_plot.ipynb new file mode 100644 index 000000000..c3a312d48 --- /dev/null +++ b/doc/jupyterlite/files/gapminder_bubble_plot.ipynb @@ -0,0 +1,57 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "a360db90", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "50bf1c9c", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Gapminder Bubble Plot\n", + "=====================\n", + "This example shows how to make a bubble plot showing the correlation between\n", + "health and income for 187 countries in the world (modified from an example\n", + "in Lisa Charlotte Rost's blog post `'One Chart, Twelve Charting Libraries' `_.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.gapminder_health_income.url\n", + "\n", + "alt.Chart(source).mark_circle().encode(\n", + " alt.X('income:Q', scale=alt.Scale(type='log')),\n", + " alt.Y('health:Q', scale=alt.Scale(zero=False)),\n", + " size='population:Q'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/grouped_bar_chart.ipynb b/doc/jupyterlite/files/grouped_bar_chart.ipynb new file mode 100644 index 000000000..7ce17bceb --- /dev/null +++ b/doc/jupyterlite/files/grouped_bar_chart.ipynb @@ -0,0 +1,56 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "fdac8eed", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5f062a88", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Grouped Bar Chart\n", + "-----------------\n", + "This example shows a grouped bar chart.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x='year:O',\n", + " y='sum(yield):Q',\n", + " color='year:N',\n", + " column='site:N'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/grouped_bar_chart2.ipynb b/doc/jupyterlite/files/grouped_bar_chart2.ipynb new file mode 100644 index 000000000..6adab7e8e --- /dev/null +++ b/doc/jupyterlite/files/grouped_bar_chart2.ipynb @@ -0,0 +1,59 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "e1a8e37a", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0d0e3111", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Grouped Bar Chart with xOffset\n", + "------------------------------\n", + "Like :ref:`gallery_grouped_bar_chart`, this example shows a grouped bar chart. Whereas :ref:`gallery_grouped_bar_chart` used the ``column`` encoding channel, this example uses the ``xOffset`` encoding channel. This is adapted from a corresponding Vega-Lite Example:\n", + "`Grouped Bar Chart `_.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame({\"Category\":list(\"AAABBBCCC\"),\n", + " \"Group\":list(\"xyzxyzxyz\"),\n", + " \"Value\":[0.1, 0.6, 0.9, 0.7, 0.2, 1.1, 0.6, 0.1, 0.2]})\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x=\"Category:N\",\n", + " y=\"Value:Q\",\n", + " xOffset=\"Group:N\",\n", + " color=\"Group:N\"\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/grouped_bar_chart_horizontal.ipynb b/doc/jupyterlite/files/grouped_bar_chart_horizontal.ipynb new file mode 100644 index 000000000..47b66a694 --- /dev/null +++ b/doc/jupyterlite/files/grouped_bar_chart_horizontal.ipynb @@ -0,0 +1,56 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "0562723b", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7714a54e", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Horizontal Grouped Bar Chart\n", + "----------------------------\n", + "This example shows a horizontal grouped bar chart.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x='sum(yield):Q',\n", + " y='year:O',\n", + " color='year:N',\n", + " row='site:N'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/grouped_bar_chart_with_error_bars.ipynb b/doc/jupyterlite/files/grouped_bar_chart_with_error_bars.ipynb new file mode 100644 index 000000000..307187337 --- /dev/null +++ b/doc/jupyterlite/files/grouped_bar_chart_with_error_bars.ipynb @@ -0,0 +1,64 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "25b7ea25", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e35993a8", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Grouped Bar Chart with Error Bars\n", + "---------------------------------\n", + "This example shows a grouped bar chart with error bars.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "bars = alt.Chart().mark_bar().encode(\n", + " x='year:O',\n", + " y=alt.Y('mean(yield):Q', title='Mean Yield'),\n", + " color='year:N',\n", + ")\n", + "\n", + "error_bars = alt.Chart().mark_errorbar(extent='ci').encode(\n", + " x='year:O',\n", + " y='yield:Q'\n", + ")\n", + "\n", + "alt.layer(bars, error_bars, data=source).facet(\n", + " column='site:N'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/hexbins.ipynb b/doc/jupyterlite/files/hexbins.ipynb new file mode 100644 index 000000000..b404666a7 --- /dev/null +++ b/doc/jupyterlite/files/hexbins.ipynb @@ -0,0 +1,82 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c69ff022", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "675cbfb5", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Hexbin Chart\n", + "-----------------\n", + "This example shows a hexbin chart.\n", + "\"\"\"\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.seattle_weather()\n", + "\n", + "# Size of the hexbins\n", + "size = 15\n", + "# Count of distinct x features\n", + "xFeaturesCount = 12\n", + "# Count of distinct y features\n", + "yFeaturesCount = 7\n", + "# Name of the x field\n", + "xField = 'date'\n", + "# Name of the y field\n", + "yField = 'date'\n", + "\n", + "# the shape of a hexagon\n", + "hexagon = \"M0,-2.3094010768L2,-1.1547005384 2,1.1547005384 0,2.3094010768 -2,1.1547005384 -2,-1.1547005384Z\"\n", + "\n", + "alt.Chart(source).mark_point(size=size**2, shape=hexagon).encode(\n", + " x=alt.X('xFeaturePos:Q', axis=alt.Axis(title='Month',\n", + " grid=False, tickOpacity=0, domainOpacity=0)),\n", + " y=alt.Y('day(' + yField + '):O', axis=alt.Axis(title='Weekday',\n", + " labelPadding=20, tickOpacity=0, domainOpacity=0)),\n", + " stroke=alt.value('black'),\n", + " strokeWidth=alt.value(0.2),\n", + " fill=alt.Color('mean(temp_max):Q', scale=alt.Scale(scheme='darkblue')),\n", + " tooltip=['month(' + xField + '):O', 'day(' + yField + '):O', 'mean(temp_max):Q']\n", + ").transform_calculate(\n", + " # This field is required for the hexagonal X-Offset\n", + " xFeaturePos='(day(datum.' + yField + ') % 2) / 2 + month(datum.' + xField + ')'\n", + ").properties(\n", + " # Exact scaling factors to make the hexbins fit\n", + " width=size * xFeaturesCount * 2,\n", + " height=size * yFeaturesCount * 1.7320508076, # 1.7320508076 is approx. sin(60°)*2\n", + ").configure_view(\n", + " strokeWidth=0\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/histogram_responsive.ipynb b/doc/jupyterlite/files/histogram_responsive.ipynb new file mode 100644 index 000000000..c0e92409a --- /dev/null +++ b/doc/jupyterlite/files/histogram_responsive.ipynb @@ -0,0 +1,74 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "117dd276", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d3c3e729", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Histogram with Responsive Bins\n", + "------------------------------\n", + "This shows an example of a histogram with bins that are responsive to a\n", + "selection domain. Click and drag on the bottom panel to see the bins\n", + "change on the top panel.\n", + "\"\"\"\n", + "# category: histograms\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.flights_5k.url\n", + "\n", + "brush = alt.selection_interval(encodings=['x'])\n", + "\n", + "base = alt.Chart(source).transform_calculate(\n", + " time=\"hours(datum.date) + minutes(datum.date) / 60\"\n", + ").mark_bar().encode(\n", + " y='count():Q'\n", + ").properties(\n", + " width=600,\n", + " height=100\n", + ")\n", + "\n", + "alt.vconcat(\n", + " base.encode(\n", + " alt.X('time:Q',\n", + " bin=alt.Bin(maxbins=30, extent=brush),\n", + " scale=alt.Scale(domain=brush)\n", + " )\n", + " ),\n", + " base.encode(\n", + " alt.X('time:Q', bin=alt.Bin(maxbins=30)),\n", + " ).add_selection(brush)\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/histogram_with_a_global_mean_overlay.ipynb b/doc/jupyterlite/files/histogram_with_a_global_mean_overlay.ipynb new file mode 100644 index 000000000..2cd1d41e6 --- /dev/null +++ b/doc/jupyterlite/files/histogram_with_a_global_mean_overlay.ipynb @@ -0,0 +1,63 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "d8de57bd", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3ebb6979", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Histogram with a Global Mean Overlay\n", + "------------------------------------\n", + "This example shows a histogram with a global mean overlay.\n", + "\"\"\"\n", + "# category: histograms\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.movies.url\n", + "\n", + "base = alt.Chart(source)\n", + "\n", + "bar = base.mark_bar().encode(\n", + " x=alt.X('IMDB_Rating:Q', bin=True, axis=None),\n", + " y='count()'\n", + ")\n", + "\n", + "rule = base.mark_rule(color='red').encode(\n", + " x='mean(IMDB_Rating):Q',\n", + " size=alt.value(5)\n", + ")\n", + "\n", + "bar + rule" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/horizon_graph.ipynb b/doc/jupyterlite/files/horizon_graph.ipynb new file mode 100644 index 000000000..db8f560dc --- /dev/null +++ b/doc/jupyterlite/files/horizon_graph.ipynb @@ -0,0 +1,80 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "f4d5c2bb", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0bf68c27", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Horizon Graph\n", + "-------------\n", + "This example shows how to make a Horizon Graph with 2 layers. (See https://idl.cs.washington.edu/papers/horizon/ for more details on Horizon Graphs.)\n", + "\"\"\"\n", + "# category: area charts\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame([\n", + " {\"x\": 1, \"y\": 28}, {\"x\": 2, \"y\": 55},\n", + " {\"x\": 3, \"y\": 43}, {\"x\": 4, \"y\": 91},\n", + " {\"x\": 5, \"y\": 81}, {\"x\": 6, \"y\": 53},\n", + " {\"x\": 7, \"y\": 19}, {\"x\": 8, \"y\": 87},\n", + " {\"x\": 9, \"y\": 52}, {\"x\": 10, \"y\": 48},\n", + " {\"x\": 11, \"y\": 24}, {\"x\": 12, \"y\": 49},\n", + " {\"x\": 13, \"y\": 87}, {\"x\": 14, \"y\": 66},\n", + " {\"x\": 15, \"y\": 17}, {\"x\": 16, \"y\": 27},\n", + " {\"x\": 17, \"y\": 68}, {\"x\": 18, \"y\": 16},\n", + " {\"x\": 19, \"y\": 49}, {\"x\": 20, \"y\": 15}\n", + "])\n", + "\n", + "area1 = alt.Chart(source).mark_area(\n", + " clip=True,\n", + " interpolate='monotone'\n", + ").encode(\n", + " alt.X('x', scale=alt.Scale(zero=False, nice=False)),\n", + " alt.Y('y', scale=alt.Scale(domain=[0, 50]), title='y'),\n", + " opacity=alt.value(0.6)\n", + ").properties(\n", + " width=500,\n", + " height=75\n", + ")\n", + "\n", + "area2 = area1.encode(\n", + " alt.Y('ny:Q', scale=alt.Scale(domain=[0, 50]))\n", + ").transform_calculate(\n", + " \"ny\", alt.datum.y - 50\n", + ")\n", + "\n", + "area1 + area2" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/horizontal_stacked_bar_chart.ipynb b/doc/jupyterlite/files/horizontal_stacked_bar_chart.ipynb new file mode 100644 index 000000000..c8078c440 --- /dev/null +++ b/doc/jupyterlite/files/horizontal_stacked_bar_chart.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "63cc3f01", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2e9e9c4d", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Horizontal Stacked Bar Chart\n", + "============================\n", + "This is an example of a horizontal stacked bar chart using data which contains crop yields over different regions and different years in the 1930s.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x='sum(yield)',\n", + " y='variety',\n", + " color='site'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/image_tooltip.ipynb b/doc/jupyterlite/files/image_tooltip.ipynb new file mode 100644 index 000000000..582fe2e7d --- /dev/null +++ b/doc/jupyterlite/files/image_tooltip.ipynb @@ -0,0 +1,60 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "d41a1000", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ab06bd34", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Image tooltip\n", + "-------------\n", + "This example shows how to render images in tooltips.\n", + "Either URLs or local file paths can be used to reference\n", + "the images.\n", + "\"\"\"\n", + "# category: other charts\n", + "\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame.from_records(\n", + " [{'a': 1, 'b': 1, 'image': 'https://altair-viz.github.io/_static/altair-logo-light.png'},\n", + " {'a': 2, 'b': 2, 'image': 'https://avatars.githubusercontent.com/u/11796929?s=200&v=4'}]\n", + ")\n", + "alt.Chart(source).mark_circle(size=200).encode(\n", + " x='a',\n", + " y='b',\n", + " tooltip=['image'] # Must be a list for the image to render\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/interactive_brush.ipynb b/doc/jupyterlite/files/interactive_brush.ipynb new file mode 100644 index 000000000..072ad25fa --- /dev/null +++ b/doc/jupyterlite/files/interactive_brush.ipynb @@ -0,0 +1,58 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c895e01a", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b55702ef", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Interactive Rectangular Brush\n", + "=============================\n", + "This example shows how to add a simple rectangular brush to a scatter plot.\n", + "By clicking and dragging on the plot, you can highlight points within the\n", + "range.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "brush = alt.selection(type='interval')\n", + "\n", + "alt.Chart(source).mark_point().encode(\n", + " x='Horsepower:Q',\n", + " y='Miles_per_Gallon:Q',\n", + " color=alt.condition(brush, 'Cylinders:O', alt.value('grey')),\n", + ").add_selection(brush)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/interactive_cross_highlight.ipynb b/doc/jupyterlite/files/interactive_cross_highlight.ipynb new file mode 100644 index 000000000..a6ec9f0c4 --- /dev/null +++ b/doc/jupyterlite/files/interactive_cross_highlight.ipynb @@ -0,0 +1,88 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "92ce890e", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3a95be8f", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Interactive Chart with Cross-Highlight\n", + "======================================\n", + "This example shows an interactive chart where selections in one portion of\n", + "the chart affect what is shown in other panels. Click on the bar chart to\n", + "see a detail of the distribution in the upper panel.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.movies.url\n", + "\n", + "pts = alt.selection(type=\"single\", encodings=['x'])\n", + "\n", + "rect = alt.Chart(data.movies.url).mark_rect().encode(\n", + " alt.X('IMDB_Rating:Q', bin=True),\n", + " alt.Y('Rotten_Tomatoes_Rating:Q', bin=True),\n", + " alt.Color('count()',\n", + " scale=alt.Scale(scheme='greenblue'),\n", + " legend=alt.Legend(title='Total Records')\n", + " )\n", + ")\n", + "\n", + "circ = rect.mark_point().encode(\n", + " alt.ColorValue('grey'),\n", + " alt.Size('count()',\n", + " legend=alt.Legend(title='Records in Selection')\n", + " )\n", + ").transform_filter(\n", + " pts\n", + ")\n", + "\n", + "bar = alt.Chart(source).mark_bar().encode(\n", + " x='Major_Genre:N',\n", + " y='count()',\n", + " color=alt.condition(pts, alt.ColorValue(\"steelblue\"), alt.ColorValue(\"grey\"))\n", + ").properties(\n", + " width=550,\n", + " height=200\n", + ").add_selection(pts)\n", + "\n", + "alt.vconcat(\n", + " rect + circ,\n", + " bar\n", + ").resolve_legend(\n", + " color=\"independent\",\n", + " size=\"independent\"\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/interactive_layered_crossfilter.ipynb b/doc/jupyterlite/files/interactive_layered_crossfilter.ipynb new file mode 100644 index 000000000..b8ed51133 --- /dev/null +++ b/doc/jupyterlite/files/interactive_layered_crossfilter.ipynb @@ -0,0 +1,84 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "cb75d2ad", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "10d16b18", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Interactive Crossfilter\n", + "=======================\n", + "This example shows a multi-panel view of the same data, where you can interactively\n", + "select a portion of the data in any of the panels to highlight that portion in any\n", + "of the other panels.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = alt.UrlData(\n", + " data.flights_2k.url,\n", + " format={'parse': {'date': 'date'}}\n", + ")\n", + "\n", + "brush = alt.selection(type='interval', encodings=['x'])\n", + "\n", + "# Define the base chart, with the common parts of the\n", + "# background and highlights\n", + "base = alt.Chart().mark_bar().encode(\n", + " x=alt.X(alt.repeat('column'), type='quantitative', bin=alt.Bin(maxbins=20)),\n", + " y='count()'\n", + ").properties(\n", + " width=160,\n", + " height=130\n", + ")\n", + "\n", + "# gray background with selection\n", + "background = base.encode(\n", + " color=alt.value('#ddd')\n", + ").add_selection(brush)\n", + "\n", + "# blue highlights on the transformed data\n", + "highlight = base.transform_filter(brush)\n", + "\n", + "# layer the two charts & repeat\n", + "alt.layer(\n", + " background,\n", + " highlight,\n", + " data=source\n", + ").transform_calculate(\n", + " \"time\",\n", + " \"hours(datum.date)\"\n", + ").repeat(column=[\"distance\", \"delay\", \"time\"])" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/interactive_legend.ipynb b/doc/jupyterlite/files/interactive_legend.ipynb new file mode 100644 index 000000000..e5145cb0c --- /dev/null +++ b/doc/jupyterlite/files/interactive_legend.ipynb @@ -0,0 +1,63 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "5fcdf63e", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e92c89e1", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Interactive Legend\n", + "------------------\n", + "The following shows how to create a chart with an interactive legend, by\n", + "binding the selection to ``\"legend\"``. Such a binding only works with\n", + "``selection_single`` or ``selection_multi`` when projected over a single\n", + "field or encoding.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.unemployment_across_industries.url\n", + "\n", + "selection = alt.selection_multi(fields=['series'], bind='legend')\n", + "\n", + "alt.Chart(source).mark_area().encode(\n", + " alt.X('yearmonth(date):T', axis=alt.Axis(domain=False, format='%Y', tickSize=0)),\n", + " alt.Y('sum(count):Q', stack='center', axis=None),\n", + " alt.Color('series:N', scale=alt.Scale(scheme='category20b')),\n", + " opacity=alt.condition(selection, alt.value(1), alt.value(0.2))\n", + ").add_selection(\n", + " selection\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/interactive_scatter_plot.ipynb b/doc/jupyterlite/files/interactive_scatter_plot.ipynb new file mode 100644 index 000000000..101e518be --- /dev/null +++ b/doc/jupyterlite/files/interactive_scatter_plot.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "1658b069", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f5b9241a", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Simple Interactive Colored Scatterplot\n", + "--------------------------------------\n", + "This example shows how to make an interactive scatterplot.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "alt.Chart(source).mark_circle().encode(\n", + " x='Horsepower',\n", + " y='Miles_per_Gallon',\n", + " color='Origin',\n", + ").interactive()" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/interval_selection.ipynb b/doc/jupyterlite/files/interval_selection.ipynb new file mode 100644 index 000000000..89091fcc2 --- /dev/null +++ b/doc/jupyterlite/files/interval_selection.ipynb @@ -0,0 +1,71 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "29ed1729", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9a2146dc", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Interval Selection Example\n", + "==========================\n", + "\n", + "This is an example of creating a stacked chart for which the domain of the\n", + "top chart can be selected by interacting with the bottom chart.\n", + "\"\"\"\n", + "# category: area charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.sp500.url\n", + "\n", + "brush = alt.selection(type='interval', encodings=['x'])\n", + "\n", + "base = alt.Chart(source).mark_area().encode(\n", + " x = 'date:T',\n", + " y = 'price:Q'\n", + ").properties(\n", + " width=600,\n", + " height=200\n", + ")\n", + "\n", + "upper = base.encode(\n", + " alt.X('date:T', scale=alt.Scale(domain=brush))\n", + ")\n", + "\n", + "lower = base.properties(\n", + " height=60\n", + ").add_selection(brush)\n", + "\n", + "upper & lower" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/iowa_electricity.ipynb b/doc/jupyterlite/files/iowa_electricity.ipynb new file mode 100644 index 000000000..5087bb915 --- /dev/null +++ b/doc/jupyterlite/files/iowa_electricity.ipynb @@ -0,0 +1,66 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "6c746af3", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "177496e9", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Iowa's renewable energy boom\n", + "----------------------------\n", + "This example is a fully developed stacked chart using the sample dataset of Iowa's electricity sources.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.iowa_electricity()\n", + "\n", + "alt.Chart(source, title=\"Iowa's renewable energy boom\").mark_area().encode(\n", + " x=alt.X(\n", + " \"year:T\",\n", + " title=\"Year\"\n", + " ),\n", + " y=alt.Y(\n", + " \"net_generation:Q\",\n", + " stack=\"normalize\",\n", + " title=\"Share of net generation\",\n", + " axis=alt.Axis(format=\".0%\"),\n", + " ),\n", + " color=alt.Color(\n", + " \"source:N\",\n", + " legend=alt.Legend(title=\"Electricity source\"),\n", + " )\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/isotype.ipynb b/doc/jupyterlite/files/isotype.ipynb new file mode 100644 index 000000000..ce66f4718 --- /dev/null +++ b/doc/jupyterlite/files/isotype.ipynb @@ -0,0 +1,117 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "f8516d4e", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "674375c2", + "metadata": {}, + "outputs": [], + "source": [ + "'''\n", + "Isotype Visualization\n", + "=====================\n", + "Isotype Visualization shows the distribution of animals across UK and US.\n", + "Inspired by `Only An Ocean Between, 1943 `_. Population Live Stock, p.13.\n", + "This is adapted from Vega-Lite example https://vega.github.io/editor/#/examples/vega-lite/isotype_bar_chart\n", + "'''\n", + "# category: case studies\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame([\n", + " {'country': 'Great Britain', 'animal': 'cattle'},\n", + " {'country': 'Great Britain', 'animal': 'cattle'},\n", + " {'country': 'Great Britain', 'animal': 'cattle'},\n", + " {'country': 'Great Britain', 'animal': 'pigs'},\n", + " {'country': 'Great Britain', 'animal': 'pigs'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'pigs'},\n", + " {'country': 'United States', 'animal': 'pigs'},\n", + " {'country': 'United States', 'animal': 'pigs'},\n", + " {'country': 'United States', 'animal': 'pigs'},\n", + " {'country': 'United States', 'animal': 'pigs'},\n", + " {'country': 'United States', 'animal': 'pigs'},\n", + " {'country': 'United States', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'sheep'}\n", + " ])\n", + "\n", + "domains = ['person', 'cattle', 'pigs', 'sheep']\n", + "\n", + "shape_scale = alt.Scale(\n", + " domain=domains,\n", + " range=[\n", + " 'M1.7 -1.7h-0.8c0.3 -0.2 0.6 -0.5 0.6 -0.9c0 -0.6 -0.4 -1 -1 -1c-0.6 0 -1 0.4 -1 1c0 0.4 0.2 0.7 0.6 0.9h-0.8c-0.4 0 -0.7 0.3 -0.7 0.6v1.9c0 0.3 0.3 0.6 0.6 0.6h0.2c0 0 0 0.1 0 0.1v1.9c0 0.3 0.2 0.6 0.3 0.6h1.3c0.2 0 0.3 -0.3 0.3 -0.6v-1.8c0 0 0 -0.1 0 -0.1h0.2c0.3 0 0.6 -0.3 0.6 -0.6v-2c0.2 -0.3 -0.1 -0.6 -0.4 -0.6z',\n", + " 'M4 -2c0 0 0.9 -0.7 1.1 -0.8c0.1 -0.1 -0.1 0.5 -0.3 0.7c-0.2 0.2 1.1 1.1 1.1 1.2c0 0.2 -0.2 0.8 -0.4 0.7c-0.1 0 -0.8 -0.3 -1.3 -0.2c-0.5 0.1 -1.3 1.6 -1.5 2c-0.3 0.4 -0.6 0.4 -0.6 0.4c0 0.1 0.3 1.7 0.4 1.8c0.1 0.1 -0.4 0.1 -0.5 0c0 0 -0.6 -1.9 -0.6 -1.9c-0.1 0 -0.3 -0.1 -0.3 -0.1c0 0.1 -0.5 1.4 -0.4 1.6c0.1 0.2 0.1 0.3 0.1 0.3c0 0 -0.4 0 -0.4 0c0 0 -0.2 -0.1 -0.1 -0.3c0 -0.2 0.3 -1.7 0.3 -1.7c0 0 -2.8 -0.9 -2.9 -0.8c-0.2 0.1 -0.4 0.6 -0.4 1c0 0.4 0.5 1.9 0.5 1.9l-0.5 0l-0.6 -2l0 -0.6c0 0 -1 0.8 -1 1c0 0.2 -0.2 1.3 -0.2 1.3c0 0 0.3 0.3 0.2 0.3c0 0 -0.5 0 -0.5 0c0 0 -0.2 -0.2 -0.1 -0.4c0 -0.1 0.2 -1.6 0.2 -1.6c0 0 0.5 -0.4 0.5 -0.5c0 -0.1 0 -2.7 -0.2 -2.7c-0.1 0 -0.4 2 -0.4 2c0 0 0 0.2 -0.2 0.5c-0.1 0.4 -0.2 1.1 -0.2 1.1c0 0 -0.2 -0.1 -0.2 -0.2c0 -0.1 -0.1 -0.7 0 -0.7c0.1 -0.1 0.3 -0.8 0.4 -1.4c0 -0.6 0.2 -1.3 0.4 -1.5c0.1 -0.2 0.6 -0.4 0.6 -0.4z',\n", + " 'M1.2 -2c0 0 0.7 0 1.2 0.5c0.5 0.5 0.4 0.6 0.5 0.6c0.1 0 0.7 0 0.8 0.1c0.1 0 0.2 0.2 0.2 0.2c0 0 -0.6 0.2 -0.6 0.3c0 0.1 0.4 0.9 0.6 0.9c0.1 0 0.6 0 0.6 0.1c0 0.1 0 0.7 -0.1 0.7c-0.1 0 -1.2 0.4 -1.5 0.5c-0.3 0.1 -1.1 0.5 -1.1 0.7c-0.1 0.2 0.4 1.2 0.4 1.2l-0.4 0c0 0 -0.4 -0.8 -0.4 -0.9c0 -0.1 -0.1 -0.3 -0.1 -0.3l-0.2 0l-0.5 1.3l-0.4 0c0 0 -0.1 -0.4 0 -0.6c0.1 -0.1 0.3 -0.6 0.3 -0.7c0 0 -0.8 0 -1.5 -0.1c-0.7 -0.1 -1.2 -0.3 -1.2 -0.2c0 0.1 -0.4 0.6 -0.5 0.6c0 0 0.3 0.9 0.3 0.9l-0.4 0c0 0 -0.4 -0.5 -0.4 -0.6c0 -0.1 -0.2 -0.6 -0.2 -0.5c0 0 -0.4 0.4 -0.6 0.4c-0.2 0.1 -0.4 0.1 -0.4 0.1c0 0 -0.1 0.6 -0.1 0.6l-0.5 0l0 -1c0 0 0.5 -0.4 0.5 -0.5c0 -0.1 -0.7 -1.2 -0.6 -1.4c0.1 -0.1 0.1 -1.1 0.1 -1.1c0 0 -0.2 0.1 -0.2 0.1c0 0 0 0.9 0 1c0 0.1 -0.2 0.3 -0.3 0.3c-0.1 0 0 -0.5 0 -0.9c0 -0.4 0 -0.4 0.2 -0.6c0.2 -0.2 0.6 -0.3 0.8 -0.8c0.3 -0.5 1 -0.6 1 -0.6z',\n", + " 'M-4.1 -0.5c0.2 0 0.2 0.2 0.5 0.2c0.3 0 0.3 -0.2 0.5 -0.2c0.2 0 0.2 0.2 0.4 0.2c0.2 0 0.2 -0.2 0.5 -0.2c0.2 0 0.2 0.2 0.4 0.2c0.2 0 0.2 -0.2 0.4 -0.2c0.1 0 0.2 0.2 0.4 0.1c0.2 0 0.2 -0.2 0.4 -0.3c0.1 0 0.1 -0.1 0.4 0c0.3 0 0.3 -0.4 0.6 -0.4c0.3 0 0.6 -0.3 0.7 -0.2c0.1 0.1 1.4 1 1.3 1.4c-0.1 0.4 -0.3 0.3 -0.4 0.3c-0.1 0 -0.5 -0.4 -0.7 -0.2c-0.3 0.2 -0.1 0.4 -0.2 0.6c-0.1 0.1 -0.2 0.2 -0.3 0.4c0 0.2 0.1 0.3 0 0.5c-0.1 0.2 -0.3 0.2 -0.3 0.5c0 0.3 -0.2 0.3 -0.3 0.6c-0.1 0.2 0 0.3 -0.1 0.5c-0.1 0.2 -0.1 0.2 -0.2 0.3c-0.1 0.1 0.3 1.1 0.3 1.1l-0.3 0c0 0 -0.3 -0.9 -0.3 -1c0 -0.1 -0.1 -0.2 -0.3 -0.2c-0.2 0 -0.3 0.1 -0.4 0.4c0 0.3 -0.2 0.8 -0.2 0.8l-0.3 0l0.3 -1c0 0 0.1 -0.6 -0.2 -0.5c-0.3 0.1 -0.2 -0.1 -0.4 -0.1c-0.2 -0.1 -0.3 0.1 -0.4 0c-0.2 -0.1 -0.3 0.1 -0.5 0c-0.2 -0.1 -0.1 0 -0.3 0.3c-0.2 0.3 -0.4 0.3 -0.4 0.3l0.2 1.1l-0.3 0l-0.2 -1.1c0 0 -0.4 -0.6 -0.5 -0.4c-0.1 0.3 -0.1 0.4 -0.3 0.4c-0.1 -0.1 -0.2 1.1 -0.2 1.1l-0.3 0l0.2 -1.1c0 0 -0.3 -0.1 -0.3 -0.5c0 -0.3 0.1 -0.5 0.1 -0.7c0.1 -0.2 -0.1 -1 -0.2 -1.1c-0.1 -0.2 -0.2 -0.8 -0.2 -0.8c0 0 -0.1 -0.5 0.4 -0.8z'\n", + " ]\n", + ")\n", + "\n", + "color_scale = alt.Scale(\n", + " domain=domains,\n", + " range=['rgb(162,160,152)', 'rgb(194,81,64)', 'rgb(93,93,93)', 'rgb(91,131,149)']\n", + ")\n", + "\n", + "alt.Chart(source).mark_point(filled=True, opacity=1, size=100).encode(\n", + " alt.X('x:O', axis=None),\n", + " alt.Y('animal:O', axis=None),\n", + " alt.Row('country:N', header=alt.Header(title='')),\n", + " alt.Shape('animal:N', legend=None, scale=shape_scale),\n", + " alt.Color('animal:N', legend=None, scale=color_scale),\n", + ").transform_window(\n", + " x='rank()',\n", + " groupby=['country', 'animal']\n", + ").properties(width=550, height=140)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/isotype_emoji.ipynb b/doc/jupyterlite/files/isotype_emoji.ipynb new file mode 100644 index 000000000..d8d8c8a89 --- /dev/null +++ b/doc/jupyterlite/files/isotype_emoji.ipynb @@ -0,0 +1,102 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "3dca6f8b", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c982ca92", + "metadata": {}, + "outputs": [], + "source": [ + "'''\n", + "Isotype Visualization with Emoji\n", + "================================\n", + "Isotype Visualization shows the distribution of animals across UK and US, using unicode emoji\n", + "marks rather than custom SVG paths (see https://altair-viz.github.io/gallery/isotype.html).\n", + "This is adapted from Vega-Lite example https://vega.github.io/vega-lite/examples/isotype_bar_chart_emoji.html.\n", + "'''\n", + "# category: case studies\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame([\n", + " {'country': 'Great Britain', 'animal': 'cattle'},\n", + " {'country': 'Great Britain', 'animal': 'cattle'},\n", + " {'country': 'Great Britain', 'animal': 'cattle'},\n", + " {'country': 'Great Britain', 'animal': 'pigs'},\n", + " {'country': 'Great Britain', 'animal': 'pigs'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'Great Britain', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'cattle'},\n", + " {'country': 'United States', 'animal': 'pigs'},\n", + " {'country': 'United States', 'animal': 'pigs'},\n", + " {'country': 'United States', 'animal': 'pigs'},\n", + " {'country': 'United States', 'animal': 'pigs'},\n", + " {'country': 'United States', 'animal': 'pigs'},\n", + " {'country': 'United States', 'animal': 'pigs'},\n", + " {'country': 'United States', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'sheep'},\n", + " {'country': 'United States', 'animal': 'sheep'}\n", + " ])\n", + "\n", + "\n", + "alt.Chart(source).mark_text(size=45, baseline='middle').encode(\n", + " alt.X('x:O', axis=None),\n", + " alt.Y('animal:O', axis=None),\n", + " alt.Row('country:N', header=alt.Header(title='')),\n", + " alt.Text('emoji:N')\n", + ").transform_calculate(\n", + " emoji=\"{'cattle': '🐄', 'pigs': '🐖', 'sheep': '🐏'}[datum.animal]\"\n", + ").transform_window(\n", + " x='rank()',\n", + " groupby=['country', 'animal']\n", + ").properties(width=550, height=140)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/isotype_grid.ipynb b/doc/jupyterlite/files/isotype_grid.ipynb new file mode 100644 index 000000000..2f02ed519 --- /dev/null +++ b/doc/jupyterlite/files/isotype_grid.ipynb @@ -0,0 +1,77 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "68a9899e", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1c515a61", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Isotype Grid\n", + "------------\n", + "This example is a grid of isotype figures.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "data = pd.DataFrame([dict(id=i) for i in range(1, 101)])\n", + "\n", + "person = (\n", + " \"M1.7 -1.7h-0.8c0.3 -0.2 0.6 -0.5 0.6 -0.9c0 -0.6 \"\n", + " \"-0.4 -1 -1 -1c-0.6 0 -1 0.4 -1 1c0 0.4 0.2 0.7 0.6 \"\n", + " \"0.9h-0.8c-0.4 0 -0.7 0.3 -0.7 0.6v1.9c0 0.3 0.3 0.6 \"\n", + " \"0.6 0.6h0.2c0 0 0 0.1 0 0.1v1.9c0 0.3 0.2 0.6 0.3 \"\n", + " \"0.6h1.3c0.2 0 0.3 -0.3 0.3 -0.6v-1.8c0 0 0 -0.1 0 \"\n", + " \"-0.1h0.2c0.3 0 0.6 -0.3 0.6 -0.6v-2c0.2 -0.3 -0.1 \"\n", + " \"-0.6 -0.4 -0.6z\"\n", + ")\n", + "\n", + "alt.Chart(data).transform_calculate(\n", + " row=\"ceil(datum.id/10)\"\n", + ").transform_calculate(\n", + " col=\"datum.id - datum.row*10\"\n", + ").mark_point(\n", + " filled=True,\n", + " size=50\n", + ").encode(\n", + " x=alt.X(\"col:O\", axis=None),\n", + " y=alt.Y(\"row:O\", axis=None),\n", + " shape=alt.ShapeValue(person)\n", + ").properties(\n", + " width=400,\n", + " height=400\n", + ").configure_view(\n", + " strokeWidth=0\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/jitter_chart.ipynb b/doc/jupyterlite/files/jitter_chart.ipynb new file mode 100644 index 000000000..54da41153 --- /dev/null +++ b/doc/jupyterlite/files/jitter_chart.ipynb @@ -0,0 +1,60 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "4dd3aee4", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "60ebd3e9", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Jitter Chart\n", + "------------\n", + "In this chart, we encode the ``Cylinders`` column from the ``cars`` dataset in the ``y``-channel. Because most cars (all but seven) in this dataset have 4, 6, or 8 cylinders, the default presentation of this data would show most of the data concentrated on three horizontal lines. Furthermore, in that default presentation, it would be difficult to gauge the relative frequencies with which different values occur (because there would be so much overlap). To compensate for this, we use the ``yOffset`` channel to incorporate a random offset (jittering). This is adapted from a corresponding Vega-Lite Example:\n", + "`Dot Plot with Jittering `_.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "alt.Chart(source).mark_point().encode(\n", + " x='Horsepower:Q',\n", + " y='Cylinders:O',\n", + " yOffset='randomCalc:Q'\n", + ").transform_calculate(\n", + " randomCalc='random()'\n", + ").properties(\n", + " height=alt.Step(50)\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/layer_line_color_rule.ipynb b/doc/jupyterlite/files/layer_line_color_rule.ipynb new file mode 100644 index 000000000..b691a284f --- /dev/null +++ b/doc/jupyterlite/files/layer_line_color_rule.ipynb @@ -0,0 +1,67 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c85b094a", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "65306655", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Line Chart with Layered Aggregates\n", + "----------------------------------\n", + "This example shows how to make a multi-series line chart of the daily closing\n", + "stock prices for AAPL, AMZN, GOOG, IBM, and MSFT between 2000 and 2010, along\n", + "with a layered rule showing the average values.\n", + "\"\"\"\n", + "# category: line charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.stocks()\n", + "\n", + "base = alt.Chart(source).properties(width=550)\n", + "\n", + "line = base.mark_line().encode(\n", + " x='date',\n", + " y='price',\n", + " color='symbol'\n", + ")\n", + "\n", + "rule = base.mark_rule().encode(\n", + " y='average(price)',\n", + " color='symbol',\n", + " size=alt.value(2)\n", + ")\n", + "\n", + "line + rule" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/layered_area_chart.ipynb b/doc/jupyterlite/files/layered_area_chart.ipynb new file mode 100644 index 000000000..1aaf6b563 --- /dev/null +++ b/doc/jupyterlite/files/layered_area_chart.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "8d2fd35b", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2616b174", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Layered Area Chart\n", + "------------------\n", + "This example shows a layered area chart.\n", + "\"\"\"\n", + "# category: area charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.iowa_electricity()\n", + "\n", + "alt.Chart(source).mark_area(opacity=0.3).encode(\n", + " x=\"year:T\",\n", + " y=alt.Y(\"net_generation:Q\", stack=None),\n", + " color=\"source:N\"\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/layered_bar_chart.ipynb b/doc/jupyterlite/files/layered_bar_chart.ipynb new file mode 100644 index 000000000..2f863da00 --- /dev/null +++ b/doc/jupyterlite/files/layered_bar_chart.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "467e69f8", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ceae5c12", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Layered Bar Chart\n", + "-----------------\n", + "This example shows a segmented bar chart that is layered rather than stacked. \n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.iowa_electricity()\n", + "\n", + "alt.Chart(source).mark_bar(opacity=0.7).encode(\n", + " x='year:O',\n", + " y=alt.Y('net_generation:Q', stack=None),\n", + " color=\"source\",\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/layered_chart_bar_mark.ipynb b/doc/jupyterlite/files/layered_chart_bar_mark.ipynb new file mode 100644 index 000000000..2c59a4b7f --- /dev/null +++ b/doc/jupyterlite/files/layered_chart_bar_mark.ipynb @@ -0,0 +1,71 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "58e12561", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d91deb43", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Bar and Tick Chart\n", + "------------------\n", + "How to layer a tick chart on top of a bar chart.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame({\n", + " 'project': ['a', 'b', 'c', 'd', 'e', 'f', 'g'],\n", + " 'score': [25, 57, 23, 19, 8, 47, 8],\n", + " 'goal': [25, 47, 30, 27, 38, 19, 4]\n", + "})\n", + "\n", + "bar = alt.Chart(source).mark_bar().encode(\n", + " x='project',\n", + " y='score'\n", + ").properties(\n", + " width=alt.Step(40) # controls width of bar.\n", + ")\n", + "\n", + "tick = alt.Chart(source).mark_tick(\n", + " color='red',\n", + " thickness=2,\n", + " size=40 * 0.9, # controls width of tick.\n", + ").encode(\n", + " x='project',\n", + " y='goal'\n", + ")\n", + "\n", + "bar + tick" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/layered_chart_with_dual_axis.ipynb b/doc/jupyterlite/files/layered_chart_with_dual_axis.ipynb new file mode 100644 index 000000000..883bd9764 --- /dev/null +++ b/doc/jupyterlite/files/layered_chart_with_dual_axis.ipynb @@ -0,0 +1,69 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "29fed018", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e5931012", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Layered chart with Dual-Axis\n", + "----------------------------\n", + "This example shows how to create a second independent y axis.\n", + "\"\"\"\n", + "# category: other charts\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.seattle_weather()\n", + "\n", + "base = alt.Chart(source).encode(\n", + " alt.X('month(date):T', axis=alt.Axis(title=None))\n", + ")\n", + "\n", + "area = base.mark_area(opacity=0.3, color='#57A44C').encode(\n", + " alt.Y('average(temp_max)',\n", + " axis=alt.Axis(title='Avg. Temperature (°C)', titleColor='#57A44C')),\n", + " alt.Y2('average(temp_min)')\n", + ")\n", + "\n", + "line = base.mark_line(stroke='#5276A7', interpolate='monotone').encode(\n", + " alt.Y('average(precipitation)',\n", + " axis=alt.Axis(title='Precipitation (inches)', titleColor='#5276A7'))\n", + ")\n", + "\n", + "alt.layer(area, line).resolve_scale(\n", + " y = 'independent'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/layered_heatmap_text.ipynb b/doc/jupyterlite/files/layered_heatmap_text.ipynb new file mode 100644 index 000000000..32785b753 --- /dev/null +++ b/doc/jupyterlite/files/layered_heatmap_text.ipynb @@ -0,0 +1,80 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c02b6fb5", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "924c6a98", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Text over a Heatmap\n", + "-------------------\n", + "\n", + "An example of a layered chart of text over a heatmap using the cars dataset.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "# Configure common options\n", + "base = alt.Chart(source).transform_aggregate(\n", + " num_cars='count()',\n", + " groupby=['Origin', 'Cylinders']\n", + ").encode(\n", + " alt.X('Cylinders:O', scale=alt.Scale(paddingInner=0)),\n", + " alt.Y('Origin:O', scale=alt.Scale(paddingInner=0)),\n", + ")\n", + "\n", + "# Configure heatmap\n", + "heatmap = base.mark_rect().encode(\n", + " color=alt.Color('num_cars:Q',\n", + " scale=alt.Scale(scheme='viridis'),\n", + " legend=alt.Legend(direction='horizontal')\n", + " )\n", + ")\n", + "\n", + "# Configure text\n", + "text = base.mark_text(baseline='middle').encode(\n", + " text='num_cars:Q',\n", + " color=alt.condition(\n", + " alt.datum.num_cars > 100,\n", + " alt.value('black'),\n", + " alt.value('white')\n", + " )\n", + ")\n", + "\n", + "# Draw the chart\n", + "heatmap + text" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/layered_histogram.ipynb b/doc/jupyterlite/files/layered_histogram.ipynb new file mode 100644 index 000000000..99abef955 --- /dev/null +++ b/doc/jupyterlite/files/layered_histogram.ipynb @@ -0,0 +1,68 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "35e9413f", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7f7d1ba9", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Layered Histogram\n", + "=================\n", + "This example shows how to use opacity to make a layered histogram in Altair.\n", + "\"\"\"\n", + "# category: histograms\n", + "import pandas as pd\n", + "import altair as alt\n", + "import numpy as np\n", + "np.random.seed(42)\n", + "\n", + "# Generating Data\n", + "source = pd.DataFrame({\n", + " 'Trial A': np.random.normal(0, 0.8, 1000),\n", + " 'Trial B': np.random.normal(-2, 1, 1000),\n", + " 'Trial C': np.random.normal(3, 2, 1000)\n", + "})\n", + "\n", + "alt.Chart(source).transform_fold(\n", + " ['Trial A', 'Trial B', 'Trial C'],\n", + " as_=['Experiment', 'Measurement']\n", + ").mark_bar(\n", + " opacity=0.3,\n", + " binSpacing=0\n", + ").encode(\n", + " alt.X('Measurement:Q', bin=alt.Bin(maxbins=100)),\n", + " alt.Y('count()', stack=None),\n", + " alt.Color('Experiment:N')\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/line_chart_with_color_datum.ipynb b/doc/jupyterlite/files/line_chart_with_color_datum.ipynb new file mode 100644 index 000000000..3ebbccb7a --- /dev/null +++ b/doc/jupyterlite/files/line_chart_with_color_datum.ipynb @@ -0,0 +1,60 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "5fccee34", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a44e072e", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Line Chart with datum for color\n", + "-------------------------------\n", + "An example of using ``datum`` and ``repeat`` to color a multi-series line chart.\n", + "This is adapted from this corresponding Vega-Lite Example:\n", + "`Repeat and Layer to Show Different Movie Measures `_.\n", + "\"\"\"\n", + "# category: line charts\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.movies()\n", + "\n", + "alt.Chart(source).mark_line().encode(\n", + " x=alt.X(\"IMDB_Rating\", bin=True),\n", + " y=alt.Y(\n", + " alt.repeat(\"layer\"), aggregate=\"mean\", title=\"Mean of US and Worldwide Gross\"\n", + " ),\n", + " color=alt.datum(alt.repeat(\"layer\")),\n", + ").repeat(layer=[\"US_Gross\", \"Worldwide_Gross\"])" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/line_chart_with_cumsum.ipynb b/doc/jupyterlite/files/line_chart_with_cumsum.ipynb new file mode 100644 index 000000000..aa9a0ae12 --- /dev/null +++ b/doc/jupyterlite/files/line_chart_with_cumsum.ipynb @@ -0,0 +1,63 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "cd7546a3", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4afe4382", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Line Chart with Cumulative Sum\n", + "------------------------------\n", + "This chart creates a simple line chart from the cumulative sum of a fields.\n", + "\"\"\"\n", + "# category: line charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.wheat()\n", + "\n", + "alt.Chart(source).mark_line().transform_window(\n", + " # Sort the data chronologically\n", + " sort=[{'field': 'year'}],\n", + " # Include all previous records before the current record and none after\n", + " # (This is the default value so you could skip it and it would still work.)\n", + " frame=[None, 0],\n", + " # What to add up as you go\n", + " cumulative_wheat='sum(wheat)'\n", + ").encode(\n", + " x='year:O',\n", + " # Plot the calculated field created by the transformation\n", + " y='cumulative_wheat:Q'\n", + ").properties(width=600)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/line_chart_with_datum.ipynb b/doc/jupyterlite/files/line_chart_with_datum.ipynb new file mode 100644 index 000000000..3cfe313b1 --- /dev/null +++ b/doc/jupyterlite/files/line_chart_with_datum.ipynb @@ -0,0 +1,71 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "6f6c1fe4", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "221bb7c8", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Line Chart with datum\n", + "---------------------------------\n", + "An example of using ``datum`` to highlight certain values, including a ``DateTime`` value.\n", + "This is adapted from two corresponding Vega-Lite Examples:\n", + "`Highlight a Specific Value `_.\n", + "\"\"\"\n", + "# category: line charts\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.stocks()\n", + "\n", + "lines = (\n", + " alt.Chart(source)\n", + " .mark_line()\n", + " .encode(x=\"date\", y=\"price\", color=\"symbol\")\n", + ")\n", + "\n", + "xrule = (\n", + " alt.Chart()\n", + " .mark_rule(color=\"cyan\", strokeWidth=2)\n", + " .encode(x=alt.datum(alt.DateTime(year=2006, month=\"November\")))\n", + ")\n", + "\n", + "yrule = (\n", + " alt.Chart().mark_rule(strokeDash=[12, 6], size=2).encode(y=alt.datum(350))\n", + ")\n", + "\n", + "\n", + "lines + yrule + xrule" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/line_chart_with_generator.ipynb b/doc/jupyterlite/files/line_chart_with_generator.ipynb new file mode 100644 index 000000000..c22563b44 --- /dev/null +++ b/doc/jupyterlite/files/line_chart_with_generator.ipynb @@ -0,0 +1,60 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "058911cc", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "967af987", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Line Chart with Sequence Generator\n", + "----------------------------------\n", + "This examples shows how to create multiple lines using the sequence generator.\n", + "\"\"\"\n", + "# category: line charts\n", + "\n", + "import altair as alt\n", + "\n", + "source = alt.sequence(start=0, stop=12.7, step=0.1, as_='x')\n", + "\n", + "alt.Chart(source).mark_line().transform_calculate(\n", + " sin='sin(datum.x)',\n", + " cos='cos(datum.x)'\n", + ").transform_fold(\n", + " ['sin', 'cos']\n", + ").encode(\n", + " x='x:Q', \n", + " y='value:Q', \n", + " color='key:N'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/line_chart_with_points.ipynb b/doc/jupyterlite/files/line_chart_with_points.ipynb new file mode 100644 index 000000000..1b2d668fe --- /dev/null +++ b/doc/jupyterlite/files/line_chart_with_points.ipynb @@ -0,0 +1,63 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "afdfa59f", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "daac5073", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Line Chart with Points\n", + "----------------------\n", + "This chart shows a simple line chart with points marking each value. Use\n", + "``point=True`` for points with default appearance or customize it with\n", + "``OverlayMarkDef()``.\n", + "\"\"\"\n", + "# category: line charts\n", + "import altair as alt\n", + "import numpy as np\n", + "import pandas as pd\n", + "\n", + "x = np.arange(100)\n", + "source = pd.DataFrame({\n", + " 'x': x,\n", + " 'f(x)': np.sin(x / 5)\n", + "})\n", + "\n", + "alt.Chart(source).mark_line(\n", + " point=alt.OverlayMarkDef(color=\"red\")\n", + ").encode(\n", + " x='x',\n", + " y='f(x)'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/line_percent.ipynb b/doc/jupyterlite/files/line_percent.ipynb new file mode 100644 index 000000000..c01545733 --- /dev/null +++ b/doc/jupyterlite/files/line_percent.ipynb @@ -0,0 +1,57 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "ff292a63", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4f683fca", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Line Chart with Percent axis\n", + "----------------------------\n", + "This example shows how to format the tick labels of the y-axis of a chart as percentages.\n", + "\"\"\"\n", + "# category: line charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.jobs.url\n", + "\n", + "alt.Chart(source).mark_line().encode(\n", + " alt.X('year:O'),\n", + " alt.Y('perc:Q', axis=alt.Axis(format='%')),\n", + " color='sex:N'\n", + ").transform_filter(\n", + " alt.datum.job == 'Welder'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/line_with_ci.ipynb b/doc/jupyterlite/files/line_with_ci.ipynb new file mode 100644 index 000000000..b83af3f97 --- /dev/null +++ b/doc/jupyterlite/files/line_with_ci.ipynb @@ -0,0 +1,61 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "1b39aec5", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2dd2997f", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Line Chart with Confidence Interval Band\n", + "----------------------------------------\n", + "How to make a line chart with a bootstrapped 95% confidence interval band.\n", + "\"\"\"\n", + "# category: line charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "line = alt.Chart(source).mark_line().encode(\n", + " x='Year',\n", + " y='mean(Miles_per_Gallon)'\n", + ")\n", + "\n", + "band = alt.Chart(source).mark_errorband(extent='ci').encode(\n", + " x='Year',\n", + " y=alt.Y('Miles_per_Gallon', title='Miles/Gallon'),\n", + ")\n", + "\n", + "band + line" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/line_with_log_scale.ipynb b/doc/jupyterlite/files/line_with_log_scale.ipynb new file mode 100644 index 000000000..be3544b1a --- /dev/null +++ b/doc/jupyterlite/files/line_with_log_scale.ipynb @@ -0,0 +1,57 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "629b7f9b", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ee25f1cc", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Line Chart with Logarithmic Scale\n", + "---------------------------------\n", + "How to make a line chart on a `Logarithmic scale `_.\n", + "\"\"\"\n", + "# category: line charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.population()\n", + "\n", + "alt.Chart(source).mark_line().encode(\n", + " x='year:O',\n", + " y=alt.Y(\n", + " 'sum(people)',\n", + " scale=alt.Scale(type=\"log\") # Here the scale is applied\n", + " )\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/london_tube.ipynb b/doc/jupyterlite/files/london_tube.ipynb new file mode 100644 index 000000000..10d02ee69 --- /dev/null +++ b/doc/jupyterlite/files/london_tube.ipynb @@ -0,0 +1,98 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "b29f1ebe", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1887b587", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "London Tube Lines\n", + "=================\n", + "This example shows the London tube lines against the background of the\n", + "borough boundaries. It is based on the vega-lite example at\n", + "https://vega.github.io/vega-lite/examples/geo_layer_line_london.html.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "boroughs = alt.topo_feature(data.londonBoroughs.url, 'boroughs')\n", + "tubelines = alt.topo_feature(data.londonTubeLines.url, 'line')\n", + "centroids = data.londonCentroids.url\n", + "\n", + "background = alt.Chart(boroughs).mark_geoshape(\n", + " stroke='white',\n", + " strokeWidth=2\n", + ").encode(\n", + " color=alt.value('#eee'),\n", + ").properties(\n", + " width=700,\n", + " height=500\n", + ")\n", + "\n", + "labels = alt.Chart(centroids).mark_text().encode(\n", + " longitude='cx:Q',\n", + " latitude='cy:Q',\n", + " text='bLabel:N',\n", + " size=alt.value(8),\n", + " opacity=alt.value(0.6)\n", + ").transform_calculate(\n", + " \"bLabel\", \"indexof (datum.name,' ') > 0 ? substring(datum.name,0,indexof(datum.name, ' ')) : datum.name\"\n", + ")\n", + "\n", + "line_scale = alt.Scale(domain=[\"Bakerloo\", \"Central\", \"Circle\", \"District\", \"DLR\",\n", + " \"Hammersmith & City\", \"Jubilee\", \"Metropolitan\", \"Northern\",\n", + " \"Piccadilly\", \"Victoria\", \"Waterloo & City\"],\n", + " range=[\"rgb(137,78,36)\", \"rgb(220,36,30)\", \"rgb(255,206,0)\",\n", + " \"rgb(1,114,41)\", \"rgb(0,175,173)\", \"rgb(215,153,175)\",\n", + " \"rgb(106,114,120)\", \"rgb(114,17,84)\", \"rgb(0,0,0)\",\n", + " \"rgb(0,24,168)\", \"rgb(0,160,226)\", \"rgb(106,187,170)\"])\n", + "\n", + "lines = alt.Chart(tubelines).mark_geoshape(\n", + " filled=False,\n", + " strokeWidth=2\n", + ").encode(\n", + " alt.Color(\n", + " 'id:N',\n", + " legend=alt.Legend(\n", + " title=None,\n", + " orient='bottom-right',\n", + " offset=0\n", + " ),\n", + " scale=line_scale\n", + " )\n", + ")\n", + "\n", + "background + labels + lines" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/multi_series_line.ipynb b/doc/jupyterlite/files/multi_series_line.ipynb new file mode 100644 index 000000000..c6e169b39 --- /dev/null +++ b/doc/jupyterlite/files/multi_series_line.ipynb @@ -0,0 +1,57 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "da5370d5", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c2f689e0", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Multi Series Line Chart\n", + "-----------------------\n", + "\n", + "This example shows how to make a multi series line chart of the daily closing stock prices for AAPL, AMZN, GOOG, IBM, and MSFT between 2000 and 2010.\n", + "\"\"\"\n", + "# category: line charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.stocks()\n", + "\n", + "alt.Chart(source).mark_line().encode(\n", + " x='date',\n", + " y='price',\n", + " color='symbol',\n", + " strokeDash='symbol',\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/multifeature_scatter_plot.ipynb b/doc/jupyterlite/files/multifeature_scatter_plot.ipynb new file mode 100644 index 000000000..28421d832 --- /dev/null +++ b/doc/jupyterlite/files/multifeature_scatter_plot.ipynb @@ -0,0 +1,56 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "791f6722", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "34450e5a", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Multifeature Scatter Plot\n", + "=========================\n", + "This example shows how to make a scatter plot with multiple feature encodings.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.iris()\n", + "\n", + "alt.Chart(source).mark_circle().encode(\n", + " alt.X('sepalLength', scale=alt.Scale(zero=False)),\n", + " alt.Y('sepalWidth', scale=alt.Scale(zero=False, padding=1)),\n", + " color='species',\n", + " size='petalWidth'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/multiline_highlight.ipynb b/doc/jupyterlite/files/multiline_highlight.ipynb new file mode 100644 index 000000000..abee0e240 --- /dev/null +++ b/doc/jupyterlite/files/multiline_highlight.ipynb @@ -0,0 +1,75 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "51d5b73a", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9dc2b624", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Multi-Line Highlight\n", + "====================\n", + "This multi-line chart uses an invisible Voronoi tessellation to handle mouseover to\n", + "identify the nearest point and then highlight the line on which the point falls.\n", + "It is adapted from the Vega-Lite example found at\n", + "https://bl.ocks.org/amitkaps/fe4238e716db53930b2f1a70d3401701\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.stocks()\n", + "\n", + "highlight = alt.selection(type='single', on='mouseover',\n", + " fields=['symbol'], nearest=True)\n", + "\n", + "base = alt.Chart(source).encode(\n", + " x='date:T',\n", + " y='price:Q',\n", + " color='symbol:N'\n", + ")\n", + "\n", + "points = base.mark_circle().encode(\n", + " opacity=alt.value(0)\n", + ").add_selection(\n", + " highlight\n", + ").properties(\n", + " width=600\n", + ")\n", + "\n", + "lines = base.mark_line().encode(\n", + " size=alt.condition(~highlight, alt.value(1), alt.value(3))\n", + ")\n", + "\n", + "points + lines" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/multiline_tooltip.ipynb b/doc/jupyterlite/files/multiline_tooltip.ipynb new file mode 100644 index 000000000..aab4d19df --- /dev/null +++ b/doc/jupyterlite/files/multiline_tooltip.ipynb @@ -0,0 +1,106 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "e449beda", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bad9c4db", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Multi-Line Tooltip\n", + "==================\n", + "This example shows how you can use selections and layers to create a\n", + "tooltip-like behavior tied to the x position of the cursor.\n", + "If you are looking for more standard tooltips, it is recommended to use the\n", + "tooltip encoding channel as shown in the\n", + "`Scatter Plot With Tooltips `_\n", + "example.\n", + "\n", + "The following example employs a little trick to isolate the x-position of the\n", + "cursor: we add some transparent points with only an x encoding (no y encoding)\n", + "and tie a *nearest* selection to these, tied to the \"x\" field.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "import pandas as pd\n", + "import numpy as np\n", + "\n", + "np.random.seed(42)\n", + "source = pd.DataFrame(np.cumsum(np.random.randn(100, 3), 0).round(2),\n", + " columns=['A', 'B', 'C'], index=pd.RangeIndex(100, name='x'))\n", + "source = source.reset_index().melt('x', var_name='category', value_name='y')\n", + "\n", + "# Create a selection that chooses the nearest point & selects based on x-value\n", + "nearest = alt.selection(type='single', nearest=True, on='mouseover',\n", + " fields=['x'], empty='none')\n", + "\n", + "# The basic line\n", + "line = alt.Chart(source).mark_line(interpolate='basis').encode(\n", + " x='x:Q',\n", + " y='y:Q',\n", + " color='category:N'\n", + ")\n", + "\n", + "# Transparent selectors across the chart. This is what tells us\n", + "# the x-value of the cursor\n", + "selectors = alt.Chart(source).mark_point().encode(\n", + " x='x:Q',\n", + " opacity=alt.value(0),\n", + ").add_selection(\n", + " nearest\n", + ")\n", + "\n", + "# Draw points on the line, and highlight based on selection\n", + "points = line.mark_point().encode(\n", + " opacity=alt.condition(nearest, alt.value(1), alt.value(0))\n", + ")\n", + "\n", + "# Draw text labels near the points, and highlight based on selection\n", + "text = line.mark_text(align='left', dx=5, dy=-5).encode(\n", + " text=alt.condition(nearest, 'y:Q', alt.value(' '))\n", + ")\n", + "\n", + "# Draw a rule at the location of the selection\n", + "rules = alt.Chart(source).mark_rule(color='gray').encode(\n", + " x='x:Q',\n", + ").transform_filter(\n", + " nearest\n", + ")\n", + "\n", + "# Put the five layers into a chart and bind the data\n", + "alt.layer(\n", + " line, selectors, points, rules, text\n", + ").properties(\n", + " width=600, height=300\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/multiple_interactions.ipynb b/doc/jupyterlite/files/multiple_interactions.ipynb new file mode 100644 index 000000000..babdcba12 --- /dev/null +++ b/doc/jupyterlite/files/multiple_interactions.ipynb @@ -0,0 +1,129 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "cbea7525", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4db81a93", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Multiple Interactions\n", + "=====================\n", + "This example shows how multiple user inputs can be layered onto a chart. The four inputs have functionality as follows:\n", + "\n", + "* Dropdown: Filters the movies by genre\n", + "* Radio Buttons: Highlights certain films by Worldwide Gross\n", + "* Mouse Drag and Scroll: Zooms the x and y scales to allow for panning.\n", + "\n", + "\n", + "\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "movies = alt.UrlData(\n", + " data.movies.url,\n", + " format=alt.DataFormat(parse={\"Release_Date\":\"date\"})\n", + ")\n", + "ratings = ['G', 'NC-17', 'PG', 'PG-13', 'R']\n", + "genres = ['Action', 'Adventure', 'Black Comedy', 'Comedy',\n", + " 'Concert/Performance', 'Documentary', 'Drama', 'Horror', 'Musical',\n", + " 'Romantic Comedy', 'Thriller/Suspense', 'Western']\n", + "\n", + "base = alt.Chart(movies, width=200, height=200).mark_point(filled=True).transform_calculate(\n", + " Rounded_IMDB_Rating = \"floor(datum.IMDB_Rating)\",\n", + " Hundred_Million_Production = \"datum.Production_Budget > 100000000.0 ? 100 : 10\",\n", + " Release_Year = \"year(datum.Release_Date)\"\n", + ").transform_filter(\n", + " alt.datum.IMDB_Rating > 0\n", + ").transform_filter(\n", + " alt.FieldOneOfPredicate(field='MPAA_Rating', oneOf=ratings)\n", + ").encode(\n", + " x=alt.X('Worldwide_Gross:Q', scale=alt.Scale(domain=(100000,10**9), clamp=True)),\n", + " y='IMDB_Rating:Q',\n", + " tooltip=\"Title:N\"\n", + ")\n", + "\n", + "# A slider filter\n", + "year_slider = alt.binding_range(min=1969, max=2018, step=1)\n", + "slider_selection = alt.selection_single(bind=year_slider, fields=['Release_Year'], name=\"Release Year_\")\n", + "\n", + "\n", + "filter_year = base.add_selection(\n", + " slider_selection\n", + ").transform_filter(\n", + " slider_selection\n", + ").properties(title=\"Slider Filtering\")\n", + "\n", + "# A dropdown filter\n", + "genre_dropdown = alt.binding_select(options=genres)\n", + "genre_select = alt.selection_single(fields=['Major_Genre'], bind=genre_dropdown, name=\"Genre\")\n", + "\n", + "filter_genres = base.add_selection(\n", + " genre_select\n", + ").transform_filter(\n", + " genre_select\n", + ").properties(title=\"Dropdown Filtering\")\n", + "\n", + "#color changing marks\n", + "rating_radio = alt.binding_radio(options=ratings)\n", + "\n", + "rating_select = alt.selection_single(fields=['MPAA_Rating'], bind=rating_radio, name=\"Rating\")\n", + "rating_color_condition = alt.condition(rating_select,\n", + " alt.Color('MPAA_Rating:N', legend=None),\n", + " alt.value('lightgray'))\n", + "\n", + "highlight_ratings = base.add_selection(\n", + " rating_select\n", + ").encode(\n", + " color=rating_color_condition\n", + ").properties(title=\"Radio Button Highlighting\")\n", + "\n", + "# Boolean selection for format changes\n", + "input_checkbox = alt.binding_checkbox()\n", + "checkbox_selection = alt.selection_single(bind=input_checkbox, name=\"Big Budget Films\")\n", + "\n", + "size_checkbox_condition = alt.condition(checkbox_selection,\n", + " alt.SizeValue(25),\n", + " alt.Size('Hundred_Million_Production:Q')\n", + " )\n", + "\n", + "budget_sizing = base.add_selection(\n", + " checkbox_selection\n", + ").encode(\n", + " size=size_checkbox_condition\n", + ").properties(title=\"Checkbox Formatting\")\n", + "\n", + "( filter_year | filter_genres) & (highlight_ratings | budget_sizing )" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/multiple_marks.ipynb b/doc/jupyterlite/files/multiple_marks.ipynb new file mode 100644 index 000000000..2525ec0b9 --- /dev/null +++ b/doc/jupyterlite/files/multiple_marks.ipynb @@ -0,0 +1,56 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "db7531ef", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3352d8dd", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Multiple Marks\n", + "==============\n", + "This example demonstrates creating a single chart with multiple markers\n", + "representing the same data.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.stocks()\n", + "\n", + "alt.Chart(source).mark_line(point=True).encode(\n", + " x='date:T',\n", + " y='price:Q',\n", + " color='symbol:N'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/natural_disasters.ipynb b/doc/jupyterlite/files/natural_disasters.ipynb new file mode 100644 index 000000000..9a707012a --- /dev/null +++ b/doc/jupyterlite/files/natural_disasters.ipynb @@ -0,0 +1,68 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "b2ef1651", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "07f16166", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Natural Disasters\n", + "-----------------\n", + "This example shows a visualization of global deaths from natural disasters.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.disasters.url\n", + "\n", + "alt.Chart(source).mark_circle(\n", + " opacity=0.8,\n", + " stroke='black',\n", + " strokeWidth=1\n", + ").encode(\n", + " alt.X('Year:O', axis=alt.Axis(labelAngle=0)),\n", + " alt.Y('Entity:N'),\n", + " alt.Size('Deaths:Q',\n", + " scale=alt.Scale(range=[0, 4000]),\n", + " legend=alt.Legend(title='Annual Global Deaths')\n", + " ),\n", + " alt.Color('Entity:N', legend=None)\n", + ").properties(\n", + " width=450,\n", + " height=320\n", + ").transform_filter(\n", + " alt.datum.Entity != 'All natural disasters'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/normalized_stacked_area_chart.ipynb b/doc/jupyterlite/files/normalized_stacked_area_chart.ipynb new file mode 100644 index 000000000..33d75c150 --- /dev/null +++ b/doc/jupyterlite/files/normalized_stacked_area_chart.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "e00dc65c", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "43118995", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Normalized Stacked Area Chart\n", + "-----------------------------\n", + "This example shows how to make a normalized stacked area chart.\n", + "\"\"\"\n", + "# category: area charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.iowa_electricity()\n", + "\n", + "alt.Chart(source).mark_area().encode(\n", + " x=\"year:T\",\n", + " y=alt.Y(\"net_generation:Q\", stack=\"normalize\"),\n", + " color=\"source:N\"\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/normalized_stacked_bar_chart.ipynb b/doc/jupyterlite/files/normalized_stacked_bar_chart.ipynb new file mode 100644 index 000000000..b2c643707 --- /dev/null +++ b/doc/jupyterlite/files/normalized_stacked_bar_chart.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "ff450abb", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5b0f6a48", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Normalized Stacked Bar Chart\n", + "----------------------------\n", + "This is an example of a normalized stacked bar chart using data which contains crop yields over different regions and different years in the 1930s.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x=alt.X('sum(yield)', stack=\"normalize\"),\n", + " y='variety',\n", + " color='site'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/normed_parallel_coordinates.ipynb b/doc/jupyterlite/files/normed_parallel_coordinates.ipynb new file mode 100644 index 000000000..ee7d14a1a --- /dev/null +++ b/doc/jupyterlite/files/normed_parallel_coordinates.ipynb @@ -0,0 +1,80 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "51e3da73", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "507efa06", + "metadata": { + "lines_to_next_cell": 3 + }, + "outputs": [], + "source": [ + "\"\"\"\n", + "Normalized Parallel Coordinates Example\n", + "---------------------------------------\n", + "A `Parallel Coordinates `_\n", + "chart is a chart that lets you visualize the individual data points by drawing\n", + "a single line for each of them.\n", + "\n", + "Such a chart can be created in Altair by first transforming the data into a\n", + "suitable representation.\n", + "\n", + "This example shows a modified parallel coordinates chart with the Iris dataset,\n", + "where the y-axis shows the value after min-max rather than the raw value. It's a\n", + "simplified Altair version of `the VegaLite version `_\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "from altair import datum\n", + "\n", + "source = data.iris()\n", + "\n", + "alt.Chart(source).transform_window(\n", + " index='count()'\n", + ").transform_fold(\n", + " ['petalLength', 'petalWidth', 'sepalLength', 'sepalWidth']\n", + ").transform_joinaggregate(\n", + " min='min(value)', \n", + " max='max(value)',\n", + " groupby=['key']\n", + ").transform_calculate(\n", + " minmax_value=(datum.value-datum.min)/(datum.max-datum.min), \n", + " mid=(datum.min+datum.max)/2\n", + ").mark_line().encode(\n", + " x='key:N',\n", + " y='minmax_value:Q',\n", + " color='species:N',\n", + " detail='index:N',\n", + " opacity=alt.value(0.5)\n", + ").properties(width=500)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/one_dot_per_zipcode.ipynb b/doc/jupyterlite/files/one_dot_per_zipcode.ipynb new file mode 100644 index 000000000..7ceacf699 --- /dev/null +++ b/doc/jupyterlite/files/one_dot_per_zipcode.ipynb @@ -0,0 +1,64 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "30de3228", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2d14c35d", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "One Dot Per Zipcode\n", + "-----------------------\n", + "This example shows a geographical plot with one dot per zipcode.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "# Since the data is more than 5,000 rows we'll import it from a URL\n", + "source = data.zipcodes.url\n", + "\n", + "alt.Chart(source).transform_calculate(\n", + " \"leading digit\", alt.expr.substring(alt.datum.zip_code, 0, 1)\n", + ").mark_circle(size=3).encode(\n", + " longitude='longitude:Q',\n", + " latitude='latitude:Q',\n", + " color='leading digit:N',\n", + " tooltip='zip_code:N'\n", + ").project(\n", + " type='albersUsa'\n", + ").properties(\n", + " width=650,\n", + " height=400\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/pacman_chart.ipynb b/doc/jupyterlite/files/pacman_chart.ipynb new file mode 100644 index 000000000..96ee9443e --- /dev/null +++ b/doc/jupyterlite/files/pacman_chart.ipynb @@ -0,0 +1,56 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c6ae208f", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1d18faca", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Pacman Chart\n", + "------------\n", + "Chart made using ``mark_arc`` and constant values.\n", + "This could also be made using \n", + "``alt.Chart(source).mark_arc(color = \"gold\", theta = (5/8)*np.pi, theta2 = (19/8)*np.pi,radius=100)``.\n", + "\"\"\"\n", + "# category: circular plots\n", + "\n", + "import numpy as np\n", + "import altair as alt\n", + "\n", + "alt.Chart().mark_arc(color=\"gold\").encode(\n", + " theta=alt.datum((5 / 8) * np.pi, scale=None),\n", + " theta2=alt.datum((19 / 8) * np.pi),\n", + " radius=alt.datum(100, scale=None),\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/parallel_coordinates.ipynb b/doc/jupyterlite/files/parallel_coordinates.ipynb new file mode 100644 index 000000000..7d5448fa0 --- /dev/null +++ b/doc/jupyterlite/files/parallel_coordinates.ipynb @@ -0,0 +1,67 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "6f4bfbca", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8ae7611d", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Parallel Coordinates Example\n", + "----------------------------\n", + "A `Parallel Coordinates `_\n", + "chart is a chart that lets you visualize the individual data points by drawing\n", + "a single line for each of them.\n", + "Such a chart can be created in Altair by first transforming the data into a\n", + "suitable representation.\n", + "This example shows a parallel coordinates chart with the Iris dataset.\n", + "\"\"\"\n", + "# category: other charts\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.iris()\n", + "\n", + "alt.Chart(source).transform_window(\n", + " index='count()' \n", + ").transform_fold(\n", + " ['petalLength', 'petalWidth', 'sepalLength', 'sepalWidth']\n", + ").mark_line().encode(\n", + " x='key:N',\n", + " y='value:Q',\n", + " color='species:N',\n", + " detail='index:N',\n", + " opacity=alt.value(0.5)\n", + ").properties(width=500)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/percentage_of_total.ipynb b/doc/jupyterlite/files/percentage_of_total.ipynb new file mode 100644 index 000000000..9a316c8a0 --- /dev/null +++ b/doc/jupyterlite/files/percentage_of_total.ipynb @@ -0,0 +1,60 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "203e6c29", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cae82cc6", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Calculating Percentage of Total\n", + "-------------------------------\n", + "This chart demonstrates how to use a joinaggregate transform to display\n", + "data values as a percentage of total.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame({'Activity': ['Sleeping', 'Eating', 'TV', 'Work', 'Exercise'],\n", + " 'Time': [8, 2, 4, 8, 2]})\n", + "\n", + "alt.Chart(source).transform_joinaggregate(\n", + " TotalTime='sum(Time)',\n", + ").transform_calculate(\n", + " PercentOfTotal=\"datum.Time / datum.TotalTime\"\n", + ").mark_bar().encode(\n", + " alt.X('PercentOfTotal:Q', axis=alt.Axis(format='.0%')),\n", + " y='Activity:N'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/pie_chart.ipynb b/doc/jupyterlite/files/pie_chart.ipynb new file mode 100644 index 000000000..0fb49d113 --- /dev/null +++ b/doc/jupyterlite/files/pie_chart.ipynb @@ -0,0 +1,57 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c314a332", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c8c51454", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Pie Chart\n", + "---------\n", + "This example shows how to make a Pie Chart using ``mark_arc``.\n", + "This is adapted from a corresponding Vega-Lite Example:\n", + "`Pie Chart `_.\n", + "\"\"\"\n", + "# category: circular plots\n", + "\n", + "import pandas as pd\n", + "import altair as alt\n", + "\n", + "source = pd.DataFrame({\"category\": [1, 2, 3, 4, 5, 6], \"value\": [4, 6, 10, 3, 7, 8]})\n", + "\n", + "alt.Chart(source).mark_arc().encode(\n", + " theta=alt.Theta(field=\"value\", type=\"quantitative\"),\n", + " color=alt.Color(field=\"category\", type=\"nominal\"),\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/pie_chart_with_labels.ipynb b/doc/jupyterlite/files/pie_chart_with_labels.ipynb new file mode 100644 index 000000000..e03bf753c --- /dev/null +++ b/doc/jupyterlite/files/pie_chart_with_labels.ipynb @@ -0,0 +1,63 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "2e32a83b", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "135ee5ec", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Pie Chart with Labels\n", + "---------------------\n", + "This example shows how to layer text over arc marks (``mark_arc``) to label pie charts.\n", + "This is adapted from a corresponding Vega-Lite Example:\n", + "`Pie Chart with Labels `_.\n", + "\"\"\"\n", + "# category: circular plots\n", + "\n", + "import pandas as pd\n", + "import altair as alt\n", + "\n", + "source = pd.DataFrame(\n", + " {\"category\": [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\"], \"value\": [4, 6, 10, 3, 7, 8]}\n", + ")\n", + "\n", + "base = alt.Chart(source).encode(\n", + " theta=alt.Theta(\"value:Q\", stack=True), color=alt.Color(\"category:N\", legend=None)\n", + ")\n", + "\n", + "pie = base.mark_arc(outerRadius=120)\n", + "text = base.mark_text(radius=140, size=20).encode(text=\"category:N\")\n", + "\n", + "pie + text" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/poly_fit_regression.ipynb b/doc/jupyterlite/files/poly_fit_regression.ipynb new file mode 100644 index 000000000..4b81a8ee1 --- /dev/null +++ b/doc/jupyterlite/files/poly_fit_regression.ipynb @@ -0,0 +1,75 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "ae0ca7c1", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7dc9afc8", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Polynomial Fit Plot with Regression Transform\n", + "=============================================\n", + "This example shows how to overlay data with multiple fitted polynomials using\n", + "the regression transform.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "\n", + "import numpy as np\n", + "import pandas as pd\n", + "import altair as alt\n", + "\n", + "# Generate some random data\n", + "rng = np.random.RandomState(1)\n", + "x = rng.rand(40) ** 2\n", + "y = 10 - 1.0 / (x + 0.1) + rng.randn(40)\n", + "source = pd.DataFrame({\"x\": x, \"y\": y})\n", + "\n", + "# Define the degree of the polynomial fits\n", + "degree_list = [1, 3, 5]\n", + "\n", + "base = alt.Chart(source).mark_circle(color=\"black\").encode(\n", + " alt.X(\"x\"), alt.Y(\"y\")\n", + ")\n", + "\n", + "polynomial_fit = [\n", + " base.transform_regression(\n", + " \"x\", \"y\", method=\"poly\", order=order, as_=[\"x\", str(order)]\n", + " )\n", + " .mark_line()\n", + " .transform_fold([str(order)], as_=[\"degree\", \"y\"])\n", + " .encode(alt.Color(\"degree:N\"))\n", + " for order in degree_list\n", + "]\n", + "\n", + "alt.layer(base, *polynomial_fit)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/pyramid.ipynb b/doc/jupyterlite/files/pyramid.ipynb new file mode 100644 index 000000000..d1b145bbc --- /dev/null +++ b/doc/jupyterlite/files/pyramid.ipynb @@ -0,0 +1,58 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "e177764e", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8ab4fbd8", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Pyramid Pie Chart\n", + "-----------------\n", + "Altair reproduction of http://robslink.com/SAS/democd91/pyramid_pie.htm\n", + "\"\"\"\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "category = ['Sky', 'Shady side of a pyramid', 'Sunny side of a pyramid']\n", + "color = [\"#416D9D\", \"#674028\", \"#DEAC58\"]\n", + "df = pd.DataFrame({'category': category, 'value': [75, 10, 15]})\n", + "\n", + "alt.Chart(df).mark_arc(outerRadius=80).encode(\n", + " alt.Theta('value:Q', scale=alt.Scale(range=[2.356, 8.639])),\n", + " alt.Color('category:N',\n", + " scale=alt.Scale(domain=category, range=color),\n", + " legend=alt.Legend(title=None, orient='none', legendX=160, legendY=50)),\n", + " order='value:Q'\n", + ").properties(width=150, height=150).configure_view(strokeOpacity=0)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/radial_chart.ipynb b/doc/jupyterlite/files/radial_chart.ipynb new file mode 100644 index 000000000..1455c4370 --- /dev/null +++ b/doc/jupyterlite/files/radial_chart.ipynb @@ -0,0 +1,64 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "ee66f6f1", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c60be8b9", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Radial Chart\n", + "------------\n", + "This radial plot uses both angular and radial extent to convey multiple dimensions of data.\n", + "This is adapted from a corresponding Vega-Lite Example:\n", + "`Radial Plot `_.\n", + "\"\"\"\n", + "# category: circular plots\n", + "\n", + "import pandas as pd\n", + "import altair as alt\n", + "\n", + "source = pd.DataFrame({\"values\": [12, 23, 47, 6, 52, 19]})\n", + "\n", + "base = alt.Chart(source).encode(\n", + " theta=alt.Theta(\"values:Q\", stack=True),\n", + " radius=alt.Radius(\"values\", scale=alt.Scale(type=\"sqrt\", zero=True, rangeMin=20)),\n", + " color=\"values:N\",\n", + ")\n", + "\n", + "c1 = base.mark_arc(innerRadius=20, stroke=\"#fff\")\n", + "\n", + "c2 = base.mark_text(radiusOffset=10).encode(text=\"values:Q\")\n", + "\n", + "c1 + c2" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/ranged_dot_plot.ipynb b/doc/jupyterlite/files/ranged_dot_plot.ipynb new file mode 100644 index 000000000..c363e5beb --- /dev/null +++ b/doc/jupyterlite/files/ranged_dot_plot.ipynb @@ -0,0 +1,82 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "aad04f0a", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2e532b30", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Ranged Dot Plot\n", + "-----------------\n", + "This example shows a ranged dot plot that uses 'layer' to convey changing life expectancy for the five most populous countries (between 1955 and 2000).\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.countries.url\n", + "\n", + "chart = alt.layer(\n", + " data=source\n", + ").transform_filter(\n", + " filter={\"field\": 'country',\n", + " \"oneOf\": [\"China\", \"India\", \"United States\", \"Indonesia\", \"Brazil\"]}\n", + ").transform_filter(\n", + " filter={'field': 'year',\n", + " \"oneOf\": [1955, 2000]}\n", + ")\n", + "\n", + "chart += alt.Chart().mark_line(color='#db646f').encode(\n", + " x='life_expect:Q',\n", + " y='country:N',\n", + " detail='country:N'\n", + ")\n", + "# Add points for life expectancy in 1955 & 2000\n", + "chart += alt.Chart().mark_point(\n", + " size=100,\n", + " opacity=1,\n", + " filled=True\n", + ").encode(\n", + " x='life_expect:Q',\n", + " y='country:N',\n", + " color=alt.Color('year:O',\n", + " scale=alt.Scale(\n", + " domain=['1955', '2000'],\n", + " range=['#e6959c', '#911a24']\n", + " )\n", + " )\n", + ").interactive()\n", + "\n", + "chart" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/ridgeline_plot.ipynb b/doc/jupyterlite/files/ridgeline_plot.ipynb new file mode 100644 index 000000000..9160720fd --- /dev/null +++ b/doc/jupyterlite/files/ridgeline_plot.ipynb @@ -0,0 +1,102 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "7f1b4ad6", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f2b6b1c3", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Ridgeline plot Example\n", + "----------------------\n", + "A `Ridgeline plot `_\n", + "chart is a chart that lets you visualize distribution of a numeric value for \n", + "several groups.\n", + "\n", + "Such a chart can be created in Altair by first transforming the data into a\n", + "suitable representation.\n", + "\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.seattle_weather.url\n", + "\n", + "step = 20\n", + "overlap = 1\n", + "\n", + "alt.Chart(source, height=step).transform_timeunit(\n", + " Month='month(date)'\n", + ").transform_joinaggregate(\n", + " mean_temp='mean(temp_max)', groupby=['Month']\n", + ").transform_bin(\n", + " ['bin_max', 'bin_min'], 'temp_max'\n", + ").transform_aggregate(\n", + " value='count()', groupby=['Month', 'mean_temp', 'bin_min', 'bin_max']\n", + ").transform_impute(\n", + " impute='value', groupby=['Month', 'mean_temp'], key='bin_min', value=0\n", + ").mark_area(\n", + " interpolate='monotone',\n", + " fillOpacity=0.8,\n", + " stroke='lightgray',\n", + " strokeWidth=0.5\n", + ").encode(\n", + " alt.X('bin_min:Q', bin='binned', title='Maximum Daily Temperature (C)'),\n", + " alt.Y(\n", + " 'value:Q',\n", + " scale=alt.Scale(range=[step, -step * overlap]),\n", + " axis=None\n", + " ),\n", + " alt.Fill(\n", + " 'mean_temp:Q',\n", + " legend=None,\n", + " scale=alt.Scale(domain=[30, 5], scheme='redyellowblue')\n", + " )\n", + ").facet(\n", + " row=alt.Row(\n", + " 'Month:T',\n", + " title=None,\n", + " header=alt.Header(labelAngle=0, labelAlign='right', format='%B')\n", + " )\n", + ").properties(\n", + " title='Seattle Weather',\n", + " bounds='flush'\n", + ").configure_facet(\n", + " spacing=0\n", + ").configure_view(\n", + " stroke=None\n", + ").configure_title(\n", + " anchor='end'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/scatter_href.ipynb b/doc/jupyterlite/files/scatter_href.ipynb new file mode 100644 index 000000000..cd09be91d --- /dev/null +++ b/doc/jupyterlite/files/scatter_href.ipynb @@ -0,0 +1,62 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "48a613d6", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "521314f6", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Scatter Plot with Href\n", + "----------------------\n", + "This example shows a scatter plot with an ``href`` encoding constructed from\n", + "the car name. With this encoding, you can click on any of the points to open\n", + "a google search for the car name.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "alt.Chart(source).transform_calculate(\n", + " url='https://www.google.com/search?q=' + alt.datum.Name\n", + ").mark_point().encode(\n", + " x='Horsepower:Q',\n", + " y='Miles_per_Gallon:Q',\n", + " color='Origin:N',\n", + " href='url:N',\n", + " tooltip=['Name:N', 'url:N']\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/scatter_linked_brush.ipynb b/doc/jupyterlite/files/scatter_linked_brush.ipynb new file mode 100644 index 000000000..bf17bdcc5 --- /dev/null +++ b/doc/jupyterlite/files/scatter_linked_brush.ipynb @@ -0,0 +1,64 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "b743c609", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4f9b2d3e", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Multi-panel Scatter Plot with Linked Brushing\n", + "---------------------------------------------\n", + "This is an example of using an interval selection to control the color of\n", + "points across multiple panels.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "brush = alt.selection(type='interval', resolve='global')\n", + "\n", + "base = alt.Chart(source).mark_point().encode(\n", + " y='Miles_per_Gallon',\n", + " color=alt.condition(brush, 'Origin', alt.ColorValue('gray')),\n", + ").add_selection(\n", + " brush\n", + ").properties(\n", + " width=250,\n", + " height=250\n", + ")\n", + "\n", + "base.encode(x='Horsepower') | base.encode(x='Acceleration')" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/scatter_linked_table.ipynb b/doc/jupyterlite/files/scatter_linked_table.ipynb new file mode 100644 index 000000000..e1fda2a1e --- /dev/null +++ b/doc/jupyterlite/files/scatter_linked_table.ipynb @@ -0,0 +1,88 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "14144cb1", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b16d79f4", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Brushing Scatter Plot to show data on a table\n", + "---------------------------------------------\n", + "A scatter plot of the cars dataset, with data tables for horsepower, MPG, and origin. \n", + "The tables update to reflect the selection on the scatter plot.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "# Brush for selection\n", + "brush = alt.selection(type='interval')\n", + "\n", + "# Scatter Plot\n", + "points = alt.Chart(source).mark_point().encode(\n", + " x='Horsepower:Q',\n", + " y='Miles_per_Gallon:Q',\n", + " color=alt.condition(brush, 'Cylinders:O', alt.value('grey'))\n", + ").add_selection(brush)\n", + "\n", + "# Base chart for data tables\n", + "ranked_text = alt.Chart(source).mark_text().encode(\n", + " y=alt.Y('row_number:O',axis=None)\n", + ").transform_window(\n", + " row_number='row_number()'\n", + ").transform_filter(\n", + " brush\n", + ").transform_window(\n", + " rank='rank(row_number)'\n", + ").transform_filter(\n", + " alt.datum.rank<20\n", + ")\n", + "\n", + "# Data Tables\n", + "horsepower = ranked_text.encode(text='Horsepower:N').properties(title='Horsepower')\n", + "mpg = ranked_text.encode(text='Miles_per_Gallon:N').properties(title='MPG')\n", + "origin = ranked_text.encode(text='Origin:N').properties(title='Origin')\n", + "text = alt.hconcat(horsepower, mpg, origin) # Combine data tables\n", + "\n", + "# Build chart\n", + "alt.hconcat(\n", + " points,\n", + " text\n", + ").resolve_legend(\n", + " color=\"independent\"\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/scatter_marginal_hist.ipynb b/doc/jupyterlite/files/scatter_marginal_hist.ipynb new file mode 100644 index 000000000..05c0c8660 --- /dev/null +++ b/doc/jupyterlite/files/scatter_marginal_hist.ipynb @@ -0,0 +1,89 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "ff860614", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5a13f68a", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Facetted Scatterplot with marginal histograms\n", + "---------------------------------------------\n", + "This example demonstrates how to generate a facetted scatterplot,\n", + "with marginal facetted histograms, and how to share their respective\n", + "- x,some y-limits.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.iris()\n", + "\n", + "base = alt.Chart(source)\n", + "\n", + "xscale = alt.Scale(domain=(4.0, 8.0))\n", + "yscale = alt.Scale(domain=(1.9, 4.55))\n", + "\n", + "bar_args = {'opacity': .3, 'binSpacing': 0}\n", + "\n", + "points = base.mark_circle().encode(\n", + " alt.X('sepalLength', scale=xscale),\n", + " alt.Y('sepalWidth', scale=yscale),\n", + " color='species',\n", + ")\n", + "\n", + "top_hist = base.mark_bar(**bar_args).encode(\n", + " alt.X('sepalLength:Q',\n", + " # when using bins, the axis scale is set through\n", + " # the bin extent, so we do not specify the scale here\n", + " # (which would be ignored anyway)\n", + " bin=alt.Bin(maxbins=20, extent=xscale.domain),\n", + " stack=None,\n", + " title=''\n", + " ),\n", + " alt.Y('count()', stack=None, title=''),\n", + " alt.Color('species:N'),\n", + ").properties(height=60)\n", + "\n", + "right_hist = base.mark_bar(**bar_args).encode(\n", + " alt.Y('sepalWidth:Q',\n", + " bin=alt.Bin(maxbins=20, extent=yscale.domain),\n", + " stack=None,\n", + " title='',\n", + " ),\n", + " alt.X('count()', stack=None, title=''),\n", + " alt.Color('species:N'),\n", + ").properties(width=60)\n", + "\n", + "top_hist & (points | right_hist)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/scatter_matrix.ipynb b/doc/jupyterlite/files/scatter_matrix.ipynb new file mode 100644 index 000000000..fe66ac6b3 --- /dev/null +++ b/doc/jupyterlite/files/scatter_matrix.ipynb @@ -0,0 +1,62 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "2010b0d3", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "31da6d80", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Scatter Matrix\n", + "--------------\n", + "An example of using a RepeatChart to construct a multi-panel scatter plot\n", + "with linked panning and zooming.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "alt.Chart(source).mark_circle().encode(\n", + " alt.X(alt.repeat(\"column\"), type='quantitative'),\n", + " alt.Y(alt.repeat(\"row\"), type='quantitative'),\n", + " color='Origin:N'\n", + ").properties(\n", + " width=150,\n", + " height=150\n", + ").repeat(\n", + " row=['Horsepower', 'Acceleration', 'Miles_per_Gallon'],\n", + " column=['Miles_per_Gallon', 'Acceleration', 'Horsepower']\n", + ").interactive()" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/scatter_qq.ipynb b/doc/jupyterlite/files/scatter_qq.ipynb new file mode 100644 index 000000000..18777d96b --- /dev/null +++ b/doc/jupyterlite/files/scatter_qq.ipynb @@ -0,0 +1,63 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "d1e6c219", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "98d4f6c5", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Quantile-Quantile Plot\n", + "----------------------\n", + "A quantile-quantile plot comparing input data to theoretical distributions.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.normal_2d.url\n", + "\n", + "base = alt.Chart(source).transform_quantile(\n", + " 'u',\n", + " step=0.01,\n", + " as_ = ['p', 'v']\n", + ").transform_calculate(\n", + " uniform = 'quantileUniform(datum.p)',\n", + " normal = 'quantileNormal(datum.p)'\n", + ").mark_point().encode(\n", + " alt.Y('v:Q')\n", + ")\n", + "\n", + "base.encode(x='uniform:Q') | base.encode(x='normal:Q')" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/scatter_tooltips.ipynb b/doc/jupyterlite/files/scatter_tooltips.ipynb new file mode 100644 index 000000000..7fe818ff9 --- /dev/null +++ b/doc/jupyterlite/files/scatter_tooltips.ipynb @@ -0,0 +1,59 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "e2b2e263", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "177730ce", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Simple Scatter Plot with Tooltips\n", + "---------------------------------\n", + "A scatter plot of the cars dataset, with tooltips showing selected column\n", + "values when you hover over points. We make the points larger so that it is\n", + "easier to hover over them.\n", + "\"\"\"\n", + "# category: simple charts\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "alt.Chart(source).mark_circle(size=60).encode(\n", + " x='Horsepower',\n", + " y='Miles_per_Gallon',\n", + " color='Origin',\n", + " tooltip=['Name', 'Origin', 'Horsepower', 'Miles_per_Gallon']\n", + ").interactive()" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/scatter_with_histogram.ipynb b/doc/jupyterlite/files/scatter_with_histogram.ipynb new file mode 100644 index 000000000..70a6be660 --- /dev/null +++ b/doc/jupyterlite/files/scatter_with_histogram.ipynb @@ -0,0 +1,99 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "8ea862e5", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7c14b78a", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Scatter Plot and Histogram with Interval Selection\n", + "==================================================\n", + "\n", + "This example shows how to link a scatter plot and a histogram\n", + "together such that an interval selection in the histogram will\n", + "plot the selected values in the scatter plot.\n", + "\n", + "Note that both subplots need to know about the `mbin` field created\n", + "by the `transform_bin` method. In order to achieve this, the data is\n", + "not passed to the `Chart()` instances creating the subplots, but\n", + "directly in the `hconcat()` function, which joins the two plots together.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "\n", + "import altair as alt\n", + "import pandas as pd\n", + "import numpy as np\n", + "\n", + "x = np.random.normal(size=100)\n", + "y = np.random.normal(size=100)\n", + "\n", + "m = np.random.normal(15, 1, size=100)\n", + "\n", + "source = pd.DataFrame({\"x\": x, \"y\":y, \"m\":m})\n", + "\n", + "# interval selection in the scatter plot\n", + "pts = alt.selection(type=\"interval\", encodings=[\"x\"])\n", + "\n", + "# left panel: scatter plot\n", + "points = alt.Chart().mark_point(filled=True, color=\"black\").encode(\n", + " x='x',\n", + " y='y'\n", + ").transform_filter(\n", + " pts\n", + ").properties(\n", + " width=300,\n", + " height=300\n", + ")\n", + "\n", + "# right panel: histogram\n", + "mag = alt.Chart().mark_bar().encode(\n", + " x='mbin:N',\n", + " y=\"count()\",\n", + " color=alt.condition(pts, alt.value(\"black\"), alt.value(\"lightgray\"))\n", + ").properties(\n", + " width=300,\n", + " height=300\n", + ").add_selection(pts)\n", + "\n", + "# build the chart:\n", + "alt.hconcat(\n", + " points,\n", + " mag,\n", + " data=source\n", + ").transform_bin(\n", + " \"mbin\",\n", + " field=\"m\",\n", + " bin=alt.Bin(maxbins=20)\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/scatter_with_labels.ipynb b/doc/jupyterlite/files/scatter_with_labels.ipynb new file mode 100644 index 000000000..2581bafb4 --- /dev/null +++ b/doc/jupyterlite/files/scatter_with_labels.ipynb @@ -0,0 +1,68 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "fe3f69ee", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d0b425df", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Simple Scatter Plot with Labels\n", + "===============================\n", + "This example shows a basic scatter plot with labels created with Altair.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame({\n", + " 'x': [1, 3, 5, 7, 9],\n", + " 'y': [1, 3, 5, 7, 9],\n", + " 'label': ['A', 'B', 'C', 'D', 'E']\n", + "})\n", + "\n", + "points = alt.Chart(source).mark_point().encode(\n", + " x='x:Q',\n", + " y='y:Q'\n", + ")\n", + "\n", + "text = points.mark_text(\n", + " align='left',\n", + " baseline='middle',\n", + " dx=7\n", + ").encode(\n", + " text='label'\n", + ")\n", + "\n", + "points + text" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/scatter_with_layered_histogram.ipynb b/doc/jupyterlite/files/scatter_with_layered_histogram.ipynb new file mode 100644 index 000000000..dd5902f38 --- /dev/null +++ b/doc/jupyterlite/files/scatter_with_layered_histogram.ipynb @@ -0,0 +1,99 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "4e578263", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9c9a41f6", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Interactive Scatter Plot and Linked Layered Histogram\n", + "=====================================================\n", + "\n", + "This example shows how to link a scatter plot and a histogram\n", + "together such that clicking on a point in the scatter plot will\n", + "isolate the distribution corresponding to that point, and vice versa.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "\n", + "import altair as alt\n", + "import pandas as pd\n", + "import numpy as np\n", + "\n", + "# generate fake data\n", + "source = pd.DataFrame({'gender': ['M']*1000 + ['F']*1000,\n", + " 'height':np.concatenate((np.random.normal(69, 7, 1000),\n", + " np.random.normal(64, 6, 1000))),\n", + " 'weight': np.concatenate((np.random.normal(195.8, 144, 1000),\n", + " np.random.normal(167, 100, 1000))),\n", + " 'age': np.concatenate((np.random.normal(45, 8, 1000),\n", + " np.random.normal(51, 6, 1000)))\n", + " })\n", + "\n", + "selector = alt.selection_single(empty='all', fields=['gender'])\n", + "\n", + "color_scale = alt.Scale(domain=['M', 'F'],\n", + " range=['#1FC3AA', '#8624F5'])\n", + "\n", + "base = alt.Chart(source).properties(\n", + " width=250,\n", + " height=250\n", + ").add_selection(selector)\n", + "\n", + "points = base.mark_point(filled=True, size=200).encode(\n", + " x=alt.X('mean(height):Q',\n", + " scale=alt.Scale(domain=[0,84])),\n", + " y=alt.Y('mean(weight):Q',\n", + " scale=alt.Scale(domain=[0,250])),\n", + " color=alt.condition(selector,\n", + " 'gender:N',\n", + " alt.value('lightgray'),\n", + " scale=color_scale),\n", + ")\n", + "\n", + "hists = base.mark_bar(opacity=0.5, thickness=100).encode(\n", + " x=alt.X('age',\n", + " bin=alt.Bin(step=5), # step keeps bin size the same\n", + " scale=alt.Scale(domain=[0,100])),\n", + " y=alt.Y('count()',\n", + " stack=None,\n", + " scale=alt.Scale(domain=[0,350])),\n", + " color=alt.Color('gender:N',\n", + " scale=color_scale)\n", + ").transform_filter(\n", + " selector\n", + ")\n", + "\n", + "\n", + "points | hists" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/scatter_with_loess.ipynb b/doc/jupyterlite/files/scatter_with_loess.ipynb new file mode 100644 index 000000000..12c0b56d5 --- /dev/null +++ b/doc/jupyterlite/files/scatter_with_loess.ipynb @@ -0,0 +1,70 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "962df83e", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e3b9e274", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Scatter Plot with LOESS Lines\n", + "-----------------------------\n", + "This example shows how to add a trend line to a scatter plot using \n", + "the LOESS transform (LOcally Estimated Scatterplot Smoothing).\n", + "\"\"\"\n", + "# category: scatter plots\n", + "\n", + "import altair as alt\n", + "import pandas as pd\n", + "import numpy as np\n", + "\n", + "np.random.seed(1)\n", + "\n", + "source = pd.DataFrame({\n", + " 'x': np.arange(100),\n", + " 'A': np.random.randn(100).cumsum(),\n", + " 'B': np.random.randn(100).cumsum(),\n", + " 'C': np.random.randn(100).cumsum(),\n", + "})\n", + "\n", + "base = alt.Chart(source).mark_circle(opacity=0.5).transform_fold(\n", + " fold=['A', 'B', 'C'], \n", + " as_=['category', 'y']\n", + ").encode(\n", + " alt.X('x:Q'), \n", + " alt.Y('y:Q'), \n", + " alt.Color('category:N')\n", + ")\n", + "\n", + "base + base.transform_loess('x', 'y', groupby=['category']).mark_line(size=4)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/scatter_with_minimap.ipynb b/doc/jupyterlite/files/scatter_with_minimap.ipynb new file mode 100644 index 000000000..c16ad3dd8 --- /dev/null +++ b/doc/jupyterlite/files/scatter_with_minimap.ipynb @@ -0,0 +1,88 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c76b4349", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0037700e", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Scatter Plot with Minimap\n", + "-------------------------\n", + "This example shows how to create a miniature version of a plot\n", + "such that creating a selection in the miniature version\n", + "adjusts the axis limits in another, more detailed view.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.seattle_weather()\n", + "\n", + "zoom = alt.selection_interval(encodings=[\"x\", \"y\"])\n", + "\n", + "minimap = (\n", + " alt.Chart(source)\n", + " .mark_point()\n", + " .add_selection(zoom)\n", + " .encode(\n", + " x=\"date:T\",\n", + " y=\"temp_max:Q\",\n", + " color=alt.condition(zoom, \"weather\", alt.value(\"lightgray\")),\n", + " )\n", + " .properties(\n", + " width=200,\n", + " height=200,\n", + " title=\"Minimap -- click and drag to zoom in the detail view\",\n", + " )\n", + ")\n", + "\n", + "detail = (\n", + " alt.Chart(source)\n", + " .mark_point()\n", + " .encode(\n", + " x=alt.X(\n", + " \"date:T\", scale=alt.Scale(domain={\"param\": zoom.name, \"encoding\": \"x\"})\n", + " ),\n", + " y=alt.Y(\n", + " \"temp_max:Q\",\n", + " scale=alt.Scale(domain={\"param\": zoom.name, \"encoding\": \"y\"}),\n", + " ),\n", + " color=\"weather\",\n", + " )\n", + " .properties(width=600, height=400, title=\"Seattle weather -- detail view\")\n", + ")\n", + "\n", + "detail | minimap" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/scatter_with_rolling_mean.ipynb b/doc/jupyterlite/files/scatter_with_rolling_mean.ipynb new file mode 100644 index 000000000..6bf4eed0f --- /dev/null +++ b/doc/jupyterlite/files/scatter_with_rolling_mean.ipynb @@ -0,0 +1,70 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "d463dba7", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b754c1d3", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Scatter Plot with Rolling Mean\n", + "------------------------------\n", + "A scatter plot with a rolling mean overlay. In this example a 30 day window\n", + "is used to calculate the mean of the maximum temperature around each date.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.seattle_weather()\n", + "\n", + "line = alt.Chart(source).mark_line(\n", + " color='red', \n", + " size=3\n", + ").transform_window(\n", + " rolling_mean='mean(temp_max)',\n", + " frame=[-15, 15]\n", + ").encode(\n", + " x='date:T',\n", + " y='rolling_mean:Q'\n", + ")\n", + "\n", + "points = alt.Chart(source).mark_point().encode(\n", + " x='date:T', \n", + " y=alt.Y('temp_max:Q', \n", + " axis=alt.Axis(title='Max Temp'))\n", + ")\n", + "\n", + "points + line" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/seattle_weather_interactive.ipynb b/doc/jupyterlite/files/seattle_weather_interactive.ipynb new file mode 100644 index 000000000..044cf0ca4 --- /dev/null +++ b/doc/jupyterlite/files/seattle_weather_interactive.ipynb @@ -0,0 +1,99 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "3d268313", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2c2be931", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Seattle Weather Interactive\n", + "===========================\n", + "This chart provides an interactive exploration of Seattle weather over the\n", + "course of the year. It includes a one-axis brush selection to easily\n", + "see the distribution of weather types in a particular date range.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.seattle_weather()\n", + "\n", + "scale = alt.Scale(domain=['sun', 'fog', 'drizzle', 'rain', 'snow'],\n", + " range=['#e7ba52', '#a7a7a7', '#aec7e8', '#1f77b4', '#9467bd'])\n", + "color = alt.Color('weather:N', scale=scale)\n", + "\n", + "# We create two selections:\n", + "# - a brush that is active on the top panel\n", + "# - a multi-click that is active on the bottom panel\n", + "brush = alt.selection_interval(encodings=['x'])\n", + "click = alt.selection_multi(encodings=['color'])\n", + "\n", + "# Top panel is scatter plot of temperature vs time\n", + "points = alt.Chart().mark_point().encode(\n", + " alt.X('monthdate(date):T', title='Date'),\n", + " alt.Y('temp_max:Q',\n", + " title='Maximum Daily Temperature (C)',\n", + " scale=alt.Scale(domain=[-5, 40])\n", + " ),\n", + " color=alt.condition(brush, color, alt.value('lightgray')),\n", + " size=alt.Size('precipitation:Q', scale=alt.Scale(range=[5, 200]))\n", + ").properties(\n", + " width=550,\n", + " height=300\n", + ").add_selection(\n", + " brush\n", + ").transform_filter(\n", + " click\n", + ")\n", + "\n", + "# Bottom panel is a bar chart of weather type\n", + "bars = alt.Chart().mark_bar().encode(\n", + " x='count()',\n", + " y='weather:N',\n", + " color=alt.condition(click, color, alt.value('lightgray')),\n", + ").transform_filter(\n", + " brush\n", + ").properties(\n", + " width=550,\n", + ").add_selection(\n", + " click\n", + ")\n", + "\n", + "alt.vconcat(\n", + " points,\n", + " bars,\n", + " data=source,\n", + " title=\"Seattle Weather: 2012-2015\"\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/select_detail.ipynb b/doc/jupyterlite/files/select_detail.ipynb new file mode 100644 index 000000000..bcd229037 --- /dev/null +++ b/doc/jupyterlite/files/select_detail.ipynb @@ -0,0 +1,104 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "8e8e9483", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d1a40992", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Selection Detail Example\n", + "========================\n", + "This example shows a selection that links two views of data: the left panel\n", + "contains one point per object, and the right panel contains one line per\n", + "object. Clicking on either the points or lines will select the corresponding\n", + "objects in both views of the data.\n", + "\n", + "The challenge lies in expressing such hierarchical data in a way that Altair\n", + "can handle. We do this by merging the data into a \"long form\" dataframe, and\n", + "aggregating identical metadata for the final plot.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "import pandas as pd\n", + "import numpy as np\n", + "\n", + "np.random.seed(0)\n", + "\n", + "n_objects = 20\n", + "n_times = 50\n", + "\n", + "# Create one (x, y) pair of metadata per object\n", + "locations = pd.DataFrame({\n", + " 'id': range(n_objects),\n", + " 'x': np.random.randn(n_objects),\n", + " 'y': np.random.randn(n_objects)\n", + "})\n", + "\n", + "# Create a 50-element time-series for each object\n", + "timeseries = pd.DataFrame(np.random.randn(n_times, n_objects).cumsum(0),\n", + " columns=locations['id'],\n", + " index=pd.RangeIndex(0, n_times, name='time'))\n", + "\n", + "# Melt the wide-form timeseries into a long-form view\n", + "timeseries = timeseries.reset_index().melt('time')\n", + "\n", + "# Merge the (x, y) metadata into the long-form view\n", + "timeseries['id'] = timeseries['id'].astype(int) # make merge not complain\n", + "data = pd.merge(timeseries, locations, on='id')\n", + "\n", + "# Data is prepared, now make a chart\n", + "\n", + "selector = alt.selection_single(empty='all', fields=['id'])\n", + "\n", + "base = alt.Chart(data).properties(\n", + " width=250,\n", + " height=250\n", + ").add_selection(selector)\n", + "\n", + "points = base.mark_point(filled=True, size=200).encode(\n", + " x='mean(x)',\n", + " y='mean(y)',\n", + " color=alt.condition(selector, 'id:O', alt.value('lightgray'), legend=None),\n", + ")\n", + "\n", + "timeseries = base.mark_line().encode(\n", + " x='time',\n", + " y=alt.Y('value', scale=alt.Scale(domain=(-15, 15))),\n", + " color=alt.Color('id:O', legend=None)\n", + ").transform_filter(\n", + " selector\n", + ")\n", + "\n", + "points | timeseries" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/select_mark_area.ipynb b/doc/jupyterlite/files/select_mark_area.ipynb new file mode 100644 index 000000000..4b3f85a6f --- /dev/null +++ b/doc/jupyterlite/files/select_mark_area.ipynb @@ -0,0 +1,69 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "5f64ac54", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f2191ca0", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Using Selection Interval with mark_area\n", + "=========================================\n", + "\n", + "Because area is considered one object, just using the plain \n", + "selector will select the entire area instead of just one part of it.\n", + "\n", + "This example shows how to use two areas, one on top of the other, and a\n", + "`transform_filter` to fake out this effect.\n", + "\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.unemployment_across_industries.url\n", + "\n", + "base = alt.Chart(source).mark_area(\n", + " color='goldenrod',\n", + " opacity=0.3\n", + ").encode(\n", + " x='yearmonth(date):T',\n", + " y='sum(count):Q',\n", + ")\n", + "\n", + "brush = alt.selection_interval(encodings=['x'],empty='all')\n", + "background = base.add_selection(brush)\n", + "selected = base.transform_filter(brush).mark_area(color='goldenrod')\n", + "\n", + "background + selected" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/selection_histogram.ipynb b/doc/jupyterlite/files/selection_histogram.ipynb new file mode 100644 index 000000000..10767ffff --- /dev/null +++ b/doc/jupyterlite/files/selection_histogram.ipynb @@ -0,0 +1,71 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "f774b1e7", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "439e9921", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Selection Histogram\n", + "===================\n", + "This chart shows an example of using an interval selection to filter the\n", + "contents of an attached histogram, allowing the user to see the proportion\n", + "of items in each category within the selection.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "brush = alt.selection(type='interval')\n", + "\n", + "points = alt.Chart(source).mark_point().encode(\n", + " x='Horsepower:Q',\n", + " y='Miles_per_Gallon:Q',\n", + " color=alt.condition(brush, 'Origin:N', alt.value('lightgray'))\n", + ").add_selection(\n", + " brush\n", + ")\n", + "\n", + "bars = alt.Chart(source).mark_bar().encode(\n", + " y='Origin:N',\n", + " color='Origin:N',\n", + " x='count(Origin):Q'\n", + ").transform_filter(\n", + " brush\n", + ")\n", + "\n", + "points & bars" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/selection_layer_bar_month.ipynb b/doc/jupyterlite/files/selection_layer_bar_month.ipynb new file mode 100644 index 000000000..4530fee6c --- /dev/null +++ b/doc/jupyterlite/files/selection_layer_bar_month.ipynb @@ -0,0 +1,69 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "b0b82935", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dfed5997", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Interactive Average\n", + "===================\n", + "The plot below uses an interval selection, which causes the chart to include an interactive brush\n", + "(shown in grey). The brush selection parameterizes the red guideline, which visualizes the average\n", + "value within the selected interval.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.seattle_weather()\n", + "brush = alt.selection(type='interval', encodings=['x'])\n", + "\n", + "bars = alt.Chart().mark_bar().encode(\n", + " x='month(date):O',\n", + " y='mean(precipitation):Q',\n", + " opacity=alt.condition(brush, alt.OpacityValue(1), alt.OpacityValue(0.7)),\n", + ").add_selection(\n", + " brush\n", + ")\n", + "\n", + "line = alt.Chart().mark_rule(color='firebrick').encode(\n", + " y='mean(precipitation):Q',\n", + " size=alt.SizeValue(3)\n", + ").transform_filter(\n", + " brush\n", + ")\n", + "\n", + "alt.layer(bars, line, data=source)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/simple_bar_chart.ipynb b/doc/jupyterlite/files/simple_bar_chart.ipynb new file mode 100644 index 000000000..5b174e4e8 --- /dev/null +++ b/doc/jupyterlite/files/simple_bar_chart.ipynb @@ -0,0 +1,57 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "ea2e1729", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "60af34dd", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Simple Bar Chart\n", + "================\n", + "This example shows a basic bar chart created with Altair.\n", + "\"\"\"\n", + "# category: simple charts\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame({\n", + " 'a': ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'],\n", + " 'b': [28, 55, 43, 91, 81, 53, 19, 87, 52]\n", + "})\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x='a',\n", + " y='b'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/simple_heatmap.ipynb b/doc/jupyterlite/files/simple_heatmap.ipynb new file mode 100644 index 000000000..3fb52338b --- /dev/null +++ b/doc/jupyterlite/files/simple_heatmap.ipynb @@ -0,0 +1,63 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "47f7728c", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "554c739a", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Simple Heatmap\n", + "--------------\n", + "This example shows a simple heatmap for showing gridded data.\n", + "\"\"\"\n", + "# category: simple charts\n", + "import altair as alt\n", + "import numpy as np\n", + "import pandas as pd\n", + "\n", + "# Compute x^2 + y^2 across a 2D grid\n", + "x, y = np.meshgrid(range(-5, 5), range(-5, 5))\n", + "z = x ** 2 + y ** 2\n", + "\n", + "# Convert this grid to columnar data expected by Altair\n", + "source = pd.DataFrame({'x': x.ravel(),\n", + " 'y': y.ravel(),\n", + " 'z': z.ravel()})\n", + "\n", + "alt.Chart(source).mark_rect().encode(\n", + " x='x:O',\n", + " y='y:O',\n", + " color='z:Q'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/simple_histogram.ipynb b/doc/jupyterlite/files/simple_histogram.ipynb new file mode 100644 index 000000000..916cb9a66 --- /dev/null +++ b/doc/jupyterlite/files/simple_histogram.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "1ca789d2", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "05f81b90", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Simple Histogram\n", + "----------------\n", + "This example shows how to make a basic histogram, based on the vega-lite docs\n", + "https://vega.github.io/vega-lite/examples/histogram.html\n", + "\"\"\"\n", + "# category: simple charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.movies.url\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " alt.X(\"IMDB_Rating:Q\", bin=True),\n", + " y='count()',\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/simple_line_chart.ipynb b/doc/jupyterlite/files/simple_line_chart.ipynb new file mode 100644 index 000000000..585b6e5b6 --- /dev/null +++ b/doc/jupyterlite/files/simple_line_chart.ipynb @@ -0,0 +1,61 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "37f80e01", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8db2c762", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Simple Line Chart\n", + "-----------------\n", + "This chart shows the most basic line chart, made from a dataframe with two\n", + "columns.\n", + "\"\"\"\n", + "# category: simple charts\n", + "\n", + "import altair as alt\n", + "import numpy as np\n", + "import pandas as pd\n", + "\n", + "x = np.arange(100)\n", + "source = pd.DataFrame({\n", + " 'x': x,\n", + " 'f(x)': np.sin(x / 5)\n", + "})\n", + "\n", + "alt.Chart(source).mark_line().encode(\n", + " x='x',\n", + " y='f(x)'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/simple_scatter_with_errorbars.ipynb b/doc/jupyterlite/files/simple_scatter_with_errorbars.ipynb new file mode 100644 index 000000000..84af88253 --- /dev/null +++ b/doc/jupyterlite/files/simple_scatter_with_errorbars.ipynb @@ -0,0 +1,82 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "a937e248", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "239f26b4", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Simple Scatter Plot with Errorbars\n", + "----------------------------------\n", + "A simple scatter plot of a data set with errorbars.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "import altair as alt\n", + "import pandas as pd\n", + "import numpy as np\n", + "\n", + "# generate some data points with uncertainties\n", + "np.random.seed(0)\n", + "x = [1, 2, 3, 4, 5]\n", + "y = np.random.normal(10, 0.5, size=len(x))\n", + "yerr = 0.2\n", + "\n", + "# set up data frame\n", + "source = pd.DataFrame({\"x\": x, \"y\": y, \"yerr\": yerr})\n", + "\n", + "# the base chart\n", + "base = alt.Chart(source).transform_calculate(\n", + " ymin=\"datum.y-datum.yerr\",\n", + " ymax=\"datum.y+datum.yerr\"\n", + ")\n", + "\n", + "# generate the points\n", + "points = base.mark_point(\n", + " filled=True,\n", + " size=50,\n", + " color='black'\n", + ").encode(\n", + " x=alt.X('x', scale=alt.Scale(domain=(0, 6))),\n", + " y=alt.Y('y', scale=alt.Scale(zero=False))\n", + ")\n", + "\n", + "# generate the error bars\n", + "errorbars = base.mark_errorbar().encode(\n", + " x=\"x\",\n", + " y=\"ymin:Q\",\n", + " y2=\"ymax:Q\"\n", + ")\n", + "\n", + "points + errorbars" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/simple_stacked_area_chart.ipynb b/doc/jupyterlite/files/simple_stacked_area_chart.ipynb new file mode 100644 index 000000000..0bd11c743 --- /dev/null +++ b/doc/jupyterlite/files/simple_stacked_area_chart.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "734cffc6", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "18583b8a", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Simple Stacked Area Chart\n", + "-------------------------\n", + "This example shows how to make a simple stacked area chart.\n", + "\"\"\"\n", + "# category: simple charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.iowa_electricity()\n", + "\n", + "alt.Chart(source).mark_area().encode(\n", + " x=\"year:T\",\n", + " y=\"net_generation:Q\",\n", + " color=\"source:N\"\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/slider_cutoff.ipynb b/doc/jupyterlite/files/slider_cutoff.ipynb new file mode 100644 index 000000000..7e5d6b461 --- /dev/null +++ b/doc/jupyterlite/files/slider_cutoff.ipynb @@ -0,0 +1,69 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "caee913b", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e1dee815", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Slider Cutoff\n", + "=============\n", + "This example shows how to bind a variable parameter to a slider, and how to use the corresponding bound value to color data points. This example is based on an example from the Altair 4 documentation for Interactions, in which the interactivity was accomplished using a selection. The version below has been simplified significantly through the use of a variable parameter. Variable parameters were added in Altair 5.\n", + "\"\"\"\n", + "# category: interactive charts\n", + "import altair as alt\n", + "import pandas as pd\n", + "import numpy as np\n", + "\n", + "rand = np.random.RandomState(42)\n", + "\n", + "df = pd.DataFrame({\n", + " 'xval': range(100),\n", + " 'yval': rand.randn(100).cumsum()\n", + "})\n", + "\n", + "slider = alt.binding_range(min=0, max=100, step=1)\n", + "cutoff = alt.parameter(bind=slider, value=50)\n", + "\n", + "alt.Chart(df).mark_point().encode(\n", + " x='xval',\n", + " y='yval',\n", + " color=alt.condition(\n", + " alt.datum.xval < cutoff,\n", + " alt.value('red'), alt.value('blue')\n", + " )\n", + ").add_parameter(\n", + " cutoff\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/slope_graph.ipynb b/doc/jupyterlite/files/slope_graph.ipynb new file mode 100644 index 000000000..182f5fe1a --- /dev/null +++ b/doc/jupyterlite/files/slope_graph.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c89d94f5", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "253f68bf", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Slope Graph\n", + "-----------------------\n", + "This example shows how to make Slope Graph.\n", + "\"\"\"\n", + "# category: line charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "alt.Chart(source).mark_line().encode(\n", + " x='year:O',\n", + " y='median(yield)',\n", + " color='site'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/sorted_error_bars_with_ci.ipynb b/doc/jupyterlite/files/sorted_error_bars_with_ci.ipynb new file mode 100644 index 000000000..98cb197d5 --- /dev/null +++ b/doc/jupyterlite/files/sorted_error_bars_with_ci.ipynb @@ -0,0 +1,75 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "63156cde", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "30d1c717", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Sorted Error Bars showing Confidence Interval\n", + "=============================================\n", + "This example shows how to show error bars using confidence intervals, while also sorting the y-axis based on x-axis values. \n", + "\"\"\"\n", + "# category: other charts\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "points = alt.Chart(source).mark_point(\n", + " filled=True,\n", + " color='black'\n", + ").encode(\n", + " x=alt.X('mean(yield)', title='Barley Yield'),\n", + " y=alt.Y(\n", + " 'variety',\n", + " sort=alt.EncodingSortField(\n", + " field='yield',\n", + " op='mean',\n", + " order='descending'\n", + " )\n", + " )\n", + ").properties(\n", + " width=400,\n", + " height=250\n", + ")\n", + "\n", + "error_bars = points.mark_rule().encode(\n", + " x='ci0(yield)',\n", + " x2='ci1(yield)',\n", + ")\n", + "\n", + "points + error_bars" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/stacked_bar_chart.ipynb b/doc/jupyterlite/files/stacked_bar_chart.ipynb new file mode 100644 index 000000000..f8d1372e5 --- /dev/null +++ b/doc/jupyterlite/files/stacked_bar_chart.ipynb @@ -0,0 +1,56 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "8e9666cc", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d0ca8a9a", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Stacked Bar Chart\n", + "-----------------\n", + "\n", + "This is an example of a stacked bar chart using data which contains crop yields over different regions and different years in the 1930s.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x='variety',\n", + " y='sum(yield)',\n", + " color='site'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/stacked_bar_chart_sorted_segments.ipynb b/doc/jupyterlite/files/stacked_bar_chart_sorted_segments.ipynb new file mode 100644 index 000000000..34f9fe24b --- /dev/null +++ b/doc/jupyterlite/files/stacked_bar_chart_sorted_segments.ipynb @@ -0,0 +1,60 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "be173c1b", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8041d8ed", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Stacked Bar Chart with Sorted Segments\n", + "--------------------------------------\n", + "This is an example of a stacked-bar chart with the segments of each bar resorted.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x='sum(yield)',\n", + " y='variety',\n", + " color='site',\n", + " order=alt.Order(\n", + " # Sort the segments of the bars by this field\n", + " 'site',\n", + " sort='ascending'\n", + " )\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/stacked_bar_chart_with_text.ipynb b/doc/jupyterlite/files/stacked_bar_chart_with_text.ipynb new file mode 100644 index 000000000..ff45e5cc7 --- /dev/null +++ b/doc/jupyterlite/files/stacked_bar_chart_with_text.ipynb @@ -0,0 +1,66 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "f44c32a5", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fe404a55", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Stacked Bar Chart with Text Overlay\n", + "===================================\n", + "This example shows how to overlay text on a stacked bar chart. For both the\n", + "bar and text marks, we use the ``stack`` argument in the ``x`` encoding to\n", + "cause the values to be stacked horizontally.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source=data.barley()\n", + "\n", + "bars = alt.Chart(source).mark_bar().encode(\n", + " x=alt.X('sum(yield):Q', stack='zero'),\n", + " y=alt.Y('variety:N'),\n", + " color=alt.Color('site')\n", + ")\n", + "\n", + "text = alt.Chart(source).mark_text(dx=-15, dy=3, color='white').encode(\n", + " x=alt.X('sum(yield):Q', stack='zero'),\n", + " y=alt.Y('variety:N'),\n", + " detail='site:N',\n", + " text=alt.Text('sum(yield):Q', format='.1f')\n", + ")\n", + "\n", + "bars + text" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/stem_and_leaf.ipynb b/doc/jupyterlite/files/stem_and_leaf.ipynb new file mode 100644 index 000000000..ac916ab60 --- /dev/null +++ b/doc/jupyterlite/files/stem_and_leaf.ipynb @@ -0,0 +1,78 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "01eaeff1", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6d2dbf92", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Stem and Leaf Plot\n", + "------------------\n", + "This example shows how to make a stem and leaf plot.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "import pandas as pd\n", + "import numpy as np\n", + "np.random.seed(42)\n", + "\n", + "# Generating random data\n", + "source = pd.DataFrame({'samples': np.random.normal(50, 15, 100).astype(int).astype(str)})\n", + "\n", + "# Splitting stem and leaf\n", + "source['stem'] = source['samples'].str[:-1]\n", + "source['leaf'] = source['samples'].str[-1]\n", + "\n", + "source = source.sort_values(by=['stem', 'leaf'])\n", + "\n", + "# Determining leaf position\n", + "source['position'] = source.groupby('stem').cumcount().add(1)\n", + "\n", + "# Creating stem and leaf plot\n", + "alt.Chart(source).mark_text(\n", + " align='left',\n", + " baseline='middle',\n", + " dx=-5\n", + ").encode(\n", + " alt.X('position:Q', title='',\n", + " axis=alt.Axis(ticks=False, labels=False, grid=False)\n", + " ),\n", + " alt.Y('stem:N', title='', axis=alt.Axis(tickSize=0)),\n", + " text='leaf:N',\n", + ").configure_axis(\n", + " labelFontSize=20\n", + ").configure_text(\n", + " fontSize=20\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/step_chart.ipynb b/doc/jupyterlite/files/step_chart.ipynb new file mode 100644 index 000000000..eeb8baf9d --- /dev/null +++ b/doc/jupyterlite/files/step_chart.ipynb @@ -0,0 +1,61 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "ebd38f14", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1779040e", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Step Chart\n", + "----------\n", + "This example shows Google's stock price over time.\n", + "This uses the \"step-after\" interpolation scheme.\n", + "The full list of interpolation options includes 'linear',\n", + "'linear-closed', 'step', 'step-before', 'step-after', 'basis',\n", + "'basis-open', 'basis-closed', 'cardinal', 'cardinal-open',\n", + "'cardinal-closed', 'bundle', and 'monotone'.\n", + "\"\"\"\n", + "# category: line charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.stocks()\n", + "\n", + "alt.Chart(source).mark_line(interpolate='step-after').encode(\n", + " x='date',\n", + " y='price'\n", + ").transform_filter(\n", + " alt.datum.symbol == 'GOOG'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/streamgraph.ipynb b/doc/jupyterlite/files/streamgraph.ipynb new file mode 100644 index 000000000..b432a5cc5 --- /dev/null +++ b/doc/jupyterlite/files/streamgraph.ipynb @@ -0,0 +1,59 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "0cfe1eed", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "efbb45a3", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Streamgraph\n", + "-----------------\n", + "This example shows the streamgraph from vega-lite examples.\n", + "\"\"\"\n", + "# category: area charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.unemployment_across_industries.url\n", + "\n", + "alt.Chart(source).mark_area().encode(\n", + " alt.X('yearmonth(date):T',\n", + " axis=alt.Axis(format='%Y', domain=False, tickSize=0)\n", + " ),\n", + " alt.Y('sum(count):Q', stack='center', axis=None),\n", + " alt.Color('series:N',\n", + " scale=alt.Scale(scheme='category20b')\n", + " )\n", + ").interactive()" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/strip_plot.ipynb b/doc/jupyterlite/files/strip_plot.ipynb new file mode 100644 index 000000000..ac206eec0 --- /dev/null +++ b/doc/jupyterlite/files/strip_plot.ipynb @@ -0,0 +1,54 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c0ecf32b", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a055a5c9", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Simple Strip Plot\n", + "-----------------\n", + "A simple example of how to make a strip plot. \n", + "\"\"\"\n", + "# category: simple charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "alt.Chart(source).mark_tick().encode(\n", + " x='Horsepower:Q',\n", + " y='Cylinders:O'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/stripplot.ipynb b/doc/jupyterlite/files/stripplot.ipynb new file mode 100644 index 000000000..4eed81cba --- /dev/null +++ b/doc/jupyterlite/files/stripplot.ipynb @@ -0,0 +1,79 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "9e0359df", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "27bab372", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Stripplot\n", + "---------\n", + "This example shows how to make a Stripplot.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.movies.url\n", + "\n", + "stripplot = alt.Chart(source, width=40).mark_circle(size=8).encode(\n", + " x=alt.X(\n", + " 'jitter:Q',\n", + " title=None,\n", + " axis=alt.Axis(values=[0], ticks=True, grid=False, labels=False),\n", + " scale=alt.Scale(),\n", + " ),\n", + " y=alt.Y('IMDB_Rating:Q'),\n", + " color=alt.Color('Major_Genre:N', legend=None),\n", + " column=alt.Column(\n", + " 'Major_Genre:N',\n", + " header=alt.Header(\n", + " labelAngle=-90,\n", + " titleOrient='top',\n", + " labelOrient='bottom',\n", + " labelAlign='right',\n", + " labelPadding=3,\n", + " ),\n", + " ),\n", + ").transform_calculate(\n", + " # Generate Gaussian jitter with a Box-Muller transform\n", + " jitter='sqrt(-2*log(random()))*cos(2*PI*random())'\n", + ").configure_facet(\n", + " spacing=0\n", + ").configure_view(\n", + " stroke=None\n", + ")\n", + "\n", + "stripplot" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/table_bubble_plot_github.ipynb b/doc/jupyterlite/files/table_bubble_plot_github.ipynb new file mode 100644 index 000000000..2e0cdf507 --- /dev/null +++ b/doc/jupyterlite/files/table_bubble_plot_github.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "db7f1fe5", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "71756246", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Table Bubble Plot (Github Punch Card)\n", + "-------------------------------------\n", + "This example shows github contributions by the day of week and hour of the day.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.github.url\n", + "\n", + "alt.Chart(source).mark_circle().encode(\n", + " x='hours(time):O',\n", + " y='day(time):O',\n", + " size='sum(count):Q'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/top_k_items.ipynb b/doc/jupyterlite/files/top_k_items.ipynb new file mode 100644 index 000000000..bdf200ab0 --- /dev/null +++ b/doc/jupyterlite/files/top_k_items.ipynb @@ -0,0 +1,66 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "7ddd9895", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "201c2bf3", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Top K Items\n", + "-----------\n", + "This example shows how to use the window and transformation filter to display\n", + "the Top items of a long list of items in decreasing order.\n", + "Here we sort the top 10 highest ranking movies of IMDB.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.movies.url\n", + "\n", + "# Top 10 movies by IMBD rating\n", + "alt.Chart(\n", + " source,\n", + ").mark_bar().encode(\n", + " x=alt.X('Title:N', sort='-y'),\n", + " y=alt.Y('IMDB_Rating:Q'),\n", + " color=alt.Color('IMDB_Rating:Q')\n", + " \n", + ").transform_window(\n", + " rank='rank(IMDB_Rating)',\n", + " sort=[alt.SortField('IMDB_Rating', order='descending')]\n", + ").transform_filter(\n", + " (alt.datum.rank < 10)\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/top_k_letters.ipynb b/doc/jupyterlite/files/top_k_letters.ipynb new file mode 100644 index 000000000..07157fb98 --- /dev/null +++ b/doc/jupyterlite/files/top_k_letters.ipynb @@ -0,0 +1,79 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "951e67af", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "78dcd45e", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Top K Letters\n", + "-------------\n", + "This example shows how to use a window transform in order to display only the\n", + "top K categories by number of entries. In this case, we rank the characters in\n", + "the first paragraph of Dickens' *A Tale of Two Cities* by number of occurances.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "import pandas as pd\n", + "import numpy as np\n", + "\n", + "# Excerpt from A Tale of Two Cities; public domain text\n", + "text = \"\"\"\n", + "It was the best of times, it was the worst of times, it was the age of wisdom,\n", + "it was the age of foolishness, it was the epoch of belief, it was the epoch of\n", + "incredulity, it was the season of Light, it was the season of Darkness, it was\n", + "the spring of hope, it was the winter of despair, we had everything before us,\n", + "we had nothing before us, we were all going direct to Heaven, we were all going\n", + "direct the other way - in short, the period was so far like the present period,\n", + "that some of its noisiest authorities insisted on its being received, for good\n", + "or for evil, in the superlative degree of comparison only.\n", + "\"\"\"\n", + "\n", + "source = pd.DataFrame(\n", + " {'letters': np.array([c for c in text if c.isalpha()])}\n", + ")\n", + "\n", + "alt.Chart(source).transform_aggregate(\n", + " count='count()',\n", + " groupby=['letters']\n", + ").transform_window(\n", + " rank='rank(count)',\n", + " sort=[alt.SortField('count', order='descending')]\n", + ").transform_filter(\n", + " alt.datum.rank < 10\n", + ").mark_bar().encode(\n", + " y=alt.Y('letters:N', sort='-x'),\n", + " x='count:Q',\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/top_k_with_others.ipynb b/doc/jupyterlite/files/top_k_with_others.ipynb new file mode 100644 index 000000000..83e26bd4b --- /dev/null +++ b/doc/jupyterlite/files/top_k_with_others.ipynb @@ -0,0 +1,70 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "d3431ceb", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7e67b73f", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Top-K plot with Others\n", + "----------------------\n", + "This example shows how to use aggregate, window, and calculate transfromations\n", + "to display the top-k directors by average worldwide gross while grouping the \n", + "remaining directors as 'All Others'.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.movies.url\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x=alt.X(\"aggregate_gross:Q\", aggregate=\"mean\", title=None),\n", + " y=alt.Y(\n", + " \"ranked_director:N\",\n", + " sort=alt.Sort(op=\"mean\", field=\"aggregate_gross\", order=\"descending\"),\n", + " title=None,\n", + " ),\n", + ").transform_aggregate(\n", + " aggregate_gross='mean(Worldwide_Gross)',\n", + " groupby=[\"Director\"],\n", + ").transform_window(\n", + " rank='row_number()',\n", + " sort=[alt.SortField(\"aggregate_gross\", order=\"descending\")],\n", + ").transform_calculate(\n", + " ranked_director=\"datum.rank < 10 ? datum.Director : 'All Others'\"\n", + ").properties(\n", + " title=\"Top Directors by Average Worldwide Gross\",\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/trail_marker.ipynb b/doc/jupyterlite/files/trail_marker.ipynb new file mode 100644 index 000000000..49bbea91c --- /dev/null +++ b/doc/jupyterlite/files/trail_marker.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c4170f39", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7b72668b", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Line Chart with Varying Size\n", + "----------------------------\n", + "This is example of using the ``trail`` marker to vary the size of a line.\n", + "\"\"\"\n", + "# category: line charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.wheat()\n", + "\n", + "alt.Chart(source).mark_trail().encode(\n", + " x='year:T',\n", + " y='wheat:Q',\n", + " size='wheat:Q'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/trellis_area.ipynb b/doc/jupyterlite/files/trellis_area.ipynb new file mode 100644 index 000000000..61a4d88d9 --- /dev/null +++ b/doc/jupyterlite/files/trellis_area.ipynb @@ -0,0 +1,58 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "d488d2fb", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ce4bce2d", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Trellis Area Chart\n", + "------------------\n", + "This example shows small multiples of an area chart.\n", + "\"\"\"\n", + "# category: area charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.iowa_electricity()\n", + "\n", + "alt.Chart(source).mark_area().encode(\n", + " x=\"year:T\",\n", + " y=\"net_generation:Q\",\n", + " color=\"source:N\",\n", + " row=\"source:N\"\n", + ").properties(\n", + " height=100\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/trellis_area_sort_array.ipynb b/doc/jupyterlite/files/trellis_area_sort_array.ipynb new file mode 100644 index 000000000..bf90b2eeb --- /dev/null +++ b/doc/jupyterlite/files/trellis_area_sort_array.ipynb @@ -0,0 +1,60 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "123879b6", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fd0063dd", + "metadata": {}, + "outputs": [], + "source": [ + "'''\n", + "Trellis Area Sort Chart\n", + "-----------------------\n", + "This example shows small multiples of an area chart.\n", + "Stock prices of four large companies\n", + "sorted by `['MSFT', 'AAPL', 'IBM', 'AMZN']`\n", + "'''\n", + "# category: area charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.stocks()\n", + "\n", + "alt.Chart(source).transform_filter(\n", + " alt.datum.symbol != 'GOOG'\n", + ").mark_area().encode(\n", + " x='date:T',\n", + " y='price:Q',\n", + " color='symbol:N',\n", + " row=alt.Row('symbol:N', sort=['MSFT', 'AAPL', 'IBM', 'AMZN'])\n", + ").properties(height=50, width=400)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/trellis_histogram.ipynb b/doc/jupyterlite/files/trellis_histogram.ipynb new file mode 100644 index 000000000..a2bd6a150 --- /dev/null +++ b/doc/jupyterlite/files/trellis_histogram.ipynb @@ -0,0 +1,56 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "f13abd10", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1640fe3b", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Trellis Histogram\n", + "-----------------\n", + "This example shows how to make a basic trellis histogram.\n", + "https://vega.github.io/vega-lite/examples/trellis_bar_histogram.html\n", + "\"\"\"\n", + "# category: histograms\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " alt.X(\"Horsepower:Q\", bin=True),\n", + " y='count()',\n", + " row='Origin'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/trellis_scatter_plot.ipynb b/doc/jupyterlite/files/trellis_scatter_plot.ipynb new file mode 100644 index 000000000..c18484ee5 --- /dev/null +++ b/doc/jupyterlite/files/trellis_scatter_plot.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "d3a208fa", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "01eab722", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Trellis Scatter Plot\n", + "-----------------------\n", + "This example shows how to make a trellis scatter plot.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.cars()\n", + "\n", + "alt.Chart(source).mark_point().encode(\n", + " x='Horsepower:Q',\n", + " y='Miles_per_Gallon:Q',\n", + " row='Origin:N'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/trellis_stacked_bar_chart.ipynb b/doc/jupyterlite/files/trellis_stacked_bar_chart.ipynb new file mode 100644 index 000000000..84e65979d --- /dev/null +++ b/doc/jupyterlite/files/trellis_stacked_bar_chart.ipynb @@ -0,0 +1,56 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "e7d698a3", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "25d90000", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Trellis Stacked Bar Chart\n", + "=========================\n", + "This is an example of a horizontal stacked bar chart using data which contains crop yields over different regions and different years in the 1930s.\n", + "\"\"\"\n", + "# category: bar charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " column='year',\n", + " x='yield',\n", + " y='variety',\n", + " color='site'\n", + ").properties(width=220)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/us_employment.ipynb b/doc/jupyterlite/files/us_employment.ipynb new file mode 100644 index 000000000..91bed1ab5 --- /dev/null +++ b/doc/jupyterlite/files/us_employment.ipynb @@ -0,0 +1,97 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "b1bbc45d", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "72273761", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "The U.S. employment crash during the Great Recession\n", + "----------------------------------------------------\n", + "This example is a fully developed bar chart with negative values using the sample dataset of U.S. employment changes during the Great Recession.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "import pandas as pd\n", + "from vega_datasets import data\n", + "\n", + "source = data.us_employment()\n", + "presidents = pd.DataFrame([\n", + " {\n", + " \"start\": \"2006-01-01\",\n", + " \"end\": \"2009-01-19\",\n", + " \"president\": \"Bush\"\n", + " },\n", + " {\n", + " \"start\": \"2009-01-20\",\n", + " \"end\": \"2015-12-31\",\n", + " \"president\": \"Obama\"\n", + " }\n", + "])\n", + "\n", + "bars = alt.Chart(\n", + " source,\n", + " title=\"The U.S. employment crash during the Great Recession\"\n", + ").mark_bar().encode(\n", + " x=alt.X(\"month:T\", title=\"\"),\n", + " y=alt.Y(\"nonfarm_change:Q\", title=\"Change in non-farm employment (in thousands)\"),\n", + " color=alt.condition(\n", + " alt.datum.nonfarm_change > 0,\n", + " alt.value(\"steelblue\"),\n", + " alt.value(\"orange\")\n", + " )\n", + ")\n", + "\n", + "rule = alt.Chart(presidents).mark_rule(\n", + " color=\"black\",\n", + " strokeWidth=2\n", + ").encode(\n", + " x='end:T'\n", + ").transform_filter(alt.datum.president == \"Bush\")\n", + "\n", + "text = alt.Chart(presidents).mark_text(\n", + " align='left',\n", + " baseline='middle',\n", + " dx=7,\n", + " dy=-135,\n", + " size=11\n", + ").encode(\n", + " x='start:T',\n", + " x2='end:T',\n", + " text='president',\n", + " color=alt.value('#000000')\n", + ")\n", + "\n", + "(bars + rule + text).properties(width=600)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/us_incomebrackets_by_state_facet.ipynb b/doc/jupyterlite/files/us_incomebrackets_by_state_facet.ipynb new file mode 100644 index 000000000..aa0f4ce29 --- /dev/null +++ b/doc/jupyterlite/files/us_incomebrackets_by_state_facet.ipynb @@ -0,0 +1,68 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "7419ecc6", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "10426131", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "US Income by State: Wrapped Facet\n", + "---------------------------------\n", + "This example shows how to create a map of income in the US by state,\n", + "faceted over income brackets \n", + "\"\"\"\n", + "# category: maps\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "states = alt.topo_feature(data.us_10m.url, 'states')\n", + "source = data.income.url\n", + "\n", + "alt.Chart(source).mark_geoshape().encode(\n", + " shape='geo:G',\n", + " color='pct:Q',\n", + " tooltip=['name:N', 'pct:Q'],\n", + " facet=alt.Facet('group:N', columns=2),\n", + ").transform_lookup(\n", + " lookup='id',\n", + " from_=alt.LookupData(data=states, key='id'),\n", + " as_='geo'\n", + ").properties(\n", + " width=300,\n", + " height=175,\n", + ").project(\n", + " type='albersUsa'\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/us_population_over_time.ipynb b/doc/jupyterlite/files/us_population_over_time.ipynb new file mode 100644 index 000000000..5ff2565a4 --- /dev/null +++ b/doc/jupyterlite/files/us_population_over_time.ipynb @@ -0,0 +1,75 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "e42f3f92", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e9185e8e", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "US Population Over Time\n", + "=======================\n", + "This chart visualizes the age distribution of the US population over time.\n", + "It uses a slider widget that is bound to the year to visualize the age\n", + "distribution over time.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.population.url\n", + "\n", + "pink_blue = alt.Scale(domain=('Male', 'Female'),\n", + " range=[\"steelblue\", \"salmon\"])\n", + "\n", + "slider = alt.binding_range(min=1900, max=2000, step=10)\n", + "select_year = alt.selection_single(name=\"year\", fields=['year'],\n", + " bind=slider, init={'year': 2000})\n", + "\n", + "alt.Chart(source).mark_bar().encode(\n", + " x=alt.X('sex:N', title=None),\n", + " y=alt.Y('people:Q', scale=alt.Scale(domain=(0, 12000000))),\n", + " color=alt.Color('sex:N', scale=pink_blue),\n", + " column='age:O'\n", + ").properties(\n", + " width=20\n", + ").add_selection(\n", + " select_year\n", + ").transform_calculate(\n", + " \"sex\", alt.expr.if_(alt.datum.sex == 1, \"Male\", \"Female\")\n", + ").transform_filter(\n", + " select_year\n", + ").configure_facet(\n", + " spacing=8\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/us_population_over_time_facet.ipynb b/doc/jupyterlite/files/us_population_over_time_facet.ipynb new file mode 100644 index 000000000..5adf4a30f --- /dev/null +++ b/doc/jupyterlite/files/us_population_over_time_facet.ipynb @@ -0,0 +1,64 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "8190e554", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c6a42101", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "US Population: Wrapped Facet\n", + "============================\n", + "This chart visualizes the age distribution of the US population over time,\n", + "using a wrapped faceting of the data by decade.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.population.url\n", + "\n", + "alt.Chart(source).mark_area().encode(\n", + " x='age:O',\n", + " y=alt.Y(\n", + " 'sum(people):Q',\n", + " title='Population',\n", + " axis=alt.Axis(format='~s')\n", + " ),\n", + " facet=alt.Facet('year:O', columns=5),\n", + ").properties(\n", + " title='US Age Distribution By Year',\n", + " width=90,\n", + " height=80\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/us_population_pyramid_over_time.ipynb b/doc/jupyterlite/files/us_population_pyramid_over_time.ipynb new file mode 100644 index 000000000..7983547fd --- /dev/null +++ b/doc/jupyterlite/files/us_population_pyramid_over_time.ipynb @@ -0,0 +1,94 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "e7ce4442", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d2fc8aab", + "metadata": {}, + "outputs": [], + "source": [ + "'''\n", + "US Population Pyramid Over Time\n", + "===============================\n", + "A population pyramid shows the distribution of age groups within a population.\n", + "It uses a slider widget that is bound to the year to visualize the age\n", + "distribution over time.\n", + "'''\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.population.url\n", + "\n", + "slider = alt.binding_range(min=1850, max=2000, step=10)\n", + "select_year = alt.selection_single(name='year', fields=['year'],\n", + " bind=slider, init={'year': 2000})\n", + "\n", + "base = alt.Chart(source).add_selection(\n", + " select_year\n", + ").transform_filter(\n", + " select_year\n", + ").transform_calculate(\n", + " gender=alt.expr.if_(alt.datum.sex == 1, 'Male', 'Female')\n", + ").properties(\n", + " width=250\n", + ")\n", + "\n", + "\n", + "color_scale = alt.Scale(domain=['Male', 'Female'],\n", + " range=['#1f77b4', '#e377c2'])\n", + "\n", + "left = base.transform_filter(\n", + " alt.datum.gender == 'Female'\n", + ").encode(\n", + " y=alt.Y('age:O', axis=None),\n", + " x=alt.X('sum(people):Q',\n", + " title='population',\n", + " sort=alt.SortOrder('descending')),\n", + " color=alt.Color('gender:N', scale=color_scale, legend=None)\n", + ").mark_bar().properties(title='Female')\n", + "\n", + "middle = base.encode(\n", + " y=alt.Y('age:O', axis=None),\n", + " text=alt.Text('age:Q'),\n", + ").mark_text().properties(width=20)\n", + "\n", + "right = base.transform_filter(\n", + " alt.datum.gender == 'Male'\n", + ").encode(\n", + " y=alt.Y('age:O', axis=None),\n", + " x=alt.X('sum(people):Q', title='population'),\n", + " color=alt.Color('gender:N', scale=color_scale, legend=None)\n", + ").mark_bar().properties(title='Male')\n", + "\n", + "alt.concat(left, middle, right, spacing=5)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/us_state_capitals.ipynb b/doc/jupyterlite/files/us_state_capitals.ipynb new file mode 100644 index 000000000..1eaf3a8eb --- /dev/null +++ b/doc/jupyterlite/files/us_state_capitals.ipynb @@ -0,0 +1,82 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "f0ad6703", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5a04ceda", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "U.S. state capitals overlayed on a map of the U.S\n", + "-------------------------------------------------\n", + "This is a layered geographic visualization that shows US capitals\n", + "overlayed on a map.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "states = alt.topo_feature(data.us_10m.url, 'states')\n", + "capitals = data.us_state_capitals.url\n", + "\n", + "# US states background\n", + "background = alt.Chart(states).mark_geoshape(\n", + " fill='lightgray',\n", + " stroke='white'\n", + ").properties(\n", + " title='US State Capitols',\n", + " width=650,\n", + " height=400\n", + ").project('albersUsa')\n", + "\n", + "# Points and text\n", + "hover = alt.selection(type='single', on='mouseover', nearest=True,\n", + " fields=['lat', 'lon'])\n", + "\n", + "base = alt.Chart(capitals).encode(\n", + " longitude='lon:Q',\n", + " latitude='lat:Q',\n", + ")\n", + "\n", + "text = base.mark_text(dy=-5, align='right').encode( \n", + " alt.Text('city', type='nominal'),\n", + " opacity=alt.condition(~hover, alt.value(0), alt.value(1))\n", + ")\n", + "\n", + "points = base.mark_point().encode(\n", + " color=alt.value('black'),\n", + " size=alt.condition(~hover, alt.value(30), alt.value(100))\n", + ").add_selection(hover)\n", + "\n", + "background + points + text" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/violin_plot.ipynb b/doc/jupyterlite/files/violin_plot.ipynb new file mode 100644 index 000000000..705c842e6 --- /dev/null +++ b/doc/jupyterlite/files/violin_plot.ipynb @@ -0,0 +1,78 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "9cbb945a", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b22ed1b5", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Violin Plot\n", + "-----------\n", + "This example shows how to make a Violin Plot using Altair's density transform.\n", + "\"\"\"\n", + "# category: other charts\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "alt.Chart(data.cars()).transform_density(\n", + " 'Miles_per_Gallon',\n", + " as_=['Miles_per_Gallon', 'density'],\n", + " extent=[5, 50],\n", + " groupby=['Origin']\n", + ").mark_area(orient='horizontal').encode(\n", + " y='Miles_per_Gallon:Q',\n", + " color='Origin:N',\n", + " x=alt.X(\n", + " 'density:Q',\n", + " stack='center',\n", + " impute=None,\n", + " title=None,\n", + " axis=alt.Axis(labels=False, values=[0],grid=False, ticks=True),\n", + " ),\n", + " column=alt.Column(\n", + " 'Origin:N',\n", + " header=alt.Header(\n", + " titleOrient='bottom',\n", + " labelOrient='bottom',\n", + " labelPadding=0,\n", + " ),\n", + " )\n", + ").properties(\n", + " width=100\n", + ").configure_facet(\n", + " spacing=0\n", + ").configure_view(\n", + " stroke=None\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/weather_heatmap.ipynb b/doc/jupyterlite/files/weather_heatmap.ipynb new file mode 100644 index 000000000..5fd87095d --- /dev/null +++ b/doc/jupyterlite/files/weather_heatmap.ipynb @@ -0,0 +1,63 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "37047da6", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1f01629a", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Seattle Weather Heatmap\n", + "-----------------------\n", + "This example shows the 2010 daily high temperature (F) in Seattle, WA.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "# Since the data is more than 5,000 rows we'll import it from a URL\n", + "source = data.seattle_temps.url\n", + "\n", + "alt.Chart(\n", + " source,\n", + " title=\"2010 Daily High Temperature (F) in Seattle, WA\"\n", + ").mark_rect().encode(\n", + " x='date(date):O',\n", + " y='month(date):O',\n", + " color=alt.Color('max(temp):Q', scale=alt.Scale(scheme=\"inferno\")),\n", + " tooltip=[\n", + " alt.Tooltip('monthdate(date):T', title='Date'),\n", + " alt.Tooltip('max(temp):Q', title='Max Temp')\n", + " ]\n", + ").properties(width=550)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/wellcome.ipynb b/doc/jupyterlite/files/wellcome.ipynb new file mode 100644 index 000000000..d3697ecc6 --- /dev/null +++ b/doc/jupyterlite/files/wellcome.ipynb @@ -0,0 +1,111 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "20d4269c-0505-4f49-841e-4810bb8e630c", + "metadata": {}, + "source": [ + "# Welcome to Altair's interactive example gallery\n", + "\n", + "You can play around with any example from the Altair gallery\n", + "by opening the corresponding notebook from the File menu in the left hand sidebar.\n", + "\n", + "This programming environment is called [JupyterLite](https://jupyterlite.readthedocs.io/)\n", + "and it runs entirely in your web browser.\n", + "This allows you to explore Altair without having to install anything on your computer!\n", + "In JupyterLite we always need to execute some boiler plate startup code\n", + "before we can run our Altair code.\n", + "Try running the cell below\n", + "by clicking on it and either clicking the play button on the toolbar above\n", + "or hitting Shift + Enter." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "434d4581-7ddf-405d-a05f-4082e1b0f48e", + "metadata": {}, + "outputs": [], + "source": [ + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "markdown", + "id": "5c8c73bd-e90b-4354-bcfd-8d12dc9164d7", + "metadata": {}, + "source": [ + "Now you can try running the Altair code in the next cell." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d878f631-0075-4e12-85df-4883b92434ad", + "metadata": {}, + "outputs": [], + "source": [ + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "cars = data.cars()\n", + "\n", + "alt.Chart(cars).mark_point().encode(\n", + " x='Horsepower',\n", + " y='Miles_per_Gallon',\n", + " color='Origin',\n", + " tooltip='Name'\n", + ").interactive()" + ] + }, + { + "cell_type": "markdown", + "id": "5bc9fd00-59e5-40ad-9352-8ab40aae09ff", + "metadata": {}, + "source": [ + "You can see which version of Altair we are running like so:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6fd2a34b-cafe-46e5-b84c-569b2fbff2cd", + "metadata": {}, + "outputs": [], + "source": [ + "alt.__version__" + ] + }, + { + "cell_type": "markdown", + "id": "49c79ccc-c2c6-4e62-b084-3fac20f56702", + "metadata": {}, + "source": [ + "Keep exploring the gallery examples via the left sidebar!" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Pyolite", + "language": "python", + "name": "python" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.10" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/wheat_wages.ipynb b/doc/jupyterlite/files/wheat_wages.ipynb new file mode 100644 index 000000000..62986e2db --- /dev/null +++ b/doc/jupyterlite/files/wheat_wages.ipynb @@ -0,0 +1,97 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "def0b19a", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2bd07dc6", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Wheat and Wages\n", + "---------------\n", + "A recreation of William Playfair's classic chart visualizing\n", + "the price of wheat, the wages of a mechanic, and the reigning British monarch.\n", + "\n", + "This is a more polished version of the simpler chart in :ref:`gallery_bar_and_line_with_dual_axis`.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "\n", + "base_wheat = alt.Chart(data.wheat.url).transform_calculate(\n", + " year_end=\"+datum.year + 5\")\n", + "\n", + "base_monarchs = alt.Chart(data.monarchs.url).transform_calculate(\n", + " offset=\"((!datum.commonwealth && datum.index % 2) ? -1: 1) * 2 + 95\",\n", + " off2=\"((!datum.commonwealth && datum.index % 2) ? -1: 1) + 95\",\n", + " y=\"95\",\n", + " x=\"+datum.start + (+datum.end - +datum.start)/2\"\n", + ")\n", + "\n", + "bars = base_wheat.mark_bar(**{\"fill\": \"#aaa\", \"stroke\": \"#999\"}).encode(\n", + " x=alt.X(\"year:Q\", axis=alt.Axis(format='d', tickCount=5)),\n", + " y=alt.Y(\"wheat:Q\", axis=alt.Axis(zindex=1)),\n", + " x2=alt.X2(\"year_end\")\n", + ")\n", + "\n", + "area = base_wheat.mark_area(**{\"color\": \"#a4cedb\", \"opacity\": 0.7}).encode(\n", + " x=alt.X(\"year:Q\"),\n", + " y=alt.Y(\"wages:Q\")\n", + ")\n", + "\n", + "area_line_1 = area.mark_line(**{\"color\": \"#000\", \"opacity\": 0.7})\n", + "area_line_2 = area.mark_line(**{\"yOffset\": -2, \"color\": \"#EE8182\"})\n", + "\n", + "top_bars = base_monarchs.mark_bar(stroke=\"#000\").encode(\n", + " x=alt.X(\"start:Q\"),\n", + " x2=alt.X2(\"end\"),\n", + " y=alt.Y(\"y:Q\"),\n", + " y2=alt.Y2(\"offset\"),\n", + " fill=alt.Fill(\"commonwealth:N\", legend=None, scale=alt.Scale(range=[\"black\", \"white\"]))\n", + ")\n", + "\n", + "top_text = base_monarchs.mark_text(**{\"yOffset\": 14, \"fontSize\": 9, \"fontStyle\": \"italic\"}).encode(\n", + " x=alt.X(\"x:Q\"),\n", + " y=alt.Y(\"off2:Q\"),\n", + " text=alt.Text(\"name:N\")\n", + ")\n", + "\n", + "(bars + area + area_line_1 + area_line_2 + top_bars + top_text).properties(\n", + " width=900, height=400\n", + ").configure_axis(\n", + " title=None, gridColor=\"white\", gridOpacity=0.25, domain=False\n", + ").configure_view(\n", + " stroke=\"transparent\"\n", + ")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/wilkinson-dot-plot.ipynb b/doc/jupyterlite/files/wilkinson-dot-plot.ipynb new file mode 100644 index 000000000..046c15ff6 --- /dev/null +++ b/doc/jupyterlite/files/wilkinson-dot-plot.ipynb @@ -0,0 +1,66 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "8bc6c129", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "39481723", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Wilkinson Dot Plot\n", + "------------------\n", + "An example of a `Wilkinson Dot Plot `_\n", + "\"\"\"\n", + "# category: other charts\n", + "\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame(\n", + " {\"data\":[1,1,1,1,1,1,1,1,1,1,\n", + " 2,2,2,\n", + " 3,3,\n", + " 4,4,4,4,4,4]\n", + " }\n", + ")\n", + "\n", + "alt.Chart(source).mark_circle(opacity=1).transform_window(\n", + " id='rank()', \n", + " groupby=['data']\n", + ").encode(\n", + " alt.X('data:O'), \n", + " alt.Y('id:O', \n", + " axis=None, \n", + " sort='descending')\n", + ").properties(height=100)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/wind_vector_map.ipynb b/doc/jupyterlite/files/wind_vector_map.ipynb new file mode 100644 index 000000000..af0d2e402 --- /dev/null +++ b/doc/jupyterlite/files/wind_vector_map.ipynb @@ -0,0 +1,63 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "f6bd2b86", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6c857ace", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Wind Vector Map\n", + "---------------\n", + "An example showing a vector array map showing wind speed and direction using ``wedge``\n", + "as shape for ``mark_point`` and ``angle`` encoding for the wind direction.\n", + "This is adapted from this corresponding Vega-Lite Example:\n", + "`Wind Vector Map `_.\n", + "\"\"\"\n", + "# category: scatter plots\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.windvectors()\n", + "\n", + "alt.Chart(source).mark_point(shape=\"wedge\", filled=True).encode(\n", + " latitude=\"latitude\",\n", + " longitude=\"longitude\",\n", + " color=alt.Color(\n", + " \"dir\", scale=alt.Scale(domain=[0, 360], scheme=\"rainbow\"), legend=None\n", + " ),\n", + " angle=alt.Angle(\"dir\", scale=alt.Scale(domain=[0, 360], range=[180, 540])),\n", + " size=alt.Size(\"speed\", scale=alt.Scale(rangeMax=500)),\n", + ").project(\"equalEarth\")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/window_rank.ipynb b/doc/jupyterlite/files/window_rank.ipynb new file mode 100644 index 000000000..36e978b87 --- /dev/null +++ b/doc/jupyterlite/files/window_rank.ipynb @@ -0,0 +1,81 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "edac8f31", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f67d0212", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "Window Rank Line Chart\n", + "----------------------\n", + "This example shows the Group F rankings in the 2018 World Cup after each matchday. \n", + "A window transformation is used to rank each after each match day, sorting by points and difference.\n", + "\"\"\"\n", + "# category: case studies\n", + "import altair as alt\n", + "import pandas as pd\n", + "\n", + "source = pd.DataFrame(\n", + " [\n", + " {\"team\": \"Germany\", \"matchday\": 1, \"point\": 0, \"diff\": -1},\n", + " {\"team\": \"Germany\", \"matchday\": 2, \"point\": 3, \"diff\": 0},\n", + " {\"team\": \"Germany\", \"matchday\": 3, \"point\": 3, \"diff\": -2},\n", + " {\"team\": \"Mexico\", \"matchday\": 1, \"point\": 3, \"diff\": 1},\n", + " {\"team\": \"Mexico\", \"matchday\": 2, \"point\": 6, \"diff\": 2},\n", + " {\"team\": \"Mexico\", \"matchday\": 3, \"point\": 6, \"diff\": -1},\n", + " {\"team\": \"South Korea\", \"matchday\": 1, \"point\": 0, \"diff\": -1},\n", + " {\"team\": \"South Korea\", \"matchday\": 2, \"point\": 0, \"diff\": -2},\n", + " {\"team\": \"South Korea\", \"matchday\": 3, \"point\": 3, \"diff\": 0},\n", + " {\"team\": \"Sweden\", \"matchday\": 1, \"point\": 3, \"diff\": 1},\n", + " {\"team\": \"Sweden\", \"matchday\": 2, \"point\": 3, \"diff\": 0},\n", + " {\"team\": \"Sweden\", \"matchday\": 3, \"point\": 6, \"diff\": 3},\n", + " ]\n", + ")\n", + "\n", + "color_scale = alt.Scale(\n", + " domain=[\"Germany\", \"Mexico\", \"South Korea\", \"Sweden\"],\n", + " range=[\"#000000\", \"#127153\", \"#C91A3C\", \"#0C71AB\"],\n", + ")\n", + "\n", + "alt.Chart(source).mark_line().encode(\n", + " x=\"matchday:O\", y=\"rank:O\", color=alt.Color(\"team:N\", scale=color_scale)\n", + ").transform_window(\n", + " rank=\"rank()\",\n", + " sort=[\n", + " alt.SortField(\"point\", order=\"descending\"),\n", + " alt.SortField(\"diff\", order=\"descending\"),\n", + " ],\n", + " groupby=[\"matchday\"],\n", + ").properties(title=\"World Cup 2018: Group F Rankings\")" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/world_map.ipynb b/doc/jupyterlite/files/world_map.ipynb new file mode 100644 index 000000000..7c4b75f81 --- /dev/null +++ b/doc/jupyterlite/files/world_map.ipynb @@ -0,0 +1,66 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "96d5d3bb", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "77320784", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "World Map\n", + "---------\n", + "\n", + "This example shows how to create a world map using data generators for\n", + "different background layers.\n", + "\"\"\"\n", + "# category: maps\n", + "\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "# Data generators for the background\n", + "sphere = alt.sphere()\n", + "graticule = alt.graticule()\n", + "\n", + "# Source of land data\n", + "source = alt.topo_feature(data.world_110m.url, 'countries')\n", + "\n", + "# Layering and configuring the components \n", + "alt.layer(\n", + " alt.Chart(sphere).mark_geoshape(fill='lightblue'), \n", + " alt.Chart(graticule).mark_geoshape(stroke='white', strokeWidth=0.5), \n", + " alt.Chart(source).mark_geoshape(fill='ForestGreen', stroke='black')\n", + ").project(\n", + " 'naturalEarth1'\n", + ").properties(width=600, height=400).configure_view(stroke=None)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/files/world_projections.ipynb b/doc/jupyterlite/files/world_projections.ipynb new file mode 100644 index 000000000..39b2b64b7 --- /dev/null +++ b/doc/jupyterlite/files/world_projections.ipynb @@ -0,0 +1,65 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "253cfb3c", + "metadata": {}, + "outputs": [], + "source": [ + "# Running this cell is required to get the examples to work in this online\n", + "# notebook until there is a way to preinstall packages\n", + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a51a4fa9", + "metadata": {}, + "outputs": [], + "source": [ + "\"\"\"\n", + "World Projections\n", + "-----------------\n", + "This example shows a map of the countries of the world using four available\n", + "geographic projections. For more details on the projections available in\n", + "Altair, see https://vega.github.io/vega-lite/docs/projection.html\n", + "\"\"\"\n", + "# category: maps\n", + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = alt.topo_feature(data.world_110m.url, 'countries')\n", + "\n", + "base = alt.Chart(source).mark_geoshape(\n", + " fill='#666666',\n", + " stroke='white'\n", + ").properties(\n", + " width=300,\n", + " height=180\n", + ")\n", + "\n", + "projections = ['equirectangular', 'mercator', 'orthographic', 'gnomonic']\n", + "charts = [base.project(proj).properties(title=proj)\n", + " for proj in projections]\n", + "\n", + "alt.concat(*charts, columns=2)" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/doc/jupyterlite/wellcome.ipynb b/doc/jupyterlite/wellcome.ipynb new file mode 100644 index 000000000..d3697ecc6 --- /dev/null +++ b/doc/jupyterlite/wellcome.ipynb @@ -0,0 +1,111 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "20d4269c-0505-4f49-841e-4810bb8e630c", + "metadata": {}, + "source": [ + "# Welcome to Altair's interactive example gallery\n", + "\n", + "You can play around with any example from the Altair gallery\n", + "by opening the corresponding notebook from the File menu in the left hand sidebar.\n", + "\n", + "This programming environment is called [JupyterLite](https://jupyterlite.readthedocs.io/)\n", + "and it runs entirely in your web browser.\n", + "This allows you to explore Altair without having to install anything on your computer!\n", + "In JupyterLite we always need to execute some boiler plate startup code\n", + "before we can run our Altair code.\n", + "Try running the cell below\n", + "by clicking on it and either clicking the play button on the toolbar above\n", + "or hitting Shift + Enter." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "434d4581-7ddf-405d-a05f-4082e1b0f48e", + "metadata": {}, + "outputs": [], + "source": [ + "# You have to wait until it has executed before you click to run the next cell\n", + "import micropip\n", + "micropip.install(['altair', 'vega_datasets'])" + ] + }, + { + "cell_type": "markdown", + "id": "5c8c73bd-e90b-4354-bcfd-8d12dc9164d7", + "metadata": {}, + "source": [ + "Now you can try running the Altair code in the next cell." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d878f631-0075-4e12-85df-4883b92434ad", + "metadata": {}, + "outputs": [], + "source": [ + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "cars = data.cars()\n", + "\n", + "alt.Chart(cars).mark_point().encode(\n", + " x='Horsepower',\n", + " y='Miles_per_Gallon',\n", + " color='Origin',\n", + " tooltip='Name'\n", + ").interactive()" + ] + }, + { + "cell_type": "markdown", + "id": "5bc9fd00-59e5-40ad-9352-8ab40aae09ff", + "metadata": {}, + "source": [ + "You can see which version of Altair we are running like so:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6fd2a34b-cafe-46e5-b84c-569b2fbff2cd", + "metadata": {}, + "outputs": [], + "source": [ + "alt.__version__" + ] + }, + { + "cell_type": "markdown", + "id": "49c79ccc-c2c6-4e62-b084-3fac20f56702", + "metadata": {}, + "source": [ + "Keep exploring the gallery examples via the left sidebar!" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Pyolite", + "language": "python", + "name": "python" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.10" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}