uczenie-maszynowe/lab/02_Wczytywanie_i_prezentowanie_danych.ipynb

950 lines
797 KiB
Plaintext
Raw Normal View History

{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
2022-11-03 15:37:40 +01:00
"### Uczenie maszynowe — laboratoria\n",
"# 2. Wczytywanie i prezentowanie danych"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2.1. Formaty CSV i TSV"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Przechowywanie danych w plikach w formatach CSV i TSV"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**CSV** (*Comma-Separated Values*) i **TSV** (*Tab-Separated Values*) to proste formaty przechowywania danych tabelarycznych w postaci tekstowej.\n",
"\n",
"Każdy rekord zapisywany jest w osobnym wierszu, a poszczególne pola oddzielone są przecinkami (CSV) lub znakami tabulacji (TSV)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Przykład\n",
"\n",
"Następujące dane tabelaryczne:\n",
"\n",
"imię | nazwisko | rok ur. | adres\n",
":----|:----------|:--------|:----------------------\n",
"Jan | Nowak | 1999 | Poznańska 3, Warszawa\n",
"Anna | Kowalska | 2001 | Warszawska 9, Poznań\n",
"Ewa | Kaczmarek | 1990 | Wrocławska 123, Gdańsk\n",
"\n",
"możemy zapisać w formacie CSV jako:\n",
"\n",
" imię,nazwisko,rok ur.,adres\n",
" Jan,Nowak,1999,\"Poznańska 3, Warszawa\"\n",
" Anna,Kowalska,2001,\"Warszawska 9, Poznań\"\n",
" Ewa,Kaczmarek,1990,\"Wrocławska 123, Gdańsk\"\n",
"\n",
"lub w formacie TSV jako:\n",
"\n",
" imię nazwisko rok ur. adres\n",
" Jan Nowak 1999 Poznańska 3, Warszawa\n",
" Anna Kowalska 2001 Warszawska 9, Poznań\n",
" Ewa Kaczmarek 1990 Wrocławska 123, Gdańsk\n",
" \n",
"W formacie TSV poszczególne pola oddzielone są znakami tabulacji, a nie spacjami.\n",
"\n",
"Znak tabulacji to ten biały (tj. niedrukowalny) znak, który pojawia się po naciśnięciu klawisza **Tab** na klawiaturze."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Formaty CSV i TSV mają tę zaletę, że są proste, łatwe do przetorzenia przez komputer oraz czytelne dla człowieka."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Wczytywanie danych z plików CSV i TSV"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Biblioteka `csv`"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['price', 'isNew', 'rooms', 'floor', 'location', 'sqrMetres']\n",
"['476118.0', 'False', '3', '1', 'Centrum', '78']\n",
"['459531.0', 'False', '3', '2', 'Sołacz', '62']\n",
"['411557.0', 'False', '3', '0', 'Sołacz', '15']\n",
"['496416.0', 'False', '4', '0', 'Sołacz', '14']\n",
"['406032.0', 'False', '3', '0', 'Sołacz', '15']\n",
"['450026.0', 'False', '3', '1', 'Naramowice', '80']\n",
"['571229.15', 'False', '2', '4', 'Wilda', '39']\n",
"['325000.0', 'False', '3', '1', 'Grunwald', '54']\n",
"['268229.0', 'False', '2', '1', 'Grunwald', '90']\n"
]
}
],
"source": [
"import csv\n",
"\n",
2022-10-14 11:38:56 +02:00
"with open(\"data1.csv\", encoding=\"utf-8\") as data_file:\n",
" reader = csv.reader(data_file)\n",
" for row in reader:\n",
2022-10-14 11:38:56 +02:00
" print(row)\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'price': '476118.0', 'isNew': 'False', 'rooms': '3', 'floor': '1', 'location': 'Centrum', 'sqrMetres': '78'}\n",
"{'price': '459531.0', 'isNew': 'False', 'rooms': '3', 'floor': '2', 'location': 'Sołacz', 'sqrMetres': '62'}\n",
"{'price': '411557.0', 'isNew': 'False', 'rooms': '3', 'floor': '0', 'location': 'Sołacz', 'sqrMetres': '15'}\n",
"{'price': '496416.0', 'isNew': 'False', 'rooms': '4', 'floor': '0', 'location': 'Sołacz', 'sqrMetres': '14'}\n",
"{'price': '406032.0', 'isNew': 'False', 'rooms': '3', 'floor': '0', 'location': 'Sołacz', 'sqrMetres': '15'}\n",
"{'price': '450026.0', 'isNew': 'False', 'rooms': '3', 'floor': '1', 'location': 'Naramowice', 'sqrMetres': '80'}\n",
"{'price': '571229.15', 'isNew': 'False', 'rooms': '2', 'floor': '4', 'location': 'Wilda', 'sqrMetres': '39'}\n",
"{'price': '325000.0', 'isNew': 'False', 'rooms': '3', 'floor': '1', 'location': 'Grunwald', 'sqrMetres': '54'}\n",
"{'price': '268229.0', 'isNew': 'False', 'rooms': '2', 'floor': '1', 'location': 'Grunwald', 'sqrMetres': '90'}\n"
]
}
],
"source": [
"import csv\n",
"\n",
2022-10-14 11:38:56 +02:00
"with open(\"data1.csv\", encoding=\"utf-8\") as data_file:\n",
" reader = csv.DictReader(data_file)\n",
" for row in reader:\n",
2022-10-14 11:38:56 +02:00
" print(dict(row))\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['price', 'isNew', 'rooms', 'floor', 'location', 'sqrMetres']\n",
"['476118.0', 'False', '3', '1', 'Centrum', '78']\n",
"['459531.0', 'False', '3', '2', 'Sołacz', '62']\n",
"['411557.0', 'False', '3', '0', 'Sołacz', '15']\n",
"['496416.0', 'False', '4', '0', 'Sołacz', '14']\n",
"['406032.0', 'False', '3', '0', 'Sołacz', '15']\n",
"['450026.0', 'False', '3', '1', 'Naramowice', '80']\n",
"['571229.15', 'False', '2', '4', 'Wilda', '39']\n",
"['325000.0', 'False', '3', '1', 'Grunwald', '54']\n",
"['268229.0', 'False', '2', '1', 'Grunwald', '90']\n"
]
}
],
"source": [
"import csv\n",
"\n",
2022-10-14 11:38:56 +02:00
"with open(\"data1.tsv\", encoding=\"utf-8\") as data_file:\n",
" reader = csv.reader(data_file, delimiter=\"\\t\")\n",
" for row in reader:\n",
2022-10-14 11:38:56 +02:00
" print(row)\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'price': '476118.0', 'isNew': 'False', 'rooms': '3', 'floor': '1', 'location': 'Centrum', 'sqrMetres': '78'}\n",
"{'price': '459531.0', 'isNew': 'False', 'rooms': '3', 'floor': '2', 'location': 'Sołacz', 'sqrMetres': '62'}\n",
"{'price': '411557.0', 'isNew': 'False', 'rooms': '3', 'floor': '0', 'location': 'Sołacz', 'sqrMetres': '15'}\n",
"{'price': '496416.0', 'isNew': 'False', 'rooms': '4', 'floor': '0', 'location': 'Sołacz', 'sqrMetres': '14'}\n",
"{'price': '406032.0', 'isNew': 'False', 'rooms': '3', 'floor': '0', 'location': 'Sołacz', 'sqrMetres': '15'}\n",
"{'price': '450026.0', 'isNew': 'False', 'rooms': '3', 'floor': '1', 'location': 'Naramowice', 'sqrMetres': '80'}\n",
"{'price': '571229.15', 'isNew': 'False', 'rooms': '2', 'floor': '4', 'location': 'Wilda', 'sqrMetres': '39'}\n",
"{'price': '325000.0', 'isNew': 'False', 'rooms': '3', 'floor': '1', 'location': 'Grunwald', 'sqrMetres': '54'}\n",
"{'price': '268229.0', 'isNew': 'False', 'rooms': '2', 'floor': '1', 'location': 'Grunwald', 'sqrMetres': '90'}\n"
]
}
],
"source": [
"import csv\n",
"\n",
2022-10-14 11:38:56 +02:00
"with open(\"data1.tsv\", encoding=\"utf-8\") as data_file:\n",
" reader = csv.DictReader(data_file, delimiter=\"\\t\")\n",
" for row in reader:\n",
2022-10-14 11:38:56 +02:00
" print(dict(row))\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Biblioteka `pandas`"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" price isNew rooms floor location sqrMetres\n",
"0 476118.00 False 3 1 Centrum 78\n",
"1 459531.00 False 3 2 Sołacz 62\n",
"2 411557.00 False 3 0 Sołacz 15\n",
"3 496416.00 False 4 0 Sołacz 14\n",
"4 406032.00 False 3 0 Sołacz 15\n",
"5 450026.00 False 3 1 Naramowice 80\n",
"6 571229.15 False 2 4 Wilda 39\n",
"7 325000.00 False 3 1 Grunwald 54\n",
"8 268229.00 False 2 1 Grunwald 90\n"
]
}
],
"source": [
"import pandas as pd\n",
"\n",
2022-10-14 11:38:56 +02:00
"data = pd.read_csv(\"data1.csv\")\n",
"print(data)\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" price isNew rooms floor location sqrMetres\n",
"0 476118.00 False 3 1 Centrum 78\n",
"1 459531.00 False 3 2 Sołacz 62\n",
"2 411557.00 False 3 0 Sołacz 15\n",
"3 496416.00 False 4 0 Sołacz 14\n",
"4 406032.00 False 3 0 Sołacz 15\n",
"5 450026.00 False 3 1 Naramowice 80\n",
"6 571229.15 False 2 4 Wilda 39\n",
"7 325000.00 False 3 1 Grunwald 54\n",
"8 268229.00 False 2 1 Grunwald 90\n"
]
}
],
"source": [
"import pandas as pd\n",
"\n",
2022-10-14 11:38:56 +02:00
"data = pd.read_csv(\"data1.tsv\", sep=\"\\t\")\n",
"print(data)\n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[476118.0 False 3 1 'Centrum' 78]\n",
" [459531.0 False 3 2 'Sołacz' 62]\n",
" [411557.0 False 3 0 'Sołacz' 15]\n",
" [496416.0 False 4 0 'Sołacz' 14]\n",
" [406032.0 False 3 0 'Sołacz' 15]\n",
" [450026.0 False 3 1 'Naramowice' 80]\n",
" [571229.15 False 2 4 'Wilda' 39]\n",
" [325000.0 False 3 1 'Grunwald' 54]\n",
" [268229.0 False 2 1 'Grunwald' 90]]\n"
]
}
],
"source": [
"print(data.to_numpy()) # dane z Pandas DataFrame można przekonwertować na tablicę NumPy\n",
2022-10-14 11:38:56 +02:00
"# data.values # dla starszych wersji biblioteki Pandas\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2.2. Wykresy biblioteka `matplotlib`"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Dokumentacja modułu `pyplot` biblioteki `matplotlib`: https://matplotlib.org/api/pyplot_api.html"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline # Jupyterowa \"magia\", żeby wykresy wyświetlały się inline, a nie w osobnym oknie"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
2022-10-14 11:38:56 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD8CAYAAACb4nSYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAASF0lEQVR4nO3df4xl5X3f8fdnMajZNRVOPSb82l2rQljEijEdrROhWv4RrGWLjFtFLauJQ1JLE0dGstVKDelKafsHkqUqbpViGU1jZFudQFzZJKhe26DUFUHyD2Y3CwavMVvEwmYRuw4KGE1Ua51v/7hntcPk3p3Ze+5yZ3jeL+nqnPOc55zznSP02cNzzzk3VYUkqQ1bpl2AJOn1Y+hLUkMMfUlqiKEvSQ0x9CWpIYa+JDVkzdBPclWSbyU5nOTJJJ/s2n8+yUNJnu6mbxmx/e4kTyU5kuSOSf8BkqT1y1r36Se5DLisqg4muRg4AHwE+E3gpar6dBfmb6mq31217QXAj4AbgWPAo8DeqvrBxP8SSdKa1rzSr6oXqupgN/8T4DBwBXAL8MWu2xcZ/EOw2i7gSFU9U1U/Be7rtpMkTcGbzqVzkp3Au4HvApdW1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Qwx9SWqIoS9JDTH0Jakhhr4kNcTQl6SGGPqS1BBDX5IaYuhLUkMMfUlqiKEvSQ0x9CWpIYa+JDXE0Jekhhj6ktQQQ1+SGmLoS1JDeoV+kmeTfD/JoSRLQ9YnyR8mOZLk8STX9zmeJKmfXr+R23l/Vf14xLqbgKu7z3uAz3VTSdIUnO/hnVuAL9XAd4BLklx2no8pSRqhb+gX8GCSA0nmh6y/Anh+xfKxru3vSTKfZCnJ0smTJ3uWJUkapm/o31BV1zM
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"import matplotlib.pyplot as plt\n",
"\n",
"# Prosty wykres punktowy\n",
"# Litery 'ro' oznaczają, że dane zostaną przedstawione za pomocą czerwonych kółek:\n",
"# 'r' ('red') czerwone\n",
"# 'o' kółko\n",
"# Zobacz też: https://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.plot\n",
"\n",
2022-10-14 11:38:56 +02:00
"plt.plot([1, 2, 3, 4], [1, 4, 9, 16], \"ro\")\n",
"plt.axis([0, 5, 0, 20]) # opcjonalnie ustawiamy zakres osi wykresu\n",
"\n",
2022-10-14 11:38:56 +02:00
"plt.show() # pokaż wykres\n"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
2022-10-14 11:38:56 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYoAAAD8CAYAAABpcuN4AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAASJ0lEQVR4nO3dbYxcZ3mH8etuTAgk0NjFiey8yItkkQbUkjALpKkshhQBaUSC5CyJRGXRIEvbtIS2EnKKNhRbSHRbVRS13WLxUldQyHR5SYTUQuQOMnXVsGMSSoJJHbJJMOvGpilQ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DQpJUZFBIkooMCklSkUEhSSoyKCRJRQaFJKnIoJAkFRkUkqQig0KSVGRQSJKKDApJUpFBIUkqMigkSUUGhSSpyKCQJBUZFJKkIoNCklRkUEiSigwKSVKRQSFJKjIoJElFBoUkqcigkCQVGRSSpCKDQpJUZFBIkooMCklSkUEhSSpadlBExGUR0YyI/RHxcETcUY2viYj7IuJA9bh65cqVJJ1p3cwongH+ODN/FXgtcHtEXAlsA3Zn5kZgd/VckjSklh0UmXkoM79ebf8fsB+4BLgR2FXttgu4qdsiJUn9syJrFBGxAbgKuB+4ODMPQTtMgItOcszWiGhFROvIkSMrUYYkqQe6DoqIuAD4LPDuzPzR6R6XmTszs5aZtbVr13ZbhiSpR7oKioh4Hu2Q+FRmfq4afioi1lWvrwMOd1eiJKmfuvmrpwA+BuzPzL/seOleYEu1vQW4Z/nlSZL6bVUXx14L/A7wzYh4sBr7E+CDQCMibgOeBG7urkRJUj8tOygy89+AOMnL1y33+0q
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# Wykres danych wczytanych z pliku\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import pandas as pd\n",
"\n",
"# Wczytanie danych\n",
2022-10-14 11:38:56 +02:00
"data = pd.read_csv(\"data1.tsv\", sep=\"\\t\")\n",
"data_array = data.to_numpy()\n",
"\n",
"# Wybór kolumn do przedstawienia na wykresie\n",
"x = data_array[:, 0]\n",
"y = data_array[:, 5]\n",
"\n",
2022-10-14 11:38:56 +02:00
"plt.plot(x, y, \"gx\") # \"gx\" - zielone (Green) krzyżyki (x)\n",
"plt.axis([0, 600000, 0, 100]) # opcjonalnie ustawiamy zakres osi wykresu\n",
"\n",
2022-10-14 11:38:56 +02:00
"plt.show() # pokaż wykres\n"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
2022-10-14 11:38:56 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEU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OYt0zztDzfN117jlU5kjTc6OozsYrIldP8L4A+HCV9+6FCzBqPPWUe37lK91j40a3L77B+SK+4E491ekm9/mmXHvbNuf5lFPC6ib3+USkpPPyl7vHo486zzk3qR2FlufR0VJV2YoVwMknu9fPPONyyD5Jej7hhCP3+WT/fmD7dmDqVOCcc4C5c12V4fbtwOLFfrWTnsfGjtzX7DR7FVbTIlJqZDz5ZPcAXLWDb+LAddppwEknue2tW/3nloaGnE5HB7B8uZ7nkLq7d7vqs2OOcSWudvC8ZQswMgIcf7wrcbWD51j3ZS8DOjvbw3MeWADJSF8fcOCAu7HMnRv2h48D1/LlTn/ePODwYZdb8slzz7kgdcIJwJQpep4XLQImT3aNq4cOhdMl9TwvW+a2Q2QUkrqAnuc4cxRaF2gPz3lgASQj8Q980knuxhLyh+/tdc9Ll5bSEEJbS7dcu7MTiBeW3Lo1nC6g5zlkRqFZPIfMKGh5Hhtz1cCAqyoLmVHIAwsgGYlvXPEPHvJP9sIL7nnJkrDaWrqa2lq6IiXtuA6+1T0PDrrqwsmTXak+ZEZBy/POnS6IzJ/vSvUhMwp5YAEkI+UX3MKFriSyY4drhPRJnFuKteMbzDbPI2G0dEdGgBdfdG0vxx0XVlvL8969rs1p1ixgxoyw2lqekwGzoyOsdrP8p0Jq54EFkIy8+KJ7XrjQPXd1uZyDiN8ungcOuMe0ae7mkkxDnCZfxBd7fIHPmeNyi/v3++3iuX27+16PO859z4Ce56SuVJz7wI9uubZPankOqaup3Q6e88ACSEbi4mX8Yye3fRY9kyU
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"# inicjalizacja\n",
"fig = plt.figure()\n",
"# dodanie \"podwykresu\" (zobacz: http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.subplot )\n",
"ax = fig.add_subplot(111)\n",
"\n",
2022-10-14 11:38:56 +02:00
"ax.set_xlabel(\"x\") # opis osi x\n",
"ax.set_ylabel(\"y\") # opis osi y\n",
"ax.set_title(\"Wykres funkcji\") # tytuł wykresu\n",
"\n",
"x = np.arange(0.0, 10.0, 0.01) # x przebiega zakres od 0 do 10 co 0.01\n",
"\n",
"# zdefiniowanie wartości y w zależności od x\n",
2022-10-14 11:38:56 +02:00
"y = np.sin(2 * np.pi * x)\n",
"# spróbuj też inne funkcje:\n",
"# y = 2 * x**2 + 5 * x - 10\n",
"# y = np.sqrt(x)\n",
"\n",
2022-10-14 11:38:56 +02:00
"ax.plot(x, y, color=\"blue\", lw=2) # \"lw\" oznacza grubość linii (Line Width)\n",
"\n",
2022-10-14 11:38:56 +02:00
"plt.show() # pokaż wykres\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Style wykresów"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
2022-10-14 11:38:56 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlcAAAHiCAYAAADF1OnfAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nOzdeXxbZ533/c9Pkld53+Mtju3EcWyHlqaUAoWWwpQpnZuyPXc7bblZCw8dlgL3MDBzl2ValmeGbW6YgU7ZoYUZYDpTtrKXlpa2aZnGsRPHcbzF+77Iq6Tr+eNIx5It2U4qyY79e79e53WOpHOOjqxE+up3nXNdYoxBKaWUUkrFhmOrD0AppZRSaifRcKWUUkopFUMarpRSSimlYkjDlVJKKaVUDGm4UkoppZSKIQ1XSimllFIxpOFKKXXeROQKEWnb6uPYDkTEiEjtVh+HUmrrifZzpZRSz56IGGC/Meb0Vh+LUmpraeVKKbUlRMS11cewFXbr61ZqN9FwpZRal4h0iciHRKRVRCZE5Osikhp47EoRORu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t1g+X4I+XtrbIndimpFg/VIKBq6kJDh+2+mPT5nOlVAJouFrP3Jz1gR4MUseOWdPYWOT1KyvDP9AbG63qlDbnKRV7i4tWwFpdLY7WYWp+/krQOnx45ceO253Y41ZK7XgarsBqtuvsDA9Qzc3WFVCR/g45OSsfzsEQ1dhoDSOilNpaU1MrVa5g4Dp2zOqva7Vg02Lw/3MweO3bp52jKqXOm4arzk7rQzVSL9Uul1V5Cv3QPXzY6pVamxe
"text/plain": [
"<Figure size 720x576 with 3 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# Umieszczanie kilku układów współrzędnych i kilku wykresów na jednym rysunku\n",
"\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"# inicjalizacja zestawu wykresów\n",
2022-10-14 11:38:56 +02:00
"fig = plt.figure(figsize=(10, 8))\n",
"\n",
"# wygenerowanie danych\n",
"x = np.arange(0.0, 1.0, 0.025)\n",
2022-10-14 11:38:56 +02:00
"y1 = np.sin(2 * np.pi * x) + 5.0\n",
"y2 = np.sin(2 * np.pi * x) + 2.5\n",
"y3 = np.sin(2 * np.pi * x)\n",
"\n",
"# pierwszy wykres\n",
2022-10-14 11:38:56 +02:00
"ax1 = fig.add_subplot(3, 1, 1)\n",
"ax1.set_ylabel(\"y\")\n",
"ax1.set_title(\"pierwszy wykres\")\n",
"\n",
2022-10-14 11:38:56 +02:00
"ax1.plot(x, y1, color=\"red\", lw=2) # pierwsza krzywa - czerwona\n",
"ax1.plot(x, y2, color=\"green\", lw=2) # druga krzywa - zielona\n",
"ax1.plot(\n",
" x, y3, color=\"#002d69\", lw=2\n",
") # trzecia krzywa - kolor zdefiniowany szesnastkowo\n",
"\n",
"# drugi wykres\n",
2022-10-14 11:38:56 +02:00
"ax2 = fig.add_subplot(3, 1, 2)\n",
"ax2.set_ylabel(\"y\")\n",
"ax2.set_title(\"drugi wykres\")\n",
"\n",
2022-10-14 11:38:56 +02:00
"ax2.plot(x, y1, color=\"black\", lw=2, linestyle=\"--\") # pierwsza krzywa - kreskowana\n",
"ax2.plot(x, y2, color=\"blue\", lw=2, linestyle=\":\") # druga krzywa - kropkowana\n",
"ax2.plot(\n",
" x, y3, color=\"#ff0000\", lw=2, linestyle=\"-.\"\n",
") # trzecia krzywa - kropkowano-kreskowana\n",
"\n",
"# trzeci wykres\n",
2022-10-14 11:38:56 +02:00
"ax3 = fig.add_subplot(3, 1, 3)\n",
"ax3.set_ylabel(\"y\")\n",
"ax3.set_title(\"trzeci wykres\")\n",
"\n",
2022-10-14 11:38:56 +02:00
"ax3.plot(x, y1, color=\"brown\", marker=\"x\") # pierwsza krzywa - krzyżyki\n",
"ax3.plot(x, y2, color=\"purple\", marker=\"o\") # druga krzywa - kółka\n",
"ax3.plot(x, y3, color=\"orange\", marker=\"^\") # trzecia krzywa - trójkąty\n",
"\n",
"# dostosowanie odstępów pomiędzy wykresami\n",
2022-10-14 11:38:56 +02:00
"plt.subplots_adjust(wspace=0.2, hspace=0.4)\n",
"\n",
2022-10-14 11:38:56 +02:00
"plt.show() # pokaż wykres\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Wykresy trójwymiarowe  linie"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
2022-10-14 11:38:56 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjwAAAHBCAYAAABt62HAAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nOy9eZQc5X3v/e1teu/Z9xlpNs2mXSMxA0HY4BgcAsIgsx07xCFcjuwrR+AkfnNPHGznensTeEEYH4gxBmNjvAZjK+BriNG1AaENCYE03bPPdM/07EtX70vV+8fwlKp7eu/qru6Z53POHFBv9fRWz7d/21fGcRwoF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VaNEf4WEIUCgVUKhUVQRQKZUNAIzwUSp5B6nRIqkooQliWhc1mw/T0NPR6PYxGI4xGI3Q6XUpihUSBpqenEQqFUFdXBwB8JEipVFIRRKFQChEa4aFQ8h2WZREMBhEKhXihIxQbCwsLGBgYQHl5OTo6OuDxeOBwODA/Pw+32w2lUgmj0QiDwQCTyRRXBEU+vkKh4OuBfD4fvF5v2HWRKTEqgigUSqFBIzwUisREq9MRCgqXywWLxQK5XI729nZotdqoNTyBQAAMw8DpdMLhcMDtdkOhUPBRIBIJkssvT6OYnp6G3+/Hpk2bYq5NWBNEkMvlfCSIiiAKhZJH0KJlCiXfiFenA6wKmOHhYSwvL6OjowOlpaX8/WIVLUcSDAbBMAz/53a7IZPJeAHk8/kgl8uxefPmlNa
"text/plain": [
"<Figure size 720x576 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"import matplotlib as mpl\n",
"from mpl_toolkits.mplot3d import Axes3D\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
2022-10-14 11:38:56 +02:00
"fig = plt.figure(figsize=(10, 8))\n",
"ax = fig.add_subplot(111, projection=\"3d\")\n",
"\n",
"theta = np.linspace(-4 * np.pi, 4 * np.pi, 50)\n",
"z = np.linspace(-2, 2, 50)\n",
"r = z**2 + 1\n",
"x = r * np.sin(theta)\n",
"y = r * np.cos(theta)\n",
"\n",
2022-10-14 11:38:56 +02:00
"ax.plot(x, y, z, label=\"krzywa parametryczna\")\n",
"ax.legend() # pokaż legendę wykresu\n",
"\n",
2022-10-14 11:38:56 +02:00
"plt.show() # pokaż wykres\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Wykresy trójwymiarowe powierzchnie"
]
},
{
"cell_type": "code",
2022-10-14 16:11:34 +02:00
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
2022-10-14 16:11:34 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAn4AAAJ8CAYAAAB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UUhkhODk5yYMHD5BS5ghBn8+3bkIwmUySSCQALQQ1Gs3moIWfRrPBZHvzZYuDbNLCL3vs2rlz51ZtY7LdkVJSWVlJZWUlu3btQinF3Nwc4XCY8fFxent7MU0zZ86w1+tdFyGY/hykI4JCCC0ENRrNuqOFn0azQazEmy8tDG7evLkpY9eyGf3zP6fpW791S0cGn3VvUkpCoRChUIj29naUUpk5w48fP+bevXu43e5MNLCqqgqv17sm+80W8csRgqZpbunfgUajeT7Qwk+j2QCWjl0rJfrm5+d59913Abhw4QJ+v3/D9rmU+OQkl7//+9nz0Y9y+ud/ftP2sVFIKTMiD1Jzj9NCcGRkhLt37+LxeDJrqqurM1Yyq6GUEEz7LEop85pFtBDUaDQrRQs/jWadSXvzLSfKNzIywp07d9ixYweRSGRNokur4f5v/iZWJMK9X/s1KhobOfwTP7Gp+ynFenjRG4ZBTU0NNTU1QGpKSloIDg0Ncfv2bXw+X06NoNvtXvV5ywnBvr4+du/ejdfrzUkNayGo0WjKoYWfRrNOLPXmKzd27datW0xOTnLq1ClCoRBDQ0PrImaWixWJcP83fzPz3zf+1b+ior6e3d/3fZu2p83GNE1qa2upra0FUr+39JzhwcFBbt26hd/vz6kRXAvLnWwhqJTi0aNHtLW1kUgkiMfjBaeKaCGo0WgKoYWfRrMOrCS1mz127eLFi3g8nkyd12YKv75PfpJEOJzz2LX/5//BU1PDjg99aJN2tbUwTZO6ujrq6uoASCaTGQ/B/v5+uru7CQQCOTWCprm6r93sGcOmaWY+I+n
"text/plain": [
2022-10-14 16:11:34 +02:00
"<Figure size 1000x800 with 1 Axes>"
]
},
2022-10-14 16:11:34 +02:00
"metadata": {},
"output_type": "display_data"
}
],
"source": [
2022-10-14 11:38:56 +02:00
"from mpl_toolkits.mplot3d import (\n",
" Axes3D,\n",
") # niezbędne do rysowania powierzchni w 3 wymiarach\n",
"from matplotlib import cm\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
2022-10-14 11:38:56 +02:00
"fig = plt.figure(figsize=(10, 8))\n",
"ax = fig.add_subplot(111, projection=\"3d\")\n",
"\n",
"X = np.arange(-5, 5, 0.25)\n",
"Y = np.arange(-5, 5, 0.25)\n",
2022-10-14 11:38:56 +02:00
"X, Y = np.meshgrid(\n",
" X, Y\n",
") # wygenerowanie tablicy danych wejściowych dla wykresu trójwymiarowego\n",
"\n",
"# obliczenie wartości rzędnych\n",
2022-10-14 11:38:56 +02:00
"Z = np.sqrt(X**2 + Y**2)\n",
"# Spróbuj też innych funkcji\n",
2022-10-14 11:38:56 +02:00
"# Z = np.sin(np.sqrt(X**2 + Y**2))\n",
"# Z = np.cos(X + Y)\n",
"# Z = X**2 * Y\n",
"\n",
2022-10-14 11:38:56 +02:00
"surf = ax.plot_surface(\n",
" X, Y, Z, rstride=1, cstride=1, cmap=cm.jet, linewidth=0, antialiased=True\n",
")\n",
"\n",
2022-10-14 11:38:56 +02:00
"plt.show()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Wykresy kolumnowe"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
2022-10-14 11:38:56 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAl4AAAH7CAYAAAAdGJFGAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO3debScdZ3n8ffHJBIUVMCIkABhEBBZBAzQiI60C6BHcZm2FRVBVLDHBR13Pbicbqbtdh/HpVFQ3FhatMWlHdIOSDssGujI0kFjNxGCKCGCCg1I4Dt/1HPTRbg3uZFbv6p7836dU+dWPeu3nl/d3E9+z++pJ1WFJEmSBu9Bwy5AkiRpU2HwkiRJasTgJUmS1IjBS5IkqRGDlyRJUiMGL0mSpEYMXpIGIsmhSVYOu47pJMn7knx5BOo4NskPh12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222zt61mzZrFmzZpm9U7EU42SJGnkHXfccbznPe9h7733vs/0ww8/nE984hNUN1L/X/7lX4ZR3qQZvCRJ0shbsGABJ5544v2mn3TSSdx9993ss88+7LXXXpx00klDqG7yUpO5lnPIFi1aVEuWLBl2GZIkbVKWLVvGHnvsMewyRtp4xyjJZVW1aLzl7fGSJElqxOAlSZLUiMFLM08y9V+vLEnSFDB4SZIkNWLwkiRJasTgJUmS1IjBS5IkjaQ3velNfOxjH1v7+vDDD+dVr3rV2tdvfvOb+chHPjKM0v5oBi9JkjQ5YxcvTdVjA574xCdy0UUXAXDvvfdy8803c/XVV6+df9FFF3HIIYcM7O0OgsFLkiS
"text/plain": [
"<Figure size 720x576 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"# data: scores in five groups for men and women\n",
"N = 5\n",
2022-10-14 11:38:56 +02:00
"menMeans = [18, 35, 30, 35, 27]\n",
"menStd = [2, 3, 4, 1, 2]\n",
"womenMeans = [25, 32, 34, 20, 25]\n",
2022-10-14 11:38:56 +02:00
"womenStd = [3, 5, 2, 3, 3]\n",
"\n",
"# start creating figure\n",
2022-10-14 11:38:56 +02:00
"fig = plt.figure(figsize=(10, 8))\n",
"ax = fig.add_subplot(111)\n",
"\n",
"# necessary variables\n",
"LOCATIONS = np.arange(N) # the x locations for the groups\n",
2022-10-14 11:38:56 +02:00
"WIDTH = 0.35 # the width of the bars\n",
"\n",
"# the bars\n",
2022-10-14 11:38:56 +02:00
"rects_m = ax.bar(\n",
" LOCATIONS,\n",
" menMeans,\n",
" WIDTH,\n",
" color=\"blue\",\n",
" yerr=menStd,\n",
" error_kw=dict(elinewidth=2, ecolor=\"red\"),\n",
")\n",
"\n",
"rects_f = ax.bar(\n",
" LOCATIONS + WIDTH,\n",
" womenMeans,\n",
" WIDTH,\n",
" color=\"red\",\n",
" yerr=womenStd,\n",
" error_kw=dict(elinewidth=2, ecolor=\"blue\"),\n",
")\n",
"\n",
"# axes and labels\n",
"ax.set_xlim(-WIDTH, len(LOCATIONS))\n",
"ax.set_ylabel(\"Scores\")\n",
"ax.set_title(\"Scores by group and gender\")\n",
2022-10-14 11:38:56 +02:00
"xTickMarks = [\"Group {}\".format(i) for i in range(1, 6)]\n",
"ax.set_xticks(LOCATIONS + WIDTH)\n",
"xtickNames = ax.set_xticklabels(xTickMarks)\n",
"plt.setp(xtickNames, rotation=45, fontsize=10)\n",
"\n",
"# add a legend\n",
2022-10-14 11:38:56 +02:00
"ax.legend((rects_m[0], rects_f[0]), (\"Men\", \"Women\"))\n",
"\n",
2022-10-14 11:38:56 +02:00
"plt.show()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Wykresy punktowe"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
2022-10-14 11:38:56 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA2kAAAGbCAYAAABeTdidAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nOzdeXxU5fX48c+dZLKQhIQlQFgTkB0CYReQ1aVad1G0VsFvLb+6a62tdam2Lq3WqrVqrVaLCy5UEau4AGJEkH0PIWENECAhgez7cn9/nCyTZJJMMlsmOe/Xa15M7r1z7zNBmTn3Oc85hmmaKKWUUkoppZRqGyzeHoBSSimllFJKqVoapCmllFJKKaVUG6JBmlJKKaWUUkq1IRqkKaWUUkoppVQbokGaUkoppZRSSrUh/t64aPfu3c3o6GhvXFoppZQHbdu2LdM0zUhvj8NXePrzsaCggJCQEI9dry3oaO9Z32/71tHeL7Sv99zUZ6RXgrTo6Gi2bt3qjUsrpZTyIMMwjnp7DL7E05+P8fHxzJo1y2PXaws62nvW99u+dbT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hTygft2gUZGXD++d4eiVKqGVHA21Xr0izAUtM0v/DymFrl/fff9/YQOo4hQASQ7cCxnYGh7h2OUsrzNEhTysf88APMmgWVlfDkk/Dww94ekVKqMaZp7gbivD0O5WMMZM71E5qvBXoBmu6oVDuk/1sr5WMSEyVAA9izx7tjUUop5SajgMtofH2aBbgUGO2xESmlPEhn0pTL7d4N77wDP/0pzJ7
"text/plain": [
"<Figure size 1080x504 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
2022-10-14 11:38:56 +02:00
"fig = plt.figure(figsize=(15, 7))\n",
"\n",
"# left panel\n",
"N = 1000\n",
"ax1 = fig.add_subplot(121)\n",
"\n",
"x = np.random.randn(N)\n",
"y = np.random.randn(N)\n",
2022-10-14 11:38:56 +02:00
"ax1.scatter(x, y, color=\"blue\", s=10, edgecolor=\"none\")\n",
"# make axes square\n",
2022-10-14 11:38:56 +02:00
"ax1.set_aspect(1.0 / ax1.get_data_ratio())\n",
"\n",
"# right panel\n",
"ax2 = fig.add_subplot(122)\n",
2022-10-14 11:38:56 +02:00
"props = dict(alpha=0.5, edgecolors=\"none\")\n",
"\n",
"M = 200\n",
2022-10-14 11:38:56 +02:00
"colors = [\"blue\", \"green\", \"magenta\", \"cyan\"]\n",
"handles = []\n",
"\n",
"for color in colors:\n",
" x = np.random.randn(M)\n",
" y = np.random.randn(M)\n",
2022-10-14 11:38:56 +02:00
" size = np.random.randint(25, 200)\n",
" handles.append(ax2.scatter(x, y, c=color, s=size, **props))\n",
"\n",
2022-10-14 11:38:56 +02:00
"# ax2.set_ylim([-5,10])\n",
"# ax2.set_xlim([-5,10])\n",
"\n",
"ax2.legend(handles, colors)\n",
"ax2.grid(True)\n",
2022-10-14 11:38:56 +02:00
"ax2.set_aspect(1.0 / ax2.get_data_ratio())\n",
"\n",
2022-10-14 11:38:56 +02:00
"plt.show()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Histogramy"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
2022-10-14 11:38:56 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlAAAAHSCAYAAAAjcvULAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAUqElEQVR4nO3df8ju933X8dd7Oa2b3UYTcycc18YohLoybKo3ZVIZc2lmpqOJf0RaVA4auB04bUFxcQPHlEFEGBMR8bBWj9h1xrUhYc7ZeLYyB2vXO122tTupqaU/YmPOWWZpY8GR9u0f5wo7a0+8r/d9X9e5rvs+jwccrl/f+1xvviTnfvK5vt/rW90dAACW9w2bHgAA4LgRUAAAQwIKAGBIQAEADAkoAIAhAQUAMHTqWr7ZzTff3Lfffvu1fEsAgEN54oknfqe7d6722jUNqNtvvz37+/vX8i0BAA6lqj7zcq/5CA8AYEhAAQAMCSgAgCEBBQAwJKAAAIYEFADAkIACABgSUAAAQwIKAGBIQAEADAkoAIAhAQUAMCSgAACGBBQAwJCAAgAYElAAAEMCCgBgSEABAAwJKACAoVObHgBg2+ye3V1qu/29/TVPAmwrK1AAAEMCCgBgSEABAAwJKACAIQEFADAkoAAAhgQUAMCQgAIAGBJQAABDAgoAYEhAAQAMCSgAgCEBBQAwJKAAAIYEFADAkIACABgSUAAAQwIKAGBIQAEADAkoAIAhAQUAMCSgAACGBBQAwNCBAVVVr6uqJ6/488WqemdV3VRVj1fV04vbG6/FwAAAm3ZgQHX3J7r7zu6+M8mfSfLlJI8keTDJ+e6+I8n5xWMAgBNv+hHeXUn+R3d/Jsm9Sc4tnj+X5L5VDgYAsK2mAfW2JO9d3L+1u59NksXtLVf7garaq6r9qtq/dOnS4ScFANgSSwdUVb0yyVuT/MfJG3T32e7e7e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PLq2KQEAtshRvgfqoSR3V9XTSe5ePAYAOPEOPAbqSt39wSQfXNx/Psldqx8JAGC7jQIK2JxlD/re39tf8yQAuJQLAMCQgAIAGBJQAABDAgoAYEhAAQAMOQsPThiXaAFYPytQAABDAgoAYEhAAQAMCSgAgCEBBQAwJKAAAIYEFADAkIACABgSUAAAQwIKAGDIpVwAjqFlL9mzv7e/5kmubnJJoU3NCEdhBQoAYEhAAQAMCSgAgCEBBQAwJKAAAIYEFADAkIACABgSUAAAQwIKAGBIQAEADLmUC8AWmVwCZZV/n8upwIwVKACAIQEFADAkoAAAhgQUAMCQgAIAGBJQAABDAgoAYEhAAQAMCSgAgCEBBQAwJKAAAIYEFADAkIACABgSUAAAQwIKAGBIQAEADAkoAIChAwOqqr6xqn6tqn6jqj5eVT+2eP6mqnq8qp5e3N64/nEBADZvmRWo/5vke7r7DUnuTHJPVX1nkgeTnO/uO5KcXzwGADjxDgyovuyFxcNXLP50knuTnFs8fy7JfWuZEABgyyx1DFRV3VBVTya5mOTx7v5wklu7+9kkWdzesr4xAQC2x6llNururyS5s6peneSRqvqOZd+gqvaS7CXJbbfddqgh4STbPbu76REAGBqdhdfdX0jywST3JHmuqk4nyeL24sv8zNnu3u3u3Z2dnSOOCwCwecuchbezWHlKVX1TkrckeSrJY0nOLDY7k+TRdQ0JALBNlvkI73SSc1V1Qy4H18Pd/XNV9atJHq6qB5J8Nsn9a5wTAGBrHBhQ3f2bSd54leefT3LXOoYCANhmvokcAGBIQAEADAkoAIAhAQUAMCSgAACGBBQAwJCAAgAYElAAAEMCCgBgSEABAAwJKACAIQEFADB04MWEATj5ds/uLrXd/t7+mieB48EKFADAkIACABg
"text/plain": [
"<Figure size 720x576 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"fig = plt.figure(figsize=(10, 8))\n",
"ax = fig.add_subplot(111)\n",
"\n",
"x = np.random.normal(0, 1, 1000)\n",
"num_bins = 50\n",
2022-10-14 11:38:56 +02:00
"ax.hist(x, num_bins, color=\"green\", alpha=0.8)\n",
"plt.show()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2.3. Wizualizacja danych - biblioteka `seaborn`"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Biblioteka `seaborn` (https://seaborn.pydata.org) to oparta o `matplotlib` biblioteka do wizualizacji danych."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Przykład 1\n",
"\n",
"Wizualizacja zbioru danych *Iris* poprzez rzutowanie go na różne osie:"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<seaborn.axisgrid.PairGrid at 0x20279e6c0d0>"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
2022-10-14 11:38:56 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA1UAAAG8CAYAAAA2K4+lAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nOydeXgUVdaH36pekk4CWcgCIWFTQBERARFFR4ILIo6M47iCLDoKg4qgnzg6qIPjyowEURAZh0UFRx1lUFGRJTiKCrKLKERZQ4DsQJImvVR9fxTd6equTjpJd0jIfZ+Hp+nqW0t3zr1V955zfkdSVRWBQCAQCAQCgUAgENQP+XRfgEAgEAgEAoFAIBA0Z8SkSiAQCAQCgUAgEAgagJhUCQQCgUAgEAgEAkEDEJMqgUAgEAgEAoFAIGgAYlIlEAgEAoFAIBAIBA1ATKoEAoFAIBAIBAKBoAFEdFIlSdJkSZJ+lCRphyRJ70iSFB3J8wkEAoFAIBAIBAJBYxOxSZUkSe2BiUA/VVV7AibgtkidTyAQCAQCgUAgEAhOB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A1WUmyJiDbiwMf+GqSgfb9TDZX98W8jfDuSO29kEwXhEgwO1183WKQwOF2aLYanYQc6phc37HbbNWULHvfXi3HvvUd43A9twvKj2iREyYLxLUFk8GjsLiPCOpBxKfdkiRZgRuA94N8fq8kSRslSdpYWNg0lFV+LSznxEkXXdNqzqfy0CEpBrvTzYGSyghfmaA50BRtukngF1KhXDKR3L63MWLFWIYsHcbhiqPeG7SH/Ip8HG6RHNwUEHbdODjcDsN+cLj8MEM+GMKI5SPILd2
"text/plain": [
"<Figure size 859.25x432 with 20 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"import pandas as pd\n",
"import seaborn\n",
"\n",
2022-10-14 11:38:56 +02:00
"data_iris = pd.read_csv(\"../wyk/iris.csv\")\n",
"\n",
"seaborn.pairplot(\n",
" data_iris,\n",
2022-10-14 11:38:56 +02:00
" vars=[c for c in data_iris.columns if c != \"Gatunek\"],\n",
" hue=\"Gatunek\",\n",
" height=1.5,\n",
" aspect=1.75,\n",
")\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Przykład 2\n",
"\n",
"Rozkład różnych typów zabudowy w zbiorze danych *Mieszkania4* pod względem roku budowy i powierzchni lokalu"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<seaborn.axisgrid.FacetGrid at 0x202002cc580>"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
2022-10-14 11:38:56 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAg0AAAFgCAYAAAA4mkqNAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nOzdd3ib1fXA8e+x5L2zN4EQAllkEfYOEGbCaNkUKKMtox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RcNqLsd/tXrQO3vszLH3L3e8/Hn71VNslDsYYYzqNSJKGfjWzKLZrOd/XJgwAa7+FOU/C/pdDXAwvrLn229qEAWD1LPc89r4UfL72i8sYY0yHE0n/8XsicnjUI4l16xc0bFvzDVRXtH0sW2Lt3Eba5rnLFcbEmNziStYWlJNbXLnVxyioLGBD6QZyynKoDla3YnTGmEiShq+B10WkXESKRKRYRIqiHVjM2enghm3DT3RjG2LZLkc2bNvtOEhMbftYjGmCqvLDhmJOfmgG+9wylV8/OIMfNhSzpQO1c8pyuHL6lUx4ZQInvHkCn675lLLqsihFbcz2J5Kk4XZgbyBFVTNUNV1VM6IcV+xJ7w0nPAzpvSAxHfa7HAYf1t5RtSyzPxx9uxu0mZQJB/wZBu7X3lEZU0duSRXnPzWbn3NKAViWW8pvn/yG3JLIexzKA+XcO+9eZq6fCbgehys+vYKiqu3vM44x0RLJxfgfgUXakedmtobkTBh2Aux0oLufmAHxye0bUyTSe8DoM2GXie5+UtaW946U50OgEhLSYr9nxXRIVcEQKzfV7RFYnVdOVSDysdelVaXMWj+rTltIQ6wuXk2v1F6tEqcx27tIkoZ1wHQ
"text/plain": [
"<Figure size 554.875x360 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"import pandas as pd\n",
"import seaborn\n",
"\n",
2022-10-14 11:38:56 +02:00
"data = pd.read_csv(\"../wyk/mieszkania4.tsv\", sep=\"\\t\")\n",
"\n",
2022-10-14 11:38:56 +02:00
"data = data[(data[\"Powierzchnia w m2\"] < 10000) & (data[\"cena\"] < 10000000)]\n",
"\n",
2022-10-14 11:38:56 +02:00
"seaborn.relplot(data=data, x=\"Rok budowy\", y=\"Powierzchnia w m2\", hue=\"Typ zabudowy\")\n"
]
}
],
"metadata": {
"celltoolbar": "Slideshow",
"kernelspec": {
2022-10-14 11:38:56 +02:00
"display_name": "Python 3.10.4 64-bit",
"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",
2022-11-03 15:37:40 +01:00
"version": "3.10.6"
},
"livereveal": {
"start_slideshow_at": "selected",
"theme": "amu"
2022-10-14 11:38:56 +02:00
},
"vscode": {
"interpreter": {
"hash": "916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1"
}
}
},
"nbformat": 4,
"nbformat_minor": 4
}