|
35 | 35 | import matplotlib.axes |
36 | 36 | from mplhep.plot import Hist1DArtists, Hist2DArtists |
37 | 37 |
|
| 38 | + from .plot import FitResultArtists, MainAxisArtists, RatiolikeArtists |
| 39 | + |
38 | 40 | InnerIndexing = Union[ |
39 | 41 | SupportsIndex, str, Callable[[bh.axis.Axis], int], slice, "ellipsis" |
40 | 42 | ] |
@@ -401,20 +403,45 @@ def plot2d_full( |
401 | 403 |
|
402 | 404 | return hist.plot.plot2d_full(self, ax_dict=ax_dict, **kwargs) |
403 | 405 |
|
| 406 | + def plot_ratio( |
| 407 | + self, |
| 408 | + other: Union["hist.BaseHist", Callable[[np.ndarray], np.ndarray], str], |
| 409 | + *, |
| 410 | + ax_dict: "Optional[Dict[str, matplotlib.axes.Axes]]" = None, |
| 411 | + **kwargs: Any, |
| 412 | + ) -> "Tuple[MainAxisArtists, RatiolikeArtists]": |
| 413 | + """ |
| 414 | + ``plot_ratio`` method for ``BaseHist`` object. |
| 415 | +
|
| 416 | + Return a tuple of artists following a structure of |
| 417 | + ``(main_ax_artists, subplot_ax_artists)`` |
| 418 | + """ |
| 419 | + |
| 420 | + import hist.plot |
| 421 | + |
| 422 | + return hist.plot._plot_ratiolike( |
| 423 | + self, other, ax_dict=ax_dict, view="ratio", **kwargs |
| 424 | + ) |
| 425 | + |
404 | 426 | def plot_pull( |
405 | 427 | self, |
406 | | - func: Callable[[np.ndarray], np.ndarray], |
| 428 | + func: Union[Callable[[np.ndarray], np.ndarray], str], |
407 | 429 | *, |
408 | 430 | ax_dict: "Optional[Dict[str, matplotlib.axes.Axes]]" = None, |
409 | 431 | **kwargs: Any, |
410 | | - ) -> "Tuple[matplotlib.axes.Axes, matplotlib.axes.Axes]": |
| 432 | + ) -> "Tuple[FitResultArtists, RatiolikeArtists]": |
411 | 433 | """ |
412 | | - Plot_pull method for BaseHist object. |
| 434 | + ``plot_pull`` method for ``BaseHist`` object. |
| 435 | +
|
| 436 | + Return a tuple of artists following a structure of |
| 437 | + ``(main_ax_artists, subplot_ax_artists)`` |
413 | 438 | """ |
414 | 439 |
|
415 | 440 | import hist.plot |
416 | 441 |
|
417 | | - return hist.plot.plot_pull(self, func, ax_dict=ax_dict, **kwargs) |
| 442 | + return hist.plot._plot_ratiolike( |
| 443 | + self, func, ax_dict=ax_dict, view="pull", **kwargs |
| 444 | + ) |
418 | 445 |
|
419 | 446 | def plot_pie( |
420 | 447 | self, |
|
0 commit comments