質問編集履歴

1

エラー分を書き足しました

2017/11/24 06:15

投稿

ruuruusann24
ruuruusann24

スコア16

test CHANGED
File without changes
test CHANGED
@@ -4,10 +4,124 @@
4
4
 
5
5
  なにか良い方法はありますでしょうか
6
6
 
7
+ 以下エラーです
8
+
9
+ --------------------------------------------
10
+
11
+ RuntimeError Traceback (most recent call last)
12
+
13
+ <ipython-input-62-670a63d7ce7e> in <module>()
14
+
15
+ ----> 1 show_volonoi_with_metrics(dist.euclidean)
16
+
17
+
18
+
19
+ <ipython-input-61-e1fd4304de1a> in show_volonoi_with_metrics(metrics)
20
+
21
+ 15 xs = map(lambda p: p[0], cluster_points)
22
+
23
+ 16 ys = map(lambda p: p[1], cluster_points)
24
+
25
+ ---> 17 ax.scatter(xs, ys, color=cm.prism(i / float(len(c_means))), marker='.')
26
+
27
+ 18
28
+
29
+ 19 ax.scatter(map(lambda p: p[0], c_means), map(lambda p: p[1], c_means), color="g", marker='o')
30
+
31
+
32
+
33
+ ~/anaconda3/envs/styletrans/lib/python3.6/site-packages/matplotlib/__init__.py in inner(ax, *args, **kwargs)
34
+
35
+ 1708 warnings.warn(msg % (label_namer, func.__name__),
36
+
37
+ 1709 RuntimeWarning, stacklevel=2)
38
+
39
+ -> 1710 return func(ax, *args, **kwargs)
40
+
41
+ 1711 pre_doc = inner.__doc__
42
+
43
+ 1712 if pre_doc is None:
44
+
45
+
46
+
47
+ ~/anaconda3/envs/styletrans/lib/python3.6/site-packages/matplotlib/axes/_axes.py in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, **kwargs)
48
+
49
+ 4007 edgecolors = 'face'
50
+
51
+ 4008
52
+
53
+ -> 4009 self._process_unit_info(xdata=x, ydata=y, kwargs=kwargs)
54
+
55
+ 4010 x = self.convert_xunits(x)
56
+
57
+ 4011 y = self.convert_yunits(y)
58
+
59
+
60
+
61
+ ~/anaconda3/envs/styletrans/lib/python3.6/site-packages/matplotlib/axes/_base.py in _process_unit_info(self, xdata, ydata, kwargs)
62
+
63
+ 1967 # we only need to update if there is nothing set yet.
64
+
65
+ 1968 if not self.xaxis.have_units():
66
+
67
+ -> 1969 self.xaxis.update_units(xdata)
68
+
69
+ 1970
70
+
71
+ 1971 if ydata is not None:
72
+
73
+
74
+
75
+ ~/anaconda3/envs/styletrans/lib/python3.6/site-packages/matplotlib/axis.py in update_units(self, data)
76
+
77
+ 1430 """
78
+
79
+ 1431
80
+
81
+ -> 1432 converter = munits.registry.get_converter(data)
82
+
83
+ 1433 if converter is None:
84
+
85
+ 1434 return False
86
+
87
+
88
+
89
+ ~/anaconda3/envs/styletrans/lib/python3.6/site-packages/matplotlib/units.py in get_converter(self, x)
90
+
91
+ 160 if converter is None:
92
+
93
+ 161 try:
94
+
95
+ --> 162 thisx = safe_first_element(x)
96
+
97
+ 163 except (TypeError, StopIteration):
98
+
99
+ 164 pass
100
+
101
+
102
+
103
+ ~/anaconda3/envs/styletrans/lib/python3.6/site-packages/matplotlib/cbook/__init__.py in safe_first_element(obj)
104
+
105
+ 2310 except TypeError:
106
+
107
+ 2311 pass
108
+
109
+ -> 2312 raise RuntimeError("matplotlib does not support generators "
110
+
111
+ 2313 "as input")
112
+
113
+ 2314 return next(iter(obj))
114
+
115
+
116
+
7
117
  RuntimeError: matplotlib does not support generators as input
8
118
 
9
119
 
10
120
 
121
+ 以下コードです
122
+
123
+ --------------------------------------------
124
+
11
125
  import numpy as np
12
126
 
13
127
  import matplotlib.pyplot as plt