8000 added basic_units download link to units examples by story645 · Pull Request #8554 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

added basic_units download link to units examples #8554

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 2 commits into from
May 2, 2017
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions examples/units/README.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.. _units_examples:

.. _units-examples-index:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just FYI - sphinx gallery will auto-create these labels when it builds the docs. They follow the convention .. _sphx_glr_path_to_file.py:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(ack NVM, I think I am wrong. These labels only get generated for the .py files converted to RST, not the README.txt files)


Units in Matplotlib
===================

Expand Down
4 changes: 4 additions & 0 deletions examples/units/annotate_with_units.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
The example illustrates how to create text and arrow
annotations using a centimeter-scale plot.

.. only:: builder_html

This example requires :download:`basic_units.py <basic_units.py>`
"""

import matplotlib.pyplot as plt
from basic_units import cm

Expand Down
4 changes: 4 additions & 0 deletions examples/units/artist_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
parent. You must initialize the artists with the axis instance if you want to
use them with unit data, or else they will not know how to convert the units
to scalars.

.. only:: builder_html

This example requires :download:`basic_ 8000 units.py <basic_units.py>`
"""
import random
import matplotlib.lines as lines
Expand Down
3 changes: 3 additions & 0 deletions examples/units/bar_demo2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
set the xlimits using scalars (ax3, current units assumed) or units
(conversions applied to get the numbers to current units).

.. only:: builder_html

This example requires :download:`basic_units.py <basic_units.py>`
"""
import numpy as np
from basic_units import cm, inch
Expand Down
9 changes: 6 additions & 3 deletions examples/units/bar_unit_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
Group barchart with units
=========================

This is the same example as
<a href='http://matplotlib.org/examples/api/barchart_demo.html'>
the barchart demo</a> in centimeters.
This is the same example as :doc:`the barchart demo<../api/barchart>`
in centimeters.

.. only:: builder_html

This example requires :download:`basic_units.py <basic_units.py>`
"""

import numpy as np
Expand Down
15 changes: 8 additions & 7 deletions examples/units/ellipse_with_units.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
==================

Compare the ellipse generated with arcs versus a polygonal approximation

.. only:: builder_html

This example requires :download:`basic_units.py <basic_units.py>`
"""
from basic_units import cm
import numpy as np
Expand All @@ -12,7 +16,6 @@


xcenter, ycenter = 0.38*cm, 0.52*cm
#xcenter, ycenter = 0., 0.
width, height = 1e-1*cm, 3e-1*cm
angle = -30

Expand All @@ -33,7 +36,8 @@

fig = plt.figure()
ax = fig.add_subplot(211, aspect='auto')
ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1)
ax.fill(x, y, alpha=0.2, facecolor='yellow',
edgecolor='yellow', linewidth=1, zorder=1)

e1 = patches.Ellipse((xcenter, ycenter), width, height,
angle=angle, linewidth=2, fill=False, zorder=2)
Expand All @@ -47,13 +51,12 @@


ax.add_patch(e2)

#fig.savefig('ellipse_compare.png')
fig.savefig('ellipse_compare')

fig = plt.figure()
ax = fig.add_subplot(211, aspect='auto')
ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1)
ax.fill(x, y, alpha=0.2, facecolor='yellow',
edgecolor='yellow', linewidth=1, zorder=1)

e1 = patches.Arc((xcenter, ycenter), width, height,
angle=angle, linewidth=2, fill=False, zorder=2)
Expand All @@ -67,8 +70,6 @@


ax.add_patch(e2)

#fig.savefig('arc_compare.png')
fig.savefig('arc_compare')

plt.show()
7 changes: 4 additions & 3 deletions examples/units/radian_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
Radian ticks
============

Plot with radians from the basic_units mockup example package.
Plot using radian units.

This example shows how the unit class can determine the tick locating,
formatting and axis labeling.
.. only:: builder_html

This example requires :download:`basic_units.py <basic_units.py>`
"""
import numpy as np
from basic_units import radians, degrees, cos
Expand Down
4 changes: 4 additions & 0 deletions examples/units/units_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
`plot` function. Note that conversions are applied to get numbers to correct
units.

.. only:: builder_html

This example requires :download:`basic_units.py <basic_units.py>`

"""
from basic_units import cm, inch
import matplotlib.pyplot as plt
Expand Down
8 changes: 4 additions & 4 deletions examples/units/units_scatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
Unit handling
=============

basic_units is a mockup of a true units package used for testing
purposed, which illustrates the basic interface that a units package
must provide to matplotlib.

The example below shows support for unit conversions over masked
arrays.

.. only:: builder_html

This example requires :download:`basic_units.py <basic_units.py>`
"""
import numpy as np
import matplotlib.pyplot as plt
Expand Down
0