ChenFeng87 / network_inference

2 stars 1 forks source link

ValueError: 'color' kwarg must be a color or sequence of color specs. For a sequence of values to be color-mapped, use the 'c' argument instead #2

Closed gui11aume closed 2 years ago

gui11aume commented 2 years ago

When I run python monotonicity_f.py in the MISA directory after the first steps, I get the error shown below. I am using Python 3.8 and matplotlib version 3.5.2. Are they the right versions?

python monotonicity_f.py

---------- Use this part to predict the steady state ----------

--   You need to wait about 10 seconds to obtain the monotonicity of f1 and f2 with respect to X2, i.e. f1_f2_X2.png

----------   import the DNN model  ----------

----------   import DNN is finish  ----------

----------   begin calculating f1 and f2  ----------

----------   calculating f1 and f2 finish ----------

----------   begin picture ----------
Traceback (most recent call last):
  File "/home/gfilion/miniconda3/envs/temp/lib/python3.8/site-packages/matplotlib/axes/_axes.py", line 4153, in _parse_scatter_color_args
    mcolors.to_rgba_array(kwcolor)
  File "/home/gfilion/miniconda3/envs/temp/lib/python3.8/site-packages/matplotlib/colors.py", line 359, in to_rgba_array
    raise ValueError("Using a string of single character colors as "
ValueError: Using a string of single character colors as a color sequence is not supported. The colors can be passed as an explicit list instead.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "monotonicity_f.py", line 87, in <module>
    plt.scatter(tt, f1, label='$f_1$', color='', marker='o', edgecolors='#0dbc3e', s=20)  # dark green
  File "/home/gfilion/miniconda3/envs/temp/lib/python3.8/site-packages/matplotlib/pyplot.py", line 2819, in scatter
    __ret = gca().scatter(
  File "/home/gfilion/miniconda3/envs/temp/lib/python3.8/site-packages/matplotlib/__init__.py", line 1412, in inner
    return func(ax, *map(sanitize_sequence, args), **kwargs)
  File "/home/gfilion/miniconda3/envs/temp/lib/python3.8/site-packages/matplotlib/axes/_axes.py", line 4380, in scatter
    self._parse_scatter_color_args(
  File "/home/gfilion/miniconda3/envs/temp/lib/python3.8/site-packages/matplotlib/axes/_axes.py", line 4155, in _parse_scatter_color_args
    raise ValueError(
ValueError: 'color' kwarg must be a color or sequence of color specs.  For a sequence of values to be color-mapped, use the 'c' argument instead.
ChenFeng87 commented 2 years ago

This may be due to version differences in matplotlib, and we have modified the code to apply to more versions. Thank you very much for your comments.