()
| 71 | |
| 72 | |
| 73 | def create_figure(): |
| 74 | plt.figure() |
| 75 | x = np.linspace(0, 1, 15) |
| 76 | |
| 77 | # line plot |
| 78 | plt.plot(x, x ** 2, "b-") |
| 79 | |
| 80 | # marker |
| 81 | plt.plot(x, 1 - x**2, "g>") |
| 82 | |
| 83 | # filled paths and patterns |
| 84 | plt.fill_between([0., .4], [.4, 0.], hatch='//', facecolor="lightgray", |
| 85 | edgecolor="red") |
| 86 | plt.fill([3, 3, .8, .8, 3], [2, -2, -2, 0, 2], "b") |
| 87 | |
| 88 | # text and typesetting |
| 89 | plt.plot([0.9], [0.5], "ro", markersize=3) |
| 90 | plt.text(0.9, 0.5, 'unicode (ü, °, \N{Section Sign}) and math ($\\mu_i = x_i^2$)', |
| 91 | ha='right', fontsize=20) |
| 92 | plt.ylabel('sans-serif, blue, $\\frac{\\sqrt{x}}{y^2}$..', |
| 93 | family='sans-serif', color='blue') |
| 94 | plt.text(1, 1, 'should be clipped as default clip_box is Axes bbox', |
| 95 | fontsize=20, clip_on=True) |
| 96 | |
| 97 | plt.xlim(0, 1) |
| 98 | plt.ylim(0, 1) |
| 99 | |
| 100 | |
| 101 | # test compiling a figure to pdf with xelatex |
no test coverage detected
searching dependent graphs…