質問編集履歴

7

情報更新

2020/03/17 07:33

投稿

raspypy
raspypy

スコア247

test CHANGED
File without changes
test CHANGED
@@ -14,47 +14,9 @@
14
14
 
15
15
 
16
16
 
17
- ![イメージ説明](7658660e1f4d31c1b97839d5b275be0f.png)
18
-
19
-
20
-
21
17
  ##センサからのデータ
22
18
 
23
- センサはアレイ型センサで、縦×横が8×8の構造です。
24
-
25
-
26
-
27
- ||0|1|2|3|4|5|6|7|
28
-
29
- |:--|:--:|--:|--:|--:|--:|--:|--:|
30
-
31
- |0|x|x|x|x|x|x|x|x|
32
-
33
- |1|x|x|x|x|x|x|x|x|
34
-
35
- |2|x|x|x|x|x|x|x|x|
36
-
37
- |3|x|x|x|x|x|x|x|x|
38
-
39
- |4|x|x|x|x|x|x|x|x|
40
-
41
- |5|x|x|x|x|x|x|x|x|
42
-
43
- |6|x|x|x|x|x|x|x|x|
44
-
45
- |7|x|x|x|x|x|x|x|x|
46
-
47
-
48
-
49
- **xの部分にデータが入ります。**
50
-
51
- **取得するデータは次の通りです。**
52
-
53
- ```text
54
-
55
- [[21.5, 21.0, 21.5, 22.0, 20.75, 21.0, 21.5, 21.0], [20.0, 20.0, 20.25, 20.5, 20.5, 20.75, 20.75, 20.75], [18.5, 19.25, 19.75, 20.0, 20.5, 22.25, 22.5, 21.0], [19.25, 19.25, 19.75, 20.75, 20.0, 22.25, 23.5, 21.25], [20.0, 19.5, 19.25, 19.75, 21.0, 22.5, 23.0, 20.75], [20.25, 19.0, 19.25, 20.25, 20.0, 22.25, 22.25, 22.5], [21.0, 19.0, 19.25, 19.5, 19.75, 20.5, 20.75, 20.75], [22.0, 18.5, 19.5, 19.25, 19.25, 19.75, 20.25, 20.5]]
56
-
57
- ```
19
+ センサはアレイ型センサです。
58
20
 
59
21
 
60
22
 
@@ -63,79 +25,3 @@
63
25
  このコードで、2次元のグラフ表示はできていますが、3次元にする方法が分かりません。
64
26
 
65
27
  教えていただけると助かります。
66
-
67
- できれば、温度データなので、z軸の値(センサからのデータ)はカラーマップにしたいです。
68
-
69
-
70
-
71
- ```python
72
-
73
- # 点を表示する (x, y) 座標を作成
74
-
75
- X, Y = np.indices(sensordata.shape)
76
-
77
-
78
-
79
- # 描画する。
80
-
81
- fig = plt.figure(figsize=(7, 7))
82
-
83
- axes = fig.add_subplot(111, projection="3d")
84
-
85
- points = axes.scatter(
86
-
87
- X.flat, Y.flat, sensordata.flat, c=sensordata.flat, cmap="jet", edgecolor="gray", s=50
88
-
89
- )
90
-
91
-
92
-
93
- # カラーバー追加 (xmin, ymin, w, h) でカラーバーを表示する位置を指定
94
-
95
- cbar_ax = fig.add_axes((0.9, 0.3, 0.02, 0.4))
96
-
97
- cbar = fig.colorbar(points, cax=cbar_ax)
98
-
99
- cbar.set_label("Temp")
100
-
101
-
102
-
103
- #軸ラベル設定
104
-
105
- axes.set_xlabel("X")
106
-
107
- axes.set_ylabel("Y")
108
-
109
-
110
-
111
- #軸目盛設定
112
-
113
- axes.set_xticks(np.arange(0, 9, 1))
114
-
115
- axes.set_yticks(np.arange(0, 9, 1))
116
-
117
- axes.set_zticks((10, 20, 30))
118
-
119
-
120
-
121
- #Title表示
122
-
123
- axes.set_title(title, fontsize=16)
124
-
125
-
126
-
127
- #余白調整
128
-
129
- plt.subplots_adjust(right=0.85)
130
-
131
- plt.subplots_adjust(wspace=0.15)
132
-
133
-
134
-
135
- # 視点
136
-
137
- axes.view_init(30, -45)
138
-
139
- ```
140
-
141
- ![イメージ説明](2e5c7a1719c9d386a6e1345da45de522.png)

6

最新の情報に更新

2020/03/17 07:33

投稿

raspypy
raspypy

スコア247

test CHANGED
File without changes
test CHANGED
@@ -70,41 +70,33 @@
70
70
 
