Skip to content

Commit

Permalink
Update first part of plotting material
Browse files Browse the repository at this point in the history
  • Loading branch information
davewhipp committed Oct 13, 2024
1 parent 4608ab5 commit fd248fb
Show file tree
Hide file tree
Showing 4 changed files with 229 additions and 283 deletions.
19 changes: 9 additions & 10 deletions source/part1/chapter-04/md/00-plotting-in-python.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jupyter:
<!-- #region editable=true slideshow={"slide_type": ""} -->
# Plotting in Python

Data visualization is an essential part of understanding and interpreting data, and Python has a large number of libraries available for use in visualizing different types of data. Below we provide a bried overview of some of the Python plotting landscape as well as an introduction to the terminology commonly used to refer to different parts of a plot created using Python.
Data visualization is an essential part of understanding and interpreting data, and Python has a large number of libraries available for use in visualizing different types of data. Below we provide a brief overview of some of the Python plotting landscape as well as an introduction to the terminology commonly used to refer to different parts of a plot created using Python.
<!-- #endregion -->

## Python plotting libraries
Expand All @@ -26,14 +26,14 @@ _**Figure 4.1**. Plotting libraries available in Python. Interactive version onl

Python has many nice, useful libraries that can be used for plotting. In the figure above, you can see a number of the available plotting library options, along with how they relate to one another. Of the options above we would like to highlight the following:

- [Matplotlib](https://matplotlib.org/) [^matplotlib]: Matplotlib is one of the most widely used Python plotting libraries, sometimes referred to as "*the grand old man of Python plotting*". Plot examples can be found in the [Matplotlib gallery](https://matplotlib.org/gallery.html).
- [Matplotlib](https://matplotlib.org/) [^matplotlib]: Matplotlib is one of the most widely used Python plotting libraries, sometimes referred to as "*the grand old man of Python plotting*". Plot examples can be found in the [Matplotlib gallery](https://matplotlib.org/stable/gallery/index.html).

- [Matplotlib Basemap](https://matplotlib.org/basemap/index.html) [^basemap]: The Matplotlib Basemap Toolkit is a plugin for visualizing maps in Python. Example plots available in the [Matplotlib basemap gallery](https://matplotlib.org/basemap/users/examples.html).
- [Matplotlib basemap](https://matplotlib.org/basemap/stable/) [^basemap]: The Matplotlib basemap toolkit is a plugin for visualizing maps in Python. Example plots available in the [Matplotlib basemap gallery](https://matplotlib.org/basemap/stable/users/examples.html).
- [Seaborn](https://seaborn.pydata.org/) [^seaborn]: Seaborn is a high-level interface for drawing attractive statistical graphics that is built on top of Matplotlib. Example plots can be found in the [Seaborn gallery](https://seaborn.pydata.org/examples/index.html).

- [Bokeh](https://docs.bokeh.org/en/latest/) [^bokeh]: Bokeh is a modern plotting library for static and interactive web-based plots including graphs, maps, and charts. Examples can be found in the [Bokeh gallery](https://docs.bokeh.org/en/latest/docs/gallery.html).
- [Plotly](https://plotly.com/python/) [^plotly]: Similar in some ways to Bokeh, Plotly is a modern plotting library for static and interactive web-based plots. Some features are commercial. Example plots are available in the [Plotly gallery](https://plotly.com/python/basic-charts/).
- [Dash](https://plotly.com/dash/) [^dash]: Dash is a Python framework for building analytical web applications. No JavaScript required.
- [Plotly](https://plotly.com/python/) [^plotly]: Similar in some ways to Bokeh, Plotly is a modern plotting library for static and interactive web-based plots. The Python library for Plotly is free and open source, but some Plotly features are commercial. Example plots are available in the [Plotly gallery](https://plotly.com/python/basic-charts/).
- [Dash](https://plotly.com/dash/) [^dash]: Dash is a Python framework for building analytical web applications. No JavaScript required. Some parts of Dash are commercial.
- [ggplot](https://yhat.github.io/ggpy/) [^ggplot]: ggplot is a Python plotting environment for those familiar with creating plots in R using ggplot2. You can use ggplot in Python too! Plot examples can be found in the [ggplot examples](https://yhat.github.io/ggpy/).
- [HoloViews](https://holoviews.org/) [^holoviews]: and [GeoViews](https://geoviews.org/) [^geoviews]: HoloViews and GeoViews aim to let the data visualize itself. Learn more in the HoloViews introductory video at <https://www.youtube.com/watch?v=hNsR2H7Lrg0>.

Expand All @@ -43,10 +43,10 @@ Python has many nice, useful libraries that can be used for plotting. In the fig

You should explore the plotting galleries and examples of different visualization libraries above to learn what's possible to do in Python. As you will see, the plotting possibilities in Python are numerous and rich. To get started, we suggest starting by learning to use one that suits your needs best, and later extending your knowledge and skills to other visualization libraries as necessary.

<!-- #region -->

## Anatomy of a plot

There are a variety of different kinds of plots (also known as graphs, charts, diagrams, etc.) available that have been designed to visually represent the characteristics of a dataset. Here is a list of several different types of plots that can be used to present different kinds of data. You can find more information about this plots online in Wikipedia, for example.
There are a variety of different kinds of plots (also known as graphs, charts, diagrams, etc.) that have been designed to visually represent the characteristics of a data set. Here is a list of several different types of plots that can be used to present different kinds of data. You can find more information about this plots online in Wikipedia, for example.

- [Bar chart](https://en.wikipedia.org/wiki/Bar_chart)
- [Histogram](https://en.wikipedia.org/wiki/Histogram)
Expand All @@ -67,9 +67,8 @@ However, before starting to visualize our data on a plot our data we need to add

_**Figure 4.2**. The basic elements of a plot. Image source: Tenkanen (2017)._


In spite of the large variety of types of plots, there are certain elements that are common for most of them (not all). Thus, it is useful to know at least the basic terminology since it makes it easier to find help and information from the internet when you start creating or modifying your own plots. Figure 4.2 illustrates different elements of a basic line plot.
<!-- #endregion -->


### Common plotting terminology

Expand Down Expand Up @@ -105,7 +104,7 @@ The common terms in Table 4.1 may vary a bit depending on the plotting library t

## Footnotes

[^basemap]: <https://matplotlib.org/basemap/index.html>
[^basemap]: <https://matplotlib.org/basemap/stable/>
[^bokeh]: <https://docs.bokeh.org/en/latest/>
[^dash]: <https://plotly.com/dash/>
[^geoviews]: <https://geoviews.org/>
Expand Down
Loading

0 comments on commit fd248fb

Please sign in to comment.