{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "0e57223c-074a-491e-8ebe-dee523fcf663", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
namestationdatemax temperatureprecipitationmin temperature
0Tromso - LangnesSN9049010.202210.7187.0-4.2
1Tromso - LangnesSN9049011.20228.541.5-7.0
2Tromso - LangnesSN9049012.20225.688.8-11.7
3Tromso - LangnesSN904901.20237.7111.4-13.9
4Tromso - LangnesSN904902.20236.6171.3-10.7
5Tromso - LangnesSN904903.20234.5157.0-15.1
6Tromso - LangnesSN904904.20239.885.0-7.1
7Tromso - LangnesSN904905.202317.7101.2-4.6
8Tromso - LangnesSN904906.202325.443.4-0.4
9Tromso - LangnesSN904907.202326.714.06.0
10Tromso - LangnesSN904908.202325.143.45.4
11Tromso - LangnesSN904909.202319.3163.70.3
12Tromso - LangnesSN9049010.20239.864.8-0.6
0Oslo - BlindernSN1870010.202217.182.9-0.4
1Oslo - BlindernSN1870011.202215.183.4-2.1
2Oslo - BlindernSN1870012.20226.585.5-14.6
3Oslo - BlindernSN187001.20237.2100.5-13.4
4Oslo - BlindernSN187002.202310.246.0-9.4
5Oslo - BlindernSN187003.20239.872.6-12.6
6Oslo - BlindernSN187004.202319.899.7-4.7
7Oslo - BlindernSN187005.202324.217.0-0.8
8Oslo - BlindernSN187006.202331.839.94.6
9Oslo - BlindernSN187007.202328.4146.98.6
10Oslo - BlindernSN187008.202324.5259.89.8
11Oslo - BlindernSN187009.202325.1105.85.3
12Oslo - BlindernSN1870010.202317.17.3-0.7
\n", "
" ], "text/plain": [ " name station date max temperature precipitation \\\n", "0 Tromso - Langnes SN90490 10.2022 10.7 187.0 \n", "1 Tromso - Langnes SN90490 11.2022 8.5 41.5 \n", "2 Tromso - Langnes SN90490 12.2022 5.6 88.8 \n", "3 Tromso - Langnes SN90490 1.2023 7.7 111.4 \n", "4 Tromso - Langnes SN90490 2.2023 6.6 171.3 \n", "5 Tromso - Langnes SN90490 3.2023 4.5 157.0 \n", "6 Tromso - Langnes SN90490 4.2023 9.8 85.0 \n", "7 Tromso - Langnes SN90490 5.2023 17.7 101.2 \n", "8 Tromso - Langnes SN90490 6.2023 25.4 43.4 \n", "9 Tromso - Langnes SN90490 7.2023 26.7 14.0 \n", "10 Tromso - Langnes SN90490 8.2023 25.1 43.4 \n", "11 Tromso - Langnes SN90490 9.2023 19.3 163.7 \n", "12 Tromso - Langnes SN90490 10.2023 9.8 64.8 \n", "0 Oslo - Blindern SN18700 10.2022 17.1 82.9 \n", "1 Oslo - Blindern SN18700 11.2022 15.1 83.4 \n", "2 Oslo - Blindern SN18700 12.2022 6.5 85.5 \n", "3 Oslo - Blindern SN18700 1.2023 7.2 100.5 \n", "4 Oslo - Blindern SN18700 2.2023 10.2 46.0 \n", "5 Oslo - Blindern SN18700 3.2023 9.8 72.6 \n", "6 Oslo - Blindern SN18700 4.2023 19.8 99.7 \n", "7 Oslo - Blindern SN18700 5.2023 24.2 17.0 \n", "8 Oslo - Blindern SN18700 6.2023 31.8 39.9 \n", "9 Oslo - Blindern SN18700 7.2023 28.4 146.9 \n", "10 Oslo - Blindern SN18700 8.2023 24.5 259.8 \n", "11 Oslo - Blindern SN18700 9.2023 25.1 105.8 \n", "12 Oslo - Blindern SN18700 10.2023 17.1 7.3 \n", "\n", " min temperature \n", "0 -4.2 \n", "1 -7.0 \n", "2 -11.7 \n", "3 -13.9 \n", "4 -10.7 \n", "5 -15.1 \n", "6 -7.1 \n", "7 -4.6 \n", "8 -0.4 \n", "9 6.0 \n", "10 5.4 \n", "11 0.3 \n", "12 -0.6 \n", "0 -0.4 \n", "1 -2.1 \n", "2 -14.6 \n", "3 -13.4 \n", "4 -9.4 \n", "5 -12.6 \n", "6 -4.7 \n", "7 -0.8 \n", "8 4.6 \n", "9 8.6 \n", "10 9.8 \n", "11 5.3 \n", "12 -0.7 " ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import pandas as pd\n", "\n", "url_prefix = \"https://raw.githubusercontent.com/coderefinery/data-visualization-python/main/data/\"\n", "\n", "data_tromso = pd.read_csv(url_prefix + \"tromso-monthly.csv\")\n", "data_oslo = pd.read_csv(url_prefix + \"oslo-monthly.csv\")\n", "\n", "data_monthly = pd.concat([data_tromso, data_oslo], axis=0)\n", "\n", "# let us print the combined result\n", "data_monthly" ] }, { "cell_type": "code", "execution_count": 2, "id": "871632d0-52b4-4a2e-990d-c4ac961e2201", "metadata": {}, "outputs": [], "source": [ "# replace mm.yyyy to date format\n", "data_monthly[\"date\"] = pd.to_datetime(list(data_monthly[\"date\"]), format=\"%m.%Y\")" ] }, { "cell_type": "code", "execution_count": 3, "id": "63fc9caa-6b2e-4d4a-b093-c2789736ebe7", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
namestationdatemax temperatureprecipitationmin temperature
0Tromso - LangnesSN904902022-10-0110.7187.0-4.2
1Tromso - LangnesSN904902022-11-018.541.5-7.0
2Tromso - LangnesSN904902022-12-015.688.8-11.7
3Tromso - LangnesSN904902023-01-017.7111.4-13.9
4Tromso - LangnesSN904902023-02-016.6171.3-10.7
\n", "
" ], "text/plain": [ " name station date max temperature precipitation \\\n", "0 Tromso - Langnes SN90490 2022-10-01 10.7 187.0 \n", "1 Tromso - Langnes SN90490 2022-11-01 8.5 41.5 \n", "2 Tromso - Langnes SN90490 2022-12-01 5.6 88.8 \n", "3 Tromso - Langnes SN90490 2023-01-01 7.7 111.4 \n", "4 Tromso - Langnes SN90490 2023-02-01 6.6 171.3 \n", "\n", " min temperature \n", "0 -4.2 \n", "1 -7.0 \n", "2 -11.7 \n", "3 -13.9 \n", "4 -10.7 " ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# print the first 5 rows\n", "data_monthly.head()" ] }, { "cell_type": "code", "execution_count": 4, "id": "0b68a0a3-1ab3-4de3-81ca-e6660933273b", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
namestationdatemax temperatureprecipitationmin temperature
8Oslo - BlindernSN187002023-06-0131.839.94.6
9Oslo - BlindernSN187002023-07-0128.4146.98.6
10Oslo - BlindernSN187002023-08-0124.5259.89.8
11Oslo - BlindernSN187002023-09-0125.1105.85.3
12Oslo - BlindernSN187002023-10-0117.17.3-0.7
\n", "
" ], "text/plain": [ " name station date max temperature precipitation \\\n", "8 Oslo - Blindern SN18700 2023-06-01 31.8 39.9 \n", "9 Oslo - Blindern SN18700 2023-07-01 28.4 146.9 \n", "10 Oslo - Blindern SN18700 2023-08-01 24.5 259.8 \n", "11 Oslo - Blindern SN18700 2023-09-01 25.1 105.8 \n", "12 Oslo - Blindern SN18700 2023-10-01 17.1 7.3 \n", "\n", " min temperature \n", "8 4.6 \n", "9 8.6 \n", "10 9.8 \n", "11 5.3 \n", "12 -0.7 " ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# print the last 5 rows\n", "data_monthly.tail()" ] }, { "cell_type": "code", "execution_count": 5, "id": "d6f83a55-f63c-4f5a-b65e-0de07a87ca81", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Index(['name', 'station', 'date', 'max temperature', 'precipitation',\n", " 'min temperature'],\n", " dtype='object')" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# print all column titles - no parentheses here\n", "data_monthly.columns" ] }, { "cell_type": "code", "execution_count": 6, "id": "7cb68bed-d42e-4e8d-aa2b-8db3c2f77b2a", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "name object\n", "station object\n", "date datetime64[ns]\n", "max temperature float64\n", "precipitation float64\n", "min temperature float64\n", "dtype: object" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# show which data types were detected\n", "data_monthly.dtypes" ] }, { "cell_type": "code", "execution_count": 7, "id": "c4bdae27-37db-4e1a-a6ae-3c6b7d0016ec", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(26, 6)" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# print table dimensions - no parentheses here\n", "data_monthly.shape" ] }, { "cell_type": "code", "execution_count": 8, "id": "5ba6556c-1959-4cde-b26c-fbd75192b8ae", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0 10.7\n", "1 8.5\n", "2 5.6\n", "3 7.7\n", "4 6.6\n", "5 4.5\n", "6 9.8\n", "7 17.7\n", "8 25.4\n", "9 26.7\n", "10 25.1\n", "11 19.3\n", "12 9.8\n", "0 17.1\n", "1 15.1\n", "2 6.5\n", "3 7.2\n", "4 10.2\n", "5 9.8\n", "6 19.8\n", "7 24.2\n", "8 31.8\n", "9 28.4\n", "10 24.5\n", "11 25.1\n", "12 17.1\n", "Name: max temperature, dtype: float64" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# print one column\n", "data_monthly[\"max temperature\"]" ] }, { "cell_type": "code", "execution_count": 9, "id": "e5ce64dc-f53f-4229-8755-803626708bf6", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "count 26.000000\n", "mean 15.930769\n", "std 8.345862\n", "min 4.500000\n", "25% 8.825000\n", "50% 16.100000\n", "75% 24.425000\n", "max 31.800000\n", "Name: max temperature, dtype: float64" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# get some statistics\n", "data_monthly[\"max temperature\"].describe()" ] }, { "cell_type": "code", "execution_count": 10, "id": "3a1de06f-edbe-4af3-8207-7dad24fe96c6", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "np.float64(31.8)" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# what was the maximum temperature?\n", "data_monthly[\"max temperature\"].max()" ] }, { "cell_type": "code", "execution_count": 11, "id": "73f0c4aa-45c7-494e-9f6e-2a38dbbd3e31", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
namestationdatemax temperatureprecipitationmin temperature
8Tromso - LangnesSN904902023-06-0125.443.4-0.4
9Tromso - LangnesSN904902023-07-0126.714.06.0
10Tromso - LangnesSN904902023-08-0125.143.45.4
7Oslo - BlindernSN187002023-05-0124.217.0-0.8
8Oslo - BlindernSN187002023-06-0131.839.94.6
9Oslo - BlindernSN187002023-07-0128.4146.98.6
10Oslo - BlindernSN187002023-08-0124.5259.89.8
11Oslo - BlindernSN187002023-09-0125.1105.85.3
\n", "
" ], "text/plain": [ " name station date max temperature precipitation \\\n", "8 Tromso - Langnes SN90490 2023-06-01 25.4 43.4 \n", "9 Tromso - Langnes SN90490 2023-07-01 26.7 14.0 \n", "10 Tromso - Langnes SN90490 2023-08-01 25.1 43.4 \n", "7 Oslo - Blindern SN18700 2023-05-01 24.2 17.0 \n", "8 Oslo - Blindern SN18700 2023-06-01 31.8 39.9 \n", "9 Oslo - Blindern SN18700 2023-07-01 28.4 146.9 \n", "10 Oslo - Blindern SN18700 2023-08-01 24.5 259.8 \n", "11 Oslo - Blindern SN18700 2023-09-01 25.1 105.8 \n", "\n", " min temperature \n", "8 -0.4 \n", "9 6.0 \n", "10 5.4 \n", "7 -0.8 \n", "8 4.6 \n", "9 8.6 \n", "10 9.8 \n", "11 5.3 " ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# print all rows where max temperature was above 20\n", "data_monthly[data_monthly[\"max temperature\"] > 20.0]" ] }, { "cell_type": "code", "execution_count": 12, "id": "84d50aaf-01b6-4fae-9791-b75e0612cca7", "metadata": {}, "outputs": [], "source": [ "import altair as alt" ] }, { "cell_type": "code", "execution_count": 13, "id": "75f61b44-33c5-4569-ad8b-8c71f5be7e36", "metadata": {}, "outputs": [], "source": [ "# this is here for google colab to update altair\n", "if not alt.__version__.startswith(\"5\"):\n", " %pip install altair==5.3.0" ] }, { "cell_type": "code", "execution_count": 14, "id": "5186ec62-7f96-4213-9f14-b9f590a74b6a", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "" ], "text/plain": [ "alt.Chart(...)" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "alt.Chart(data_monthly).mark_bar().encode(\n", " x=\"date\",\n", " y=\"precipitation\",\n", " color=\"name\",\n", ")" ] }, { "cell_type": "code", "execution_count": 15, "id": "f5672d7c-917e-41ee-aa76-d0f7ad8335de", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "" ], "text/plain": [ "alt.Chart(...)" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "alt.Chart(data_monthly).mark_bar().encode(\n", " x=\"yearmonth(date):T\",\n", " y=\"precipitation\",\n", " color=\"name\",\n", ")" ] }, { "cell_type": "code", "execution_count": 16, "id": "80fdecf9-a723-401e-8010-57273d6cc470", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "" ], "text/plain": [ "alt.Chart(...)" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "alt.Chart(data_monthly).mark_bar().encode(\n", " x=\"yearmonth(date):T\",\n", " y=\"precipitation\",\n", " color=\"name\",\n", " column=\"name\",\n", ")" ] }, { "cell_type": "code", "execution_count": 17, "id": "893998b1-80ac-41a7-b1e8-33608f50afdd", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "" ], "text/plain": [ "alt.Chart(...)" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "alt.Chart(data_monthly).mark_bar().encode(\n", " x=\"yearmonth(date):T\",\n", " y=\"precipitation\",\n", " color=\"name\",\n", " xOffset=\"name\",\n", ")" ] }, { "cell_type": "code", "execution_count": 18, "id": "42b5b621-35fd-44be-937f-c6e2a04c969c", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "" ], "text/plain": [ "alt.Chart(...)" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "alt.Chart(data_monthly).mark_bar().encode(\n", " y=\"yearmonth(date):T\",\n", " x=\"precipitation\",\n", " color=\"name\",\n", " yOffset=\"name\",\n", ")" ] }, { "cell_type": "code", "execution_count": 19, "id": "5ef7465b-983a-4213-8fd5-b78a06c35595", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "" ], "text/plain": [ "alt.Chart(...)" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "alt.Chart(data_monthly).mark_bar().encode(\n", " y=\"yearmonth(date):T\",\n", " x=alt.X(\"precipitation\").title(\"Precipitation (mm)\"),\n", " color=\"name\",\n", " yOffset=\"name\",\n", ")" ] }, { "cell_type": "code", "execution_count": 20, "id": "d35b0b7a-eba2-41e9-ad63-a408377d477f", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "" ], "text/plain": [ "alt.Chart(...)" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "alt.Chart(data_monthly).mark_area(opacity=0.5).encode(\n", " x=\"yearmonth(date):T\",\n", " y=\"max temperature\",\n", " y2=\"min temperature\",\n", " color=\"name\",\n", ")" ] }, { "cell_type": "code", "execution_count": 21, "id": "39de3c06-a377-419e-80b7-112e90f0c563", "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "" ], "text/plain": [ "alt.Chart(...)" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "alt.Chart(data_monthly).mark_area(opacity=0.5).encode(\n", " x=\"yearmonth(date):T\",\n", " y=\"max temperature\",\n", " y2=\"min temperature\",\n", " color=\"name\",\n", " column=\"name\",\n", ")" ] }, { "cell_type": "code", "execution_count": 22, "id": "3adbb4ae-be88-46fd-879b-11f0cc112001", "metadata": {}, "outputs": [], "source": [ "url_prefix = \"https://raw.githubusercontent.com/coderefinery/data-visualization-python/main/data/\"\n", "\n", "data_tromso = pd.read_csv(url_prefix + \"tromso-daily.csv\")\n", "data_oslo = pd.read_csv(url_prefix + \"oslo-daily.csv\")\n", "\n", "data_daily = pd.concat([data_tromso, data_oslo], axis=0)" ] }, { "cell_type": "code", "execution_count": 23, "id": "b1f3b573-d2db-4da3-b871-bff589c1efbc", "metadata": {}, "outputs": [], "source": [ "# replace dd.mm.yyyy to date format\n", "data_daily[\"date\"] = pd.to_datetime(list(data_daily[\"date\"]), format=\"%d.%m.%Y\")\n", "\n", "# we are here only interested in the range december to may\n", "data_daily = data_daily[\n", " (data_daily[\"date\"] > \"2022-12-01\") & (data_daily[\"date\"] < \"2023-05-01\")\n", "]" ] }, { "cell_type": "code", "execution_count": 24, "id": "d89fcadb-d800-4e54-a600-2704ff1770a7", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "" ], "text/plain": [ "alt.Chart(...)" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "alt.Chart(data_daily).mark_bar().encode(\n", " x=\"date\",\n", " y=\"snow depth\",\n", " column=\"name\",\n", ")" ] }, { "cell_type": "code", "execution_count": 25, "id": "eae3c8d3-1b02-401b-a4fe-2d091fa318d5", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "" ], "text/plain": [ "alt.Chart(...)" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "alt.Chart(data_daily).mark_bar().encode(\n", " x=\"date\",\n", " y=\"snow depth\",\n", " color=\"max temperature\",\n", " column=\"name\",\n", ")" ] }, { "cell_type": "code", "execution_count": 26, "id": "6ff2004b-c906-429f-824c-58d61c01ab3d", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "" ], "text/plain": [ "alt.Chart(...)" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "alt.Chart(data_daily).mark_bar().encode(\n", " x=\"date\",\n", " y=\"snow depth\",\n", " color=alt.Color(\"max temperature\").scale(scheme=\"plasma\"),\n", " column=\"name\",\n", ")" ] }, { "cell_type": "code", "execution_count": 27, "id": "ef1fdeeb-655e-474e-b8ce-a4275c87087b", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "" ], "text/plain": [ "alt.Chart(...)" ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "alt.Chart(data_daily).mark_circle().encode(\n", " x=\"date\",\n", " y=\"snow depth\",\n", " color=alt.Color(\"max temperature\").scale(scheme=\"plasma\"),\n", " column=\"name\",\n", ")" ] } ], "metadata": { "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.12.7" } }, "nbformat": 4, "nbformat_minor": 5 }