質問編集履歴

2

どこを変更したか明確化

2018/10/28 10:31

投稿

ruei
ruei

スコア284

test CHANGED
File without changes
test CHANGED
@@ -36,6 +36,16 @@
36
36
 
37
37
  ```
38
38
 
39
+ そこで、
40
+
41
+ ```
42
+
43
+ cbar = fig.colorbar(im, ticks = [-math.pi, 0, math.pi], label = ["-π","0","π"])
44
+
45
+ ```
46
+
47
+ の部分を、
48
+
39
49
  [https://matplotlib.org/examples/pylab_examples/colorbar_tick_labelling_demo.html](https://matplotlib.org/examples/pylab_examples/colorbar_tick_labelling_demo.html)
40
50
 
41
51
  を参考に
@@ -48,7 +58,7 @@
48
58
 
49
59
  ```
50
60
 
51
- ところ
61
+ 書き換えてみ所、
52
62
 
53
63
  ```
54
64
 
@@ -56,7 +66,7 @@
56
66
 
57
67
  ```
58
68
 
59
- というエラーが出てしまいます
69
+ というエラーが出てしまいこちらも駄目でした
60
70
 
61
71
  正しく、カラーバーにπを表示する方法の分かり方いらっしゃったらご教示ください。
62
72
 

1

試したこと追加

2018/10/28 10:31

投稿

ruei
ruei

スコア284

test CHANGED
File without changes
test CHANGED
@@ -36,7 +36,27 @@
36
36
 
37
37
  ```
38
38
 
39
+ [https://matplotlib.org/examples/pylab_examples/colorbar_tick_labelling_demo.html](https://matplotlib.org/examples/pylab_examples/colorbar_tick_labelling_demo.html)
39
40
 
41
+ を参考に
42
+
43
+ ```
44
+
45
+ cbar = fig.colorbar(im, ticks = [-math.pi, 0, math.pi])
46
+
47
+ cbar.ax.set_yticklabels["-π","0","π"]
48
+
49
+ ```
50
+
51
+ としたところ
52
+
53
+ ```
54
+
55
+ TypeError: 'method' object is not subscriptable
56
+
57
+ ```
58
+
59
+ というエラーが出てしまいます。
40
60
 
41
61
  正しく、カラーバーにπを表示する方法の分かり方いらっしゃったらご教示ください。
42
62