umz21/lab/02_Wczytywanie_i_prezentowanie_danych.ipynb

884 lines
561 KiB
Plaintext
Raw Normal View History

{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
2021-05-19 07:49:54 +02:00
"## Uczenie maszynowe zastosowania\n",
"### Zajęcia laboratoryjne\n",
"# 2. Wczytywanie i prezentowanie danych"
]
},
{
"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",
2022-03-10 12:40:55 +01:00
"execution_count": 1,
"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",
"with open('data1.csv') as data_file:\n",
" reader = csv.reader(data_file)\n",
" for row in reader:\n",
" print(row)"
]
},
{
"cell_type": "code",
2022-03-10 12:40:55 +01:00
"execution_count": 2,
"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",
"with open('data1.csv') as data_file:\n",
" reader = csv.DictReader(data_file)\n",
" for row in reader:\n",
" print(dict(row))"
]
},
{
"cell_type": "code",
2022-03-10 12:40:55 +01:00
"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",
"with open('data1.tsv') as data_file:\n",
" reader = csv.reader(data_file, delimiter='\\t')\n",
" for row in reader:\n",
" print(row)"
]
},
{
"cell_type": "code",
2022-03-10 12:40:55 +01:00
"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",
"with open('data1.tsv') as data_file:\n",
" reader = csv.DictReader(data_file, delimiter='\\t')\n",
" for row in reader:\n",
" print(dict(row))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Biblioteka `pandas`"
]
},
{
"cell_type": "code",
2022-03-10 12:40:55 +01:00
"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",
"data = pd.read_csv('data1.csv')\n",
"print(data)"
]
},
{
"cell_type": "code",
2022-03-10 12:40:55 +01:00
"execution_count": 6,
2021-03-17 13:20:09 +01:00
"metadata": {
"scrolled": true
},
"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",
"data = pd.read_csv('data1.tsv', sep='\\t')\n",
"print(data)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Dane z Pandas DataFrame można przekonwertować na tablicę NumPy:\n",
"* za pomocą właściwości `values`\n",
"* za pomocą metody `to_numpy()` (od wersji Pandas 1.1.0)"
]
},
{
"cell_type": "code",
2022-03-10 12:40:55 +01:00
"execution_count": 7,
"metadata": {},
"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": [
"\n",
"print(data.to_numpy()) # Pandas w wersji >=1.1.0\n",
"# lub:\n",
"# print(data.values) # dla starszych wersji biblioteki Pandas"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Wykresy biblioteka `matplotlib`"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Dokumentacja modułu `pyplot` biblioteki `matplotlib`: https://matplotlib.org/api/pyplot_api.html"
]
},
{
"cell_type": "code",
2022-03-10 12:40:55 +01:00
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
2021-03-17 11:29:33 +01:00
"# Trochę jupyterowej magii, żeby wykresy wyświetlały się bezpośrednio pod kodem, który go wywołuje\n",
"%matplotlib inline"
]
},
{
"cell_type": "code",
2022-03-10 12:40:55 +01:00
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
2022-03-10 12:40:55 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD8CAYAAACb4nSYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAASEklEQVR4nO3df4wn9X3f8efrADe9M41xvCYYuLsoQViOVWNndU6EatlOIECQcSurAW1d0iJtEtmSrVZqnJ4Up46QXFVxqpYoaGuQcbLBbmOToBjbnBJXBMk/2LseNuTsQBEHl0PcOeeA0UaNznn3j++cbll/v+z3vvM9vrv+PB/SVzPzmc/MvG8Erx19vjPzTVUhSWrDtlkXIEl6+Rj6ktQQQ1+SGmLoS1JDDH1JaoihL0kN2TD0k1ya5EtJDiV5NMkHuvZXJ9mX5LFuesGI7W/u+jyW5OZp/wMkSePLRvfpJ7kIuKiqDiQ5H9gPvBv4JeBEVX00yYeAC6rq19Zt+2pgBZgHqtv2p6rqO1P/l0iSNrThlX5VPVNVB7r57wKHgIuBG4C7um53MfhDsN7PA/uq6kQX9PuAa6ZRuCTpzJ17Jp2T7AbeDHwVuLCqnoH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TQl6SGGPqS1BBDX5IaYuhLUkMMfUlqiKEvSQ0x9CWpIYa+JDXE0JekhvQO/SRPJvlGkoNJVoasT5L/luTxJF9P8pa+x5QkTabXb+Su8Y6q+vaIddcCl3WftwK/100lSS+zl2N45wbgkzXwFeBVSS56GY4rSVpnGqFfwP1J9idZHLL+YuDpNctHurYXSbKYZCXJyvHjx6dQliRpvWmE/pVV9RYGwzjvS/K2deszZJv6voaqpaqar6r5ubm
"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-03-10 12:40:55 +01:00
"plt.plot([1,2,3,4], [1,4,9,16], 'ro')\n",
2021-03-17 11:29:33 +01:00
"plt.axis([0, 5, 0, 20]) # opcjonalnie ustawiamy zakres osi wykresu\n",
"\n",
"plt.show() # pokaż wykres"
]
},
{
"cell_type": "code",
2022-03-10 12:40:55 +01:00
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZMAAAD8CAYAAACyyUlaAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAWxUlEQVR4nO3dcYyc9X3n8fe3ODSUlhqoQdgGsVGsEnpqEpgF96AoSyqwaVTzh9kjKoeFOFlaJS299kRxJQfVvhOJdSoNunQlK6SYSy5k5abFikJcy5kTCQpk1yUHASfylu3hvaXYkYFyhwRH7nt/zG/xeL3eHe9jdmZn3i9pNM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SpMsNEklSZYSJJqswwkSRVZphIkiozTCRJlRkmUgfa8dQO6hP1E2r1iTo7ntrRpj2S5maYSB2of2U/g7sH3wuU+kSdwd2D9K/sb/OeSbNb1u4dkHSygb4BRjaOMLh7kKHaEMNjw4xsHGGgb6DduybNyjMTqUMN9A0wVBti+5PbGaoNGSTqaIaJ1KHqE3WGx4bZesNWhseGTxpDkTqJYSJ1oOkxkpGNI2wb2PbeJS8DRZ3KMJE60OjU6AljJNNjKKNTo23eM2l2kZnt3oczqlar5djYWLt3Q5KWlIg4kJm1hW7vmYkkqbJ5wyQiPhgRP4yI/xERL0TEn5d6X0Q8ExGHIuIbEXF2qf9iWR8vr1/e9F5bSv2nEXFzU31dqY1HxH1N9Vn7kCR1llbOTN4GbszMjwIfA9ZFxFrgC8CDmbkGeA24u7S/G3gtMz8MPFjaERFXArcDvwGsA/4qIs6KiLOALwHrgSuBT5e2zNGHJKmDzBsm2fC/y+o
"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",
"data = pd.read_csv('data1.tsv', sep='\\t')\n",
2022-03-10 12:40:55 +01:00
"\n",
"# konwersja Pandas DataFrame na numpy.array\n",
"# data_array = data.values # dla starszych wersji biblioteki Pandas\n",
"data_array = data.to_numpy() \n",
"\n",
"# Wybór kolumn do przedstawienia na wykresie\n",
"x = data_array[:, 5]\n",
"y = data_array[:, 0]\n",
"\n",
2021-03-17 11:37:25 +01:00
"plt.plot(x, y, 'gx') # \"gx\" - zielone (Green) krzyżyki (x)\n",
"plt.axis([0, 100, 0, 600000]) # opcjonalnie ustawiamy zakres osi wykresu\n",
"\n",
"plt.show() # pokaż wykres"
]
},
{
"cell_type": "code",
2022-03-10 12:40:55 +01:00
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
2022-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7F9ZVqrpMVWep6gpV/YKq/i9V/V/J56qq16rqqap6jqqOZL57s6qeljy+GOP404vsvPPg7LOnb/NJmuDOOMMFkew2n0xMVKrKzj8fTjvN3WzSNhGfxPK8b5/LGAwNuZLA0qWul9Dzz/vXjuV582aX81+yBF7zGuf9+edh/37/2rE8P/WUqxo+9dRK4HrqqTDVZ7E8F0GnV2F1LLt3u8fcuXDccS7hAWza5F87DVJnnhlW99lnXVvEihWuqN0LntP6+NNPd7nTXvCc1e3rg5NPdu+fCbAyeid4Tq/pw4dddVJI7ZCei8ACSE7Si+mUU0Ak7Il/+mn3vGpV5eJ+9ln/uaWsLsTzfMopcXTBPIfU7gXPR47AT3/qAvUpp4T1XAQWQHKSnuD0hIc88Zs3u+eVK8PmlrK6EM/zsmWuWmXHDv/VKrE8T01VqslWrAibUYjlef9+V2U4ezYsWhQvfUE47a1bXdXZ8cfDrFkWQHqGtASSXtihTrzq9BtLSO1YuocOwYsvwsCAa4MIWa0Sy/OOHa7NafFiGB4Om1HohPQlMj2jcOBAOG2Id01l03WIjhrtYgEkJ9Unfvly9+z74t6zx/V6mj/ftUOE1E5zaaE9p7+/fLkLHiG1Y3mu1o2pHUu3rw9OOCGOdizPc+fCggWuamvnTr/aRWABJCdpP+1ly6Y/v/CC37ls0gSXJvBqbZ9Ua8fSjaltnsPpxtTuBc9FYAEkJ+ko6PRkz54Nxx7rqhh8Tm5YK2eaHoPvkdnV2kuXuqqG7dtddUsoXYjnOZZuKG3V3vM8Pu7ScH+/a4sIpQtx03YRWADJSXpy0wSXfe3zxFdXnWV1fedYqrU
"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",
2021-03-17 11:37:25 +01: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",
2021-03-17 11:37:25 +01:00
"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",
2021-03-17 11:37:25 +01:00
"y = np.sin(2*np.pi*x)\n",
"# spróbuj też inne funkcje:\n",
2021-03-17 11:37:25 +01:00
"# y = 2 * x**2 + 5 * x - 10\n",
2022-03-10 12:40:55 +01:00
"# y = np.sqrt(x)\n",
"\n",
2021-03-17 11:29:33 +01:00
"ax.plot(x, y, color='blue', lw=2) # \"lw\" oznacza grubość linii (Line Width)\n",
"\n",
"plt.show() # pokaż wykres"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Style wykresów"
]
},
{
"cell_type": "code",
2021-03-17 13:20:09 +01:00
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
2022-03-10 12:40:55 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlcAAAHiCAYAAADF1OnfAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nOzdeXxjZ33v8c9Pkld538fbeLyMx2N7SMiEECCEPUDTErbb5CahrKGvpkACFArtTYEmLJeytUAhJewk0AZKCVvCGhIISSbhZjz2jMfj8Tbe90VeJT33jyMdS7ZkeyaWvP3er9d56Ug65+ic0Vj66vec8zxijEEppZRSSm0Ox1bvgFJKKaXUbqLhSimllFJqE2m4UkoppZTaRBqulFJKKaU2kYYrpZRSSqlNpOFKKaWUUmoTabhSSl0wEblCRFq3ej+2AxExIlK91fuhlNp6ov1cKaXU0yciBqgxxpzZ6n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2CYlWT9UgoGrsRGOHLH6Y9Pmc6VUHGi4WsvsrPWBHgxSx49b0+ho5OXLy8M/0BsarOqUNucptfkWFqyAtbJaHK3D1Nzc5aB15Mjyjx23O777rZTa9TRcgdVs19ERHqCamqwroCL9O2RlLX84B0NUQ4M1jIhSamtNTi5XuYKB6/hxq7+ulYJNi8G/52DwOnBAO0dVSl0wDVcdHdaHaqReql0uq/IU+qF75IjVK7U2Lyi1cxhj9VQf+gPq+HHrfC6vd/Xybrf1gyn0776xUYcCUkptiIarpSWrb53c3PAP0SNHtElPqd1ucdEKWKEV66eessZljKS0dHXgqq3Vi1CUUmE0XIH
"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",
"fig = plt.figure(figsize=(10,8))\n",
"\n",
"# wygenerowanie danych\n",
2021-03-17 11:29:33 +01:00
"x = np.arange(0.0, 1.0, 0.025)\n",
"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",
"ax1 = fig.add_subplot(3,1,1)\n",
2021-03-17 11:29:33 +01:00
"ax1.set_ylabel('y')\n",
"ax1.set_title('pierwszy wykres')\n",
"\n",
2021-03-17 11:29:33 +01: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(x, y3, color='#002d69', lw=2) # trzecia krzywa - kolor zdefiniowany szesnastkowo\n",
"\n",
"# drugi wykres\n",
"ax2 = fig.add_subplot(3,1,2)\n",
2021-03-17 11:29:33 +01:00
"ax2.set_ylabel('y')\n",
"ax2.set_title('drugi wykres')\n",
"\n",
2021-03-17 11:29:33 +01: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(x, y3, color='#ff0000', lw=2,linestyle=\"-.\") # trzecia krzywa - kropkowano-kreskowana\n",
"\n",
"# trzeci wykres\n",
"ax3 = fig.add_subplot(3,1,3)\n",
2021-03-17 11:29:33 +01:00
"ax3.set_ylabel('y')\n",
"ax3.set_title('trzeci wykres')\n",
"\n",
2021-03-17 11:29:33 +01: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",
"plt.subplots_adjust(wspace=0.2,hspace=.4)\n",
"\n",
"plt.show() # pokaż wykres"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Wykresy trójwymiarowe  linie"
]
},
{
"cell_type": "code",
2021-03-17 13:20:09 +01:00
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
2022-03-10 12:40:55 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjwAAAHBCAYAAABt62HAAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nOy9eZQc5X3v/e1teu/Z9xlpNs2mXSMxA0HY4BgcAsIgsx07xCFcjuwrR+AkfnNPHGznensTeEEYH4gxBmNjvAZjK+BriNG1AaENCYE03bPPdM/07EtX70vV+8fwlKp7eu/qru6Z53POHFBv9fRWz7d/21fGcRwoFAqFQqFQ1jNyqRdAoVAoFAqFk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AIzwUSp5B6nRIqkooQliWhc1mw/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",
"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",
2021-03-17 11:37:25 +01:00
"ax.plot(x, y, z, label='krzywa parametryczna')\n",
"ax.legend() # pokaż legendę wykresu\n",
"\n",
"plt.show() # pokaż wykres"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Wykresy trójwymiarowe powierzchnie"
]
},
{
"cell_type": "code",
2022-03-10 12:40:55 +01:00
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
2022-03-10 12:40:55 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjwAAAHBCAYAAABt62HAAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAb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ayVXE4HDgcjrQAgmRlVkoETU5OEolE0DQtZ5J8OUWQHJ0hkawMKXgkLxTl8ukUo5yCZ+bTnyba3Y1is9HyjncweutWzprqw4cx790DoOd7v5f9r75K1TvfWZb9bAWWU6Vlt9upra2ltrY2/Vg8HicYDOL3+5meniYcDq+LCAoEAvT09NDR0QHI0RkSSQopeCQvBKm0wODgINXV1c9MQazUp1OMcpWlW4bByNMKLCuRwPnoEfXt7Ux1dWWtq1ZVUme34nEef9d3ceDv/g7f+fMl39OLjN1up6amhpqamvRjiUQiHQlKiSBVVXNEUCknyacEtqqqeUdngBRBkhcTKXgkW55Mn87s7CwVFRUFP9xX69MpRrkiPDN/8zdEe3rSP5vhML6JCeI7d7LwtB9PZXs75u3bWa8zIxG6v+3bOPjZz+I9caLk+9rsLLcPz3Kw2Ww5IkjX9bQIGhgYIBwOI4TIEkEej2fVIihz/8udHwZydIZk6yMFj2TLYpomuq5n+XQKRVue16dTjHIIHkvXGfnN38x53Jibo8HhQG9qIjQ+To3HQ74zm4EA3d/8zRz83OdwHzpU0r1JiqNpGtXV1VRXV6cf03U9PUR1aGiIUCiEECJnkvxy3pPPEmyFRJAcnSHZ6kjBI9lyFPPp5BM8pfDpFKMcKa3pT32KWF9f3ucS4+O07trFzNGjmDduUOj2pM/NMfD
"text/plain": [
"<Figure size 720x576 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"from mpl_toolkits.mplot3d import Axes3D # 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",
"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",
"X, Y = np.meshgrid(X, Y) # wygenerowanie tablicy danych wejściowych dla wykresu trójwymiarowego\n",
"\n",
"# obliczenie wartości rzędnych\n",
"Z = np.sqrt(X**2 + Y**2) \n",
"# Spróbuj też innych funkcji\n",
"# Z = np.sin(np.sqrt(X**2 + Y**2)) \n",
"# Z = np.cos(X + Y) \n",
"# Z = X**2 * Y\n",
"\n",
"surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet,\n",
" linewidth=0, antialiased=True)\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Wykresy kolumnowe"
]
},
{
"cell_type": "code",
2021-03-17 13:20:09 +01:00
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
2022-03-10 12:40:55 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAl4AAAH7CAYAAAAdGJFGAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nO3de5gcZZn38e+dAwliCATCMdEAAsImEdiEgyCwgATwAHhAWUVdRFxWdxERRV9R3BVlxQOCB4SFBREhrujCC65yEF4WgkiQcDKooBACLE4CSIiAJNzvH1WTbYaZZALTT9fMfD/X1dd0V1VX3T339MxvnqquisxEkiRJ7Tei0wVIkiQNFwYvSZKkQgxekiRJhRi8JEmSCjF4SZIkFWLwkiRJKsTgJaltIiIj4lWdrmMwacr3LCLui4h9Ol2HNNQYvKRBJCJ2i4g5EfGniHg0Im6IiJmdrkuS1D+jOl2ApP6JiLWBy4CjgB8AawCvA54Z4O2MzMzlA7nOkiIigMjM5zpdy3AUEaMyc1mn65CayhEvafDYCiAzL8zM5Zn5VGZekZm3dy8QER+IiPkRsSQifh0RO9TTt4mIayPi8Yi4KyLe3PKccyPi2xHxk4hYCvxNRIyJiC9HxIKIeCQizoiINevl14+Iy+p1PRoR/x0RK/tdckBE/D4iFkXEKRExol7/oxExraWODSLiqYiY2HMFETEyIr5Sr+MPEfHhep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U1EcSDWyKWmQMHhJ6oiI+BeqXaWnZOYfVrU41S69x6h2Nc7nf88rNpxsRHVaiCeB04CjMvPWjlYkabW4q1GSJKkQR7wkSZIKMXhJkiQVMqrTBfTH+uuvn1OmTOl0GZIkSat0yy23LMrMib3NGxTBa8qUKcydO7fTZUiSJK1SRPR5+S93NUqSJBVi8JIkSSrE4CVJklTIoDjGS5IklfXss8+ycOFCnn766U6X0lhjx45l0qRJjB49ut/PMXhJkqQXWLhwIePGjWPKlClERKfLaZzMZPHixSxcuJDNNtus389zV6MkSXqBp59+mvXWW8/Q1YeIYL311lvtEUGDlyRJ6pWha+VezPfH4CVJkhopIjjssMNWPF62bBkTJ07kjW98Yweremk8xkuSJK3SQA9+Za56mbXWWos777yTp556ijXXXJMrr7ySTTfddGALKcwRL0mS1Fj7778/l19+OQAXXnghhx566Ip5S5cu5fDDD2fmzJlsv/32XHLJJQCce+65vOUtb2G//fZjyy235OMf/3hHau+NwUuSJDXWO9/5Ti666CKefvppbr/9dnbaaacV80466ST22msvbr75Zq655hqOO+44li5dCsC8efOYPXs2d9xxB7Nnz+aBBx7o1Et4Hnc1SpKkxpo+fTr33XcfF154IQcccMDz5l1xxRVceumlfPnLXwaqT2IuWLAAgL333pvx48cDsO2223L//fczefLkssX3wuAlSZIa7c1vfjMf+9jHuPbaa1m8ePGK6ZnJxRdfzNZbb/285W+66SbGjBmz4vHIkSNZtmxZsXpXxl2NkiSp0Q4//HA+85nPMG3atOdNnzVrFqeffjpZH6l/6623dqK81WLwkiRJjTZp0iSOPvroF0w/4YQTePbZZ5k+fTpTp07lhBNO6EB1qyeyP5/n7LAZM2bk3LlzO12GJEnDxvz589lmm206XUbj9fZ9iohbMnNGb8s74iVJklSIwUuSJKkQg5eGnoiBP8WyJEkDwOAlSZJUiMFLkiSpEIOXJElSIQYvSZLUOMcccwynnnrqisezZs3iiCOOWPH42GOP5atf/WonSntJDF6SJGnVuj+4NFC3VXjta1/LnDlzAHjuuedYtGgRd91114r5c+bMYdddd23by20Xg5ckSWqcXXfddUX
"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",
"menMeans = [18, 35, 30, 35, 27]\n",
"menStd = [2, 3, 4, 1, 2]\n",
"womenMeans = [25, 32, 34, 20, 25]\n",
"womenStd = [3, 5, 2, 3, 3]\n",
"\n",
"# start creating figure\n",
"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",
"WIDTH = 0.35 # the width of the bars\n",
"\n",
"# the bars\n",
"rects_m = ax.bar(LOCATIONS, menMeans, WIDTH,\n",
" color='blue',\n",
" yerr=menStd,\n",
" error_kw=dict(elinewidth=2,ecolor='red'))\n",
"\n",
"rects_f = ax.bar(LOCATIONS+WIDTH, womenMeans, WIDTH,\n",
" color='red',\n",
" yerr=womenStd,\n",
" error_kw=dict(elinewidth=2,ecolor='blue'))\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",
"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",
"ax.legend( (rects_m[0], rects_f[0]), ('Men', 'Women') )\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Wykresy punktowe"
]
},
{
"cell_type": "code",
2021-03-17 13:20:09 +01:00
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
2022-03-10 12:40:55 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA2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nnn68N9lJTUz06vlL+IA9YDTwNrAJWAn8CPgMqfNcs1UW1OUgzRUn1t0HVj6ZvuSmllFLKKwzDYGrcVI+2mRbnedq/adOmcdlll5GUlMRVV13F1KlTa4coOnvuuefYunUriYmJjBs3jhdeeAGARx55BKvVSmJiIhMmTOCRRx7xuA1K+VIO8HdgD9Trg64EtgD/AMp90C7VdXllwJZhGBZgGzAC+KtpmptdrLMMWAYwZMgQbxxWKaWU6vaSBySzKWMThZWFLa4bHRJNUv+kVh3n//2//8evf/1rysrKOPfcc3nwwQf5wQ9+UG+dmJgY3nnnnUbbhoWF8eKLLzZ6/bbbbuO2226r/f6TTz5pVduUam8fAGXNLM8G1gCXNrOOUp7wStoD0zTtpmlOAgYB0w3DmOBinZdM05xqmubU2NhYbxxWKaWU6vZCA0O5KfEmooKjml0vKjiKmxNvJjQwtFXHWbZsGZMmTWLy5MlcffXVTJ48uVX7UaqzyQAy3VhvFzrsUXmPV1MfmKZZYBjGWuBCpEdYKaWUUu2sb0RffjDlB2xI38DOrJ1U2OouFUMDQ5nUfxKzBs+iR0iPVh/jzTff9EZTlep0jrq5nhU4CYxsx7ao7sMb2R1jAWt1gBYGLAL+2OaWKaWUUsptPUJ6cNHIi1g4bCHphelU2ioJCQxhaPRQgixBvm6eUp2WJ0Uu3M+ZqlTzvNGTNgB4pXpeWgDwrmmaOqhcdVlWK5g
"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",
"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",
"ax1.scatter(x, y, color='blue', s=10, edgecolor='none')\n",
"# make axes square\n",
"ax1.set_aspect(1. / ax1.get_data_ratio()) \n",
"\n",
"# right panel\n",
"ax2 = fig.add_subplot(122)\n",
"props = dict(alpha=0.5, edgecolors='none')\n",
"\n",
"M = 200\n",
"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",
" size = np.random.randint(25,200)\n",
" handles.append(ax2.scatter(x, y, c=color, s=size, **props))\n",
"\n",
"#ax2.set_ylim([-5,10])\n",
"#ax2.set_xlim([-5,10])\n",
"\n",
"ax2.legend(handles, colors)\n",
"ax2.grid(True)\n",
"ax2.set_aspect(1./ax2.get_data_ratio())\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Histogramy"
]
},
{
"cell_type": "code",
2021-03-17 13:20:09 +01:00
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
2022-03-10 12:40:55 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlAAAAHSCAYAAAAjcvULAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAT2ElEQVR4nO3df8ju933X8dd7Oa0b3UZaeyfEpvF0EGqL2FZuQqUytGln1NFEWGVlyEED9wZOO1Rs3MAxdbAibBUR8bBUj9CtDe1KwpyzMWuZA5v1TpttbU9naujamJhztjWsUXCkffvHueJie07P9b7Pdd3Xdd/34wGH68f9vc/15nt+3E8+1/X9fqu7AwDA8r5l0wMAABw1AgoAYEhAAQAMCSgAgCEBBQAwJKAAAIZOHeaLvfzlL+/Tp08f5ksCABzII4888rvdvXO5rx1qQJ0+fTr7+/uH+ZIAAAdSVb9zpa95Cw8AYEhAAQAMCSgAgCEBBQAwJKAAAIYEFADAkIACABgSUAAAQwIKAGBIQAEADAkoAIAhAQUAMCSgAACGBBQAwJCAAgAYElAAAEMCCgBgSEABAAwJKACAoVObHgA4eXbP7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DqqpeWVUfrarzVfWZqnrn4vmXVdWDVfXY4val6x8XAGDzllmBei7J3+/u1yR5Y5K/XVWvTXJPkoe6+9YkDy0eAwAce1cNqO5+qrs/ubj/lSTnk7wiyZ1Jzi02O5fkrnUNCQCwTU5NNq6q00nekOThJDd291PJpciqqhuu8D17SfaS5JZbbrmWWeH/2T2
"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",
"ax.hist(x, num_bins, color='green', alpha=0.8)\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Zadania"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Zadania podstawowe"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Zadanie 2.1 (2 punkty)\n",
"\n",
"Wybierz dwie dowolne kolumny (z wyjątkiem pierwszej) z pliku *data2.csv*. Przedstaw zależność między tymi danymi na wykresie punktowym (wartości z jednej kolumny powinny znaleźć się na jednej osi, a wartości z drugiej kolumny na drugiej osi)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Zadanie 2.2A (2 punkty)\n",
"\n",
"Wygeneruj wykres funkcji $y = f(x) = (a - 4) \\, x^2 + (b - 5) \\, x + (c - 6)$, gdzie $a, b, c$ to trzy ostatnie cyfry Twojego numeru indeksu. Pamiętaj o opisaniu osi wykresu ($x$ oraz $y$)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Zadania zaawansowane"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Zadanie 2.2B (1 punkt)\n",
"\n",
"Na wykresie z zadania 2.2 przedstaw dodatkowo wykres funkcji $y = g(x) = \\frac{e^x}{e^x + 1}$. Linie przestawiające funkcje $y = f(x)$ i $y = g(x)$ powinny znaleźć się na tym samym wykresie, ale powinny różnić się kolorami. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Zadanie 2.3 (2 punkty)\n",
"\n",
2021-03-17 13:20:09 +01:00
"Stwórz trójwymiarowy (powierzchniowy) wykres funkcji $f(x,y) = -(x^2 + y^3)$.\n",
"\n",
"Wykres powinien przedstawiać powierzchnię $z = -(x^2 + y^3)$."
]
}
],
"metadata": {
"celltoolbar": "Slideshow",
"kernelspec": {
"display_name": "Python 3",
"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.7.6"
},
"livereveal": {
"start_slideshow_at": "selected",
"theme": "amu"
}
},
"nbformat": 4,
"nbformat_minor": 4
}