|
16 | 16 | """
|
17 | 17 | import numpy as np
|
18 | 18 | import matplotlib.pyplot as plt
|
19 |
| -from matplotlib.transforms import blended_transform_factory |
20 | 19 |
|
21 | 20 | linestyle_str = [
|
22 |
| - ('solid', 'solid'), # Same as (0, ()) or '-' |
| 21 | + ('solid', 'solid'), # Same as (0, ()) or '-' |
23 | 22 | ('dotted', 'dotted'), # Same as (0, (1, 1)) or '.'
|
24 | 23 | ('dashed', 'dashed'), # Same as '--'
|
25 | 24 | ('dashdot', 'dashdot')] # Same as '-.'
|
@@ -55,11 +54,11 @@ def plot_linestyles(ax, linestyles):
|
55 | 54 |
|
56 | 55 | # For each line style, add a text annotation with a small offset from
|
57 | 56 | # the reference point (0 in Axes coords, y tick value in Data coords).
|
58 |
| - reference_transform = blended_transform_factory(ax.transAxes, ax.transData) |
59 | 57 | for i, (name, linestyle) in enumerate(linestyles):
|
60 |
| - ax.annotate(repr(linestyle), xy=(0.0, i), xycoords=reference_transform, |
61 |
| - xytext=(-6, -12), textcoords='offset points', color="blue", |
62 |
| - fontsize=8, ha="right", family="monospace") |
| 58 | + ax.annotate(repr(linestyle), |
| 59 | + xy=(0.0, i), xycoords=ax.get_yaxis_transform(), |
| 60 | + xytext=(-6, -12), textcoords='offset points', |
| 61 | + color="blue", fontsize=8, ha="right", family="monospace") |
63 | 62 |
|
64 | 63 |
|
65 | 64 | fig, (ax0, ax1) = plt.subplots(2, 1, gridspec_kw={'height_ratios': [1, 3]},
|
|
0 commit comments