We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 592c123 commit 0f70a22Copy full SHA for 0f70a22
lib/matplotlib/colors.py
@@ -3097,8 +3097,22 @@ def rgb_to_hsv(arr):
3097
dtype=np.promote_types(arr.dtype, np.float32), # Don't work on ints.
3098
ndmin=2, # In case input was 1D.
3099
)
3100
+
3101
out = np.zeros_like(arr)
3102
arr_max = arr.max(-1)
3103
+ # Check if input is in the expected range
3104
+ if np.any(arr_max > 1):
3105
+ raise ValueError(
3106
+ "Input array must be in the range [0, 1]. "
3107
+ f"Found a maximum value of {arr_max.max()}"
3108
+ )
3109
3110
+ if arr.min() < 0:
3111
3112
3113
+ f"Found a minimum value of {arr.min()}"
3114
3115
3116
ipos = arr_max > 0
3117
delta = np.ptp(arr, -1)
3118
s = np.zeros_like(delta)
0 commit comments