Skip to content

[Bug]: 3D Scatterplot - Passing String as Positional Argument Results in Unexpected Behaviour #27287

@knods3k

Description

@knods3k

Bug summary

When passing the "x" as a positional argument to the scatterplot function, it unexpectedly reorders the actual input data.

Code for reproduction

import matplotlib.pyplot as plt
import numpy as np

np.random.seed(1)

x = np.random.uniform(-5, 5, 50)
y = np.random.uniform(-5, 5, 50)
z = np.random.uniform(-5, 5, 50)

ax = plt.subplot(111, projection='3d')
ax.scatter(x,y,z, "x", color="r", label="Target")
ax.scatter(x,y,z, "^", color="b", label="Target")

Actual outcome

image

Expected outcome

This should probably throw an error of some kind. Otherwise it should not result i unexpected behaviour.

image

Additional information

No response

Operating system

Mac OS 13.5

Matplotlib Version

3.8.0

Matplotlib Backend

module://matplotlib_inline.backend_inline

Python version

3.11.6

Jupyter version

7.0.6

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions