Skip to content

Deleted "Our Favorite Recipes" section and moved the examples. #18323

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 1 commit into from
Aug 24, 2020
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
4 changes: 2 additions & 2 deletions examples/axisartist/demo_axisline_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

Note: The `mpl_toolkits.axisartist` axes classes may be confusing for new
users. If the only aim is to obtain arrow heads at the ends of the axes,
rather check out the :doc:`/gallery/recipes/centered_spines_with_arrows`
example.
rather check out the
:doc:`/gallery/ticks_and_spines/centered_spines_with_arrows` example.
"""

from mpl_toolkits.axisartist.axislines import SubplotZero
Expand Down
8 changes: 0 additions & 8 deletions examples/recipes/README.txt

This file was deleted.

73 changes: 0 additions & 73 deletions examples/recipes/common_date_problems.py

This file was deleted.

27 changes: 16 additions & 11 deletions examples/text_labels_and_annotations/date.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@
provides the converter functions `.date2num` and `.num2date`, which convert
`datetime.datetime` and `numpy.datetime64` objects to and from Matplotlib's
internal representation.

An alternative way of displaying dates can be seen at
:doc:`/gallery/ticks_and_spines/date_concise_formatter`.
"""

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.cbook as cbook

years = mdates.YearLocator() # every year
months = mdates.MonthLocator() # every month
years_fmt = mdates.DateFormatter('%Y')

# Load a numpy structured array from yahoo csv data with fields date, open,
# close, volume, adj_close from the mpl-data/example directory. This array
# stores the date as an np.datetime64 with a day unit ('D') in the 'date'
Expand All @@ -34,18 +33,24 @@
fig, ax = plt.subplots()
ax.plot('date', 'adj_close', data=data)

# format the ticks
ax.xaxis.set_major_locator(years)
ax.xaxis.set_major_formatter(years_fmt)
ax.xaxis.set_minor_locator(months)
# Major ticks every 6 months
fmt_half_year = mdates.MonthLocator(interval=6)
ax.xaxis.set_major_locator(fmt_half_year)

# Minor ticks every month
fmt_month = mdates.MonthLocator()
ax.xaxis.set_minor_locator(fmt_month)

# Text in the x axis will be displayed in 'YYYY-mm' format
ax.xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m'))

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

# format the coords message box
ax.format_xdata = mdates.DateFormatter('%Y-%m-%d')
# Format the coords message box
ax.format_xdata = mdates.DateFormatter('%Y-%m')
Copy link
Member

Choose a reason for hiding this comment

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

Often when you are dragging the cursor around, you want to know exactly where something is. So why drop the day here?

Copy link
Member

Choose a reason for hiding this comment

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

I'll merge despite this - its not that important

ax.format_ydata = lambda x: '$%1.2f' % x # format the price.
ax.grid(True)

Expand Down
2 changes: 1 addition & 1 deletion examples/ticks_and_spines/spine_placement_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Adjusting the location and appearance of axis spines.

Note: If you want to obtain arrow heads at the ends of the axes, also check
out the :doc:`/gallery/recipes/centered_spines_with_arrows` example.
out the :doc:`/gallery/ticks_and_spines/centered_spines_with_arrows` example.
"""
import numpy as np
import matplotlib.pyplot as plt
Expand Down
2 changes: 1 addition & 1 deletion examples/widgets/textbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

Note: The `matplotlib.widgets.TextBox` widget is different from the following
static elements: :doc:`/tutorials/text/annotations` and
:doc:`/gallery/recipes/placing_text_boxes`.
:doc:`/gallery/text_labels_and_annotations/placing_text_boxes`.
"""

import numpy as np
Expand Down