Skip to content

trouble with log scales and clean_figure #437

@bjuergens

Description

@bjuergens

clean_figure() seems to break when using log-scales.

import matplotlib.pyplot as plt
import tikzplotlib

fig, axes = plt.subplots(1)
ax = axes
ax.plot(range(1,100), range(1,100))
ax.set_yscale('log')
tikzplotlib.clean_figure()
fig.show()

output (console):

/home/name/.venv/neuro/lib/python3.8/site-packages/tikzplotlib/_cleanfigure.py:613: RuntimeWarning: divide by zero encountered in log10
  yData = np.log10(yData)
/home/name/.venv/neuro/lib/python3.8/site-packages/tikzplotlib/_cleanfigure.py:1001: RuntimeWarning: invalid value encountered in true_divide
  v = v / np.linalg.norm(v)

output (image): https://i.imgur.com/n6S42ly.png

when I comment out the line tikzplotlib.clean_figure(), don't get any console output (as expected) and the axes are scaled correctly: https://i.imgur.com/EAsrGqM.png

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions