Skip to content

[Doc] Add pcolor, contour, imshow to and other small changes #9394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 14, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add pcolor and other small changes
  • Loading branch information
jklymak committed Oct 13, 2017
commit 0cf3a2b5561c3efdb95e9a6fc36669765d23d688
110 changes: 75 additions & 35 deletions tutorials/introductory/sample_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@

.. _screenshots_subplot_demo:

Subplot demo
============
Multiple subplots in one figure
===============================

Multiple axes (i.e. subplots) are created with the
:func:`~matplotlib.pyplot.subplot` command:
:func:`~matplotlib.pyplot.subplot` function:

.. figure:: ../../gallery/subplots_axes_and_figures/images/sphx_glr_subplot_001.png
:target: ../../gallery/subplots_axes_and_figures/subplot.html
Expand All @@ -36,12 +36,46 @@

Subplot

.. _screenshots_images_demo:

Images
======

Matplotlib can display images (assuming equally spaced
horizontal dimensions) using the :func:`~matplotlib.pyplot.imshow` function.

.. figure:: ../../gallery/images_contours_and_fields/images/sphx_glr_image_demo_003.png
:target: ../../gallery/images_contours_and_fields/image_demo.html
:align: center
:scale: 50

Example of using :func:`~matplotlib.pyplot.imshow` to display a CT scan

.. _screenshots_pcolormesh_demo:


Contouring and pseudocolor
==========================

The :func:`~matplotlib.pyplot.pcolormesh` function can make a colored
representation of a two-dimensional array, even if the horizontal dimensions
are unevenly spaced. The
:func:`~matplotlib.pyplot.contour` function is another way to represent
the same data:

.. figure:: ../../gallery/images_contours_and_fields/images/sphx_glr_pcolormesh_levels_001.png
:target: ../../gallery/images_contours_and_fields/pcolormesh_levels.html
:align: center
:scale: 50

Example comparing :func:`~matplotlib.pyplot.pcolormesh` and :func:`~matplotlib.pyplot.contour` for plotting two-dimensional data

.. _screenshots_histogram_demo:

Histograms
==========

The :func:`~matplotlib.pyplot.hist` command automatically generates
The :func:`~matplotlib.pyplot.hist` function automatically generates
histograms and returns the bin counts or probabilities:

.. figure:: ../../gallery/statistics/images/sphx_glr_histogram_features_001.png
Expand All @@ -54,8 +88,8 @@

.. _screenshots_path_demo:

Path demo
=========
Paths
=====

You can add arbitrary paths in Matplotlib using the
:mod:`matplotlib.path` module:
Expand All @@ -69,8 +103,8 @@

.. _screenshots_mplot3d_surface:

mplot3d
=========
Three-dimensional plotting
==========================

The mplot3d toolkit (see :ref:`toolkit_mplot3d-tutorial` and
:ref:`mplot3d-examples-index`) has support for simple 3d graphs
Expand Down Expand Up @@ -103,7 +137,7 @@
:align: center
:scale: 50

Plot Streamplot
Streamplot with various plotting options.

This feature complements the :meth:`~matplotlib.pyplot.quiver` function for
plotting vector fields. Thanks to Tom Flannaghan and Tony Yu for adding the
Expand Down Expand Up @@ -132,7 +166,7 @@
Bar charts
==========

Use the :func:`~matplotlib.pyplot.bar` command to make bar charts, which
Use the :func:`~matplotlib.pyplot.bar` function to make bar charts, which
includes customizations such as error bars:

.. figure:: ../../gallery/statistics/images/sphx_glr_barchart_demo_001.png
Expand All @@ -153,7 +187,7 @@
Pie charts
==========

The :func:`~matplotlib.pyplot.pie` command allows you to create pie
The :func:`~matplotlib.pyplot.pie` function allows you to create pie
charts. Optional features include auto-labeling the percentage of area,
exploding one or more wedges from the center of the pie, and a shadow effect.
Take a close look at the attached code, which generates this figure in just
Expand All @@ -168,10 +202,10 @@

