Matplotlib error: MatplotlibDeprecationWarning: Adding an axes using the same arguments…
matpltlib error:
MatplotlibDeprecationWarning: Adding an axes using the same arguments as a previous axes currently reuses the earlier instance. In a future version, a new instance will always be created and returned. Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.
self.axes = self.fig.add_subplot(111) # Create a subgraph
The reason is to add subgraphs repeatedly, for example, self.axes = self.fig.add has been used_ Subplot (111)
adds a subgraph, and then adds it repeatedly to report an error.
Solution:
Delete the subgraph of figure and add it again. Clear() is the method of figure class. Examples (the following are all examples in the class)
self.fig = plt.figure()
self.axes = self.fig.add_subplot(111) # Create a subgraph
self.fig.clear() # Clear the subplot first
self.axes = self.fig.add_subplot(111) # Create a subplot
Read More:
- import matplotlib.pyplot as plt [How to Solve]
- Matplotlib draw error: Fail to allocate bitmap [How to Solve]
- [Solved] Python matplotlib Error: RuntimeError: In set_size: Could not set the fontsize…
- [Solved] main.py: error: the following arguments are required:
- [Solved] matplotlib.units.ConversionError: Failed to convert value(s) to axis units: ‘LiR‘
- [Solved] Error: [email protected]: wrong number of arguments (given 1, expected 0)
- [Solved] Matplotlib scatter Draw Error: TypeError: ufunc ‘sqrt‘ not supported for the input types…rule ‘‘safe‘‘
- Python TypeError: not all arguments converted during string formatting [Solved]
- [Solved] Error: unrecognized arguments: — no site packages
- [Solved] TypeError: not all arguments converted during string formatting
- Python ValueError: only 2 non-keyword arguments accepted
- [Solved] error: unrecognized arguments: –multiprocessing-fork
- [Solved] train.py: error: the following arguments are required: –XXXX
- [Solved] Unable to find “…\setuptools-40.8.0-py3.7.egg\EGG-INFO“ when adding binary and data files
- Tensor for argument #2 ‘mat1‘ is on CPU, but expected it to be on GPU (while checking arguments for
- [Solved] error: the following arguments are required (Default parameters are set)
- [Solved] pytest error: error: unrecognized arguments
- When sending an email, an error was reported: AttributeError:’list’ object has no attribute’encode’
- Python errors: valueerror: if using all scalar values, you must pass an index (four solutions)
- Pandas Error: ValueError: setting an array element with a sequence.