{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# A brief glance at the wider Python data visualisation landscape\n", "One of the strengths of Python is its community and the numerous packages at your disposal. As a result, there is an entire ecosystem of figure making libraries out there. The overview below is from Jake VanderPlas' talk [\"The Python Visualization Landscape\"](https://www.youtube.com/watch?v=FytuB8nFHPQ) at PyCon 2017:\n", "![The Python visualization landscape](../figures/python_visualization_landscape22.png)\n", "\n", "Now that we are nearing the end, sit back and relax and take a brief look at the possibilities that different Python packages offer for figure making. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[The Python Graph Gallery](https://python-graph-gallery.com/) is a nice resource if you have an idea of what kind of graph you'd like to make but you aren't sure what Python tools you can use for it, even though it's not entirely up to date in all sections. Or you can look at the tools listed below or displayed above. Websites of plotting libraries almost always have a \"gallery\" section which you can browse for inspiration for your next plot.\n", "\n", "General purpose plotting libraries: \n", "- [matplotlib](https://matplotlib.org/), of course! See Notebook 5.\n", "- [seaborn](https://seaborn.pydata.org/index.html): statistical plotting, see Notebook 6.\n", "- [plotnine](https://plotnine.readthedocs.io/en/stable/) (less used): uses grammar of graphics, Python's answer to R's ggplot2, will feel very familiar for R users!\n", "\n", "Interactive plots and dashboards:\n", "- [plotly](https://plotly.com/python/) and its high level wrapper [plotly express](https://plotly.com/python/plotly-express/)\n", " - [Dash](https://dash-gallery.plotly.host/Portal/): interactive data visualisation apps. Comparable to R's Shiny.\n", "- [Bokeh](https://docs.bokeh.org/en/latest/index.html)\n", "- [Altair](https://altair-viz.github.io/): follows a grammar of graphics.\n", "\n", "Other libraries have more or less specific purposes: \n", "- [NetworkX](https://networkx.org/documentation/stable/): for working with and displaying different kinds of network data\n", "- [BioPython's GenomeDiagram](http://biopython.org/DIST/docs/tutorial/Tutorial.html#sec336) for visualizing genomes\n", "- ...\n", "\n", "Making maps: \n", "- [Cartopy](https://scitools.org.uk/cartopy/docs/latest/): high quality static maps, builds on matplotlib. See notebook 7.\n", "- [Folium](https://python-visualization.github.io/folium/): for interactive maps, based on the JavaScript library leaflet.js.\n", "- [Plotly maps](https://plotly.com/python/maps/): for easy interactive maps, based on the JavaScript library D3.js.\n", "- [pyproj](https://pyproj4.github.io/pyproj/stable/) (not a plotting library): if you need to transform your spatial data to another coordinate reference system/geographic projection, see for example [Callum's tutorial on the UEA Python website](https://ueapy.github.io/making-a-geographic-grid-with-pyproj.html).\n", "\n", "### Colour matters.\n", "- Test your figures for accessibility by simulating different types of colorblindness: [Coblis](https://www.color-blindness.com/coblis-color-blindness-simulator/). \n", "- There is some useful guidance on [matplotlib's own tutorial on choosing colormaps](https://matplotlib.org/stable/tutorials/colors/colormaps.html).\n", "- To explore why jet/rainbow is bad for science, go read [this blog post](https://titan.uio.no/english/2021/improper-use-colours-can-distort-scientific-data) or [this Nature Communications paper](https://www.nature.com/articles/s41467-020-19160-7). \n", "- Good colourmaps:\n", " - [some (but definitely not all) of the matplotlib included colormaps](https://matplotlib.org/stable/tutorials/colors/colormaps.html)\n", " - [cmocean](https://matplotlib.org/cmocean/ ) (Kirsten Thyng)\n", " - [scientific colormaps](https://www.fabiocrameri.ch/colourmaps/) (Fabio Crameri)\n", " - [ColorBrewer](https://colorbrewer2.org) (Cynthia Brewer)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# That's all folks!" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now is your time to look back over the notebooks and ask us about anything you're unsure of. You can experiment with your own data, try to import it to Python and plot it up. Feel free to ask the instructors for help " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---------\n", "### Further reading and useful resources" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Much of this short course is condensed/stolen from the UEA Cefas 3 day \"Python for data science\" course. The materials are available as jupyter notebooks [here](https://github.com/ueapy/pythoncourse2022-materials). " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "-------------\n", "### Course evaluation (2 mins)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Your feedback helps us improve this course and is greatly appreciated: https://forms.gle/9v7PF6JVLXVFZLTu9." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---\n", "# Join the UEA scientific Python user group!" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The group is open to all scientific Python users. Our members range from complete beginners to true experts. \n", "\n", "We share tips, resources, what we're working on and are there to answer each other's questions. You can join us using the [invite link](https://join.slack.com/t/uea-python/shared_invite/zt-1jkl1gqsj-3cPqYB5Zcl_0mnF39dksxw)\n", "\n", " You can get a taste of previous tutorials on our [website](https://ueapy.github.io/)." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "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.8" } }, "nbformat": 4, "nbformat_minor": 2 }