diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5e9c5e60..306b454c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,7 +64,7 @@ jobs: shell: bash -l {0} run: | rm -r _build/.doctrees - jb build lectures --path-output ./ -nW --keep-going + jb build lectures --path-output ./ - name: Upload Execution Reports (HTML) uses: actions/upload-artifact@v2 if: failure() diff --git a/lectures/_config.yml b/lectures/_config.yml index ad95918c..84f98523 100644 --- a/lectures/_config.yml +++ b/lectures/_config.yml @@ -37,6 +37,43 @@ latex: sphinx: extra_extensions: [sphinx_multitoc_numbering, sphinxext.rediraffe, sphinx_exercise, sphinx_togglebutton, sphinx.ext.intersphinx, sphinx_proof, sphinx_tojupyter] config: + suppress_warnings: ["mystnb.unknown_mime_type"] + nb_mime_priority_overrides: [ + # HTML + ['html', 'application/vnd.plotly.v1+json', 9], + ['html', 'application/vnd.jupyter.widget-view+json', 10], + ['html', 'application/javascript', 20], + ['html', 'text/html', 30], + ['html', 'text/latex', 40], + ['html', 'image/svg+xml', 50], + ['html', 'image/png', 60], + ['html', 'image/jpeg', 70], + ['html', 'text/markdown', 80], + ['html', 'text/plain', 90], + # Jupyter Notebooks + ['jupyter', 'application/vnd.plotly.v1+json', 9], + ['jupyter', 'application/vnd.jupyter.widget-view+json', 10], + ['jupyter', 'application/javascript', 20], + ['jupyter', 'text/html', 30], + ['jupyter', 'text/latex', 40], + ['jupyter', 'image/svg+xml', 50], + ['jupyter', 'image/png', 60], + ['jupyter', 'image/jpeg', 70], + ['jupyter', 'text/markdown', 80], + ['jupyter', 'text/plain', 90], + # LaTeX + ['latex', 'text/latex', 10], + ['latex', 'application/pdf', 20], + ['latex', 'image/png', 30], + ['latex', 'image/jpeg', 40], + ['latex', 'text/markdown', 50], + ['latex', 'text/plain', 60], + ['latex', 'text/html', 70], + ['latex', 'application/vnd.plotly.v1+json', 80], + ['latex', 'application/vnd.jupyter.widget-view+json', 90], + # Link Checker + ['linkcheck', 'text/plain', 10], + ] # false-positive links linkcheck_ignore: ['https://doi.org/https://doi.org/10.2307/1235116'] # myst-nb config @@ -44,6 +81,8 @@ sphinx: width: 80% nb_code_prompt_show: "Show {type}" # ------------- + html_js_files: + - https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js html_favicon: _static/lectures-favicon.ico html_theme: quantecon_book_theme html_static_path: ['_static'] diff --git a/lectures/_toc.yml b/lectures/_toc.yml index a9e5b70e..b0820c7a 100644 --- a/lectures/_toc.yml +++ b/lectures/_toc.yml @@ -5,6 +5,7 @@ parts: numbered: true chapters: - file: about + - file: plotly - caption: Economic Data numbered: true chapters: diff --git a/lectures/plotly.md b/lectures/plotly.md new file mode 100644 index 00000000..f3b34b36 --- /dev/null +++ b/lectures/plotly.md @@ -0,0 +1,31 @@ +--- +jupytext: + text_representation: + extension: .md + format_name: myst + format_version: 0.13 + jupytext_version: 1.15.1 +kernelspec: + display_name: Python 3 (ipykernel) + language: python + name: python3 +--- + +# Plotly Example + +```{code-cell} ipython3 +!pip install plotly +``` + +An example plot + +(plotlyfig)= +```{code-cell} ipython3 +import plotly.express as px +fig = px.scatter(x=[0, 1, 2, 3, 4], y=[0, 1, 4, 9, 16]) +fig.show() +``` + +```{only} latex +This figure is interactive you may [click here to see this figure on the website](https://intro.quantecon.org/plotly.html#plotlyfig) +```