|
8 | 8 | TYPE_CHECKING,
|
9 | 9 | Sequence,
|
10 | 10 | )
|
11 |
| -import warnings |
12 | 11 |
|
13 | 12 | import numpy as np
|
14 | 13 |
|
@@ -516,17 +515,14 @@ def get_y_axis(self, ax):
|
516 | 515 | return ax._shared_axes["y"]
|
517 | 516 |
|
518 | 517 |
|
519 |
| -def _check_plot_works(f, filterwarnings="always", default_axes=False, **kwargs): |
| 518 | +def _check_plot_works(f, default_axes=False, **kwargs): |
520 | 519 | """
|
521 | 520 | Create plot and ensure that plot return object is valid.
|
522 | 521 |
|
523 | 522 | Parameters
|
524 | 523 | ----------
|
525 | 524 | f : func
|
526 | 525 | Plotting function.
|
527 |
| - filterwarnings : str |
528 |
| - Warnings filter. |
529 |
| - See https://docs.python.org/3/library/warnings.html#warning-filter |
530 | 526 | default_axes : bool, optional
|
531 | 527 | If False (default):
|
532 | 528 | - If `ax` not in `kwargs`, then create subplot(211) and plot there
|
@@ -554,24 +550,22 @@ def _check_plot_works(f, filterwarnings="always", default_axes=False, **kwargs):
|
554 | 550 | gen_plots = _gen_two_subplots
|
555 | 551 |
|
556 | 552 | ret = None
|
557 |
| - with warnings.catch_warnings(): |
558 |
| - warnings.simplefilter(filterwarnings) |
559 |
| - try: |
560 |
| - fig = kwargs.get("figure", plt.gcf()) |
561 |
| - plt.clf() |
| 553 | + try: |
| 554 | + fig = kwargs.get("figure", plt.gcf()) |
| 555 | + plt.clf() |
562 | 556 |
|
563 |
| - for ret in gen_plots(f, fig, **kwargs): |
564 |
| - tm.assert_is_valid_plot_return_object(ret) |
| 557 | + for ret in gen_plots(f, fig, **kwargs): |
| 558 | + tm.assert_is_valid_plot_return_object(ret) |
565 | 559 |
|
566 |
| - with tm.ensure_clean(return_filelike=True) as path: |
567 |
| - plt.savefig(path) |
| 560 | + with tm.ensure_clean(return_filelike=True) as path: |
| 561 | + plt.savefig(path) |
568 | 562 |
|
569 |
| - except Exception as err: |
570 |
| - raise err |
571 |
| - finally: |
572 |
| - tm.close(fig) |
| 563 | + except Exception as err: |
| 564 | + raise err |
| 565 | + finally: |
| 566 | + tm.close(fig) |
573 | 567 |
|
574 |
| - return ret |
| 568 | + return ret |
575 | 569 |
|
576 | 570 |
|
577 | 571 | def _gen_default_plot(f, fig, **kwargs):
|
|
0 commit comments