812 lines
538 KiB
Plaintext
812 lines
538 KiB
Plaintext
|
{
|
|||
|
"cells": [
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {
|
|||
|
"slideshow": {
|
|||
|
"slide_type": "slide"
|
|||
|
}
|
|||
|
},
|
|||
|
"source": [
|
|||
|
"## Uczenie maszynowe 2019/2020 – laboratoria\n",
|
|||
|
"### 9/10 marca 2020\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",
|
|||
|
"['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",
|
|||
|
"{'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",
|
|||
|
"['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",
|
|||
|
"{'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,
|
|||
|
"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.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": [
|
|||
|
"%matplotlib inline"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 9,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD8CAYAAACb4nSYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAASEklEQVR4nO3df4wn9X3f8efrADe9M41xvCYYuLsoQViOVWNndU6EatlOIECQcSurAW1d0iJtEtmSrVZqnJ4Up46QXFVxqpYoaGuQcbLBbmOToBjbnBJXBMk/2LseNuTsQBEHl0PcOeeA0UaNznn3j++cbll/v+z3vvM9vrv+PB/SVzPzmc/MvG8Erx19vjPzTVUhSWrDtlkXIEl6+Rj6ktQQQ1+SGmLoS1JDDH1JaoihL0kN2TD0k1ya5EtJDiV5NMkHuvZXJ9mX5LFuesGI7W/u+jyW5OZp/wMkSePLRvfpJ7kIuKiqDiQ5H9gPvBv4JeBEVX00yYeAC6rq19Zt+2pgBZgHqtv2p6rqO1P/l0iSNrThlX5VPVNVB7r57wKHgIuBG4C7um53MfhDsN7PA/uq6kQX9PuAa6ZRuCTpzJ17Jp2T7AbeDHwVuLCqnoHBH4Ykrx2yycXA02uWj3Rtw/a9CCwC7Nix46de//rXn0lpktS0/fv3f7uq5jbqN3boJ3kl8Bngg1X1fJKxNhvSNnQ8qaqWgCWA+fn5WllZGbc0SWpeksPj9Bvr7p0k5zEI/OWq+mzX/Gw33n9q3P/YkE2PAJeuWb4EODrOMSVJ0zfO3TsB7gAOVdXH1qy6Fzh1N87NwJ8M2fyLwNVJLuju7rm6a5MkzcA4V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qpaqar6r5ubm
|
|||
|
"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",
|
|||
|
"plt.plot([1,2,3,4], [1,4,9,16], 'ro')\n",
|
|||
|
"plt.axis([0, 5, 0, 20]) # opis osi wykresu\n",
|
|||
|
"\n",
|
|||
|
"plt.show() # pokaż wykres"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 10,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZAAAAEICAYAAABxiqLiAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3dd5hU5fXA8e8BpFkAYVUUEERUsATMBlusEaNGQRMLKIolwRJU1B8CgqBYsCN2ERViQyWia8USW4woixQpAitGQVCRIiIIwp7fH+dudlh2l9nZnXmnnM/z3Gfv3Lkzcy5lzr73LUdUFeecc66qaoUOwDnnXGbyBOKccy4hnkCcc84lxBOIc865hHgCcc45lxBPIM455xLiCcS5ahCRViKyWkRqh47FuVQTnwfinH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LomObEZFdgTZA7LCa+iJSKCKTRKTC0nki0js6r3Dp0qU1EXf6mTev9Lfru+6Cjt4w+58zz7RbWOvWWX/QTz+Fjsi5rBEygZRXtaiiG9XdgfGqujHmWKuoyPsZwF0i0ra8F6rqKFXNV9X8vLy86kWcjtats07z1autJO0FF4SOKP3cfbfNE5k/Hy66KHQ0zmWNkAlkEdAy5nELYHEF53anzO0rVV0c/VwAvMum/SO5Y/BguzXTti2MGpVe1QTTRYMG8OyzNifmySetT8Q5V20hE8hkoJ2ItBGRuliS2Gw0lYjsCTQBPoo51kRE6kX7zYBDgNllX5v13n0X7rjDOsufeMKW8nDl22svm6EO1gpZuLDy851zWxQsgajqBqAPMBGYAzyrqrN
|
|||
|
"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",
|
|||
|
"ax.set_ylabel('volts') # opis osi y\n",
|
|||
|
"ax.set_title('a sine wave') # tytuł wykresu\n",
|
|||
|
"\n",
|
|||
|
"t = np.arange(0.0, 1.0, 0.01)\n",
|
|||
|
"s = np.sin(2*np.pi*t)\n",
|
|||
|
"line = ax.plot(t, s, color='red', lw=2)\n",
|
|||
|
"\n",
|
|||
|
"plt.show() # pokaż wykres"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Style wykresów"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 11,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlcAAAHiCAYAAADF1OnfAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nOzdeXxdZ33v+89P8yxZlmzZmu3Ikyw7Ic5EGpq8UgqEoRQCN4HcpDRAexmaMqRlak97C/QWSCAlB06THEg5GZoQCg0tIYSShECTNA7EtjxbtmXLsmUN1jxYw3P/ePbag7Qly4m2xu/79Xpeaw9rr8Hb2uu3fs9kzjlEREREZGYkzfUBiIiIiCwmCq5EREREZpCCKxEREZEZpOBKREREZAYpuBIRERGZQQquRERERGaQgisRmbfMrMLMes0sea6PRURkukzjXImIiIjMHGWuRERERGaQgisRSQgz+4yZNZhZj5ntMbM/nGLdS81su5l1m1mLmd0Zer3KzJyZpYSeP2Nmf2dmvw5t92dmVhS1ncvN7L/MrNPMdpjZ1ZPs7wNm9uOo54fM7NGo58fN7MLQ47tCz7vN7GUzuyr0+mozGzCzwqjPXWRmbWaWGnr+x2a218zOmNmTZlb5Kv85RWQBUXAlIonSAFwF5AN/CzxgZqsmWfcu4C7nXB6wFnh0kvUA3gd8AFgBpAGfBjCzUuA/gC8ChaHXf2BmxXG28SxwlZklhY4pFbgytJ01QA6wM7TuS8CFoW0+BHzfzDKcc83A88C7xx3bY865YTN7J/A54F1AMfAc8PAU5yUii4SCKxFJCOfc951zzc65MefcI8BB4NJJVh8GLjCzIudcr3PuhSk2/V3n3AHn3AA+CLsw9PpNwE+ccz8J7fMpYDtwXZxjOwz0hD77u8CTwAkz2xB6/pxzbiy07gPOuXbn3Ihz7g4gHV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Nvnu+jHs3Jl5OIUvSwrU/sXmR+c843pg6xqcGOwb59/PZ60NH9DUFvry+bNvlRXK9MlIgvXZMGV7iVngHO+2q6+Hnbtig2mJmsPVVrqLzKbNkXKxo3KQsn8Z+b//5aWwrXXxr7X2emDrCAbG9xQHDvm/zZ27YpdPyPD/9/fvBnq6iLL1atVnS0iC5cyV+epv99fLHbu9BeKYDnZIJElJf6CEdytBwFVfv7sHrfIXOrpiQRbwY1Hfb0fWiKeZct8kFVXB1u2RAKv3NzZPW4RkamoWvA8jY35HlY7d8aWQ4d8pmq8vLzIBSC4+66t9Q1/RSS+zk4faAUZ3yC7deZM/PWrq32wFV3WrlXVoojMDQVXU+jujmShduyIZKPiNdpNSfFtoKLvqOvq/JhQqsYQee2CNl1BoBX8be7dG3/Q28xMf0Ozdav/m9y61f9NLls2+8cuIkuLgit8NurIkci4PkEwdeRI/PVXrYq9Q66r8+2iNBK5yOwbHvY9FXftivz97tzpB0+Np6IiEmwFywsuUJZLRGbOkg+ujhzxP7DxslFpab4KL/qHeMsWPzWIiMxvHR2xAdeOHb6KMV6P3OgsV/TfekHB7B+3iCTG6KgfRqamJvE3U0s+uBoe9qORL18eeye7dasfNyo1NSG7FZE5EPy4BsFWUCbLclVWRgKt4PdBWS6R+e/MmdgmPdE3V/v2+SFgEmnJB1fgG8/qDlVk6eroiFQnBgFXfT0MDU1cN8hyjW8aoKl/RGZfdLOA6GBqqmYBDzwAV12V2ONScCUiEsfISCTLFR10TfajvXr1xA4tGzdCevrsHrfIYrTQOrQouBIROQ9nzkR+2KOrG+JNUZWc7JsXBMFWMBSLRqAXmVwwFEv0MCznGoqlri62veRcD8Wi4EpE5DUKehyPH0T40CH/3niZmX7Q4GDan6BUVGg6K1k6enoi8+hGDyQ8WXZ4IQ0
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 720x576 with 3 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {
|
|||
|
"needs_background": "light"
|
|||
|
},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"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",
|
|||
|
"t = np.arange(0.0, 1.0, 0.01)\n",
|
|||
|
"s = np.sin(2*np.pi*t)\n",
|
|||
|
"\n",
|
|||
|
"# pierwszy wykres\n",
|
|||
|
"ax1 = fig.add_subplot(3,1,1)\n",
|
|||
|
"ax1.set_ylabel('volts')\n",
|
|||
|
"ax1.set_title('a sine wave')\n",
|
|||
|
"\n",
|
|||
|
"line1 = ax1.plot(t, s+5.0, color='blue', lw=2)\n",
|
|||
|
"line2 = ax1.plot(t, s+2.5, color='red', lw=2)\n",
|
|||
|
"line3 = ax1.plot(t, s, color='orange', lw=2)\n",
|
|||
|
"\n",
|
|||
|
"# drugi wykres\n",
|
|||
|
"ax2 = fig.add_subplot(3,1,2)\n",
|
|||
|
"ax2.set_ylabel('volts')\n",
|
|||
|
"ax2.set_title('a sine wave')\n",
|
|||
|
"\n",
|
|||
|
"line1 = ax2.plot(t, s+5.0, color='black', lw=2,linestyle=\"--\")\n",
|
|||
|
"line2 = ax2.plot(t, s+2.5, color='black', lw=2,linestyle=\"-.\")\n",
|
|||
|
"line3 = ax2.plot(t, s, color='#000000', lw=2,linestyle=\":\")\n",
|
|||
|
"\n",
|
|||
|
"# trzeci wykres\n",
|
|||
|
"ax3 = fig.add_subplot(3,1,3)\n",
|
|||
|
"ax3.set_ylabel('volts')\n",
|
|||
|
"ax3.set_title('a sine wave')\n",
|
|||
|
"\n",
|
|||
|
"line1 = ax3.plot(t,s+5.0, color='blue', marker=\"+\")\n",
|
|||
|
"line2 = ax3.plot(t,s+2.5, color='red', marker=\"o\")\n",
|
|||
|
"line3 = ax3.plot(t,s, color='orange', marker=\"^\")\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",
|
|||
|
"execution_count": 12,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjwAAAHBCAYAAABt62HAAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nOydeZhb5X3vv9p3zb7P2DNjezZ7vI2HcYAAacEQB8hCCPAkJZSkFHIh3KZJmi6XEG63S8ltSElJSggkvS0lgSQ0FNI0KWQhYI+NwdgeafZFM5p90dF+pHPuH8N7fKTRriMdSfN+nsdPwmg5r3Sk8371274KnudBoVAoFAqFUsoo5V4AhUKhUCgUSq6hgodCoVAoFErJQwUPhUKhUCiUkocKHgqFQqFQKCUPFTwUCoVCoVBKHip4KBQKhUKhlDzqJLfTnnUKhUKhUCjFgiLeDTTCQ6FQKBQKpeShgodCoVAoFErJQwUPhUKhUCiUkocKHgqFQqFQKCVPsqJlCoVCoVCKCpZl4XA44Pf75V4KJUfo9Xo0NzdDo9Gk/BhFEvNQ2qVFoVAolKJiYmICFosFVVVVUCjiNu1QihSe57GysgKGYdDW1hZ9M+3SolAoFMr2wO/3U7FTwigUClRVVaUdwaOCh0KhUCglBxU7pU0m55cKHgqFQqFQtglPP/005ubm4t7+wAMP4Oc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ZCyhmd5eRkulwvt7e1ZP5cYnucFEUT+hUIhqNVqcByHtrY2WCwWaLXatJ+XWmdQKJQE0KJlCiX
|
|||
|
"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",
|
|||
|
"ax.plot(x, y, z, label='parametric curve')\n",
|
|||
|
"ax.legend() # pokaż legendę wykresu\n",
|
|||
|
"\n",
|
|||
|
"plt.show() # pokaż wykres"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Wykresy trójwymiarowe – powierzchnie"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 13,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjwAAAHBCAYAAABt62HAAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsI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6OolEouHi7vXpnDp1qmOfTitEhOdgsdvl/rIsV0WNi2VZ1UnyKysr3LhxA9M0iUajNSIoEAh0tP/tzg9z90uMzhAcZoTgERxaLMvCMIwan45ftGV1dZXp6WmGh4e37dNpRbcFj67rzM7OVgdcdlomLeg9ZFkmHo8Tj8c5evQo4AgTVwStra1x8+ZNDMOomSTvDlH1spVgayaCxOgMwWFHCB7BoaOVT8creHK5HJOTkyiKwlvf+lYikciu7E+3Ulrers5Hjx7FNE3m5+fJZrM1UYNkMtlxwzzBJr3S0FGSJGKxGLFYjLGxMWBzkrymaWxsbDA3N0e5XK4RQdtJT4nRGYK7ASF4BIeGdvrpyLJMuVzmypUrpNPprvl0WtGNCM/GxgaTk5MMDAzwyCOPVNMS7vG5vWIymUxNwzxvJCAWi/XEjVywfbyT5I8cOQI0TpLf2Nggn8/z6quv7niSPIjRGYLDgxA8ggOPG45vp5+OO1ByYmKCCxcu7MkFeSeCp1gsMjU1hWEY/MAP/ACxWAxwbjhe/HrFGIZRHZ3gJ4LcSJC4KdXSKxGedqmfJO+WxZ8+fbpmknyxWCQUCu1okrwYnSE4yAjBIzjQtNM4EDZ9OoqicPbsWY4dO7Zn+yhJUnUuV7uYpsnNmzdZXl5mYmKC0dHRjrerqioDAwM1ESxd16uRoJmZGfL
|
|||
|
"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",
|
|||
|
"R = np.sqrt(X**2 + Y**2)\n",
|
|||
|
"Z = np.sin(R) # obliczenie wartości rzędnych\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",
|
|||
|
"execution_count": 14,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAl4AAAH7CAYAAAAdGJFGAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3de5gcZZn38e+dAwliCATCMdEAAsImEdiEgyCwgATwAHhAWUVdRFxWdxERRV9R3BVlxQOCB4SFBREhrujCC65yEF4WgkiQcDKooBACLE4CSIiAJNzvH1WTbYaZZALTT9fMfD/X1dd0V1VX3T339MxvnqquisxEkiRJ7Tei0wVIkiQNFwYvSZKkQgxekiRJhRi8JEmSCjF4SZIkFWLwkiRJKsTgJaltIiIj4lWdrmMwacr3LCLui4h9Ol2HNNQYvKRBJCJ2i4g5EfGniHg0Im6IiJmdrkuS1D+jOl2ApP6JiLWBy4CjgB8AawCvA54Z4O2MzMzlA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O6EB1qyeyP5/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",
|
|||
|
"execution_count": 15,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA2kAAAGbCAYAAABeTdidAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nOzdd3gU1/Xw8e+oC1QoojfRBRYCBKJj04x7Bdu44oJxnMQ9ceK8ISYuiZ0fseMS1zjGvcQYFzA2xlim9yoQRfQiQCBQQXW18/5xtKhtlbZI4nyeZx9Wu3dm7iDY2TP33HMN0zRRSimllFJKKVU/BAW6A0oppZRSSimlKmiQppRSSimllFL1iAZpSimllFJKKVWPaJCmlFJKKaWUUvWIBmlK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XsMwyDwe0Hu98ez9rbpKSkcPXVV9O/f3+uv/56Bg8efC5FsbKXX36ZdevWkZSURN++fXnjjTcAmDFjBqWlpSQlJZGYmMiMGTM87oM/ebVwiFLKe6xWuPpqmD8ffv1r+Pe/A90jpZRSSqmaBrUbxNoja8kpznHZdmC7gR6PvNn87ne/Y+bMmRQUFHDhhRfy2GOPce+991ZpExcXx2effVZj28jISN58880ar995553ceeed536eN69+zNrSkTSl6qkjRyRAA3j77cD2RSmllFLKkcjQSG5Luo3YcOeLlfeJ68MVPa+o9XGmT5/OgAEDSE5OZtKkSSQnJ9d6X/WdjqQpVU+1bw8TJsC
|
|||
|
"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",
|
|||
|
"execution_count": 16,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlAAAAHSCAYAAAAjcvULAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAS3ElEQVR4nO3df6jleX3f8dc7O9oEk2LMjrJ1nY5/LKKUROGwCJaQ+iPdtsHdQgxKCANduA00VElKNAk05BcoASOE/pFLVzoFE5UYWUnTxu1GSQPReNesRjOaNWKS7S7OJnGJSyBh9Z0/5myd6p295z33njnn3vt4wHDPj+/d894vc+88+ZxzPqe6OwAArO6bNj0AAMBxI6AAAIYEFADAkIACABgSUAAAQwIKAGDozI18sJtvvrnPnz9/Ix8SAOC6PPDAA3/Z3Wf3u++GBtT58+ezt7d3Ix8SAOC6VNWfXes+T+EBAAwJKACAIQEFADAkoAAAhgQUAMCQgAIAGBJQAABDAgoAYEhAAQAMCSgAgCEBBQAwJKAAAIYEFADAkIACABgSUAAA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3vaTSd6a5L1VdXeSP0/yuvWMCACwXQ4MqO7+vSR1jbtfdbTjAABsPzuRAwAMCSgAgCEBBQAwJKAAAIYEFADAkIACABgSUAAAQwIKAGBIQAEADAkoAIAhAQUAMCSgAACGBBQAwJCAAgAYElAAAEMCCgBgSEABAAwJKACAIQEFADAkoAAAhgQUAMCQgAIAGBJQAABDAgoAYEhAAQAMCSgAgCEBBQAwJKAAAIYEFADAkIA
|
|||
|
"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.2 (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.2a (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 (1 punkt)\n",
|
|||
|
"\n",
|
|||
|
"Stwórz trójwymiarowy (pownierzchniowy) 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
|
|||
|
}
|