Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
183 lines (133 sloc) 4.14 KB

Matplotlib Examples

Moduł matplotlib pozwala na rysowanie wykresów i diagramów. Jest to bardzo rozbudowana biblioteka z setkami opcji konfiguracyjnych. Najczęściej używanym modułem biblioteki matplotlib jest moduł pyplot, który implementuje szereg funkcji umożliwiających rysowanie wykresów 2d.

Matplotlib is a Python 2D plotting library which produces publication-quality figures in a variety of hardcopy formats and interactive environments across platforms. Matplotlib can be used in Python scripts, the Python and IPython shell (à la MATLAB or Mathematica), web application servers, and various graphical user interface toolkits.

It provides an object-oriented API for embedding plots into applications using general-purpose GUI toolkits like Tkinter, wxPython, Qt, or GTK+. There is also a procedural "pylab" interface based on a state machine (like OpenGL), designed to closely resemble that of MATLAB, though its use is discouraged. SciPy makes use of matplotlib.

Gallery

Matplotlib and Jupyter

  • %matplotlib inline

Points

Simple Points

.. literalinclude:: src/matplotlib-points-simple.py
    :language: python
    :caption: Simple Points

Multiple Points

.. literalinclude:: src/matplotlib-points-multiple.py
    :language: python
    :caption: Multiple Points

Points with Labels

.. literalinclude:: src/matplotlib-points-labels.py
    :language: python
    :caption: Points with Labels


Line Chart

Simple Line

.. literalinclude:: src/matplotlib-line-simple.py
    :language: python
    :caption: Simple Line Chart

Multiple Lines

.. literalinclude:: src/matplotlib-line-multiple.py
    :language: python
    :caption: Multiple Lines


Multiple Charts

Multiple Charts Aligned

.. literalinclude:: src/matplotlib-multiple-aligned.py
    :language: python
    :caption: Multiple Charts Aligned

Multiple Charts in Grid

.. literalinclude:: src/matplotlib-multiple-charts.py
    :language: python
    :caption: Multiple Charts in Grid


Box Chart

Simple Box Charts

.. literalinclude:: src/matplotlib-box-simple.py
    :language: python
    :caption: Simple Box Chart

Multiple Box Charts

.. literalinclude:: src/matplotlib-box-multiple.py
    :language: python
    :caption: Multiple Box Charts

Various Box Charts

.. literalinclude:: src/matplotlib-box-various.py
    :language: python
    :caption: Various Box Charts


Bars

.. literalinclude:: src/matplotlib-bars.py
    :language: python
    :caption: Bars


Annotate

Simple Annotation

.. literalinclude:: src/matplotlib-annotate-simple.py
    :language: python
    :caption: Simple Annotation

Multiple Annotations

.. literalinclude:: src/matplotlib-annotate-multiple.py
    :language: python
    :caption: Multiple Annotations


Scales

.. literalinclude:: src/matplotlib-scales.py
    :language: python
    :caption: Scales


Pie Chart

Simple Pie Chart

.. literalinclude:: src/matplotlib-pie-simple.py
    :language: python
    :caption: Simple Pie Chart

Donut Pie Chart

.. literalinclude:: src/matplotlib-pie-donut.py
    :language: python
    :caption: Donut Pie Chart


3D

3D Sphere

.. literalinclude:: src/matplotlib-3d-sphere.py
    :language: python
    :caption: 3D Sphere

3D Surface

.. literalinclude:: src/matplotlib-3d-surface.py
    :language: python
    :caption: 3D Surface


Grid

.. literalinclude:: src/matplotlib-grid-extra.py
    :language: python
    :caption: Grid


Legend using pre-defined labels

.. literalinclude:: src/matplotlib-legend.py
    :language: python
    :caption: Legend using pre-defined labels


Radar Chart

.. literalinclude:: src/matplotlib-radar-chart.py
    :language: python
    :caption: Radar Chart