MajorXLocator

class pysmithchart.locators.MajorXLocator(axes, n, precision=None)[source]

Bases: Locator

A locator for the real (resistance/X) axis on the Smith chart.

axes

The parent Smith chart axes to which this locator applies.

Type:

SmithAxes

steps

The maximum number of divisions for the real axis.

Type:

int

precision

The maximum number of significant decimals for tick rounding.

Type:

int

ticks

The calculated tick positions.

Type:

list

Methods Summary

__call__()

Compute or return cached tick values.

invert(x)

Apply the inverse Möbius transformation to a value.

nice_round(num[, down])

Round a number to a nicely rounded value based on precision.

out_of_range(x)

Check if a value is outside the valid range for the real axis.

tick_values(vmin, vmax)

Compute the tick values for the real axis.

transform(x)

Apply the Möbius transformation to a value.

Methods Documentation

__call__()[source]

Compute or return cached tick values.

invert(x)[source]

Apply the inverse Möbius transformation to a value.

nice_round(num, down=True)[source]

Round a number to a nicely rounded value based on precision.

The rounding behavior adapts dynamically to ensure ticks are visually consistent across different scales.

Parameters:
  • num (float) – The number to round.

  • down (bool, optional) – Whether to round down. Defaults to True.

Returns: A nicely rounded value.

out_of_range(x)[source]

Check if a value is outside the valid range for the real axis.

tick_values(vmin, vmax)[source]

Compute the tick values for the real axis.

Includes the center value as a mandatory tick and dynamically adjusts spacing to ensure evenly distributed ticks.

Parameters:
  • vmin (float) – The minimum value of the axis.

  • vmax (float) – The maximum value of the axis.

Returns: he computed tick values for the real axis.

transform(x)[source]

Apply the Möbius transformation to a value.