Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c2eb617

Browse files
committed
2d colorbar printing now
1 parent 55a7a68 commit c2eb617

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

lib/matplotlib/colorbar.py

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,8 @@ def draw_all(self):
972972
self._process_values()
973973
self._find_range()
974974
X, Y = self._mesh()
975-
C = self._values[:, np.newaxis]
975+
C = np.array(X * 256 * 256 + Y * 256, dtype='int64')
976+
# C = self._values[:, np.newaxis]
976977
self._config_axes(X, Y)
977978
if self.filled:
978979
self._add_solids(X, Y, C)
@@ -1101,21 +1102,6 @@ def set_label(self, xlabel, ylabel, **kw):
11011102
self._labelkw = kw
11021103
self._set_label()
11031104

1104-
def _outline(self, X, Y):
1105-
'''
1106-
Return *x*, *y* arrays of colorbar bounding polygon,
1107-
taking orientation into account.
1108-
'''
1109-
N = X.shape[0]
1110-
ii = [0, 1, N - 2, N - 1, 2 * N - 1, 2 * N - 2, N + 1, N, 0]
1111-
x = np.take(np.ravel(np.transpose(X)), ii)
1112-
y = np.take(np.ravel(np.transpose(Y)), ii)
1113-
x = x.reshape((len(x), 1))
1114-
y = y.reshape((len(y), 1))
1115-
# if self.orientation == 'horizontal':
1116-
# return np.hstack((y, x))
1117-
return np.hstack((x, y))
1118-
11191105
def _edges(self, X, Y):
11201106
'''
11211107
Return the separator line segments; helper for _add_solids.
@@ -1414,11 +1400,11 @@ def _mesh(self):
14141400
transposition for a horizontal colorbar are done outside
14151401
this function.
14161402
'''
1417-
x = np.array([0.0, 1.0])
14181403
if self.spacing == 'uniform':
1419-
y = self._uniform_y(self._central_N())
1404+
x = y = self._uniform_y(self._central_N())
14201405
else:
1421-
y = self._proportional_y()
1406+
x = y = self._proportional_y()
1407+
self._x = x
14221408
self._y = y
14231409
X, Y = np.meshgrid(x, y)
14241410
if self._extend_lower() and not self.extendrect:

0 commit comments

Comments
 (0)