reading-notes

reading notes for code fellows


Project maintained by dLeigh01 Hosted on GitHub Pages — Theme by mattgraham

Data Visualization

This will be important going forward for us to make good use of Python’s abilities to plot data and accurately portray our data science work.

Matplotlib Tutorial

Matplotlib provides a quick way to vizualize data from Python, with an optional addition of pyplot, which provides a convenient interface for matplotlib. matplotlib comes with a variety of default settings that allow many different levels of customization from the figure size to the font properties. Usually the defaults are pretty good, but you may occasionally want to change them.

In matplotlib, a figure is defined as the entirety of the user interface window, which means it can include several, smaller subplots placed freely within the figure. The arguments that dtermine the look of a figure are

the only thing among these that is frequently changed is the number, as it updates whenever a new figure is created. Figures can be closed within the program by calling close with an optional argument of the figure(s) you would like to close, or else it will close the current one. For the subplots within a figure, you can set them in a grid layout by specifying how many rows and columns they should take up and which plot humber you would like in the specified space. If you don’t want to use a grid, you can also use axes to place the subplot anywhere you want, even within another subplot.

Ticks are another things within matplot lib that are totally customizable. Major and minor ticks can be formatted completely independant of one another. In the past, if you wanted your plot to be animated, it would be very difficult to pull off, but now there are built in tools to do so. The easiest way to go about it currently is to declare a FuncAnimation object that specifies to matplotlib which figure needs to be updated, what to change, and the fps.

The different general types of plots you can use are

Discussion

I like this far better than the previous graphing software we used with javascript. It wasn’t nearly as customizable and caused a lot of frustration with some of the default settings that we couldn’t change.

[< table of contents]

[< home]