@@ -254,7 +254,7 @@ def my_plotter(ax, data1, data2, param_dict):
254
254
#
255
255
# Line widths are typically in typographic points (1 pt = 1/72 inch) and
256
256
# available for artists that have stroked lines. Similarly, stroked lines
257
- # can have a linestyle. See the `linestyles example
257
+ # can have a linestyle. See the :doc: `linestyles example
258
258
# </gallery/lines_bars_and_markers/linestyles>`.
259
259
#
260
260
# Marker size depends on the method being used. `~.Axes.plot` specifies
@@ -266,10 +266,13 @@ def my_plotter(ax, data1, data2, param_dict):
266
266
# Labelling plots
267
267
# ===============
268
268
#
269
- # `~.Axes.text` can be used to add text in an arbitrary location, and
269
+ # Axes labels and text
270
+ # --------------------
271
+ #
270
272
# `~.Axes.set_xlabel`, `~.Axes.set_ylabel` and `~.Axes.set_title` are used to
271
273
# add text in the indicated locations (see :doc:`/tutorials/text/text_intro` for
272
- # more discussion)
274
+ # more discussion). Text can also be directly added to plots using
275
+ # `~.Axes.text`:
273
276
274
277
mu , sigma = 100 , 15
275
278
x = mu + sigma * np .random .randn (10000 )
@@ -354,7 +357,7 @@ def my_plotter(ax, data1, data2, param_dict):
354
357
# Axis scales and ticks
355
358
# =====================
356
359
#
357
- # Each Axes has two (or three) `~.Axis` objects represnting the x- and y-axis.
360
+ # Each Axes has two (or three) `~.axis. Axis` objects represnting the x- and y-axis.
358
361
# These control the *scale* of the axis, the tick *Locators* and the tick
359
362
# *Formatters*.
360
363
#
@@ -365,7 +368,7 @@ def my_plotter(ax, data1, data2, param_dict):
365
368
# such as a log-scale. Since log-scales are used so much there are also
366
369
# direct methods like `~.Axes.loglog`, `~.Axes.semilogx`, and
367
370
# `~.Axes.semilogy`. There are a number of scales (see
368
- # :doc:`/gallery/scales/` for other examples). Here we set the scale
371
+ # :doc:`/gallery/scales/scales ` for other examples). Here we set the scale
369
372
# manually:
370
373
371
374
fig , axs = plt .subplots (1 , 2 , figsize = (5 , 2.7 ), constrained_layout = True )
@@ -379,7 +382,7 @@ def my_plotter(ax, data1, data2, param_dict):
379
382
# The scale sets the mapping from data values to spacing along the Axis. This
380
383
# happens in both directions, and gets combined into a *transform*, which
381
384
# is the way that Matplotlib maps from data co-ordinates to Axes, Figure, or
382
- # screen co-ordinates. See doc:`/tutorials/advanced/transforms_tutorial`.
385
+ # screen co-ordinates. See : doc:`/tutorials/advanced/transforms_tutorial`.
383
386
#
384
387
# Tick locators and formatters
385
388
# ----------------------------
@@ -399,8 +402,8 @@ def my_plotter(ax, data1, data2, param_dict):
399
402
##############################################################################
400
403
# Different scales can have different locators and formatters; for instance
401
404
# the log-scale above uses `~.LogLocator` and `~.LogFormatter`. See
402
- # :doc:`/gallery/ticks_and_spines /tick-locators` and
403
- # :doc:gallery/ticks_and_spines /tick-formatters` for other formatters and
405
+ # :doc:`/gallery/ticks /tick-locators` and
406
+ # :doc:gallery/ticks /tick-formatters` for other formatters and
404
407
# locators and information for writing your own.
405
408
#
406
409
# Plotting dates and strings
@@ -409,20 +412,16 @@ def my_plotter(ax, data1, data2, param_dict):
409
412
# Matplotlib can handle plotting arrays of dates and arrays of strings as
410
413
# well as floating point numbers. These get special locators and formatters
411
414
# as appropriate. For dates:
412
- #
413
415
414
416
fig , ax = plt .subplots (figsize = (5 , 3.7 ), constrained_layout = True )
415
- dates = np .arange (np .datetime64 ('2021-11-15' ), np .datetime64 ('2021-11 -25' ),
417
+ dates = np .arange (np .datetime64 ('2021-11-15' ), np .datetime64 ('2021-12 -25' ),
416
418
np .timedelta64 (1 , 'h' ))
417
-
418
- ax .plot (dates , np .arange (len (dates )))
419
- # these tick labels will over-run each other so we turn them 45 degrees:
420
- for tick in ax .get_xticklabels ():
421
- tick .set_rotation (45 )
422
- tick .set_horizontalalignment ('right' )
419
+ data = np .cumsum (np .random .randn (len (dates )))
420
+ ax .plot (dates , data )
423
421
424
422
##############################################################################
425
- # For more information see the date examples in :doc:`/gallery/ticks/`
423
+ # For more information see the date examples
424
+ # (e.g. :doc:`/gallery/text_labels_and_annotations/date`)
426
425
#
427
426
# For strings, we get categorical plotting (see:
428
427
# :doc:`/gallery/lines_bars_and_markers/categorical_variables`).
0 commit comments