---
title: "Quarto Demo"
format: html
toc: true
jupyter: template-python-project # IMPORTANT: Change this to the name of your project folder, so quarto can find the right Python!
execute: 
  cache: true
editor: 
  render-on-save: true
code-fold: show
code-annotations: hover
code-line-numbers: true
code-summary: "Toggle Code"
---

:::{.callout-note}
You can preview this file by clicking the preview button in the top right corner or by opening the command palette (`cmd+shift+p`) and searching "Quarto Preview".  
:::

This is a [Quarto](https://quarto.org/) file. It's an alternative to Python Notebooks **keeps code and output in separate files**. The `.qmd` file is like a "recipe" that generates a output (an HTML webpage by default) containing your code and its output.

You'll notice that 2 new items were created in the sidebar: `quarto-demo.html` and `quarto-demo_files`. Together those contain all the outputs of your code that you view in any web-browser on any computer without having to install anything. We've configured `git` to ignore them by default as they can be quite large.

You write markdown-prose and Python code in a `.qmd` file, which quarto will render and auto-update when you save. You can also [easily go back-and-forth](https://quarto.org/docs/tools/jupyter-lab.html#converting-notebooks) between Quarto and Python notebooks so you don't have to pick and choose.


Let's start by importing some libraries:

```{python}
#| code-fold: true
# This is a code cell in Quarto
import numpy as np
import seaborn as sns
import polars as pl
```

Now let's generate some random data:

```{python}
a = np.random.randn(100)
b = np.random.randn(100)
df = pl.DataFrame({"a": a, "b": b})
```

Now let's make a plot:

```{python}
grid = sns.FacetGrid(df)
grid.map(sns.scatterplot, "a", "b")
```

Now let's save the plot:

```{python}
#| eval: false
grid.savefig("figures/demo.png", bbox_inches="tight")
```