.. _screenshots_table_demo:

Table demo
==========
Tables
======

The :func:`~matplotlib.pyplot.table` command adds a text table
The :func:`~matplotlib.pyplot.table` function adds a text table
to an axes.

.. figure:: ../../gallery/misc/images/sphx_glr_table_demo_001.png
Expand All @@ -185,10 +219,10 @@
.. _screenshots_scatter_demo:


Scatter demo
============
Scatter plots
=============

The :func:`~matplotlib.pyplot.scatter` command makes a scatter plot
The :func:`~matplotlib.pyplot.scatter` function makes a scatter plot
with (optional) size and color arguments. This example plots changes
in Google's stock price, with marker sizes reflecting the
trading volume and colors varying with time. Here, the
Expand All @@ -204,7 +238,7 @@

.. _screenshots_slider_demo:

Slider demo
GUI widgets
===========

Matplotlib has basic GUI widgets that are independent of the graphical
Expand All @@ -217,15 +251,15 @@
:align: center
:scale: 50

Slider Demo
Slider and radio-button GUI.


.. _screenshots_fill_demo:

Fill demo
=========
Filled curves
=============

The :func:`~matplotlib.pyplot.fill` command lets you
The :func:`~matplotlib.pyplot.fill` function lets you
plot filled curves and polygons:

.. figure:: ../../gallery/lines_bars_and_markers/images/sphx_glr_fill_001.png
Expand All @@ -239,8 +273,8 @@

.. _screenshots_date_demo:

Date demo
=========
Date handling
=============

You can plot timeseries data with major and minor ticks and custom
tick formatters for both.
Expand Down Expand Up @@ -280,7 +314,7 @@
Polar plots
===========

The :func:`~matplotlib.pyplot.polar` command generates polar plots.
The :func:`~matplotlib.pyplot.polar` function generates polar plots.

.. figure:: ../../gallery/pie_and_polar_charts/images/sphx_glr_polar_demo_001.png
:target: ../../gallery/pie_and_polar_charts/polar_demo.html
Expand All @@ -295,9 +329,9 @@
Legends
=======

The :func:`~matplotlib.pyplot.legend` command automatically
generates figure legends, with MATLAB-compatible legend placement
commands.
The :func:`~matplotlib.pyplot.legend` function automatically
generates figure legends, with MATLAB-compatible legend-placement
functions.

.. figure:: ../../gallery/api/images/sphx_glr_legend_001.png
:target: ../../gallery/api/legend.html
Expand All @@ -306,12 +340,12 @@

Legend

Thanks to Charles Twardy for input on the legend command.
Thanks to Charles Twardy for input on the legend function.

.. _screenshots_mathtext_examples_demo:

Mathtext_examples
=================
TeX-notation for text objects
=============================

Below is a sampling of the many TeX expressions now supported by Matplotlib's
internal mathtext engine. The mathtext module provides TeX style mathematical
Expand Down Expand Up @@ -349,8 +383,8 @@

.. _screenshots_eeg_demo:

EEG demo
=========
EEG GUI
=======

You can embed Matplotlib into pygtk, wx, Tk, or Qt applications.
Here is a screenshot of an EEG viewer called `pbrain
Expand All @@ -372,7 +406,7 @@
XKCD-style sketch plots
=======================

Matplotlib supports plotting in the style of `xkcd
Just for fun, Matplotlib supports plotting in the style of `xkcd
<http://www.xkcd.com/>`.

.. figure:: ../../gallery/showcase/images/sphx_glr_xkcd_001.png
Expand All @@ -383,7 +417,13 @@
Xkcd
"""

# An extra set of sample plots for the thumbnail image.
###################################################################
# Subplot example
# ===============
#
# Many plot types can be combined in one figure to create
# powerful and flexible representations of data.
#
import matplotlib.pyplot as plt
import numpy as np

Expand Down