33# %% auto 0
44__all__ = ['plot' ]
55
6- # %% ../nbs/02_repr_plt.ipynb 3
6+ # %% ../nbs/02_repr_plt.ipynb
77import math
88from typing import Union , Tuple , Any , Optional as O
99
1515from .utils import get_config , config
1616from .utils .utils import cached_property
1717
18- # %% ../nbs/02_repr_plt.ipynb 4
18+ # %% ../nbs/02_repr_plt.ipynb
1919def normal_pdf ( x :np .ndarray ,
2020 mean :Union [np .ndarray , float ] = 0. ,
2121 std :Union [np .ndarray , float ] = 1. ):
@@ -34,7 +34,7 @@ def normal_pdf( x :np.ndarray,
3434 (std * np .sqrt ((np .pi * 2 )))
3535 )
3636
37- # %% ../nbs/02_repr_plt.ipynb 6
37+ # %% ../nbs/02_repr_plt.ipynb
3838def sample ( x :np .ndarray ,
3939 max_s :int ,
4040 plt0 :bool ):
@@ -60,7 +60,7 @@ def sample( x :np.ndarray,
6060
6161 return (x , x_min , x_max )
6262
63- # %% ../nbs/02_repr_plt.ipynb 7
63+ # %% ../nbs/02_repr_plt.ipynb
6464def find_xlims ( x_min :Union [float , None ],
6565 x_max :Union [float , None ],
6666 x_mean :Union [float , None ],
@@ -97,7 +97,7 @@ def find_xlims( x_min :Union[float, None],
9797
9898 return (xlim_min , xlim_max )
9999
100- # %% ../nbs/02_repr_plt.ipynb 8
100+ # %% ../nbs/02_repr_plt.ipynb
101101def plot_histogram ( x :np .ndarray ,
102102 ax :axes .Axes ):
103103 if x .size :
@@ -115,7 +115,7 @@ def plot_histogram( x :np.ndarray,
115115
116116 ax .hist (x , bins = bins , color = "deepskyblue" , align = "mid" , density = True , zorder = 4 )
117117
118- # %% ../nbs/02_repr_plt.ipynb 9
118+ # %% ../nbs/02_repr_plt.ipynb
119119def plot_pdf ( x_mean :Union [float , None ],
120120 x_std :Union [float , None ],
121121 ax :axes .Axes ):
@@ -129,7 +129,7 @@ def plot_pdf( x_mean :Union[float, None],
129129 ax .plot (xl , normal_pdf (xl , mean = x_mean , std = x_std ), zorder = 5 )
130130
131131
132- # %% ../nbs/02_repr_plt.ipynb 10
132+ # %% ../nbs/02_repr_plt.ipynb
133133def plot_sigmas (x_min :Union [float , None ],
134134 x_max :Union [float , None ],
135135 x_mean :Union [float , None ],
@@ -152,7 +152,7 @@ def plot_sigmas(x_min :Union[float, None],
152152 ax .text (x_pos , ylims [1 ]* 0.95 , greek , ha = "center" , va = "top" , bbox = bbox , zorder = 5 , weight = weight )
153153
154154
155- # %% ../nbs/02_repr_plt.ipynb 11
155+ # %% ../nbs/02_repr_plt.ipynb
156156def plot_minmax (x_min :Union [float , None ],
157157 x_max :Union [float , None ],
158158 ax :axes .Axes ):
@@ -185,13 +185,13 @@ def plot_minmax(x_min :Union[float, None],
185185 ax .axvline (x_max , 0 , 1 , c = "red" , zorder = 2 )
186186
187187
188- # %% ../nbs/02_repr_plt.ipynb 12
188+ # %% ../nbs/02_repr_plt.ipynb
189189def plot_str (t_str , ax ):
190190 xlim = ax .get_xlim ()
191191 ylim = ax .get_ylim ()
192192 ax .text (xlim [0 ], ylim [1 ]* 1.05 , s = t_str )
193193
194- # %% ../nbs/02_repr_plt.ipynb 13
194+ # %% ../nbs/02_repr_plt.ipynb
195195@config (show_mem_above = np .inf )
196196def fig_plot ( x :np .ndarray , #
197197 center :str = "zero" , # Center plot on `zero`, `mean`, or `range`
@@ -248,7 +248,7 @@ def fig_plot( x :np.ndarray, #
248248 return ax .figure
249249
250250
251- # %% ../nbs/02_repr_plt.ipynb 14
251+ # %% ../nbs/02_repr_plt.ipynb
252252# This is here for the monkey-patched tensor use case.
253253# Gives the ability to call both .plt and .plt(ax=ax).
254254
@@ -295,7 +295,7 @@ def _repr_svg_(self):
295295 svg_repr = print_figure (self .fig , fmt = "svg" , metadata = metadata )
296296 return svg_repr
297297
298- # %% ../nbs/02_repr_plt.ipynb 15
298+ # %% ../nbs/02_repr_plt.ipynb
299299def plot ( x :np .ndarray , # Your data
300300 center :str = "zero" , # Center plot on `zero`, `mean`, or `range`
301301 max_s :int = 10000 , # Draw up to this many samples. =0 to draw all
0 commit comments