8000 If division by zero, python cannot convert float infinity to integer in `get_tick_space()` · Issue #8136 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

If division by zero, python cannot convert float infinity to integer in get_tick_space() #8136

@LinShanify

Description

@LinShanify
    def get_tick_space(self):
        ends = self.axes.transAxes.transform([[0, 0], [1, 0]])
        length = ((ends[1][0] - ends[0][0]) / self.axes.figure.dpi) * 72.0
        tick = self._get_tick(True)
        # There is a heuristic here that the aspect ratio of tick text
        # is no more than 3:1
        size = tick.label1.get_size() * 3

        return int(np.floor(length / size))

In the last line: if size is zero, python cannot convert float infinity to integer

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0