1+ {
2+ "cells" : [
3+ {
4+ "cell_type" : " markdown" ,
5+ "metadata" : {},
6+ "source" : [
7+ " # Quarto Basics\n " ,
8+ " \n " ,
9+ " For a demonstration of a line plot on a polar axis, see\n " ,
10+ " <a href=\" #fig-polar\" class=\" quarto-xref\" >Figure 1</a>."
11+ ],
12+ "id" : " 4e9afca1-abea-42d2-bf89-a9c79ed7e7d6"
13+ },
14+ {
15+ "cell_type" : " code" ,
16+ "execution_count" : 1 ,
17+ "metadata" : {},
18+ "outputs" : [
19+ {
20+ "output_type" : " display_data" ,
21+ "metadata" : {},
22+ "data" : {}
23+ }
24+ ],
25+ "source" : [
26+ " import numpy as np\n " ,
27+ " import matplotlib.pyplot as plt\n " ,
28+ " \n " ,
29+ " r = np.arange(0, 2, 0.01)\n " ,
30+ " theta = 2 * np.pi * r\n " ,
31+ " fig, ax = plt.subplots(\n " ,
32+ " subplot_kw = {'projection': 'polar'} \n " ,
33+ " )\n " ,
34+ " ax.plot(theta, r)\n " ,
35+ " ax.set_rticks([0.5, 1, 1.5, 2])\n " ,
36+ " ax.grid(True)\n " ,
37+ " plt.show()"
38+ ],
39+ "id" : " cell-fig-polar"
40+ },
41+ {
42+ "cell_type" : " markdown" ,
43+ "metadata" : {},
44+ "source" : [
45+ " ## Demo: Basic Pandas Table\n " ,
46+ " \n " ,
47+ " This section demonstrates how to create and display a simple pandas\n " ,
48+ " DataFrame."
49+ ],
50+ "id" : " c03f9f89-b6e9-44f9-b464-6800ec1d44cd"
51+ },
52+ {
53+ "cell_type" : " code" ,
54+ "execution_count" : 2 ,
55+ "metadata" : {},
56+ "outputs" : [],
57+ "source" : [
58+ " import pandas as pd\n " ,
59+ " \n " ,
60+ " data = {\n " ,
61+ " \" Name\" : [\" Alice\" , \" Bob\" , \" Charlie\" ],\n " ,
62+ " \" Age\" : [25, 30, 35],\n " ,
63+ " \" City\" : [\" Paris\" , \" Dublin\" , \" Berlin\" ]\n " ,
64+ " }\n " ,
65+ " \n " ,
66+ " df = pd.DataFrame(data)\n " ,
67+ " df"
68+ ],
69+ "id" : " 0ff4f6a1-3bd4-4e29-a893-cdb85bc8fa0e"
70+ },
71+ {
72+ "cell_type" : " markdown" ,
73+ "metadata" : {},
74+ "source" : [
75+ " ## A more sophisticated table"
76+ ],
77+ "id" : " c8dbc722-f687-41f6-a7b7-7d50c1df52a2"
78+ },
79+ {
80+ "cell_type" : " code" ,
81+ "execution_count" : 3 ,
82+ "metadata" : {},
83+ "outputs" : [
84+ {
85+ "output_type" : " display_data" ,
86+ "metadata" : {},
87+ "data" : {
88+ "text/html" : [
89+ " \n " ,
90+ " \n " ,
91+ " </div>"
92+ ]
93+ }
94+ }
95+ ],
96+ "source" : [
97+ " from great_tables import GT, html\n " ,
98+ " from great_tables.data import sza\n " ,
99+ " import polars as pl\n " ,
100+ " import polars.selectors as cs\n " ,
101+ " \n " ,
102+ " sza_pivot = (\n " ,
103+ " pl.from_pandas(sza)\n " ,
104+ " .filter((pl.col(\" latitude\" ) == \" 20\" ) & (pl.col(\" tst\" ) <= \" 1200\" ))\n " ,
105+ " .select(pl.col(\" *\" ).exclude(\" latitude\" ))\n " ,
106+ " .drop_nulls()\n " ,
107+ " .pivot(values=\" sza\" , index=\" month\" , on=\" tst\" , sort_columns=True)\n " ,
108+ " )\n " ,
109+ " \n " ,
110+ " (\n " ,
111+ " GT(sza_pivot, rowname_col=\" month\" )\n " ,
112+ " .data_color(\n " ,
113+ " domain=[90, 0],\n " ,
114+ " palette=[\" rebeccapurple\" , \" white\" , \" orange\" ],\n " ,
115+ " na_color=\" white\" ,\n " ,
116+ " )\n " ,
117+ " .tab_header(\n " ,
118+ " title=\" Solar Zenith Angles from 05:30 to 12:00\" ,\n " ,
119+ " subtitle=html(\" Average monthly values at latitude of 20°N.\" ),\n " ,
120+ " )\n " ,
121+ " .sub_missing(missing_text=\"\" )\n " ,
122+ " )"
123+ ],
124+ "id" : " f46d4edf"
125+ }
126+ ],
127+ "nbformat" : 4 ,
128+ "nbformat_minor" : 5 ,
129+ "metadata" : {
130+ "kernelspec" : {
131+ "name" : " python3" ,
132+ "display_name" : " Python 3 (ipykernel)" ,
133+ "language" : " python" ,
134+ "path" : " /home/runner/work/AIML4OS-template-quarto-python/AIML4OS-template-quarto-python/.venv/share/jupyter/kernels/python3"
135+ },
136+ "language_info" : {
137+ "name" : " python" ,
138+ "codemirror_mode" : {
139+ "name" : " ipython" ,
140+ "version" : " 3"
141+ },
142+ "file_extension" : " .py" ,
143+ "mimetype" : " text/x-python" ,
144+ "nbconvert_exporter" : " python" ,
145+ "pygments_lexer" : " ipython3" ,
146+ "version" : " 3.12.3"
147+ }
148+ }
149+ }
0 commit comments