RealFormatter

class pysmithchart.formatters.RealFormatter(axes, *args, **kwargs)[source]

Bases: Formatter

Formatter for the real axis of a Smith chart.

This formatter formats tick values for the real axis by printing numbers as floats, removing trailing zeros and unnecessary decimal points. Special cases include returning an empty string ‘’ for values near zero.

Parameters:

axes (SmithAxes) – The parent SmithAxes instance associated with this formatter.

Raises:

AssertionError – If axes is not an instance of SmithAxes.

Example

>>> formatter = RealFormatter(axes)
>>> print(formatter(0.1))  # "0.1"
>>> print(formatter(0))    # ""

Methods Summary

__call__(x[, pos])

Format the given tick value.

Methods Documentation

__call__(x, pos=None)[source]

Format the given tick value.

Parameters:
  • x (float) – The tick value to format.

  • pos (int, optional) – The position of the tick value (ignored in this formatter).

Returns:

str – The formatted tick value as a string, or ‘’ for values near zero.