umz21/lab/02_Wczytywanie_i_prezentowanie_danych.ipynb

869 lines
550 KiB
Plaintext
Raw Normal View History

{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## Uczenie maszynowe 2019/2020 laboratoria\n",
"### 17 marca 2021\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",
"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",
2021-03-17 13:20:09 +01:00
"['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",
"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",
2021-03-17 13:20:09 +01:00
"{'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",
"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",
2021-03-17 13:20:09 +01:00
"['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",
"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",
2021-03-17 13:20:09 +01:00
"{'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",
"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",
"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": "code",
"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": [
"print(data.to_numpy()) # dane z Pandas DataFrame można przekonwertować na tablicę NumPy"
]
},
{
"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",
"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",
2021-03-17 13:20:09 +01:00
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
2021-03-17 11:37:25 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD8CAYAAACb4nSYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAASF0lEQVR4nO3df4xl5X3f8fdnMajZNRVOPSb82l2rQljEijEdrROhWv4RrGWLjFtFLauJQ1JLE0dGstVKDelKafsHkqUqbpViGU1jZFudQFzZJKhe26DUFUHyD2Y3CwavMVvEwmYRuw4KGE1Ua51v/7hntcPk3p3Ze+5yZ3jeL+nqnPOc55zznSP02cNzzzk3VYUkqQ1bpl2AJOn1Y+hLUkMMfUlqiKEvSQ0x9CWpIYa+JDVkzdBPclWSbyU5nOTJJJ/s2n8+yUNJnu6mbxmx/e4kTyU5kuSOSf8BkqT1y1r36Se5DLisqg4muRg4AHwE+E3gpar6dBfmb6mq31217QXAj4AbgWPAo8DeqvrBxP8SSdKa1rzSr6oXqupgN/8T4DBwBXAL8MWu2xcZ/EOw2i7gSFU9U1U/Be7rtpMkTcGbzqVzkp3Au4HvApdW1Qsw+IchyduGbHIF8PyK5WPAe0bsex6YB9i2bds/ecc73nEupUlS0w4cOPDjqppZq9+6Qz/Jm4GvAJ+qqleSrGuzIW1Dx5OqagFYAJidna2lpaX1liZJzUtydD391nX3TpILGQT+YlV9tWt+sRvvPz3uf2LIpseAq1YsXwkcX88xJUmTt567dwJ8HjhcVZ9ZseoB4LZu/jbgz4Zs/ihwdZK3J7kIuLXbTpI0Beu50r8B+Cj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vSTKfZCnJ0smTJ3uWJUkapm/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",
2021-03-17 11:37:25 +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",
2021-03-17 13:20:09 +01:00
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
2021-03-17 11:37:25 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYoAAAD8CAYAAABpcuN4AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAASJ0lEQVR4nO3dbYxcZ3mH8etuTAgk0NjFiey8yItkkQbUkjALpKkshhQBaUSC5CyJRGXRIEvbtIS2EnKKNhRbSHRbVRS13WLxUldQyHR5SYTUQuQOMnXVsGMSSoJJHbJJMOvGpilQ8QEI3P0wx87s2n7s7Ox4Xnz9pNWceeacPfdtJfvf5zw7cyIzkSTpZH6p3wVIkgabQSFJKjIoJElFBoUkqcigkCQVGRSSpKJTBkVEfDwiDkfEQx1jayLivog4UD2u7njtzoh4NCIeiYg39qpwSdKZcTozir8H3rRkbBuwOzM3Arur50TElcAtwMurY/42Is5ZsWolSWfcKYMiM/cATy8ZvhHYVW3vAm7qGP9MZv4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cHtEXAlsA3Zn5kZgd/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",
"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",
2021-03-17 11:37:25 +01:00
"plt.plot(x, y, 'gx') # \"gx\" - zielone (Green) krzyżyki (x)\n",
2021-03-17 11:29:33 +01:00
"plt.axis([0, 600000, 0, 100]) # opcjonalnie ustawiamy zakres osi wykresu\n",
"\n",
"plt.show() # pokaż wykres"
]
},
{
"cell_type": "code",
2021-03-17 13:20:09 +01:00
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
2021-03-17 11:37:25 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZAAAAEWCAYAAABIVsEJAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO2de7hcZX3vv9+9d647hCTmQm5AwCCgAoYIKhZFBAEvwSIVHkWweiI9YrVH7c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/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",
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",
"# 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": {
2021-03-17 11:29:33 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlcAAAHiCAYAAADF1OnfAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nOzdeXxbZ533/c9Pkld53+Mtju3EcWyHlqaUAoWWwpQpnZuyPXc7bblZCw8dlgL3MDBzl2ValmeGbW6YgU7ZoYUZYDpTtrKXlpa2aZnGsRPHcbzF+77Iq6Tr+eNIx5It2U4qyY79e79e53WOpHOOjqxE+up3nXNdYoxBKaWUUkrFhmOrD0AppZRSaifRcKWUUkopFUMarpRSSimlYkjDlVJKKaVUDGm4UkoppZSKIQ1XSimllFIxpOFKKXXeROQKEWnb6uPYDkTEiEjtVh+HUmrrifZzpZRSz56IGGC/Meb0Vh+LUmpraeVKKbUlRMS11cewFXbr61ZqN9FwpZRal4h0iciHRKRVRCZE5Osikhp47EoRORuybqmI/FBERkSkU0TeHfLYR0XkByLyHRGZBt4hIvMiUhB4/O9ExCsiWYHbd4rI5wPL1waef0ZE+kTkA4H7HxCR2ZDJLyJvFJEvichnVr2OB0TkvRFe38dE5P8GlpNExCMi/1/gdpqILIhIroj8RETetWrbYyJyfYR9vkhEekXkqsBtIyK3iUg70B647zoR+W8RmRSRR0XkcMj2Hwy8zhkRaRORq8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m4arzk7rQzVSL9Uul1V5Cv3QPXzY6pVamxe
"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": {
2021-03-17 11:37:25 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjwAAAHBCAYAAABt62HAAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nOy9eZQc5X3v/e1teu/Z9xlpNs2mXSMxA0HY4BgcAsIgsx07xCFcjuwrR+AkfnNPHGznensTeEEYH4gxBmNjvAZjK+BriNG1AaENCYE03bPPdM/07EtX70vV+8fwlKp7eu/qru6Z53POHFBv9fRWz7d/21fGcRwoFAqFQqFQ1jNyqRdAoVAoFAqFkm2o4KFQKBQKhbLuoYKHQqFQKBTKuocKHgqFQqFQKOseKngoFAqFQqGse6jgoVAoFAqFsu5RJrie9qxTKBQKhUIpFGSxrqARHgqFQqFQKOseKngoFAqFQqGse6jgoVAoFAqFsu6hgodCoVAoFMq6J1HRMoVCoVAoGRMIBGCz2eD1eqVeCmUdoNFo0NDQAJVKlfR9ZAnMQ2mXFoVCoVAyZnR0FEajEeXl5ZDJYjbSUCgJ4TgOCwsLYBgGzc3NkVfTLi0KhUKhSIfX66VihyIKMpkM5eXlKUcLqeChUCgUSk6gYociF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ZJH0KJlCiXfiFenA6wKmOHhYSwvL6OjowOlpaX8/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",
2021-03-17 13:20:09 +01:00
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjwAAAHBCAYAAABt62HAAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nOy9d5hc+Vnv+fmdcypXV+cstbLUaiWrlUcasu8aruECS1i4cHkMBu7CeolLWsOCCSYaD8nXYMAshrGxgcWAB65tDDOSRmE0ylK31N3qnGPlcML+Uarqqq6g7lZVJ/0+zzPPM131q3N+p1Vd51vv+33fV1iWhUQikUgkEslWRlnvDUgkEolEIpGUGyl4JBKJRCKRbHmk4JFIJBKJRLLlkYJHIpFIJBLJlkcKHolEIpFIJFseKXgkEolEI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hcTKXgkW55Mn87s7CwVFRUFP9xX69MpRrkiPDN/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": {
2021-03-17 13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cyc477zzp9TzVKEmSxnXnnXeyzTbbGLrGkYRtttlmo3sDDV6SJGlChq6J/THHxuAlSZJGVhKOPvrota/XrFnDvHnzePaznz3Eqv54jvGSJEmTMtWdX1UbXuahD30oV111FXfccQebb745ixcvZv78+VNbSEP2eEmSpJH2zGc+k+985zsAnHHGGRx11FFr591+++0cd9xxHHDAAey3335885vfBOALX/gCL3jBCzjiiCPYddddedvb3jaU2tdl8JIkSSPtxS9+MWeeeSZ33nknV1xxBQcddNDaeSeffDJPfepT+fGPf8z555/PW9/6Vm6//XYAli5dyllnncWVV17JWWedxfXXXz+st7CWpxolSdJI22effVixYgVnnHEGz3rWs+4z77zzzuPcc8/lQx/6ENC7EvO6664D4GlPexoPf/jDAXjc4x7HL37xC3bYYYe2xa/D4CVJkkbekUceyVve8hYuuOACVq9evXZ6VXHOOeew++6732f5Sy+9lM0222zt61mzZrFmzZpm9U7EU42SJGnkHXfccbznPe9h7733vs/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",
"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": {
2021-03-17 13:20:09 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA2kAAAGbCAYAAABeTdidAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nOzdeXxU9dX48c/NvgeyEEIChE1Zg+yyyCKgtVZEharFCnWh1ZZate3raX381afVp60Pdl+srS0uKLbuttaFamRRhLCFAGEPkJA9kH2ZydzfH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//u9/9Lo899hi1tbXMnz+fhx9+mHvvvbfNPldccQVbtmzp8NwRI0bw3nvvdXh8w4YNbb6vrq7usI8/aJCmlFJKdRPDMBIBS3OAFg4sAX7u52EppVS3MQyDCYMmMGHQBJ8fe+3atRw6dIj6+npWr17N1KlTfX6O3kKDNKWUUqr7JAPPNa9LCwD+bprmP/08JqWU6pNeeuklfw+hx2iQppRSSnUT0zSzAPcXISillFLIXT2llFJKKaWUUr2EBmlKKaWUUkop1YtokKaUUkop1cdZgHq0U7pS/YWuSVNKKaWU6oMagf1AJlDU/FgIMBGYCQz207iUogk4DtQiv4jJ/h2OL2VkZBASEsKcOXO69TwapCmllFJK9THFwEagot3jjcCe5o+rgMU9PC6lOAa8Bdi3GxsOfBmI9MuIfCojI4OoqKhuD9I03VEppZRSqg+pAJ6nY4DW3lagY0tfpbqPUWbAK7QN0ABOA5u6duzc3FzGjh3LPff
"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": {
2021-03-17 13:20:09 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlAAAAHSCAYAAAAjcvULAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAVjUlEQVR4nO3df6zleX3X8de7O2D50YZdubuZAuvUuMESIoveEBTTaJet29qw6x/bQKyZ1DXXJtaC0di1TSTVNMFomhrTGCcFHSOlXfmR3dRaWacltUmh3IVtgQ64iLBQxp0pLQKStC68/WPOymS5w5z3zL1zvjP38Ugm55zv/d457/1m9t5nPud7zre6OwAArO+bNj0AAMC1RkABAAwJKACAIQEFADAkoAAAhgQUAMDQkav5ZM9//vP72LFjV/MpAQAuyyOPPPJ73b2119fWCqiq+ntJ/laSTvKhJD+Y5NlJfiHJsSSfTPL93f0H3+jvOXbsWHZ3d9ceHABgU6rqUxf72iVfwquqFyT5kSTb3f3SJDckeW2S+5Oc6u7bkpxaPQYAuO6tew7UkSTPqqojOb/y9Nkkdyc5ufr6yST37P94AADLc8mA6u7fTfIvkjye5EyS/93d705yS3efWe1zJsnNe31/Ve1U1W5V7Z47d27/JgcA2JB1XsK7MedXm749ybcleU5V/cC6T9DdJ7p7u7u3t7b2PA8LAOCass5LeK9O8j+7+1x3/98k70zyF5I8UVVHk2R1e/bgxgQAWI51AurxJK+sqmdXVSW5I8npJA8lOb7a53iSBw9mRACAZbnkxxh09/uq6u1JPpDkySQfTHIiyXOTPFBV9+V8ZN17kIMCACzFWp8D1d1vTPLGp23+w5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IYEFADAkIACABgSUAAAQy7lAnCZJpea2d3ZPcBJgKvNChQAwJCAAgAYElAAAEMCCgBgyEnkAFfBuiecO9kcrg1WoAAAhgQUAMCQgAIAGBJQAABDAgoAYEhAAQAMCSgAgCEBBQAwJKAAAIYEFADAkIACABgSUAAAQwIKAGBIQAEADAkoAIAhAQUAMCSgAACG1g6oqrqhqj5YVb+4enxTVT1cVY+tbm88uDEBAJZjsgL1+iSnL3h8f5JT3X1bklOrxwAA1721AqqqXpjkryb52Qs2353k5Or+yST37O9oAADLtO4K1E8n+YdJvnrBtlu6+0ySrG5v3ufZAAAW6ZIBVVXfl+Rsdz9yOU9QVTtVtVtVu+fOnbucvwIAYFHWWYF6VZLXVNUnk/x8ku+qqv+Q5ImqOpokq9uze31zd5/o7u3u3t7a2tqnsQEANueSAdXd/6i7X9jdx5K8NsmvdPcPJHkoyfHVbseTPHhgUwIALMiVfA7Um5LcWVWPJblz9RgA4Lp3ZLJzd78nyXtW9z+X5I79HwkAYNlGAQVszvaJ7bX2293ZPeBJAHApFwCAIQEFADAkoAAAhgQUAMCQgAIAGBJQAABDAgoAYEhAAQAMCSgAgCEBBQAw5FIucJ1Z95IvAFw+K1AAAEMCCgBgSEABAAwJKACAIQEFADAkoAAAhgQUAMCQgAIAGBJQAABDAgoAYMilXAAWxKV44NpgBQoAYEhAAQAMCSgAgCEBBQAw5CRy2DAnDQNce6xAAQAMCSgAgCEBBQAwJKAAAIYEFADAkIACABgSUAAAQwIKAGBIQAEADAkoAIAhAQUAMCSgAACGBBQAwJCAAgAYElAAAEMCCgBgSEABAAxdMqCq6pur6jer6req6iNV9ROr7TdV1cNV9djq9saDHxcAYPPWWYH6wyTf1d0vS3J7kruq6pVJ7k9yqrtvS3Jq9RgA4Lp3yYDq8760eviM1Z9OcneSk6vtJ5PccyATAgAszJF1dqq
"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.8.3"
},
"livereveal": {
"start_slideshow_at": "selected",
"theme": "amu"
}
},
"nbformat": 4,
"nbformat_minor": 4
}