|
3 | 3 | """
|
4 | 4 |
|
5 | 5 | import functools
|
6 |
| -import numpy |
7 |
| -from matplotlib import pyplot |
| 6 | +import numpy as np |
| 7 | +from matplotlib import pyplot as plt |
8 | 8 |
|
9 | 9 | from .helpers import unzip, normalize, simplex_iterator, permute_point, project_point
|
10 | 10 | from .colormapping import get_cmap, colormapper, colorbar_hack
|
@@ -85,13 +85,13 @@ def generate_hexagon_deltas():
|
85 | 85 | hexagon points for the hexagonal heatmap.
|
86 | 86 | """
|
87 | 87 |
|
88 |
| - zero = numpy.array([0, 0, 0]) |
89 |
| - alpha = numpy.array([-1./3, 2./3, 0]) |
90 |
| - deltaup = numpy.array([1./3, 1./3, 0]) |
91 |
| - deltadown = numpy.array([2./3, -1./3, 0]) |
92 |
| - i_vec = numpy.array([0, 1./2, -1./2]) |
93 |
| - i_vec_down = numpy.array([1./2, -1./2, 0]) |
94 |
| - deltaX_vec = numpy.array([1./2, 0, -1./2]) |
| 88 | + zero = np.array([0, 0, 0]) |
| 89 | + alpha = np.array([-1./3, 2./3, 0]) |
| 90 | + deltaup = np.array([1./3, 1./3, 0]) |
| 91 | + deltadown = np.array([2./3, -1./3, 0]) |
| 92 | + i_vec = np.array([0, 1./2, -1./2]) |
| 93 | + i_vec_down = np.array([1./2, -1./2, 0]) |
| 94 | + deltaX_vec = np.array([1./2, 0, -1./2]) |
95 | 95 |
|
96 | 96 | d = dict()
|
97 | 97 | # Corner Points
|
@@ -131,8 +131,8 @@ def hexagon_coordinates(i, j, k):
|
131 | 131 | else:
|
132 | 132 | signature += "1"
|
133 | 133 | deltas = hexagon_deltas[signature]
|
134 |
| - center = numpy.array([i, j, k]) |
135 |
| - return numpy.array([center + x for x in deltas]) |
| 134 | + center = np.array([i, j, k]) |
| 135 | + return np.array([center + x for x in deltas]) |
136 | 136 |
|
137 | 137 |
|
138 | 138 | ## Heatmaps ##
|
@@ -228,12 +228,12 @@ def heatmap(data, scale, vmin=None, vmax=None, cmap=None, ax=None,
|
228 | 228 | """
|
229 | 229 |
|
230 | 230 | if not ax:
|
231 |
| - fig, ax = pyplot.subplots() |
| 231 | + fig, ax = plt.subplots() |
232 | 232 | # If use_rgba, make the RGBA values numpy arrays so that they can
|
233 | 233 | # be averaged.
|
234 | 234 | if use_rgba:
|
235 | 235 | for k, v in data.items():
|
236 |
| - data[k] = numpy.array(v) |
| 236 | + data[k] = np.array(v) |
237 | 237 | else:
|
238 | 238 | cmap = get_cmap(cmap)
|
239 | 239 | if vmin is None:
|
@@ -395,7 +395,7 @@ def svg_heatmap(data, scale, filename, vmax=None, vmin=None, style='h',
|
395 | 395 | if vmax is None:
|
396 | 396 | vmax = max(data.values())
|
397 | 397 |
|
398 |
| - height = scale * numpy.sqrt(3) / 2 + 2 |
| 398 | + height = scale * np.sqrt(3) / 2 + 2 |
399 | 399 |
|
400 | 400 | output_file = open(filename, 'w')
|
401 | 401 | output_file.write('<svg height="%s" width="%s">\n' % (height, scale))
|
|
0 commit comments