mgplot 0.3.3__py3-none-any.whl → 0.3.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
mgplot/axis_utils.py CHANGED
@@ -8,6 +8,7 @@ such as days, months, quarters, and years.
8
8
  """
9
9
 
10
10
  import calendar
11
+ import math
11
12
  from collections.abc import Callable
12
13
  from enum import Enum
13
14
  from typing import Any, Final
@@ -429,8 +430,11 @@ def refresh_period_labels(axes: Axes, max_ticks: int | None = None) -> None:
429
430
  stashed = options.get("max_ticks", DEFAULT_REFRESH_TICKS)
430
431
  max_ticks = stashed if isinstance(stashed, int) else DEFAULT_REFRESH_TICKS
431
432
  xlim = axes.get_xlim()
432
- x_min = min(stash_min, int(xlim[0]))
433
- x_max = max(stash_max, int(xlim[1]))
433
+ # round inwards: only periods inside the view get a label. A bar chart's limits sit
434
+ # half a bar beyond its end bars, and truncating them named the neighbouring period,
435
+ # whose tick set_xticks then widened the axis to show.
436
+ x_min = min(stash_min, math.ceil(xlim[0]))
437
+ x_max = max(stash_max, math.floor(xlim[1]))
434
438
 
435
439
  full_range = period_range(
436
440
  start=Period(ordinal=x_min, freq=freq),
@@ -212,11 +212,16 @@ def check_peelable(value: Any, expected: type) -> bool:
212
212
  def check_type(value: Any, expected: type) -> bool:
213
213
  """Check if a value is of the expected type and reports an error if not.
214
214
 
215
+ As in Python typing (PEP 484), an int satisfies float; a bool, though an int
216
+ subclass, does not.
217
+
215
218
  Args:
216
219
  value: The value to check.
217
220
  expected: The expected type(s).
218
221
 
219
222
  """
223
+ if expected is float and isinstance(value, int) and not isinstance(value, bool):
224
+ return True
220
225
  return expected is Any or isinstance(value, expected)
221
226
 
222
227
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: mgplot
3
- Version: 0.3.3
3
+ Version: 0.3.4
4
4
  Summary: mgplot is a time-series/PeriodIndex frontend for matplotlib
5
5
  Project-URL: Repository, https://github.com/bpalmer4/mgplot
6
6
  Project-URL: Homepage, https://github.com/bpalmer4/mgplot
@@ -1,13 +1,13 @@
1
1
  mgplot/__init__.py,sha256=9AXauCKo2XlPP-yfDQRnEXr3X9OI2A7kCe0zDcbLRn8,3305
2
2
  mgplot/annotation_utils.py,sha256=p0iju88_QGsfzttK3sn53DwF4hD3ZXiCJVkE6RENovw,20972
3
- mgplot/axis_utils.py,sha256=iJlTDplmc2uaoRHYYMxE3miCTmm6Q_ufg2BFSZce-TI,16041
3
+ mgplot/axis_utils.py,sha256=oolTlkMzsBMkfpfSR1BeCunjM4nnthBJ2sDuRD1INGg,16302
4
4
  mgplot/bar_plot.py,sha256=FobAsadYSEf-U0RZFgZutTzse4Rgr0TDFyWUMM68JVs,12513
5
5
  mgplot/colors.py,sha256=f5q4z7kORUu66uAxNeK9KAZ64gv_7h_x2qH53BvzwPw,4848
6
6
  mgplot/fill_between_plot.py,sha256=XJvtkBeOkohHyayQnu84jURapB5RsMAR-3SaskHkHfM,3361
7
7
  mgplot/finalise_plot.py,sha256=8NGi2SFAABrP1vjKpHcug8OS6jWWpHErwq1mif6qCCg,24456
8
8
  mgplot/finalisers.py,sha256=-3gSpGa4-z4JyhnrKyFyexKmYcY3u9IlHRDgsv4HqL8,11256
9
9
  mgplot/growth_plot.py,sha256=ahGvOB2hr981KvgoqeoWb7jRg6Uag91JrD6-aKMojXM,8752
10
- mgplot/keyword_checking.py,sha256=8CFexwEK_Uyv3_8hAnJ2ewk0tEjNjkwzKfX2uFw2UpM,11446
10
+ mgplot/keyword_checking.py,sha256=-XXYlrfJOTQkWxA8L_FPxCfRJvKMGR9wKUQprb9O1Hs,11657
11
11
  mgplot/line_plot.py,sha256=9_peu41ivxx3VovDJ-lzM40ld7BQQwRF7BoiZBqBJ9s,10161
12
12
  mgplot/lint-all.sh,sha256=O7ns09v0cQNQ6POWtXtYn6VdtYURHTjy06vntR8tr_U,465
13
13
  mgplot/multi_plot.py,sha256=ONEY16Lql3a7iFzLcWSVcSnoLF0RnACsAo7_yQHJINY,10730
@@ -20,7 +20,7 @@ mgplot/seastrend_plot.py,sha256=hi9t0cY0bHdIOU5abLMX7qvAp_hlVLlJFyEKNBzg6Ts,2000
20
20
  mgplot/settings.py,sha256=GxIR-CvVmUwHBhD_H0MDcG1Fxc7-bUndPn4tA5MGzn4,5581
21
21
  mgplot/summary_plot.py,sha256=Kg7VD8KFIls4KlD4jeaaXnDw51BZ3p_wMAUpjG49zGQ,11102
22
22
  mgplot/utilities.py,sha256=269tGaEt4sMqPKSr1sUXfBjN7RLvCugLwN6EjTS2uE0,8536
23
- mgplot-0.3.3.dist-info/METADATA,sha256=fH5_Eyv5zwUatIEGe3F9PqcWfyx5-t5h9RKhlxhpno0,7950
24
- mgplot-0.3.3.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
25
- mgplot-0.3.3.dist-info/licenses/LICENSE,sha256=6ZyruOwF8J7mY25-vZHdOibtY8cSNLz0vWeH59TLhtw,1082
26
- mgplot-0.3.3.dist-info/RECORD,,
23
+ mgplot-0.3.4.dist-info/METADATA,sha256=CnV_ALt9EbHX8GyXqX1t746jMqCYMlF7xts7HMs4AHc,7950
24
+ mgplot-0.3.4.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
25
+ mgplot-0.3.4.dist-info/licenses/LICENSE,sha256=6ZyruOwF8J7mY25-vZHdOibtY8cSNLz0vWeH59TLhtw,1082
26
+ mgplot-0.3.4.dist-info/RECORD,,
File without changes