Skip to content

Commit 7730016

Browse files
authored
Merge pull request #18323 from diegopetrola/issue#18300
Deleted "Our Favorite Recipes" section and moved the examples.
2 parents e93bda7 + 5569802 commit 7730016

File tree

10 files changed

+20
-96
lines changed

10 files changed

+20
-96
lines changed

examples/axisartist/demo_axisline_style.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
88
Note: The `mpl_toolkits.axisartist` axes classes may be confusing for new
99
users. If the only aim is to obtain arrow heads at the ends of the axes,
10-
rather check out the :doc:`/gallery/recipes/centered_spines_with_arrows`
11-
example.
10+
rather check out the
11+
:doc:`/gallery/ticks_and_spines/centered_spines_with_arrows` example.
1212
"""
1313

1414
from mpl_toolkits.axisartist.axislines import SubplotZero

examples/recipes/README.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

examples/recipes/common_date_problems.py

Lines changed: 0 additions & 73 deletions
This file was deleted.

examples/text_labels_and_annotations/date.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,16 @@
1414
provides the converter functions `.date2num` and `.num2date`, which convert
1515
`datetime.datetime` and `numpy.datetime64` objects to and from Matplotlib's
1616
internal representation.
17+
18+
An alternative way of displaying dates can be seen at
19+
:doc:`/gallery/ticks_and_spines/date_concise_formatter`.
1720
"""
1821

1922
import numpy as np
2023
import matplotlib.pyplot as plt
2124
import matplotlib.dates as mdates
2225
import matplotlib.cbook as cbook
2326

24-
years = mdates.YearLocator() # every year
25-
months = mdates.MonthLocator() # every month
26-
years_fmt = mdates.DateFormatter('%Y')
27-
2827
# Load a numpy structured array from yahoo csv data with fields date, open,
2928
# close, volume, adj_close from the mpl-data/example directory. This array
3029
# stores the date as an np.datetime64 with a day unit ('D') in the 'date'
@@ -34,18 +33,24 @@
3433
fig, ax = plt.subplots()
3534
ax.plot('date', 'adj_close', data=data)
3635

37-
# format the ticks
38-
ax.xaxis.set_major_locator(years)
39-
ax.xaxis.set_major_formatter(years_fmt)
40-
ax.xaxis.set_minor_locator(months)
36+
# Major ticks every 6 months
37+
fmt_half_year = mdates.MonthLocator(interval=6)
38+
ax.xaxis.set_major_locator(fmt_half_year)
39+
40+
# Minor ticks every month
41+
fmt_month = mdates.MonthLocator()
42+
ax.xaxis.set_minor_locator(fmt_month)
43+
44+
# Text in the x axis will be displayed in 'YYYY-mm' format
45+
ax.xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m'))
4146

42-
# round to nearest years.
47+
# Round to nearest years.
4348
datemin = np.datetime64(data['date'][0], 'Y')
4449
datemax = np.datetime64(data['date'][-1], 'Y') + np.timedelta64(1, 'Y')
4550
ax.set_xlim(datemin, datemax)
4651

47-
# format the coords message box
48-
ax.format_xdata = mdates.DateFormatter('%Y-%m-%d')
52+
# Format the coords message box
53+
ax.format_xdata = mdates.DateFormatter('%Y-%m')
4954
ax.format_ydata = lambda x: '$%1.2f' % x # format the price.
5055
ax.grid(True)
5156

examples/ticks_and_spines/spine_placement_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Adjusting the location and appearance of axis spines.
77
88
Note: If you want to obtain arrow heads at the ends of the axes, also check
9-
out the :doc:`/gallery/recipes/centered_spines_with_arrows` example.
9+
out the :doc:`/gallery/ticks_and_spines/centered_spines_with_arrows` example.
1010
"""
1111
import numpy as np
1212
import matplotlib.pyplot as plt

examples/widgets/textbox.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
1111
Note: The `matplotlib.widgets.TextBox` widget is different from the following
1212
static elements: :doc:`/tutorials/text/annotations` and
13-
:doc:`/gallery/recipes/placing_text_boxes`.
13+
:doc:`/gallery/text_labels_and_annotations/placing_text_boxes`.
1414
"""
1515

1616
import numpy as np

0 commit comments

Comments
 (0)