Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c4b200f

Browse filesBrowse files
authored
Merge pull request #16827 from QuLogic/doc-fixes
Fix warnings in doc examples
2 parents fd2e276 + dd54a33 commit c4b200f
Copy full SHA for c4b200f

File tree

Expand file treeCollapse file tree

6 files changed

+25
-34
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+25
-34
lines changed

‎examples/color/custom_cmap.py

Copy file name to clipboardExpand all lines: examples/color/custom_cmap.py
+3-7Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155

156156

157157
###############################################################################
158-
# Now we will use this example to illustrate 3 ways of
158+
# Now we will use this example to illustrate 2 ways of
159159
# handling custom colormaps.
160160
# First, the most direct and explicit:
161161

@@ -170,12 +170,8 @@
170170
blue_red2 = LinearSegmentedColormap('BlueRed2', cdict2)
171171
plt.register_cmap(cmap=blue_red2)
172172

173-
###############################################################################
174-
# Third, for LinearSegmentedColormap only,
175-
# leave everything to register_cmap:
176-
177-
plt.register_cmap(name='BlueRed3', data=cdict3) # optional lut kwarg
178-
plt.register_cmap(name='BlueRedAlpha', data=cdict4)
173+
plt.register_cmap(cmap=LinearSegmentedColormap('BlueRed3', cdict3))
174+
plt.register_cmap(cmap=LinearSegmentedColormap('BlueRedAlpha', cdict4))
179175

180176
###############################################################################
181177
# Make the figure:

‎examples/event_handling/data_browser.py

Copy file name to clipboardExpand all lines: examples/event_handling/data_browser.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def update(self):
9191

9292
fig, (ax, ax2) = plt.subplots(2, 1)
9393
ax.set_title('click on point to plot time series')
94-
line, = ax.plot(xs, ys, 'o', picker=5) # 5 points tolerance
94+
line, = ax.plot(xs, ys, 'o', picker=True, pickradius=5)
9595

9696
browser = PointBrowser()
9797

‎examples/event_handling/pick_event_demo.py

Copy file name to clipboardExpand all lines: examples/event_handling/pick_event_demo.py
+16-21Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,27 @@
88
(for example, a matplotlib Line2D, Text, Patch, Polygon, AxesImage,
99
etc...)
1010
11-
There are a variety of meanings of the picker property
11+
There are a variety of meanings of the picker property:
1212
13-
None - picking is disabled for this artist (default)
13+
* *None* - picking is disabled for this artist (default)
1414
15-
boolean - if True then picking will be enabled and the
16-
artist will fire a pick event if the mouse event is over
17-
the artist
15+
* bool - if *True* then picking will be enabled and the artist will fire a pick
16+
event if the mouse event is over the artist.
1817
19-
float - if picker is a number it is interpreted as an
20-
epsilon tolerance in points and the artist will fire
21-
off an event if it's data is within epsilon of the mouse
22-
event. For some artists like lines and patch collections,
23-
the artist may provide additional data to the pick event
24-
that is generated, for example, the indices of the data within
25-
epsilon of the pick event
18+
Setting ``pickradius`` will add an epsilon tolerance in points and the artist
19+
will fire off an event if its data is within epsilon of the mouse event. For
20+
some artists like lines and patch collections, the artist may provide
21+
additional data to the pick event that is generated, for example, the indices
22+
of the data within epsilon of the pick event
2623
27-
function - if picker is callable, it is a user supplied
28-
function which determines whether the artist is hit by the
29-
mouse event.
24+
* function - if picker is callable, it is a user supplied function which
25+
determines whether the artist is hit by the mouse event.
3026
31-
hit, props = picker(artist, mouseevent)
32-
33-
to determine the hit test. If the mouse event is over the
34-
artist, return hit=True and props is a dictionary of properties
35-
you want added to the PickEvent attributes
27+
hit, props = picker(artist, mouseevent)
3628
29+
to determine the hit test. If the mouse event is over the artist, return
30+
hit=True and props is a dictionary of properties you want added to the
31+
PickEvent attributes.
3732
3833
After you have enabled an artist for picking by setting the "picker"
3934
property, you need to connect to the figure canvas pick_event to get
@@ -80,7 +75,7 @@ def pick_simple():
8075
fig, (ax1, ax2) = plt.subplots(2, 1)
8176
ax1.set_title('click on points, rectangles or text', picker=True)
8277
ax1.set_ylabel('ylabel', picker=True, bbox=dict(facecolor='red'))
83-
line, = ax1.plot(rand(100), 'o', picker=5) # 5 points tolerance
78+
line, = ax1.plot(rand(100), 'o', picker=True, pickradius=5)
8479

8580
# pick the rectangle
8681
ax2.bar(range(10), rand(10), picker=True)

‎examples/event_handling/pick_event_demo2.py

Copy file name to clipboardExpand all lines: examples/event_handling/pick_event_demo2.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
fig, ax = plt.subplots()
1919
ax.set_title('click on point to plot time series')
20-
line, = ax.plot(xs, ys, 'o', picker=5) # 5 points tolerance
20+
line, = ax.plot(xs, ys, 'o', picker=True, pickradius=5)
2121

2222

2323
def onpick(event):

‎examples/userdemo/pgf_preamble_sgskip.py

Copy file name to clipboardExpand all lines: examples/userdemo/pgf_preamble_sgskip.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
"font.family": "serif", # use serif/main font for text elements
1313
"text.usetex": True, # use inline math for ticks
1414
"pgf.rcfonts": False, # don't setup fonts from rc parameters
15-
"pgf.preamble": [
15+
"pgf.preamble": "\n".join([
1616
"\\usepackage{units}", # load additional packages
1717
"\\usepackage{metalogo}",
1818
"\\usepackage{unicode-math}", # unicode math setup
1919
r"\setmathfont{xits-math.otf}",
2020
r"\setmainfont{DejaVu Serif}", # serif font via preamble
21-
]
21+
])
2222
})
2323

2424
plt.figure(figsize=(4.5, 2.5))

‎examples/userdemo/pgf_texsystem.py

Copy file name to clipboardExpand all lines: examples/userdemo/pgf_texsystem.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
import matplotlib.pyplot as plt
99
plt.rcParams.update({
1010
"pgf.texsystem": "pdflatex",
11-
"pgf.preamble": [
11+
"pgf.preamble": "\n".join([
1212
r"\usepackage[utf8x]{inputenc}",
1313
r"\usepackage[T1]{fontenc}",
1414
r"\usepackage{cmbright}",
15-
]
15+
]),
1616
})
1717

1818
plt.figure(figsize=(4.5, 2.5))

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.