71
71
  ```python
72
72
 
73
- # データ取得
73
+ # 点を表示する (x, y) 座標を作成
74
74
 
75
- sensordata = np.array(linedata)
76
-
77
-
78
-
79
- #X軸、Y軸データ作成
80
-
81
- # 2次元グリッド各x、yの位置にsensordataの値をyとして代入
82
-
83
- array = 8
84
-
85
- x = np.linspace(0, 7, array)
75
+ X, Y = np.indices(sensordata.shape)
86
-
87
- y = np.linspace(0, 7, array)
88
-
89
- z = np.zeros((len(x), len(y)))
90
-
91
- for i0 in range(array):
92
-
93
- for i1 in range(array):
94
-
95
- z[i1, i0] = sensordata[i0, i1]
96
-
97
-
98
76
 
99
77
 
100
78
 
101
79
  # 描画する。
102
80
 
103
- fig = plt.figure(figsize=(8, 8))
81
+ fig = plt.figure(figsize=(7, 7))
104
82
 
105
83
  axes = fig.add_subplot(111, projection="3d")
106
84
 
85
+ points = axes.scatter(
86
+
107
- im = axes.plot_surface(x, y, z, cmap="magma", edgecolor="gray")
87
+ X.flat, Y.flat, sensordata.flat, c=sensordata.flat, cmap="jet", edgecolor="gray", s=50
88
+
89
+ )
90
+
91
+
92
+
93
+ # カラーバー追加 (xmin, ymin, w, h) でカラーバーを表示する位置を指定
94
+
95
+ cbar_ax = fig.add_axes((0.9, 0.3, 0.02, 0.4))
96
+
97
+ cbar = fig.colorbar(points, cax=cbar_ax)
98
+
99
+ cbar.set_label("Temp")
108
100
 
109
101
 
110
102
 
@@ -114,29 +106,21 @@
114
106
 
115
107
  axes.set_ylabel("Y")
116
108
 
109
+
110
+
117
111
  #軸目盛設定
118
112
 
119
113
  axes.set_xticks(np.arange(0, 9, 1))
120
114
 
121
115
  axes.set_yticks(np.arange(0, 9, 1))
122
116
 
117
+ axes.set_zticks((10, 20, 30))
118
+
119
+
120
+
123
121
  #Title表示
124
122
 
125
123
  axes.set_title(title, fontsize=16)
126
-
127
-
128
-
129
- axpos = axes.get_position()
130
-
131
- #Color Bar作成
132
-
133
- #add_axes([x軸の開始位置, y軸の開始位置, x軸の長さ(全体に対する比率), y軸の長さ(全体に対する比率)])
134
-
135
- cbar_ax = fig.add_axes([0.85, axpos.y0, 0.02, axpos.height])
136
-
137
- cbar = fig.colorbar(im,cax=cbar_ax)
138
-
139
- cbar.set_label("Temp")
140
124
 
141
125
 
142
126
 
@@ -146,12 +130,12 @@
146
130
 
147
131
  plt.subplots_adjust(wspace=0.15)
148
132
 
133
+
134
+
149
135
  # 視点
150
136
 
151
137
  axes.view_init(30, -45)
152
138
 
153
- plt.savefig('/home/pi/dev/data/3D.png', format='png')
154
-
155
139
  ```
156
140
 
157
- ![イメージ説明](b2c0ed9a21391017eca4c24e1f6b203c.png)
141
+ ![イメージ説明](2e5c7a1719c9d386a6e1345da45de522.png)

5

情報を更新しました。

2020/03/10 06:51

投稿

raspypy
raspypy

スコア247

test CHANGED
File without changes
test CHANGED
@@ -52,7 +52,7 @@
52
52
 
53
53
  ```text
54
54
 
55
- [[22.25, 20.25, 21.75, 24.5, 25.0, 25.0, 25.5, 25.75], [22.25, 20.25, 21.75, 24.5, 25.0, 25.0, 25.5, 25.75], [22.25, 20.25, 21.75, 24.5, 25.0, 25.0, 25.5, 25.75], [22.25, 20.25, 21.75, 24.5, 25.0, 25.0, 25.5, 25.75], [22.25, 20.25, 21.75, 24.5, 25.0, 25.0, 25.5, 25.75], [22.25, 20.25, 21.75, 24.5, 25.0, 25.0, 25.5, 25.75], [22.25, 20.25, 21.75, 24.5, 25.0, 25.0, 25.5, 25.75], [22.25, 20.25, 21.75, 24.5, 25.0, 25.0, 25.5, 25.75]]
55
+ [[21.5, 21.0, 21.5, 22.0, 20.75, 21.0, 21.5, 21.0], [20.0, 20.0, 20.25, 20.5, 20.5, 20.75, 20.75, 20.75], [18.5, 19.25, 19.75, 20.0, 20.5, 22.25, 22.5, 21.0], [19.25, 19.25, 19.75, 20.75, 20.0, 22.25, 23.5, 21.25], [20.0, 19.5, 19.25, 19.75, 21.0, 22.5, 23.0, 20.75], [20.25, 19.0, 19.25, 20.25, 20.0, 22.25, 22.25, 22.5], [21.0, 19.0, 19.25, 19.5, 19.75, 20.5, 20.75, 20.75], [22.0, 18.5, 19.5, 19.25, 19.25, 19.75, 20.25, 20.5]]
56
56
 
57
57
  ```
58
58
 
@@ -72,344 +72,86 @@
72
72
 
73
73
  # データ取得
74
74
 
75
- sensordata = sensor.pixels
75
+ sensordata = np.array(linedata)
76
76
 
77
77
 
78
78
 
79
- # 8x8ピクセルのデータ
79
+ #X軸、Y軸データ作成
80
80
 
81
- plt.subplot(1, 2, 1)
81
+ # 2次元グリッド各x、yの位置にsensordataの値をyとして代入
82
82
 
83
- fig = plt.imshow(sensordata, cmap="inferno")
83
+ array = 8
84
84
 
85
- plt.colorbar()
85
+ x = np.linspace(0, 7, array)
86
86
 
