Thanks to visit codestin.com
Credit goes to github.com

Skip to content

PGF Backend: "Dimension too large" error while processing log-scale plot #4482

Closed
@rwirth

Description

@rwirth

The PGF backend of MPL 1.4.3 causes a "Dimension too large" LaTeX error when processing a log-scale plot with a point at zero. The error is

[...]
! Dimension too large.
<to be read again> 
                   \pgf@y 
l.69 ...\pgfqpoint{-2148537.332542in}{0.600000in}}
                                                  %
No pages of output.
Transcript written on figure.log.

Obviously, the x coordinate of the point is way out of bounds. The script triggering the error is

import matplotlib as mpl
mpl.use('pgf')
import matplotlib.pyplot as plt

fig, ax = plt.subplots()
ax.plot([0, 1], [.5, 1])
ax.set_xscale('log')
fig.savefig('fig.pdf')

Adding nonposx='mask' to the call to set_xscale prevents the error but produces a plot consisting of only a single point. The PGF version installed is 2.10 but the error also occurs with PGF 3.00.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions