Skip to content

list_plot plots y-values on x-axis when a value is None #29960

Closed
@rburing

Description

The error handling in list_plot is dubious, with the following incredible side effect:

list_plot([(0,-1),(1,-2),(2,-3),(3,-4),(4,None)])

What happens is that list_plot eventually calls point which raises a TypeError due to the None, and then list_plot assumes that it was because the input consists of complex numbers (which is not the reason), and further it assumes that the input data has already been replaced by list(enumerate(data)) by the previous code (which isn't the case), so it takes the second entry of each pair and converts it into an element of CC and plots that. Hence the y-values are plotted on the x-axis. (And the None is converted to 0.)

Component: graphics

Keywords: list_plot, None

Issue created by migration from https://trac.sagemath.org/ticket/29960

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions