Skip to main content Accessibility help
×
Hostname: page-component-76fb5796d-skm99 Total loading time: 0 Render date: 2024-04-28T10:37:27.464Z Has data issue: false hasContentIssue false

5 - Two-Dimensional Graphics

Published online by Cambridge University Press:  02 August 2017

John M. Stewart
Affiliation:
University of Cambridge
Get access

Summary

The most venerable and perhaps best-known scientific graphics package is Gnuplot, and downloads of this open-source project can be obtained from its website. The official documentation is Gnuplot Community (2016), some 250 pages, and a more descriptive introduction can be found in Janert (2015). Gnuplot is of course independent of Python. However, there is a NumPy interface to it, which provides Python-like access to the most commonly used Gnuplot functions. This is available on line. Although most scientific Python implementations install the relevant code as a matter of course, the documentation and example files from this online source are useful. For many applications requiring two-dimensional graphics, the output from Gnuplot is satisfactory, but only at its best is it of publication quality. Here Matlab has been, until recently, the market leader in this respect, but Python aims to equal or surpass it in quality and versatility.

The Matplotlib project aims to produce Matlab-quality graphics as an add-on to NumPy. Almost certainly, this should be part of your installation. It is installed by default in most Python packages designed for scientists. There is extensive “official documentation” (2842 pages) at Matplotlib Community (2016), and a useful alternative description in Tosi (2009). The reader is strongly urged to peruse the Matplotlib Gallery where a large collection of publication quality figures, and the code to generate them, is displayed. This is an excellent way (a) to explore the visual capabilities of Matplotlib and (b) to obtain code snippets to help create a desired figure. Because Matplotlib contains hundreds of functions, we can include here only a small subset. Note that almost all of the figures in this and subsequent chapters were generated using Matplotlib, and the relevant code snippets are included here. However the exigencies of book publishing have required the conversion of these colour figures to black, white and many shades of grey.

As with all other powerful versatile tools, a potential user is strongly encouraged to read the instruction manual, but at well over one thousand pages few scientific users will attempt to do so.

Type
Chapter
Information
Publisher: Cambridge University Press
Print publication year: 2017

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

Available formats
×