{ "cells": [ { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# Foundations of Computational Economics #16\n", "\n", "by Fedor Iskhakov, ANU\n", "\n", "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "## Visualization of data and solutions\n", "\n", "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "\n", "\n", "[https://youtu.be/dJdWVkSNNpc](https://youtu.be/dJdWVkSNNpc)\n", "\n", "Description: Principles and functions of graphics. Examples of visualization of economic models." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "### Why visualize?\n", "\n", "1. **Convey ideas to others**\n", " Ability to efficiently explain your idea/work to other busy people is crucial element of success in many fields \n", "1. **Check your own work**\n", " Creating of new knowledge using computational tools requires absolute certainty in the code \n", "1. **Aggregate large amounts of information**\n", " Makes it possible to get the big picture and the message behind it " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "\n", "\n", "[https://www.strava.com/heatmap#5.13/120.47297/37.61174/hot/all](https://www.strava.com/heatmap#5.13/120.47297/37.61174/hot/all)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "### Matplotlib and other libraries\n", "\n", "- `matplotlib` - Python library that abstracts from the graphical backbone\n", " of each system and ensures *code mobility* \n", "\n", "\n", "**Matplotlib thumbnail gallery** [https://matplotlib.org/gallery.html](https://matplotlib.org/gallery.html)\n", "\n", "- `seaborn` - pretty plots geared towards statistical applications\n", " [https://seaborn.pydata.org/examples/index.html](https://seaborn.pydata.org/examples/index.html) \n", "- `bokeh` is a library for creating interactive plots\n", " [http://bokeh.pydata.org/en/latest/docs/gallery.html](http://bokeh.pydata.org/en/latest/docs/gallery.html) " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "#### Plan\n", "\n", "1. Visualization examples from my own research projects \n", "1. Links to compulsory online learning resources " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "#### Graphical objects\n", "\n", "Extensive collection of objects to modify all aspects of the graphics\n", "\n", "- figure - axes - subplots \n", "- lines - polygons (patches) \n", "- fill color and edge color \n", "- annotations and other text " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "#### Types of plots\n", "\n", "- **bar** - categorical data, histograms \n", "- **scatter** - individual data points \n", "- **line** - continuous measure \n", "- **area** - dynamics of composition \n", "- **pie** - static composition \n", "- **Sankey** - flow diagram " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "#### How to choose the plot type\n", "\n", "1. Number of variables to be represented \n", "1. Type of variables \n", " - continuous \n", " - categorical \n", " - ordered \n", "1. What is the message of the graphics? " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "### General tips\n", "\n", "1. **Less visual clutter!** \n", " Every dot, line, shape and label has to convey useful information \n", "1. **Read the the manual and change the options** \n", " Defaults are good for quick and dirty preliminary runs only \n", "1. **Careful with 3D** \n", " Much harder to make clear \n", "1. **“Animations”** \n", " May be useful in cases when there are one too many dimensions in the data to visualize " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "#### Less visual clutter\n", "\n", "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "#### Choice of appropriate plot type" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "#### Using many dimensions in one plot\n", "\n", "- location (x,y,z) \n", "- color \n", "- line or marker style \n", "- size \n", "- animation \n", "- multiple plots in a figure " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "#### Visual debugging and dashboards\n", "\n", "Using visual representation to verify the code\n", "- *Seeing* a bug in a plot is easier than in the code!\n", "\n", "Dashboards are ideal for aggregation of large amounts of information\n", "\n", "1. Calibration/estimation an moment matching \n", "1. Monitoring computing resources " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "#### Visualizing economic model for new insights" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "### Tutorials for compulsory self-study\n", "\n", "- Excellent tutorial on Matplotlib on QuantEcon DataScience\n", " [https://datascience.quantecon.org/applications/visualization_rules.html](https://datascience.quantecon.org/applications/visualization_rules.html) \n", "- Presentation by Hans Rosling (1948-2017, Swedish physician, academic, statistician, and public speaker)\n", " [https://youtu.be/hVimVzgtD6w?t=159](https://youtu.be/hVimVzgtD6w?t=159) " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "### Further learning resources\n", "\n", "- Excellent beginner tutorial for Matplotlib by the authors (3h)\n", " [https://www.youtube.com/watch?v=6gdNUDs6QPc&t=2843s](https://www.youtube.com/watch?v=6gdNUDs6QPc&t=2843s) \n", "- Playlist of lectures and tutorials\n", " [https://www.youtube.com/user/EnthoughtMedia/search?query=matplotlib](https://www.youtube.com/user/EnthoughtMedia/search?query=matplotlib) \n", "- Visualization of sorting algorithms\n", " [https://www.youtube.com/watch?v=kPRA0W1kECg](https://www.youtube.com/watch?v=kPRA0W1kECg) " ] } ], "metadata": { "celltoolbar": "Slideshow", "date": 1612589584.968545, "download_nb": false, "filename": "16_vizualization.rst", "filename_with_path": "16_vizualization", "kernelspec": { "display_name": "Python", "language": "python3", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.6" }, "title": "Foundations of Computational Economics #16" }, "nbformat": 4, "nbformat_minor": 4 }