87
- ```
87
+ y = np.linspace(0, 7, array)
88
88
 
89
+ z = np.zeros((len(x), len(y)))
89
90
 
91
+ for i0 in range(array):
90
92
 
91
- Scipyインストール時のエラー
93
+ for i1 in range(array):
92
94
 
93
- ```text
94
-
95
- pi@raspberrypi:~/dev $ pip install scipy
96
-
97
- Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
98
-
99
- Collecting scipy
100
-
101
- Downloading https://files.pythonhosted.org/packages/62/4f/7e95c5000c411164d5ca6f55ac54cda5d200a3b6719dafd215ee0bd61578/scipy-1.2.3.tar.gz (23.3MB)
102
-
103
- 100% |????????????????????????????????| 23.3MB 9.0kB/s
104
-
105
- Building wheels for collected packages: scipy
106
-
107
- Running setup.py bdist_wheel for scipy ... error
108
-
109
- Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-FqXt9K/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-DRoX0Z --python-tag cp27:
110
-
111
- Running from scipy source directory.
112
-
113
- lapack_opt_info:
114
-
115
- lapack_mkl_info:
116
-
117
- customize UnixCCompiler
118
-
119
- libraries mkl_rt not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
120
-
121
- NOT AVAILABLE
122
-
123
-
124
-
125
- openblas_lapack_info:
126
-
127
- customize UnixCCompiler
128
-
129
- customize UnixCCompiler
130
-
131
- libraries openblas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
132
-
133
- NOT AVAILABLE
134
-
135
-
136
-
137
- openblas_clapack_info:
138
-
139
- customize UnixCCompiler
140
-
141
- customize UnixCCompiler
142
-
143
- libraries openblas,lapack not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
144
-
145
- NOT AVAILABLE
146
-
147
-
148
-
149
- /usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:638: UserWarning:
150
-
151
- Atlas (http://math-atlas.sourceforge.net/) libraries not found.
152
-
153
- Directories to search for the libraries can be specified in the
154
-
155
- numpy/distutils/site.cfg file (section [atlas]) or by setting
156
-
157
- the ATLAS environment variable.
158
-
159
- self.calc_info()
160
-
161
- lapack_info:
162
-
163
- customize UnixCCompiler
164
-
165
- libraries lapack not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
166
-
167
- NOT AVAILABLE
168
-
169
-
170
-
171
- /usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:638: UserWarning:
172
-
173
- Lapack (http://www.netlib.org/lapack/) libraries not found.
174
-
175
- Directories to search for the libraries can be specified in the
176
-
177
- numpy/distutils/site.cfg file (section [lapack]) or by setting
178
-
179
- the LAPACK environment variable.
180
-
181
- self.calc_info()
182
-
183
- lapack_src_info:
184
-
185
- NOT AVAILABLE
186
-
187
-
188
-
189
- /usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:638: UserWarning:
190
-
191
- Lapack (http://www.netlib.org/lapack/) sources not found.
192
-
193
- Directories to search for the sources can be specified in the
194
-
195
- numpy/distutils/site.cfg file (section [lapack_src]) or by setting
196
-
197
- the LAPACK_SRC environment variable.
198
-
199
- self.calc_info()
200
-
201
- NOT AVAILABLE
202
-
203
-
204
-
205
- Traceback (most recent call last):
206
-
207
- File "<string>", line 1, in <module>
208
-
209
- File "/tmp/pip-install-FqXt9K/scipy/setup.py", line 492, in <module>
210
-
211
- setup_package()
212
-
213
- File "/tmp/pip-install-FqXt9K/scipy/setup.py", line 488, in setup_package
214
-
215
- setup(**metadata)
216
-
217
- File "/usr/lib/python2.7/dist-packages/numpy/distutils/core.py", line 137, in setup
218
-
219
- config = configuration()
220
-
221
- File "/tmp/pip-install-FqXt9K/scipy/setup.py", line 395, in configuration
222
-
223
- raise NotFoundError(msg)
224
-
225
- numpy.distutils.system_info.NotFoundError: No lapack/blas resources found.
226
-
227
-
228
-
229
- ----------------------------------------
230
-
231
- Failed building wheel for scipy
232
-
233
- Running setup.py clean for scipy
234
-
235
- Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-FqXt9K/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:
236
-
237
-
238
-
239
- `setup.py clean` is not supported, use one of the following instead:
240
-
241
-
242
-
243
- - `git clean -xdf` (cleans all files)
244
-
245
- - `git clean -Xdf` (cleans all versioned files, doesn't touch
246
-
247
- files that aren't checked into the git repo)
248
-
249
-
250
-
251
- Add `--force` to your command to use it anyway if you must (unsupported).
95
+ z[i1, i0] = sensordata[i0, i1]
252
96
 
253
97
 
254
98
 
255
99
 
256
100
 
257
- ----------------------------------------
101
+ # 描画する。
258
102
 
259
- Failed cleaning build dir for scipy
103
+ fig = plt.figure(figsize=(8, 8))
260
104
 
261
- Failed to build scipy
105
+ axes = fig.add_subplot(111, projection="3d")
262
106
 
263
- Installing collected packages: scipy
264
-
265
- Running setup.py install for scipy ... error
266
-
267
- Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-FqXt9K/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-e3RwQy/install-record.txt --single-version-externally-managed --compile --user --prefix=:
107
+ im = axes.plot_surface(x, y, z, cmap="magma", edgecolor="gray")
268
108
 
269
109
 
270
110
 
271
- Note: if you need reliable uninstall behavior, then install
111
+ #軸ラベル設定
272
112
 
113
+ axes.set_xlabel("X")
114
+
115
+ axes.set_ylabel("Y")
116
+
117
+ #軸目盛設定
118
+
273
- with pip instead of using `setup.py install`:
119
+ axes.set_xticks(np.arange(0, 9, 1))
120
+
121
+ axes.set_yticks(np.arange(0, 9, 1))
122
+
123
+ #Title表示
124
+
125
+ axes.set_title(title, fontsize=16)
274
126
 
275
127
 
276
128
 
277
- - `pip install .` (from a git repo or downloaded source
129
+ axpos = axes.get_position()
278
130
 
279
- release)
131
+ #Color Bar作成
280
132
 
133
+ #add_axes([x軸の開始位置, y軸の開始位置, x軸の長さ(全体に対する比率), y軸の長さ(全体に対する比率)])
134
+
281
- - `pip install scipy` (last SciPy release on PyPI)
135
+ cbar_ax = fig.add_axes([0.85, axpos.y0, 0.02, axpos.height])
136
+
137
+ cbar = fig.colorbar(im,cax=cbar_ax)
138
+
139
+ cbar.set_label("Temp")
282
140
 
283
141
 
284
142
 
143
+ #余白調整
285
144
 
145
+ plt.subplots_adjust(right=0.85)
286
146
 
287
- Running from scipy source directory.
147
+ plt.subplots_adjust(wspace=0.15)
288
148
 
289
- lapack_opt_info:
149
+ # 視点
290
150
 
291
- lapack_mkl_info:
151
+ axes.view_init(30, -45)
292
152
 
293
- customize UnixCCompiler
294
-
295
- libraries mkl_rt not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
296
-
297
- NOT AVAILABLE
298
-
299
-
300
-
301
- openblas_lapack_info:
302
-
303
- customize UnixCCompiler
304
-
305
- customize UnixCCompiler
306
-
307
- libraries openblas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
308
-
309
- NOT AVAILABLE
310
-
311
-
312
-
313
- openblas_clapack_info:
314
-
315
- customize UnixCCompiler
316
-
317
- customize UnixCCompiler
318
-
319
- libraries openblas,lapack not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
320
-
321
- NOT AVAILABLE
322
-
323
- accelerate_info:
324
-
325
- NOT AVAILABLE
326
-
327
-
328
-
329
- /usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:638: UserWarning:
330
-
331
- Atlas (http://math-atlas.sourceforge.net/) libraries not found.
332
-
333
- Directories to search for the libraries can be specified in the
334
-
335
- numpy/distutils/site.cfg file (section [atlas]) or by setting
336
-
337
- the ATLAS environment variable.
338
-
339
- self.calc_info()
340
-
341
- lapack_info:
342
-
343
- customize UnixCCompiler
344
-
345
- libraries lapack not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
346
-
347
- NOT AVAILABLE
348
-
349
-
350
-
351
- /usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:638: UserWarning:
352
-
353
- Lapack (http://www.netlib.org/lapack/) libraries not found.
354
-
355
- Directories to search for the libraries can be specified in the
356
-
357
- numpy/distutils/site.cfg file (section [lapack]) or by setting
358
-
359
- the LAPACK environment variable.
360
-
361
- self.calc_info()
362
-
363
- lapack_src_info:
364
-
365
- NOT AVAILABLE
366
-
367
-
368
-
369
- /usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:638: UserWarning:
370
-
371
- Lapack (http://www.netlib.org/lapack/) sources not found.
372
-
373
- Directories to search for the sources can be specified in the
374
-
375
- numpy/distutils/site.cfg file (section [lapack_src]) or by setting
376
-
377
- the LAPACK_SRC environment variable.
378
-
379
- self.calc_info()
380
-
381
- NOT AVAILABLE
382
-
383
-
384
-
385
- Traceback (most recent call last):
386
-
387
- File "<string>", line 1, in <module>
388
-
389
- File "/tmp/pip-install-FqXt9K/scipy/setup.py", line 492, in <module>
390
-
391
- setup_package()
392
-
393
- File "/tmp/pip-install-FqXt9K/scipy/setup.py", line 488, in setup_package
394
-
395
- setup(**metadata)
396
-
397
- File "/usr/lib/python2.7/dist-packages/numpy/distutils/core.py", line 137, in setup
398
-
399
- config = configuration()
400
-
401
- File "/tmp/pip-install-FqXt9K/scipy/setup.py", line 395, in configuration
402
-
403
- raise NotFoundError(msg)
404
-
405
- numpy.distutils.system_info.NotFoundError: No lapack/blas resources found.
406
-
407
-
408
-
409
- ----------------------------------------
410
-
411
- Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-FqXt9K/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-e3RwQy/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-FqXt9K/scipy/
412
-
413
- コード
153
+ plt.savefig('/home/pi/dev/data/3D.png', format='png')
414
154
 
415
155
  ```
156
+
157
+ ![イメージ説明](b2c0ed9a21391017eca4c24e1f6b203c.png)

4

scipyインストール時のエラー情報を追加

2020/03/10 06:01

投稿

raspypy
raspypy

スコア247

test CHANGED
File without changes
test CHANGED
@@ -88,232 +88,328 @@
88
88
 
89
89
 
90
90
 
91
- **追加**
92
-
93
-
94
-
95
- ```python
96
-
97
- linedata=[]
98
-
99
- for i in range(8) :
100
-
101
- data = bus.read_i2c_block_data(i2c_address , 0x80+0x10*i, 16)
102
-
103
- oneline =[]
104
-
105
- for j in range(8) :
106
-
107
- oneline.append( (int(((data[2*j+1] & 0b00000111) << 8) + data[2*j]))*0.25 )
108
-
109
- linedata.append(oneline)
110
-
111
-
112
-
113
- #配列データ表示
114
-
115
- print linedata
116
-
117
-
118
-
119
- indata = np.array(linedata)
120
-
121
- # 温度データの形状を確認
122
-
123
- indata.shape
124
-
125
-
126
-
127
- # 2次元グリッド各x0、x1の位置にindataの値をyとして代入
128
-
129
- xn = 8
130
-
131
- x0 = np.linspace(0, 7, xn)
132
-
133
- x1 = np.linspace(0, 7, xn)
134
-
135
- y = np.zeros((len(x0), len(x1)))
136
-
137
- for i0 in range(xn):
138
-
139
- for i1 in range(xn):
140
-
141
- y[i1, i0] = indata[i0, i1]
142
-
143
-
144
-
145
- # 3次元グリッドを作成
146
-
147
- xx0, xx1 = np.meshgrid(x0, x1)
148
-
149
-
150
-
151
- # 作画領域
152
-
153
- plt.figure(figsize=(10, 7))
154
-
155
- ax = plt.subplot(1, 1, 1, projection='3d')
156
-
157
-
158
-
159
- # 3次元グリッドに温度データとカラーマップを与えて曲面を描く
160
-
161
- surf = ax.plot_surface(xx0, xx1, y, cmap = "autumn_r", edgecolor='gray')
162
-
163
-
164
-
165
- # 曲面データを基に、カラーバーを描く
166
-
167
- plt.colorbar(surf)
168
-
169
-
170
-
171
- # Z軸目盛り
172
-
173
- ax.set_zticks((10, 20, 30))
174
-
175
-
176
-
177
- # タイトル
178
-
179
- ax.set_title("温度分布")
180
-
181
-
182
-
183
- # 視点
184
-
185
- ax.view_init(30, -10)
186
-
187
-
188
-
189
- plt.savefig('/home/pi/3D.png', format='png')
91
+ Scipyインストール時のエラー
92
+
93
+ ```text
94
+
95
+ pi@raspberrypi:~/dev $ pip install scipy
96
+
97
+ Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
98
+
99
+ Collecting scipy
100
+
101
+ Downloading https://files.pythonhosted.org/packages/62/4f/7e95c5000c411164d5ca6f55ac54cda5d200a3b6719dafd215ee0bd61578/scipy-1.2.3.tar.gz (23.3MB)
102
+
103
+ 100% |????????????????????????????????| 23.3MB 9.0kB/s
104
+
105
+ Building wheels for collected packages: scipy
106
+
107
+ Running setup.py bdist_wheel for scipy ... error
108
+
109
+ Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-FqXt9K/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-DRoX0Z --python-tag cp27:
110
+
111
+ Running from scipy source directory.
112
+
113
+ lapack_opt_info:
114
+
115
+ lapack_mkl_info:
116
+
117
+ customize UnixCCompiler
118
+
119
+ libraries mkl_rt not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
120
+
121
+ NOT AVAILABLE
122
+
123
+
124
+
125
+ openblas_lapack_info:
126
+
127
+ customize UnixCCompiler
128
+
129
+ customize UnixCCompiler
130
+
131
+ libraries openblas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
132
+
133
+ NOT AVAILABLE
134
+
135
+
136
+
137
+ openblas_clapack_info:
138
+
139
+ customize UnixCCompiler
140
+
141
+ customize UnixCCompiler
142
+
143
+ libraries openblas,lapack not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
144
+
145
+ NOT AVAILABLE
146
+
147
+
148
+
149
+ /usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:638: UserWarning:
150
+
151
+ Atlas (http://math-atlas.sourceforge.net/) libraries not found.
152
+
153
+ Directories to search for the libraries can be specified in the
154
+
155
+ numpy/distutils/site.cfg file (section [atlas]) or by setting
156
+
157
+ the ATLAS environment variable.
158
+
159
+ self.calc_info()
160
+
161
+ lapack_info:
162
+
163
+ customize UnixCCompiler
164
+
165
+ libraries lapack not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
166
+
167
+ NOT AVAILABLE
168
+
169
+
170
+
171
+ /usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:638: UserWarning:
172
+
173
+ Lapack (http://www.netlib.org/lapack/) libraries not found.
174
+
175
+ Directories to search for the libraries can be specified in the
176
+
177
+ numpy/distutils/site.cfg file (section [lapack]) or by setting
178
+
179
+ the LAPACK environment variable.
180
+
181
+ self.calc_info()
182
+
183
+ lapack_src_info:
184
+
185
+ NOT AVAILABLE
186
+
187
+
188
+
189
+ /usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:638: UserWarning:
190
+
191
+ Lapack (http://www.netlib.org/lapack/) sources not found.
192
+
193
+ Directories to search for the sources can be specified in the
194
+
195
+ numpy/distutils/site.cfg file (section [lapack_src]) or by setting
196
+
197
+ the LAPACK_SRC environment variable.
198
+
199
+ self.calc_info()
200
+
201
+ NOT AVAILABLE
202
+
203
+
204
+
205
+ Traceback (most recent call last):
206
+
207
+ File "<string>", line 1, in <module>
208
+
209
+ File "/tmp/pip-install-FqXt9K/scipy/setup.py", line 492, in <module>
210
+
211
+ setup_package()
212
+
213
+ File "/tmp/pip-install-FqXt9K/scipy/setup.py", line 488, in setup_package
214
+
215
+ setup(**metadata)
216
+
217
+ File "/usr/lib/python2.7/dist-packages/numpy/distutils/core.py", line 137, in setup
218
+
219
+ config = configuration()
220
+
221
+ File "/tmp/pip-install-FqXt9K/scipy/setup.py", line 395, in configuration
222
+
223
+ raise NotFoundError(msg)
224
+
225
+ numpy.distutils.system_info.NotFoundError: No lapack/blas resources found.
226
+
227
+
228
+
229
+ ----------------------------------------
230
+
231
+ Failed building wheel for scipy
232
+
233
+ Running setup.py clean for scipy
234
+
235
+ Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-FqXt9K/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:
236
+
237
+
238
+
239
+ `setup.py clean` is not supported, use one of the following instead:
240
+
241
+
242
+
243
+ - `git clean -xdf` (cleans all files)
244
+
245
+ - `git clean -Xdf` (cleans all versioned files, doesn't touch
246
+
247
+ files that aren't checked into the git repo)
248
+
249
+
250
+
251
+ Add `--force` to your command to use it anyway if you must (unsupported).
252
+
253
+
254
+
255
+
256
+
257
+ ----------------------------------------
258
+
259
+ Failed cleaning build dir for scipy
260
+
261
+ Failed to build scipy
262
+
263
+ Installing collected packages: scipy
264
+
265
+ Running setup.py install for scipy ... error
266
+
267
+ Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-FqXt9K/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-e3RwQy/install-record.txt --single-version-externally-managed --compile --user --prefix=:
268
+
269
+
270
+
271
+ Note: if you need reliable uninstall behavior, then install
272
+
273
+ with pip instead of using `setup.py install`:
274
+
275
+
276
+
277
+ - `pip install .` (from a git repo or downloaded source
278
+
279
+ release)
280
+
281
+ - `pip install scipy` (last SciPy release on PyPI)
282
+
283
+
284
+
285
+
286
+
287
+ Running from scipy source directory.
288
+
289
+ lapack_opt_info:
290
+
291
+ lapack_mkl_info:
292
+
293
+ customize UnixCCompiler
294
+
295
+ libraries mkl_rt not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
296
+
297
+ NOT AVAILABLE
298
+
299
+
300
+
301
+ openblas_lapack_info:
302
+
303
+ customize UnixCCompiler
304
+
305
+ customize UnixCCompiler
306
+
307
+ libraries openblas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
308
+
309
+ NOT AVAILABLE
310
+
311
+
312
+
313
+ openblas_clapack_info:
314
+
315
+ customize UnixCCompiler
316
+
317
+ customize UnixCCompiler
318
+
319
+ libraries openblas,lapack not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
320
+
321
+ NOT AVAILABLE
322
+
323
+ accelerate_info:
324
+
325
+ NOT AVAILABLE
326
+
327
+
328
+
329
+ /usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:638: UserWarning:
330
+
331
+ Atlas (http://math-atlas.sourceforge.net/) libraries not found.
332
+
333
+ Directories to search for the libraries can be specified in the
334
+
335
+ numpy/distutils/site.cfg file (section [atlas]) or by setting
336
+
337
+ the ATLAS environment variable.
338
+
339
+ self.calc_info()
340
+
341
+ lapack_info:
342
+
343
+ customize UnixCCompiler
344
+
345
+ libraries lapack not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
346
+
347
+ NOT AVAILABLE
348
+
349
+
350
+
351
+ /usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:638: UserWarning:
352
+
353
+ Lapack (http://www.netlib.org/lapack/) libraries not found.
354
+
355
+ Directories to search for the libraries can be specified in the
356
+
357
+ numpy/distutils/site.cfg file (section [lapack]) or by setting
358
+
359
+ the LAPACK environment variable.
360
+
361
+ self.calc_info()
362
+
363
+ lapack_src_info:
364
+
365
+ NOT AVAILABLE
366
+
367
+
368
+
369
+ /usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:638: UserWarning:
370
+
371
+ Lapack (http://www.netlib.org/lapack/) sources not found.
372
+
373
+ Directories to search for the sources can be specified in the
374
+
375
+ numpy/distutils/site.cfg file (section [lapack_src]) or by setting
376
+
377
+ the LAPACK_SRC environment variable.
378
+
379
+ self.calc_info()
380
+
381
+ NOT AVAILABLE
382
+
383
+
384
+
385
+ Traceback (most recent call last):
386
+
387
+ File "<string>", line 1, in <module>
388
+
389
+ File "/tmp/pip-install-FqXt9K/scipy/setup.py", line 492, in <module>
390
+
391
+ setup_package()
392
+
393
+ File "/tmp/pip-install-FqXt9K/scipy/setup.py", line 488, in setup_package
394
+
395
+ setup(**metadata)
396
+
397
+ File "/usr/lib/python2.7/dist-packages/numpy/distutils/core.py", line 137, in setup
398
+
399
+ config = configuration()
400
+
401
+ File "/tmp/pip-install-FqXt9K/scipy/setup.py", line 395, in configuration
402
+
403
+ raise NotFoundError(msg)
404
+
405
+ numpy.distutils.system_info.NotFoundError: No lapack/blas resources found.
406
+
407
+
408
+
409
+ ----------------------------------------
410
+
411
+ Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-FqXt9K/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-e3RwQy/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-FqXt9K/scipy/
412
+
413
+ コード
190
414
 
191
415
  ```
192
-
193
-
194
-
195
- 次のエラーが出てしまいました。
196
-
197
- **print linedata**でデータ取得まではできているのですが、グラフ化ができません。
198
-
199
- ```text
200
-
201
- [[24.0, 24.0, 24.5, 23.5, 23.25, 25.0, 25.5, 25.0], [22.5, 25.25, 26.0, 25.75, 25.75, 26.0, 26.25, 26.25], [26.0, 25.5, 25.0, 26.5, 26.25, 27.0, 27.25, 27.0], [25.75, 26.0, 27.0, 27.5, 27.25, 28.0, 28.0, 28.0], [23.0, 22.75, 24.75, 27.0, 27.75, 27.75, 28.5, 27.75], [24.5, 25.5, 26.25, 26.25, 27.25, 28.0, 27.5, 27.75], [22.25, 23.0, 24.0, 25.75, 27.25, 27.5, 27.5, 27.5], [21.0, 20.25, 23.0, 25.75, 26.5, 26.0, 25.75, 25.75]]
202
-
203
- Traceback (most recent call last):
204
-
205
- File "./test.py", line 59, in <module>
206
-
207
- ax = plt.subplot(1, 1, 1, projection='3d')
208
-
209
- File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/pyplot.py", line 1057, in subplot
210
-
211
- a = fig.add_subplot(*args, **kwargs)
212
-
213
- File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/figure.py", line 1239, in add_subplot
214
-
215
- self, *args, **kwargs)
216
-
217
- File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/projections/__init__.py", line 91, in process_projection_requirements
218
-
219
- projection_class = get_projection_class(projection)
220
-
221
- File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/projections/__init__.py", line 65, in get_projection_class
222
-
223
- raise ValueError("Unknown projection '%s'" % projection)
224
-
225
- ValueError: Unknown projection '3d'
226
-
227
- ```
228
-
229
-
230
-
231
- 最新のエラー
232
-
233
- ```text
234
-
235
- [[21.25, 19.75, 21.25, 22.0, 22.25, 22.25, 22.75, 22.0], [21.75, 22.0, 20.25, 21.0, 23.5, 22.25, 23.25, 23.25], [19.5, 22.5, 22.75, 21.75, 23.5, 24.25, 24.75, 24.0], [19.0, 20.25, 22.75, 23.75, 23.75, 24.5, 25.25, 25.25], [18.75, 18.0, 20.0, 23.25, 24.5, 25.0, 25.5, 25.25], [18.5, 18.5, 19.0, 20.75, 24.5, 24.75, 24.5, 25.25], [19.5, 20.75, 22.5, 21.25, 22.75, 24.25, 24.5, 24.75], [20.0, 19.0, 21.75, 23.0, 24.0, 23.25, 23.75, 24.5]]
236
-
237
- Traceback (most recent call last):
238
-
239
- File "./test.py", line 77, in <module>
240
-
241
- plt.savefig('/home/pi/dev/data/3D.png', format='png')
242
-
243
- File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/pyplot.py", line 695, in savefig
244
-
245
- res = fig.savefig(*args, **kwargs)
246
-
247
- File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/figure.py", line 2062, in savefig
248
-
249
- self.canvas.print_figure(fname, **kwargs)
250
-
251
- File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 2263, in print_figure
252
-
253
- **kwargs)
254
-
255
- File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 517, in print_png
256
-
257
- FigureCanvasAgg.draw(self)
258
-
259
- File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 437, in draw
260
-
261
- self.figure.draw(self.renderer)
262
-
263
- File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
264
-
265
- return draw(artist, renderer, *args, **kwargs)
266
-
267
- File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/figure.py", line 1493, in draw
268
-
269
- renderer, self, artists, self.suppressComposite)
270
-
271
- File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/image.py", line 141, in _draw_list_compositing_images
272
-
273
- a.draw(renderer)
274
-
275
- File "/home/pi/.local/lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.py", line 301, in draw
276
-
277
- super(Axes3D, self).draw(renderer)
278
-
279
- File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
280
-
281
- return draw(artist, renderer, *args, **kwargs)
282
-
283
- File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/axes/_base.py", line 2635, in draw
284
-
285
- mimage._draw_list_compositing_images(renderer, self, artists)
286
-
287
- File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/image.py", line 141, in _draw_list_compositing_images
288
-
289
- a.draw(renderer)
290
-
291
- File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
292
-
293
- return draw(artist, renderer, *args, **kwargs)
294
-
295
- File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/text.py", line 706, in draw
296
-
297
- bbox, info, descent = textobj._get_layout(renderer)
298
-
299
- File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/text.py", line 305, in _get_layout
300
-
301
- clean_line, ismath = self.is_math_text(line, self.get_usetex())
302
-
303
- File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/text.py", line 1190, in is_math_text
304
-
305
- if cbook.is_math_text(s):
306
-
307
- File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/cbook/__init__.py", line 2035, in is_math_text
308
-
309
- "matplotlib display text must have all code points < 128 or use "
310
-
311
- ValueError: matplotlib display text must have all code points < 128 or use Unicode strings
312
-
313
- コード
314
-
315
- ```
316
-
317
-
318
-
319
- ![イメージ説明](1771bcf37f5b75b68b75c5913a79cc7b.png)

3

画像を追加

2020/03/09 06:56

投稿

raspypy
raspypy

スコア247

test CHANGED
File without changes
test CHANGED
@@ -313,3 +313,7 @@
313
313
  コード
314
314
 
315
315
  ```
316
+
317
+
318
+
319
+ ![イメージ説明](1771bcf37f5b75b68b75c5913a79cc7b.png)

2

エラー情報の追加

2020/03/09 01:24

投稿

raspypy
raspypy

スコア247

test CHANGED
File without changes
test CHANGED
@@ -225,3 +225,91 @@
225
225
  ValueError: Unknown projection '3d'
226
226
 
227
227
  ```
228
+
229
+
230
+
231
+ 最新のエラー
232
+
233
+ ```text
234
+
235
+ [[21.25, 19.75, 21.25, 22.0, 22.25, 22.25, 22.75, 22.0], [21.75, 22.0, 20.25, 21.0, 23.5, 22.25, 23.25, 23.25], [19.5, 22.5, 22.75, 21.75, 23.5, 24.25, 24.75, 24.0], [19.0, 20.25, 22.75, 23.75, 23.75, 24.5, 25.25, 25.25], [18.75, 18.0, 20.0, 23.25, 24.5, 25.0, 25.5, 25.25], [18.5, 18.5, 19.0, 20.75, 24.5, 24.75, 24.5, 25.25], [19.5, 20.75, 22.5, 21.25, 22.75, 24.25, 24.5, 24.75], [20.0, 19.0, 21.75, 23.0, 24.0, 23.25, 23.75, 24.5]]
236
+
237
+ Traceback (most recent call last):
238
+
239
+ File "./test.py", line 77, in <module>
240
+
241
+ plt.savefig('/home/pi/dev/data/3D.png', format='png')
242
+
243
+ File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/pyplot.py", line 695, in savefig
244
+
245
+ res = fig.savefig(*args, **kwargs)
246
+
247
+ File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/figure.py", line 2062, in savefig
248
+
249
+ self.canvas.print_figure(fname, **kwargs)
250
+
251
+ File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 2263, in print_figure
252
+
253
+ **kwargs)
254
+
255
+ File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 517, in print_png
256
+
257
+ FigureCanvasAgg.draw(self)
258
+
259
+ File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 437, in draw
260
+
261
+ self.figure.draw(self.renderer)
262
+
263
+ File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
264
+
265
+ return draw(artist, renderer, *args, **kwargs)
266
+
267
+ File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/figure.py", line 1493, in draw
268
+
269
+ renderer, self, artists, self.suppressComposite)
270
+
271
+ File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/image.py", line 141, in _draw_list_compositing_images
272
+
273
+ a.draw(renderer)
274
+
275
+ File "/home/pi/.local/lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.py", line 301, in draw
276
+
277
+ super(Axes3D, self).draw(renderer)
278
+
279
+ File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
280
+
281
+ return draw(artist, renderer, *args, **kwargs)
282
+
283
+ File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/axes/_base.py", line 2635, in draw
284
+
285
+ mimage._draw_list_compositing_images(renderer, self, artists)
286
+
287
+ File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/image.py", line 141, in _draw_list_compositing_images
288
+
289
+ a.draw(renderer)
290
+
291
+ File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
292
+
293
+ return draw(artist, renderer, *args, **kwargs)
294
+
295
+ File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/text.py", line 706, in draw
296
+
297
+ bbox, info, descent = textobj._get_layout(renderer)
298
+
299
+ File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/text.py", line 305, in _get_layout
300
+
301
+ clean_line, ismath = self.is_math_text(line, self.get_usetex())
302
+
303
+ File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/text.py", line 1190, in is_math_text
304
+
305
+ if cbook.is_math_text(s):
306
+
307
+ File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/cbook/__init__.py", line 2035, in is_math_text
308
+
309
+ "matplotlib display text must have all code points < 128 or use "
310
+
311
+ ValueError: matplotlib display text must have all code points < 128 or use Unicode strings
312
+
313
+ コード
314
+
315
+ ```

1

エラー内容を追記。

2020/03/09 01:08

投稿

raspypy
raspypy

スコア247

test CHANGED
File without changes
test CHANGED
@@ -85,3 +85,143 @@
85
85
  plt.colorbar()
86
86
 
87
87
  ```
88
+
89
+
90
+
91
+ **追加**
92
+
93
+
94
+
95
+ ```python
96
+
97
+ linedata=[]
98
+
99
+ for i in range(8) :
100
+
101
+ data = bus.read_i2c_block_data(i2c_address , 0x80+0x10*i, 16)
102
+
103
+ oneline =[]
104
+
105
+ for j in range(8) :
106
+
107
+ oneline.append( (int(((data[2*j+1] & 0b00000111) << 8) + data[2*j]))*0.25 )
108
+
109
+ linedata.append(oneline)
110
+
111
+
112
+
113
+ #配列データ表示
114
+
115
+ print linedata
116
+
117
+
118
+
119
+ indata = np.array(linedata)
120
+
121
+ # 温度データの形状を確認
122
+
123
+ indata.shape
124
+
125
+
126
+
127
+ # 2次元グリッド各x0、x1の位置にindataの値をyとして代入
128
+
129
+ xn = 8
130
+
131
+ x0 = np.linspace(0, 7, xn)
132
+
133
+ x1 = np.linspace(0, 7, xn)
134
+
135
+ y = np.zeros((len(x0), len(x1)))
136
+
137
+ for i0 in range(xn):
138
+
139
+ for i1 in range(xn):
140
+
141
+ y[i1, i0] = indata[i0, i1]
142
+
143
+
144
+
145
+ # 3次元グリッドを作成
146
+
147
+ xx0, xx1 = np.meshgrid(x0, x1)
148
+
149
+
150
+
151
+ # 作画領域
152
+
153
+ plt.figure(figsize=(10, 7))
154
+
155
+ ax = plt.subplot(1, 1, 1, projection='3d')
156
+
157
+
158
+
159
+ # 3次元グリッドに温度データとカラーマップを与えて曲面を描く
160
+
161
+ surf = ax.plot_surface(xx0, xx1, y, cmap = "autumn_r", edgecolor='gray')
162
+
163
+
164
+
165
+ # 曲面データを基に、カラーバーを描く
166
+
167
+ plt.colorbar(surf)
168
+
169
+
170
+
171
+ # Z軸目盛り
172
+
173
+ ax.set_zticks((10, 20, 30))
174
+
175
+
176
+
177
+ # タイトル
178
+
179
+ ax.set_title("温度分布")
180
+
181
+
182
+
183
+ # 視点
184
+
185
+ ax.view_init(30, -10)
186
+
187
+
188
+
189
+ plt.savefig('/home/pi/3D.png', format='png')
190
+
191
+ ```
192
+
193
+
194
+
195
+ 次のエラーが出てしまいました。
196
+
197
+ **print linedata**でデータ取得まではできているのですが、グラフ化ができません。
198
+
199
+ ```text
200
+
201
+ [[24.0, 24.0, 24.5, 23.5, 23.25, 25.0, 25.5, 25.0], [22.5, 25.25, 26.0, 25.75, 25.75, 26.0, 26.25, 26.25], [26.0, 25.5, 25.0, 26.5, 26.25, 27.0, 27.25, 27.0], [25.75, 26.0, 27.0, 27.5, 27.25, 28.0, 28.0, 28.0], [23.0, 22.75, 24.75, 27.0, 27.75, 27.75, 28.5, 27.75], [24.5, 25.5, 26.25, 26.25, 27.25, 28.0, 27.5, 27.75], [22.25, 23.0, 24.0, 25.75, 27.25, 27.5, 27.5, 27.5], [21.0, 20.25, 23.0, 25.75, 26.5, 26.0, 25.75, 25.75]]
202
+
203
+ Traceback (most recent call last):
204
+
205
+ File "./test.py", line 59, in <module>
206
+
207
+ ax = plt.subplot(1, 1, 1, projection='3d')
208
+
209
+ File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/pyplot.py", line 1057, in subplot
210
+
211
+ a = fig.add_subplot(*args, **kwargs)
212
+
213
+ File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/figure.py", line 1239, in add_subplot
214
+
215
+ self, *args, **kwargs)
216
+
217
+ File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/projections/__init__.py", line 91, in process_projection_requirements
218
+
219
+ projection_class = get_projection_class(projection)
220
+
221
+ File "/home/pi/.local/lib/python2.7/site-packages/matplotlib/projections/__init__.py", line 65, in get_projection_class
222
+
223
+ raise ValueError("Unknown projection '%s'" % projection)
224
+
225
+ ValueError: Unknown projection '3d'
226
+
227
+ ```