Bug summary
When passing a NumPy array to ax.set_xticks(), Matplotlib retains a reference to the array instead of creating a copy. Any in-place modifications made to the array after calling set_xticks() directly mutate the plot's tick locations. Passing a standard Python list does not exhibit this issue, suggesting Matplotlib should create an explicit copy of array input internally.
Code for reproduction
import numpy as np
import matplotlib.pyplot as plt
attributes = ['Speed', 'Reliability', 'Comfort', 'Safety', 'Efficiency']
fig = plt.figure()
ax1 = fig.add_subplot(2, 1, 1, projection='polar')
theta = np.linspace(0, 2*np.pi, 5, endpoint=False)
# theta = np.linspace(0, 2*np.pi, 5, endpoint=False).tolist() # this works
ax1.set_xticks(theta)
ax1.set_xticklabels(attributes)
for i in range(5): theta[i] += np.pi * 2
Actual outcome
Expected outcome
Additional information
No response
Operating system
No response
Matplotlib Version
0.2.0.dev55193+unknown.g2153774ae
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
None
Bug summary
When passing a NumPy array to ax.set_xticks(), Matplotlib retains a reference to the array instead of creating a copy. Any in-place modifications made to the array after calling set_xticks() directly mutate the plot's tick locations. Passing a standard Python list does not exhibit this issue, suggesting Matplotlib should create an explicit copy of array input internally.
Code for reproduction
Actual outcome
Expected outcome
Additional information
No response
Operating system
No response
Matplotlib Version
0.2.0.dev55193+unknown.g2153774ae
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
None