Skip to content

Infinite loop in pgfplots when starting and ending values of domain are equal #1326

@dlglin

Description

@dlglin

The following MWE leads to LaTeX running away when generating a hardcopy.

DOCUMENT();

loadMacros('PGstandard.pl', 'PGML.pl', 'plots.pl', 'PGcourse.pl');

$plot = Plot();

$plot->add_function('x', 'x', 2, 2);

BEGIN_PGML
>>[!!]{$plot}{400}<<
END_PGML

ENDDOCUMENT();

I have attached a copy of the .tex file that this generates to produce the graph. LaTeX reports "TeX capacity exceeded" on line 76. It looks like the domain=2:2 option is causing an infinite loop.

This appears to be a bug in pgfplots if the domain starts and ends at the same point. Should we be protecting against this?

A related note: both JSXGraph and pgfplots are okay with the domain being expressed in the wrong order (i.e. $plot->add_function('x','x',2,1); draws the graph from 1 to 2. Is there any reason to try and prevent this?

BTW this arose as I was updating code from an old OPL problem (Library/ASU-topics/setLimitConcepts/3-2-36.pg) where they used this construct to draw a solid circle by plotting a function that started and ended at the same point.

pgfplots.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions