2021-03-02 08:32:40 +01:00
{
"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",
2021-03-02 08:32:40 +01:00
"# 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 11:08:21 +01:00
"execution_count": 2,
2021-03-02 08:32:40 +01:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['price', 'isNew', 'rooms', 'floor', 'location', 'sqrMetres']\n",
"['476118.0', 'False', '3', '1', 'Centrum', '78']\n",
2022-03-10 11:08:21 +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",
2021-03-02 08:32:40 +01:00
"['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 11:08:21 +01:00
"execution_count": 3,
2021-03-02 08:32:40 +01:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'price': '476118.0', 'isNew': 'False', 'rooms': '3', 'floor': '1', 'location': 'Centrum', 'sqrMetres': '78'}\n",
2022-03-10 11:08:21 +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",
2021-03-02 08:32:40 +01:00
"{'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 11:08:21 +01:00
"execution_count": 4,
2021-03-02 08:32:40 +01:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['price', 'isNew', 'rooms', 'floor', 'location', 'sqrMetres']\n",
"['476118.0', 'False', '3', '1', 'Centrum', '78']\n",
2022-03-10 11:08:21 +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",
2021-03-02 08:32:40 +01:00
"['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 11:08:21 +01:00
"execution_count": 5,
2021-03-02 08:32:40 +01:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'price': '476118.0', 'isNew': 'False', 'rooms': '3', 'floor': '1', 'location': 'Centrum', 'sqrMetres': '78'}\n",
2022-03-10 11:08:21 +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",
2021-03-02 08:32:40 +01:00
"{'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 11:08:21 +01:00
"execution_count": 6,
2021-03-02 08:32:40 +01:00
"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 11:08:21 +01:00
"execution_count": 7,
2021-03-17 13:20:09 +01:00
"metadata": {
"scrolled": true
},
2021-03-02 08:32:40 +01:00
"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)"
]
},
2022-03-10 11:08:21 +01:00
{
"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)"
]
},
2021-03-02 08:32:40 +01:00
{
"cell_type": "code",
2022-03-10 11:08:21 +01:00
"execution_count": 8,
2021-03-02 08:32:40 +01:00
"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": [
2022-03-10 11:08:21 +01:00
"\n",
"print(data.to_numpy()) # Pandas w wersji >=1.1.0\n",
"# lub:\n",
"# print(data.values) # dla starszych wersji biblioteki Pandas"
2021-03-02 08:32:40 +01:00
]
},
{
"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 11:08:21 +01:00
"execution_count": 9,
2021-03-02 08:32:40 +01:00
"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",
2021-03-02 08:32:40 +01:00
"%matplotlib inline"
]
},
{
"cell_type": "code",
2022-03-10 11:08:21 +01:00
"execution_count": 10,
2021-03-02 08:32:40 +01:00
"metadata": {},
"outputs": [
{
"data": {
2022-03-10 11:08:21 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD8CAYAAACb4nSYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAASLUlEQVR4nO3dbYxmZ33f8e+vtmnSxS0mDI7xQxw1lhFBwZDx0sgqT4kd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EtSQwx9SWrI2KGf5Ooke5Z8jif5wLI+b0syt6TPb/cvWZI0rrGfyK2qbwHXACQ5D/hr4MERXf+iqm4Z9zySpMmZ1PTOzwL/r6p8+5MkrWOTCv3bgAdW2PYzSZ5I8vkkP7nSAZJsSTKTZObo0aMTKkuStFTv0E/yMuCdwP8ZsXkX8GNV9QbgfwB/vNJxqmpbVU1X1fTU1FTfsiRJI0xipH8TsKuqDi/fUFXHq+r5bvlh4IIkr5rAOSVJY5hE6N/OClM7SX40Sbrlzd35/mYC55QkjaHX+/ST/CPgeuDXlrT9OkBV3Q28G/iNJCeBvwNuq6oadSxJ0tnXK/Sr6nvAjyxru3vJ8l3AXX3OIUmaHJ/IlaSGGPqS1BBDX5IaYuhLUkMMfUlqiKEvSQ0x9CWpIYa+JDXE0Jekhhj6ktQQQ1+SGmLoS1JDDH1JaoihL0kNMfQlqSGGviQ1xNCXpIYY+pLUkN6hn2Q2yTeS7EkyM2J7kvz3JM8k+XqSN/U9pyRpPL3+Ru4Sb6+qb6+w7Sbgqu7zZuD3u29J0kvspZjeuRX4RC34CvCKJJe8BOeVJC0zidAv4JEkO5NsGbH9UuC5Jev7u7a/J8mWJDNJZo4ePTqBsiRJy00i9K+rqjexMI3z3iRvWbY
2021-03-02 08:32:40 +01:00
"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 11:08:21 +01:00
"plt.plot([1,2,3,4], [1,4,9,16], 'm^')\n",
2021-03-17 11:29:33 +01:00
"plt.axis([0, 5, 0, 20]) # opcjonalnie ustawiamy zakres osi wykresu\n",
2021-03-02 08:32:40 +01:00
"\n",
"plt.show() # pokaż wykres"
]
},
{
"cell_type": "code",
2022-03-10 11:08:21 +01:00
"execution_count": 11,
2021-03-02 08:32:40 +01:00
"metadata": {},
"outputs": [
{
"data": {
2022-03-10 11:08:21 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZMAAAD8CAYAAACyyUlaAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAWxUlEQVR4nO3dcYyc9X3n8fe3ODSUlhqoQdgGsVGsEnpqEpgF96AoSyqwaVTzh9kjKoeFOFlaJS299kRxJQfVvhOJdSoNunQlK6SYSy5k5abFikJcy5kTCQpk1yUHASfylu3hvaXYkYFyhwRH7nt/zG/xeL3eHe9jdmZn3i9pNM/znd8zv8ejx/74eX6/eSYyE0mSqviFdu+AJGnpM0wkSZUZJpKkygwTSVJlhokkqTLDRJJUWUthEhHLI2J3RPwkIg5GxG9FxAURsS8iDpXn80vbiIiHImI8Ip6LiKua3mdTaX8oIjY11a+OiOfLNg9FRJT6rH1IkjpLq2cmXwS+k5lXAB8FDgL3Afszcw2wv6wDrAfWlMdmYBgawQDcD1wLXAPc3xQOw6Xt9HbrSv1UfUiSOsi8YRIR5wE3AA8DZOY7mfk6sAHYVZrtAm4tyxuAR7PhaWB5RFwC3Azsy8xjmfkasA9YV147LzN/kI1vUD46471m60OS1EGWtdDmQ8BR4K8j4qPAAeAe4OLMfAUgM1+JiItK+1XA4abtJ0ttrvrkLHXm6OMEEbGZxpkN55577tVXXHFFC38sSdK0AwcO/CwzVyx0+1bCZBlwFfAHmflMRHyRuS83xSy1XEC9ZZm5E9gJUKvVcmxs7HQ2l6SeFxH/s8r2rYyZTAKTmflMWd9NI1xeLZeoKM9Hmtpf2rT9amBqnvrqWerM0YckqYPMGyaZ+c/A4Y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
"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 11:08:21 +01:00
"data_array = data.values\n",
2021-03-17 10:44:12 +01:00
"\n",
"# Wybór kolumn do przedstawienia na wykresie\n",
2022-03-10 11:08:21 +01:00
"x = data_array[:, 5]\n",
"y = data_array[:, 0]\n",
2021-03-17 10:44:12 +01:00
"\n",
2021-03-17 11:37:25 +01:00
"plt.plot(x, y, 'gx') # \"gx\" - zielone (Green) krzyżyki (x)\n",
2022-03-10 11:08:21 +01:00
"plt.axis([0, 100, 0, 600000]) # opcjonalnie ustawiamy zakres osi wykresu\n",
2021-03-17 10:44:12 +01:00
"\n",
"plt.show() # pokaż wykres"
]
},
{
"cell_type": "code",
2022-03-10 11:08:21 +01:00
"execution_count": 17,
2021-03-17 10:44:12 +01:00
"metadata": {},
"outputs": [
{
"data": {
2022-03-10 11:08:21 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAEWCAYAAABv+EDhAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO2deXhV5bX/vyszc4CEOYyCMogKiFZQFBTFK47XoYNV21u11Vp629vqrVc7+KtXr7XV1mvrdMGKVYuzQkFBFASpzKNAEAgJEIYQCGRO1u+PdbZnJ5wk55w9vOecvT7Pk2ef7Jxzvu/K3vtd633XOxAzQ1EURQkeaaYLoCiKophBHYCiKEpAUQegKIoSUNQBKIqiBBR1AIqiKAFFHYCiKEpAUQegpDxENJCImIgyfNbtSUSfEFEFEf3O4XddSETFcXxuHhHdEnr9TSJa4KQcSmqhDkBJSIjoPiK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JYlRB6AoicjevTIB6/XXgVWrgEsvBW69VTY+79TJdOmUFEEdgKIkCrt2SdfO668DW7bITNx77pHKv10706VTUhB1AIpikt27gb//XXbF2rVLkrj33w9MmQJkZZkunZLiqANQFL8pKQlX+tu3A9dcAzz8sPTt68qaio/o3aYofrB/v+yK9eqrMhv3qquABx+USD8z03TplICiDkBRvOLgQenTf/VVYM0aWU755z8HLrlEZ+MqCYE6AEVxk7IyGb3z6qvAP/8pu2Xdc4+sv5OTY7p0itIEdQCK4pQTJ2T5hdmzgSVLgKlTge99T9b
2021-03-02 08:32:40 +01:00
"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",
2021-03-02 08:32:40 +01:00
"\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",
2021-03-17 10:44:12 +01:00
"\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",
2021-03-17 10:44:12 +01:00
"# 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 11:08:21 +01:00
"z = np.sqrt(x)\n",
2021-03-17 10:44:12 +01:00
"\n",
2021-03-17 11:29:33 +01:00
"ax.plot(x, y, color='blue', lw=2) # \"lw\" oznacza grubość linii (Line Width)\n",
2022-03-10 11:08:21 +01:00
"ax.plot(x, z, color='red', lw=1) # \"lw\" oznacza grubość linii (Line Width)\n",
2021-03-02 08:32:40 +01:00
"\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,
2021-03-02 08:32:40 +01:00
"metadata": {},
"outputs": [
{
"data": {
2022-03-10 11:08:21 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlcAAAHiCAYAAADF1OnfAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nOzdeXxbZ533/c9Pkld53+Mtju3EcWyHlqaUAoWWwpQpnZuyPXc7bblZCw8dlgL3MDBzl2ValmeGbW6YgU7ZoYUZYDpTtrKXlpa2aZnGsRPHcbzF+77Iq6Tr+eNIx5It2U4qyY79e79e53WOpHOOjqxE+up3nXNdYoxBKaWUUkrFhmOrD0AppZRSaifRcKWUUkopFUMarpRSSimlYkjDlVJKKaVUDGm4UkoppZSKIQ1XSimllFIxpOFKKXXeROQKEWnb6uPYDkTEiEjtVh+HUmrrifZzpZRSz56IGGC/Meb0Vh+LUmpraeVKKbUlRMS11cewFXbr61ZqN9FwpZRal4h0iciHRKRVRCZE5Osikhp47EoRORuybqmI/FBERkSkU0TeHfLYR0XkByLyHRGZBt4hIvMiUhB4/O9ExCsiWYHbd4rI5wPL1waef0ZE+kTkA4H7HxCR2ZDJLyJvFJEvichnVr2OB0TkvRFe38dE5P8GlpNExCMi/1/gdpqILIhIroj8RETetWrbYyJyfYR9vkhEekXkqsBtIyK3iUg70B647zoR+W8RmRSRR0XkcMj2Hwy8zhkRaRORq8/lPVNKbS0NV0qpzbgJuAaoAQ4Af7d6BRFxAA8AzwBlwNXAe0XkmpDVXgX8AMgBv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figure size 720x576 with 3 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
2021-03-17 10:44:12 +01:00
"# Umieszczanie kilku układów współrzędnych i kilku wykresów na jednym rysunku\n",
"\n",
2021-03-02 08:32:40 +01:00
"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",
2021-03-02 08:32:40 +01:00
"\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",
2021-03-02 08:32:40 +01:00
"\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",
2021-03-02 08:32:40 +01:00
"\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",
2021-03-02 08:32:40 +01:00
"\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",
2021-03-02 08:32:40 +01:00
"\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",
2021-03-02 08:32:40 +01:00
"\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",
2021-03-02 08:32:40 +01:00
"\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,
2021-03-02 08:32:40 +01:00
"metadata": {},
"outputs": [
{
"data": {
2022-03-10 11:08:21 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjwAAAHBCAYAAABt62HAAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nOy9eZQc5X3v/e1teu/Z9xlpNs2mXSMxA0HY4BgcAsIgsx07xCFcjuwrR+AkfnNPHGznensTeEEYH4gxBmNjvAZjK+BriNG1AaENCYE03bPPdM/07EtX70vV+8fwlKp7eu/qru6Z53POHFBv9fRWz7d/21fGcRwoFAqFQqFQ1jNyqRdAoVAoFAqFkm2o4KFQKBQKhbLuoYKHQqFQKBTKuocKHgqFQqFQKOseKngoFAqFQqGse6jgoVAoFAqFsu5RJrie9qxTKBQKhUIpFGSxrqARHgqFQqFQKOseKngoFAqFQqGse6jgoVAoFAqFsu6hgodCoVAoFMq6J1HRMoVCoVAoGRMIBGCz2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vkKh4OuBfD4fvF5v2HWRKTEqgigUSqFBIzwUisREq9MRCgqXywWLxQK5XI729nZotdqoNTyBQAAMw8DpdMLhcMDtdkOhUPBRIBIJkssvT6OYnp6G3+/Hpk2bYq5NWBNEkMvlfCSIiiAKhZJH0KJlCiXfiFenA6wKmOHhYSwvL6OjowOlpaX8/WIVLUcSDAbBMAz/53a7IZPJeAHk8/kgl8uxefPmlNa
2021-03-02 08:32:40 +01:00
"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",
2021-03-02 08:32:40 +01:00
"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 11:08:21 +01:00
"execution_count": 21,
2021-03-02 08:32:40 +01:00
"metadata": {},
"outputs": [
{
"data": {
2022-03-10 11:08:21 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjwAAAHBCAYAAABt62HAAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nOy9d5hc+Vnv+fmdcypXV+cstb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r75K1TvfWZb9bAWWU6Vlt9upra2ltrY2/Vg8HicYDOL3+5meniYcDq+LCAoEAvT09NDR0QHI0RkSSQopeCQvBKm0wODgINXV1c9MQazUp1OMcpWlW4bByNMKLCuRwPnoEfXt7Ux1dWWtq1ZVUme34nEef9d3ceDv/g7f+fMl39OLjN1up6amhpqamvRjiUQiHQlKiSBVVXNEUCknyacEtqqqeUdngBRBkhcTKXgkW55Mn87s7CwVFRUFP9xX69MpRrkiPDN/8zdEe3rSP5vhML6JCeI7d7LwtB9PZXs75u3bWa8zIxG6v+3bOPjZz+I9caLk+9rsLLcPz3Kw2Ww5IkjX9bQIGhgYIBwOI4TIEkEej2fVIihz/8udHwZydIZk6yMFj2TLYpomuq5n+XQKRVue16dTjHIIHkvXGfnN38x53Jibo8HhQG9qIjQ+To3HQ74zm4EA3d/8zRz83OdwHzpU0r1JiqNpGtXV1VRXV6cf03U9PUR1aGiIUCiEECJnkvxy3pPPEmyFRJAcnSHZ6kjBI9lyFPPp5BM8pfDpFKMcKa3pT32KWF9f3ucS4+O07trFzNGjmDduUOj2pM/NMfD
2021-03-02 08:32:40 +01:00
"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",
2021-03-17 10:44:12 +01:00
"\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",
2021-03-02 08:32:40 +01:00
"\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,
2021-03-02 08:32:40 +01:00
"metadata": {},
"outputs": [
{
"data": {
2022-03-10 11:08:21 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAl4AAAH7CAYAAAAdGJFGAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO3debScdZ3n8ffHJBIUVMCIkABhEBBZBAzQiI60C6BHcZm2FRVBVLDHBR13Pbicbqbtdh/HpVFQ3FhatMWlHdIOSDssGujI0kFjNxGCKCGCCg1I4Dt/1HPTRbg3uZFbv6p7836dU+dWPeu3nl/d3E9+z++pJ1WFJEmSBu9Bwy5AkiRpU2HwkiRJasTgJUmS1IjBS5IkqRGDlyRJUiMGL0mSpEYMXpIGIsmhSVYOu47pJMn7knx5BOo4NskPh12HNBMZvKRpJMmTklyU5LdJfpPk/yU5YNh1SZImZ/awC5A0OUkeBnwb+AvgbODBwJOBu6Z4P7Oq6p6p3GZLSWZX1Zph17Gpmu6fH2nQ7PGSpo/dAKrqjKq6p6ruqKrzquqKsQWSvDrJsiS/T/KvSfbvpu+R5IIktya5OsmRfet8Icmnk3w3ye3AnybZPsk5SVYluTbJG/qWPzDJkiS/S/LrJB9ZX9FJ3pXk5iQrkry0m3ZAt+7svuX+W5KlE2xjmyTf6vb54yR/1X8qLEkleW2S5cDyvmPx865n8Nwk23fTF3bL9+/7giSv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UUXAXDvvfdy8803c/XVV6+df9FFF3HIIYcM7O0OgsFLkiS
2021-03-02 08:32:40 +01:00
"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,
2021-03-02 08:32:40 +01:00
"metadata": {},
"outputs": [
{
"data": {
2022-03-10 11:08:21 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA2kAAAGbCAYAAABeTdidAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nOzdeXxU9dX48c/NvgeyEEIChE1Zg+yyyCKgtVZEharFCnWh1ZZate3raX381afVp60Pdl+srS0uKLbuttaFamRRhLCFAGEPkJA9kH2ZydzfHychk2RmMjOZZJJw3q9XXknm3rn3OyRk7rnf8z3HME0TpZRSSimllFK9Q4C/B6CUUkoppZRSqpUGaUoppZRSSinVi2iQppRSSimllFK9iAZpSimllFJKKdWLaJCmlFJKKaWUUr1IkD9OmpCQYKalpfnj1EoppXrQ7t27S03TTPT3OPqK/vz+WFNTQ2RkpL+H4ReX6mu/VF83XLqv/VJ93eDda3f1HumXIC0tLY3MzEx/nFoppVQPMgzjtL/H0Jf05/fHjIwMFi5c6O9h+MWl+tov1dcNl+5rv1RfN3j32l29R2q6o1JKKaWUUkr1IhqkKaWUUkoppVQvokGaUkoppZRSSvUiflmTppRSSimllOobLBYLeXl51NfXu9wvNjaWw4cP99CoehdXrz0sLIzU1FSCg4PdPp4GaUoppZRSSimn8vLyiI6OJi0tDcMwnO5XVVVFdHR0D46s93D22k3TpKysjLy8PEaMGOH28TTdUSmllFJKKeVUfX098fHxLgM0e1YrFBdDfj6cP9/Ng+vlDMMgPj6+01nI9nQmTSmllFJKKeWSOwHahQuwYwfs3Qu1ta2PJyfDjBmQng5Bl2D04W5wa+8S/GdSSimllFJK+dLx4/DCCyE4ikcKCuDttyEzE1atgku037VHNN1RKaWUUkop5bW8PNi0CRobXe937hxs3AgWi+fnyM3NZeLEiR0eX7hwIZmZmZ4fsJfzWZBmGEagYRh7DcP4p6+OqZRSSimllOrdPvhA1qG549w52Leve8fT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HdCgzSllFKqG5mm2QRcYRjGAOANwzAmmqaZbbf9GeAZgOnTp5sLFy70z0C7WUZGBv31tXXmUn3tl+rrhv732g8fPkx0dHSn+401xzKjYQZZRVltHg80AlkxfgUDYwd6PYaFCxeyfPly5s2bx/Dhw5k5cyaDBg0iMDCQyMjIi+N7/fXX+fa3v01FRQVWq5XvfOc7zJw5k02bNnHffffx1FNPYbFYuO2225gzZw7BwcGEh4e3eX3uvNb2qqqqXD4vLCyMKVOmuH08DdKUUkqpHmCa5gXDMDKALwDZneyulFJ9jmEY3DT2Ji6Pv5x9hfsu9kmbmTKTpKikLh//u9/9Lo899hi1tbXMnz+fhx9+mHvvvbfNPldccQVbtmzp8NwRI0bw3nvvdXh8w4YNbb6vrq7usI8/aJCmlFJKdRPDMBIBS3OAFg4sAX7u52EppVS3MQyDCYMmMGHQBJ8fe+3atRw6dIj6+npWr17N1KlTfX6O3kKDNKWUUqr7JAPPNa9LCwD+bprmP/08JqWU6pNeeuklfw+hx2iQppRSSnUT0zSzAPcXISillFLIXT2llFJKKaWUUr2EBmlKKaWUUkop1YtokKaUUkop1cdZgHq0U7pS/YWuSVNKKaWU6oMagf1AJlDU/FgIMBGYCQz207iUogk4DtQiv4jJ/h2OL2VkZBASEsKcOXO69TwapCmllFJK9THFwEagot3jjcCe5o+rgMU9PC6lOAa8Bdi3GxsOfBmI9MuIfCojI4OoqKhuD9I03VEppZRSqg+pAJ6nY4DW3lagY0tfpbqPUWbAK7QN0ABOA5u6duzc3FzGjh3LPff
2021-03-02 08:32:40 +01:00
"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,
2021-03-02 08:32:40 +01:00
"metadata": {},
"outputs": [
{
"data": {
2022-03-10 11:08:21 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlAAAAHSCAYAAAAjcvULAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAVjUlEQVR4nO3df6zleX3X8de7O2D50YZdubuZAuvUuMESIoveEBTTaJet29qw6x/bQKyZ1DXXJtaC0di1TSTVNMFomhrTGCcFHSOlXfmR3dRaWacltUmh3IVtgQ64iLBQxp0pLQKStC68/WPOymS5w5z3zL1zvjP38Ugm55zv/d457/1m9t5nPud7zre6OwAArO+bNj0AAMC1RkABAAwJKACAIQEFADAkoAAAhgQUAMDQkav5ZM9//vP72LFjV/MpAQAuyyOPPPJ73b2119fWCqiq+ntJ/laSTvKhJD+Y5NlJfiHJsSSfTPL93f0H3+jvOXbsWH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xKV44NpgBQoAYEhAAQAMCSgAgCEBBQAw5CRy2DAnDQNce6xAAQAMCSgAgCEBBQAwJKAAAIYEFADAkIACABgSUAAAQwIKAGBIQAEADAkoAIAhAQUAMCSgAACGBBQAwJCAAgAYElAAAEMCCgBgSEABAAxdMqCq6pur6jer6req6iNV9ROr7TdV1cNV9djq9saDHxcAYPPWWYH6wyTf1d0vS3J7kruq6pVJ7k9yqrtvS3Jq9RgA4Lp3yYDq8760eviM1Z9OcneSk6vtJ5PccyATAgAszJF1dqq
2021-03-02 08:32:40 +01:00
"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": [
2021-03-17 10:44:12 +01:00
"### Zadanie 2.2A (2 punkty)\n",
2021-03-02 08:32:40 +01:00
"\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": [
2021-03-17 10:44:12 +01:00
"### Zadanie 2.2B (1 punkt)\n",
2021-03-02 08:32:40 +01:00
"\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": [
2021-03-17 10:44:12 +01:00
"### Zadanie 2.3 (2 punkty)\n",
2021-03-02 08:32:40 +01:00
"\n",
2021-03-17 13:20:09 +01:00
"Stwórz trójwymiarowy (powierzchniowy) wykres funkcji $f(x,y) = -(x^2 + y^3)$.\n",
2021-03-02 08:32:40 +01:00
"\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",
2022-03-10 11:08:21 +01:00
"version": "3.7.6"
2021-03-02 08:32:40 +01:00
},
"livereveal": {
"start_slideshow_at": "selected",
"theme": "amu"
}
},
"nbformat": 4,
"nbformat_minor": 4
}