fixing the typo #1
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The code was using 6 values (-6, 6, -6, 6, -6, 6) for plt.axis(), which is only valid for 3D plots (x, y, z).
Since this is a 2D plot, it needs only 4 values:
xmin, xmax, ymin, ymax
Changed it to plt.axis((-6, 6, -6, 6)) — sets the x-axis from -6 to 6 and the y-axis from -6 to 6. The code should run without errors now.
fixing this issue
TypeError Traceback (most recent call last)
Cell In[9], line 15
13 plt.legend()
14 plt.axis('square')
---> 15 plt.axis((-6, 6, -6, 6, -6, 6 ))
16 plt.grid()
17 plt.show()
File /opt/anaconda3/lib/python3.13/site-packages/matplotlib/pyplot.py:2940, in axis(arg, emit, **kwargs)
2932 @_copy_docstring_and_deprecators(Axes.axis)
2933 def axis(
2934 arg: tuple[float, float, float, float] | bool | str | None = None,
(...)
2938 **kwargs,
2939 ) -> tuple[float, float, float, float]:
-> 2940 return gca().axis(arg, emit=emit, **kwargs)
File /opt/anaconda3/lib/python3.13/site-packages/matplotlib/axes/_base.py:2174, in _AxesBase.axis(self, arg, emit, **kwargs)
2172 if arg is not None:
2173 if len(arg) != 2len(self._axis_names):
-> 2174 raise TypeError(
2175 "The first argument to axis() must be an iterable of the form "
2176 "[{}]".format(", ".join(
2177 f"{name}min, {name}max" for name in self._axis_names)))
2178 limits = {
2179 name: arg[2i:2*(i+1)]
2180 for i, name in enumerate(self._axis_names)
2181 }
2182 else:
TypeError: The first argument to axis() must be an iterable of the form [xmin, xmax, ymin, ymax]