You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Compatibility Issue with Pandas 3.0.0 & Matplotlib 3.10.8: ChainedAssignmentError leads to ValueError: Invalid RGBA argument: nan in plot_matrix #303
Description
When using upsetplot version 0.9.0 with Pandas 3.0.0 and Matplotlib 3.10.8, the library fails during the plotting phase.
Pandas 3.0 has fully enabled Copy-on-Write (CoW) by default, and it can no longer be disabled via options (attempting to set pd.options.mode.copy_on_write = False now throws a Pandas4Warning). This causes internal styling assignments in upsetplot/plotting.py that use inplace=True on DataFrame slices to fail. Consequently, style attributes like facecolor and edgecolor remain NaN, causing Matplotlib to crash with a ValueError.
Steps to Reproduce
Running a standard UpSet plot in an environment with Pandas 3.0.0+ results in a crash because the internal styles dataframe is not updated correctly.
from upsetplot import UpSet, from_memberships
import matplotlib.pyplot as plt
import pandas as pd
# Pandas 3.0.0+ enforces Copy-on-Write
data = from_memberships([[0, 1], [1, 2]], data=[5, 10])
upset = UpSet(data)
upset.plot()
Traceback
Python
# Warning encountered when attempting workaround:
Pandas4Warning: The 'mode.copy_on_write' option is deprecated. Copy-on-Write can no longer be disabled (it is always enabled with pandas >= 3.0), and setting the option has no impact.
# The primary library error:
.../upsetplot/plotting.py:795: ChainedAssignmentError: A value is being set on a copy of a DataFrame or Series through chained assignment using an inplace method.
Such inplace method never works to update the original DataFrame or Series...
styles["linewidth"].fillna(1, inplace=True)
---------------------------------------------------------------------------
ValueError: Invalid RGBA argument: nan
File .../upsetplot/plotting.py:1098, in UpSet.plot(self, fig)
-> 1098 self.plot_matrix(matrix_ax)
File .../upsetplot/plotting.py:810, in UpSet.plot_matrix(self, ax)
--> 810 ax.scatter(
811 *self._swapaxes(x, y),
812 **styles.rename(columns=style_columns),
813 )
File .../matplotlib/colors.py:401, in _to_rgba_no_colorcycle(c, alpha)
--> 401 raise ValueError(f"Invalid RGBA argument: {orig_c!r}")
ValueError: Invalid RGBA argument: nan
Actual Behavior
In upsetplot/plotting.py, lines 795–798 attempt to fill missing style values:
Under Pandas 3.0.0 CoW rules, these inplace=True operations on a slice fail to update the styles dataframe. Matplotlib 3.10.8 then receives NaN values for colors/widths and raises a ValueError.
Thanks a lot for your help and for developing this package
Reacted by Hervé Ménager, DaRealNim, Parker Hicks, jaro-slamecka, Thibaut Aulagnon, Dmitry Solovey, limenode, Mateus Bernabe Fiamenghi, Julia Sulyaeva, kmuenchrx and 8 more
That example code gives me this error with pandas 3.0.3, numpy 2.4.6, and UpSetPlot 0.9.0:
Traceback (most recent call last):
File "acode.py", line 6, in <module>
data = from_memberships([[0, 1], [1, 2]], data=[5, 10])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "[..]/site-packages/upsetplot/data.py", line 299, in from_memberships
raise ValueError("Category names should be strings")
Activity
StrohD commentedon Feb 12, 2026
Just replace lines 795-798 with the following, then it works again:
styles["linewidth"] = styles["linewidth"].fillna(1)
styles["facecolor"] = styles["facecolor"].fillna(self._facecolor)
styles["edgecolor"] = styles["edgecolor"].fillna(styles["facecolor"])
styles["linestyle"] = styles["linestyle"].fillna("solid")
Fix chained assignment error
hugobuddel commentedon Jul 12, 2026
That example code gives me this error with pandas 3.0.3, numpy 2.4.6, and UpSetPlot 0.9.0:
Update plotting.py
Fix missing_upset() on pandas 3 (#30)