From 7ef622972ce350eba9eed03b446ed6d64a6621c9 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Tue, 4 Jun 2019 17:03:14 +0200 Subject: [PATCH] Misc. docstring cleanups. --- examples/animation/random_walk.py | 12 ++++++++---- examples/animation/strip_chart.py | 2 +- examples/axisartist/demo_axis_direction.py | 4 +--- examples/axisartist/demo_curvelinear_grid2.py | 4 +--- examples/axisartist/simple_axis_pad.py | 4 +--- examples/event_handling/pick_event_demo2.py | 6 +++--- 6 files changed, 15 insertions(+), 17 deletions(-) diff --git a/examples/animation/random_walk.py b/examples/animation/random_walk.py index b26a8a71cd13..1f9e43334d57 100644 --- a/examples/animation/random_walk.py +++ b/examples/animation/random_walk.py @@ -15,10 +15,14 @@ def gen_rand_line(length, dims=2): """ - Create a line using a random walk algorithm - - length is the number of points for the line. - dims is the number of dimensions the line has. + Create a line using a random walk algorithm. + + Parameters + ---------- + length : int + The number of points of the line. + dims : int + The number of dimensions of the line. """ line_data = np.empty((dims, length)) line_data[:, 0] = np.random.rand(dims) diff --git a/examples/animation/strip_chart.py b/examples/animation/strip_chart.py index a361b82e135f..2661e1927b97 100644 --- a/examples/animation/strip_chart.py +++ b/examples/animation/strip_chart.py @@ -40,7 +40,7 @@ def update(self, y): def emitter(p=0.03): - 'return a random value with probability p, else 0' + """Return a random value in [0, 1) with probability p, else 0.""" while True: v = np.random.rand(1) if v > p: diff --git a/examples/axisartist/demo_axis_direction.py b/examples/axisartist/demo_axis_direction.py index d4c8f817b5cc..c3ceccdd749d 100644 --- a/examples/axisartist/demo_axis_direction.py +++ b/examples/axisartist/demo_axis_direction.py @@ -19,9 +19,7 @@ def setup_axes(fig, rect): - """ - polar projection, but in a rectangular box. - """ + """Polar projection, but in a rectangular box.""" # see demo_curvelinear_grid.py for details tr = Affine2D().scale(np.pi/180., 1.) + PolarAxes.PolarTransform() diff --git a/examples/axisartist/demo_curvelinear_grid2.py b/examples/axisartist/demo_curvelinear_grid2.py index 88b656b32cd7..7126e1e39731 100644 --- a/examples/axisartist/demo_curvelinear_grid2.py +++ b/examples/axisartist/demo_curvelinear_grid2.py @@ -22,9 +22,7 @@ def curvelinear_test1(fig): - """ - grid for custom transform. - """ + """Grid for custom transform.""" def tr(x, y): sgn = np.sign(x) diff --git a/examples/axisartist/simple_axis_pad.py b/examples/axisartist/simple_axis_pad.py index cac9d84915b3..f95e2f6e3836 100644 --- a/examples/axisartist/simple_axis_pad.py +++ b/examples/axisartist/simple_axis_pad.py @@ -19,9 +19,7 @@ def setup_axes(fig, rect): - """ - polar projection, but in a rectangular box. - """ + """Polar projection, but in a rectangular box.""" # see demo_curvelinear_grid.py for details tr = Affine2D().scale(np.pi/180., 1.) + PolarAxes.PolarTransform() diff --git a/examples/event_handling/pick_event_demo2.py b/examples/event_handling/pick_event_demo2.py index 72cd4d6f4719..6204613690f1 100644 --- a/examples/event_handling/pick_event_demo2.py +++ b/examples/event_handling/pick_event_demo2.py @@ -3,9 +3,9 @@ Pick Event Demo2 ================ -compute the mean and standard deviation (stddev) of 100 data sets and plot -mean vs stddev. When you click on one of the mu, sigma points, plot the raw -data from the dataset that generated the mean and stddev. +Compute the mean (mu) and standard deviation (sigma) of 100 data sets and plot +mu vs. sigma. When you click on one of the (mu, sigma) points, plot the raw +data from the dataset that generated this point. """ import numpy as np import matplotlib.pyplot as plt