質問編集履歴
5
ソースコード編集
title
CHANGED
File without changes
|
body
CHANGED
@@ -27,13 +27,9 @@
|
|
27
27
|
```python
|
28
28
|
#生成されるグラフは
|
29
29
|
# x軸; 角度
|
30
|
-
# y軸は
|
31
|
-
#
|
30
|
+
# y軸は: heat-O2
|
32
|
-
#2; thermo-C8H18
|
33
|
-
#3; thermo-radius
|
34
|
-
#4; O2-radius
|
35
|
-
#5; C8H18-radiusの5種類
|
36
31
|
|
32
|
+
|
37
33
|
#heat-O2のグラフ作成(第1軸)
|
38
34
|
chart_h_O2 = ScatterChart()
|
39
35
|
#chart_t.title = ""
|
@@ -46,73 +42,10 @@
|
|
46
42
|
chart_h_O2.x_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
47
43
|
chart_h_O2.y_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
48
44
|
|
49
|
-
|
45
|
+
|
50
|
-
chart_h_C8H18 = ScatterChart()
|
51
|
-
#chart_t.title = ""
|
52
|
-
chart_h_C8H18.x_axis.title = "Angular cordinate [deg.] (from"+ str(temp_min) + "K to " + str(temp_max) + "K)"
|
53
|
-
chart_h_C8H18.y_axis.title = "Thermo diffusion [J/m^3/s]"
|
54
|
-
chart_h_C8H18.y_axis.scaling.logBase = 10
|
55
|
-
chart_h_C8H18.y_axis.numFmt = "0.00E+00"
|
56
|
-
chart_h_C8H18.x_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
57
|
-
chart_h_C8H18.y_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
58
|
-
chart_h_C8H18.x_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
59
|
-
chart_h_C8H18.y_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
60
|
-
|
61
|
-
#heat-radiusのグラフ作成(第1軸)
|
62
|
-
chart_h_r = ScatterChart()
|
63
|
-
#chart_t.title = ""
|
64
|
-
chart_h_r.x_axis.title = "Angular cordinate [deg.]"
|
65
|
-
chart_h_r.y_axis.title = "Thermo diffusion [J/m^3/s]"
|
66
|
-
chart_h_r.y_axis.scaling.logBase = 10
|
67
|
-
chart_h_r.y_axis.numFmt = "0.00E+00"
|
68
|
-
chart_h_r.x_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
69
|
-
chart_h_r.y_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
70
|
-
chart_h_r.x_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
71
|
-
chart_h_r.y_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
72
|
-
|
73
|
-
#C8H18-radiusのグラフ作成(第1軸)
|
74
|
-
chart_C8H18_r = ScatterChart()
|
75
|
-
#chart_C8H18_r.title = "O2拡散量"
|
76
|
-
chart_C8H18_r.x_axis.title = "Angular cordinate [deg.]"
|
77
|
-
chart_C8H18_r.y_axis.title = "C8H18 diffusion [kg/m^3/s]"
|
78
|
-
chart_C8H18_r.y_axis.numFmt = "0.00E+00"
|
79
|
-
chart_C8H18_r.x_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
80
|
-
chart_C8H18_r.y_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
81
|
-
chart_C8H18_r.x_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
82
|
-
chart_C8H18_r.y_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
83
|
-
|
84
|
-
#O2-radiusのグラフ作成(第1軸)
|
85
|
-
chart_O2_r = ScatterChart()
|
86
|
-
#chart_C8H18.title = "O2拡散量"
|
87
|
-
chart_O2_r.x_axis.title = "Angular cordinate [deg.]"
|
88
|
-
chart_O2_r.y_axis.title = "O2 diffusion [kg/m^3/s]"
|
89
|
-
chart_O2_r.y_axis.numFmt = "0.00E+00"
|
90
|
-
chart_O2_r.x_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
91
|
-
chart_O2_r.y_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
92
|
-
chart_O2_r.x_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
93
|
-
chart_O2_r.y_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
94
46
|
|
95
47
|
#第2軸に付け足すもの↓
|
96
|
-
#radiusのグラフ作成(第2軸)
|
97
|
-
chart_r_2 = ScatterChart()
|
98
|
-
#chart_r.title = "熱拡散量"
|
99
|
-
chart_r_2.y_axis.title = "Flame radius [m]"
|
100
|
-
#chart_r_2.x_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
101
|
-
chart_r_2.y_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
102
|
-
#chart_r_2.x_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
103
|
-
chart_r_2.y_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
104
48
|
|
105
|
-
#C8H18のグラフ作成(第2軸)
|
106
|
-
chart_C8H18_2 = ScatterChart()
|
107
|
-
#chart_C8H18_2.title = "C8H18拡散量"
|
108
|
-
#chart_C8H18_2.x_axis.title = "Angular cordinate [deg.] (from"+ str(temp_min) + "K to " + str(temp_max) + "K)"
|
109
|
-
chart_C8H18_2.y_axis.title = "C8H18 diffusion [kg/m^3/s]"
|
110
|
-
chart_C8H18_2.y_axis.numFmt = "0.00E+00"
|
111
|
-
#chart_C8H18_2.x_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
112
|
-
chart_C8H18_2.y_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
113
|
-
#chart_C8H18_2.x_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
114
|
-
chart_C8H18_2.y_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
115
|
-
|
116
49
|
#O2のグラフ作成(第2軸)
|
117
50
|
chart_O2_2 = ScatterChart()
|
118
51
|
#chart_C8H18.title = "O2拡散量"
|
@@ -141,11 +74,10 @@
|
|
141
74
|
agvalues = Reference(ws, min_col=ag+1, max_col=ag+1, min_row=2, max_row=73)
|
142
75
|
|
143
76
|
# 系列のデータをSeriesオブジェクトとして定義する
|
144
|
-
|
77
|
+
|
145
78
|
series_h = Series(thermovalues, agvalues, title = "Thermo diffusion")
|
146
79
|
series_O2 = Series(O2values, agvalues, title = "O2 diffusion" )
|
147
|
-
|
80
|
+
|
148
|
-
|
149
81
|
serieslist = [series_r, series_h, series_O2, series_C8H18]
|
150
82
|
|
151
83
|
# 各系列のプロットを表現するマーカーのシンボルの指定を辞書形式で用意
|
@@ -177,27 +109,16 @@
|
|
177
109
|
|
178
110
|
#第1軸となるグラフ
|
179
111
|
chart_h_O2.series.append(series_h)
|
180
|
-
|
112
|
+
|
181
|
-
chart_h_r.series.append(series_h)
|
182
|
-
chart_C8H18_r.series.append(series_C8H18)
|
183
|
-
chart_O2_r.series.append(series_O2)
|
184
|
-
|
185
113
|
#第2軸となるグラフ
|
186
114
|
chart_O2_2.series.append(series_O2)
|
187
|
-
|
115
|
+
|
188
|
-
chart_r_2.series.append(series_r)
|
189
|
-
|
190
116
|
#第2軸のグラフを第1軸のグラフに合成
|
191
117
|
chart_h_O2 += chart_O2_2
|
192
|
-
chart_h_C8H18 += chart_C8H18_2
|
193
|
-
chart_h_r += chart_r_2
|
194
|
-
chart_C8H18_r += chart_r_2
|
195
|
-
chart_O2_r += chart_r_2
|
196
118
|
|
119
|
+
|
197
|
-
#第1軸となるグラフ
|
120
|
+
#第1軸となるグラフに凡例を追加
|
198
|
-
chartlist = [chart_h_O2, chart_h_C8H18, chart_h_r, chart_C8H18_r, chart_O2_r]
|
199
|
-
for chart in chartlist:
|
200
|
-
|
121
|
+
chart_h_O2.legend.legendPos = "b"
|
201
122
|
|
202
123
|
|
203
124
|
#第2軸となるグラフのリスト
|
@@ -206,12 +127,10 @@
|
|
206
127
|
#自分のソースコードでは,第2軸が右に来るようにしています.
|
207
128
|
chart.y_axis.crosses = "max"
|
208
129
|
|
209
|
-
ws.add_chart(chart_h_r, 'AH2')
|
210
|
-
ws.add_chart(chart_O2_r, 'AH20')
|
211
|
-
ws.add_chart(chart_C8H18_r, 'AH38')
|
212
|
-
ws.add_chart(chart_h_O2, 'AH56')
|
213
|
-
ws.add_chart(chart_h_C8H18, 'AH74')
|
214
130
|
|
131
|
+
ws.add_chart(chart_h_O2, 'AH2')
|
132
|
+
|
133
|
+
|
215
134
|
wb.save(file)
|
216
135
|
wb.close
|
217
136
|
```
|
4
タグ追加
title
CHANGED
File without changes
|
body
CHANGED
File without changes
|
3
補足
title
CHANGED
File without changes
|
body
CHANGED
@@ -17,6 +17,9 @@
|
|
17
17
|
〇 △ ◆
|
18
18
|
〇 △ ◆
|
19
19
|
|
20
|
+
ここから横軸はタイトル1,縦軸にタイトル2,3のデータを使用して,
|
21
|
+
グラフを作成したいと思っています。
|
22
|
+
|
20
23
|
必要な設定など,何か分かる方いたらよろしくお願いします。
|
21
24
|
|
22
25
|
### ソースコード
|
2
補足
title
CHANGED
File without changes
|
body
CHANGED
@@ -22,8 +22,15 @@
|
|
22
22
|
### ソースコード
|
23
23
|
|
24
24
|
```python
|
25
|
+
#生成されるグラフは
|
26
|
+
# x軸; 角度
|
27
|
+
# y軸は
|
28
|
+
#1; heat-O2
|
29
|
+
#2; thermo-C8H18
|
30
|
+
#3; thermo-radius
|
31
|
+
#4; O2-radius
|
32
|
+
#5; C8H18-radiusの5種類
|
25
33
|
|
26
|
-
|
27
34
|
#heat-O2のグラフ作成(第1軸)
|
28
35
|
chart_h_O2 = ScatterChart()
|
29
36
|
#chart_t.title = ""
|
1
書式の改善
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
openpyxlを利用して,Excelで縦軸が2つあるグラフ
|
1
|
+
openpyxlを利用して,Excelで縦軸が2つあるグラフが作成できない
|
body
CHANGED
@@ -1,5 +1,207 @@
|
|
1
|
+
### 前提・実現したいこと
|
1
|
-
python3.9でopenpyxlを利用して,縦軸が2つあるグラフを作成したい
|
2
|
+
python3.9でopenpyxlを利用して,縦軸が2つある散布図グラフを作成したいと思っています.
|
3
|
+
|
4
|
+
### 発生している問題・エラーメッセージ
|
5
|
+
下のリンクを参考に書いても,エラーなどは無く動くのですが,
|
2
|
-
|
6
|
+
結果のグラフで,第2軸が来るはずの左側の縦軸が表示されない状態です。
|
7
|
+
|
3
8
|
https://stackoverflow.com/questions/63696835/python-openpyxl-scatter-plots-with-secondary-y-axis
|
4
9
|
|
10
|
+
|
11
|
+
生データは,1行目に項目名のタイトル,
|
12
|
+
2行目以降にデータが行方向に並んだexcelファイルです
|
13
|
+
|
14
|
+
タイトル1 タイトル2 タイトル3
|
15
|
+
〇 △ ◆
|
16
|
+
〇 △ ◆
|
17
|
+
〇 △ ◆
|
18
|
+
〇 △ ◆
|
19
|
+
|
5
|
-
必要な設定など,何か分かる方いたらよろしくお願いします。
|
20
|
+
必要な設定など,何か分かる方いたらよろしくお願いします。
|
21
|
+
|
22
|
+
### ソースコード
|
23
|
+
|
24
|
+
```python
|
25
|
+
|
26
|
+
|
27
|
+
#heat-O2のグラフ作成(第1軸)
|
28
|
+
chart_h_O2 = ScatterChart()
|
29
|
+
#chart_t.title = ""
|
30
|
+
chart_h_O2.x_axis.title = "Angular cordinate [deg.] (from"+ str(temp_min) + "K to " + str(temp_max) + "K)"
|
31
|
+
chart_h_O2.y_axis.title = "Thermo diffusion [J/m^3/s]"
|
32
|
+
chart_h_O2.y_axis.scaling.logBase = 10
|
33
|
+
chart_h_O2.y_axis.numFmt = "0.00E+00"
|
34
|
+
chart_h_O2.x_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
35
|
+
chart_h_O2.y_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
36
|
+
chart_h_O2.x_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
37
|
+
chart_h_O2.y_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
38
|
+
|
39
|
+
#heat-C8H18のグラフ作成(第1軸)
|
40
|
+
chart_h_C8H18 = ScatterChart()
|
41
|
+
#chart_t.title = ""
|
42
|
+
chart_h_C8H18.x_axis.title = "Angular cordinate [deg.] (from"+ str(temp_min) + "K to " + str(temp_max) + "K)"
|
43
|
+
chart_h_C8H18.y_axis.title = "Thermo diffusion [J/m^3/s]"
|
44
|
+
chart_h_C8H18.y_axis.scaling.logBase = 10
|
45
|
+
chart_h_C8H18.y_axis.numFmt = "0.00E+00"
|
46
|
+
chart_h_C8H18.x_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
47
|
+
chart_h_C8H18.y_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
48
|
+
chart_h_C8H18.x_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
49
|
+
chart_h_C8H18.y_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
50
|
+
|
51
|
+
#heat-radiusのグラフ作成(第1軸)
|
52
|
+
chart_h_r = ScatterChart()
|
53
|
+
#chart_t.title = ""
|
54
|
+
chart_h_r.x_axis.title = "Angular cordinate [deg.]"
|
55
|
+
chart_h_r.y_axis.title = "Thermo diffusion [J/m^3/s]"
|
56
|
+
chart_h_r.y_axis.scaling.logBase = 10
|
57
|
+
chart_h_r.y_axis.numFmt = "0.00E+00"
|
58
|
+
chart_h_r.x_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
59
|
+
chart_h_r.y_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
60
|
+
chart_h_r.x_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
61
|
+
chart_h_r.y_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
62
|
+
|
63
|
+
#C8H18-radiusのグラフ作成(第1軸)
|
64
|
+
chart_C8H18_r = ScatterChart()
|
65
|
+
#chart_C8H18_r.title = "O2拡散量"
|
66
|
+
chart_C8H18_r.x_axis.title = "Angular cordinate [deg.]"
|
67
|
+
chart_C8H18_r.y_axis.title = "C8H18 diffusion [kg/m^3/s]"
|
68
|
+
chart_C8H18_r.y_axis.numFmt = "0.00E+00"
|
69
|
+
chart_C8H18_r.x_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
70
|
+
chart_C8H18_r.y_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
71
|
+
chart_C8H18_r.x_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
72
|
+
chart_C8H18_r.y_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
73
|
+
|
74
|
+
#O2-radiusのグラフ作成(第1軸)
|
75
|
+
chart_O2_r = ScatterChart()
|
76
|
+
#chart_C8H18.title = "O2拡散量"
|
77
|
+
chart_O2_r.x_axis.title = "Angular cordinate [deg.]"
|
78
|
+
chart_O2_r.y_axis.title = "O2 diffusion [kg/m^3/s]"
|
79
|
+
chart_O2_r.y_axis.numFmt = "0.00E+00"
|
80
|
+
chart_O2_r.x_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
81
|
+
chart_O2_r.y_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
82
|
+
chart_O2_r.x_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
83
|
+
chart_O2_r.y_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
84
|
+
|
85
|
+
#第2軸に付け足すもの↓
|
86
|
+
#radiusのグラフ作成(第2軸)
|
87
|
+
chart_r_2 = ScatterChart()
|
88
|
+
#chart_r.title = "熱拡散量"
|
89
|
+
chart_r_2.y_axis.title = "Flame radius [m]"
|
90
|
+
#chart_r_2.x_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
91
|
+
chart_r_2.y_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
92
|
+
#chart_r_2.x_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
93
|
+
chart_r_2.y_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
94
|
+
|
95
|
+
#C8H18のグラフ作成(第2軸)
|
96
|
+
chart_C8H18_2 = ScatterChart()
|
97
|
+
#chart_C8H18_2.title = "C8H18拡散量"
|
98
|
+
#chart_C8H18_2.x_axis.title = "Angular cordinate [deg.] (from"+ str(temp_min) + "K to " + str(temp_max) + "K)"
|
99
|
+
chart_C8H18_2.y_axis.title = "C8H18 diffusion [kg/m^3/s]"
|
100
|
+
chart_C8H18_2.y_axis.numFmt = "0.00E+00"
|
101
|
+
#chart_C8H18_2.x_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
102
|
+
chart_C8H18_2.y_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
103
|
+
#chart_C8H18_2.x_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
104
|
+
chart_C8H18_2.y_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
105
|
+
|
106
|
+
#O2のグラフ作成(第2軸)
|
107
|
+
chart_O2_2 = ScatterChart()
|
108
|
+
#chart_C8H18.title = "O2拡散量"
|
109
|
+
#chart_O2.x_axis.title = "Angular cordinate [deg.] (from"+ str(temp_min) + "K to " + str(temp_max) + "K)"
|
110
|
+
chart_O2_2.y_axis.title = "O2 diffusion [kg/m^3/s]"
|
111
|
+
chart_O2_2.y_axis.numFmt = "0.00E+00"
|
112
|
+
#chart_O2.x_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
113
|
+
chart_O2_2.y_axis.spPr = GraphicalProperties(ln =LineProperties(solidFill="E6E6E6", w=1*12700))
|
114
|
+
#chart_O2.x_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
115
|
+
chart_O2_2.y_axis.majorGridlines.spPr = GraphicalProperties(ln=LineProperties(solidFill= "E6E6E6", w=0.01*12700))
|
116
|
+
|
117
|
+
# 凡例の配置位置
|
118
|
+
#chart1.legend.position = 'b'
|
119
|
+
#r,l,t,b and tr for right, left, top, bottom and top right. default is right.
|
120
|
+
|
121
|
+
nrow=ws.max_row
|
122
|
+
ncol=ws.max_column
|
123
|
+
|
124
|
+
# 系列のY軸の値の参照する
|
125
|
+
rvalues = Reference(ws, min_col=r+1, max_col=r+1, min_row=2, max_row=73)
|
126
|
+
thermovalues = Reference(ws, min_col=h+1, max_col=h+1, min_row=2, max_row=73)
|
127
|
+
O2values = Reference(ws, min_col=O2+1, max_col=O2+1, min_row=2, max_row=73)
|
128
|
+
C8H18values = Reference(ws, min_col=C8H18+1, max_col=C8H18+1, min_row=2, max_row=73)
|
129
|
+
|
130
|
+
# 系列のX軸の値の参照する
|
131
|
+
agvalues = Reference(ws, min_col=ag+1, max_col=ag+1, min_row=2, max_row=73)
|
132
|
+
|
133
|
+
# 系列のデータをSeriesオブジェクトとして定義する
|
134
|
+
series_r = Series(rvalues, agvalues, title = " Location from "+ str(temp_min) + "K to " + str(temp_max) + "K (Flame radius)" )
|
135
|
+
series_h = Series(thermovalues, agvalues, title = "Thermo diffusion")
|
136
|
+
series_O2 = Series(O2values, agvalues, title = "O2 diffusion" )
|
137
|
+
series_C8H18 = Series(C8H18values, agvalues, title = "C8H18 diffusion")
|
138
|
+
|
139
|
+
serieslist = [series_r, series_h, series_O2, series_C8H18]
|
140
|
+
|
141
|
+
# 各系列のプロットを表現するマーカーのシンボルの指定を辞書形式で用意
|
142
|
+
#marker_symbol = {1:"triangle", 2:"diamond", 3:"square", 4:"star", 5:"circle", 6:"plus"}
|
143
|
+
|
144
|
+
# マーカーを塗り潰す色を同様に辞書形式で用意
|
145
|
+
# 色の指定はRGBのHex指定とColorChoiceオブジェクト指定による2タイプで指定
|
146
|
+
#marker_solidFill = {1:"00bFFF", 2:"FF4500", 3:"FFF0F",
|
147
|
+
# 4:ColorChoice(prstClr="midnightBlue"),
|
148
|
+
# 5:ColorChoice(prstClr="yellowGreen"),
|
149
|
+
# 6:ColorChoice(prstClr="cornflowerBlue")}
|
150
|
+
|
151
|
+
|
152
|
+
#各系列のマーカーの形状,色を指定
|
153
|
+
marker_solidFill = {1:"4169e1", 2:"ffc0cb", 3:"90ee90", 4:"90ee90"}
|
154
|
+
marker_linesolidFill = {1:"191970", 2:"ff4500", 3:"228b22", 4:"228b22"}
|
155
|
+
for i, obj in enumerate(serieslist, 1):
|
156
|
+
|
157
|
+
# ラインの設定
|
158
|
+
#obj.graphicalProperties.line.noFill = True
|
159
|
+
obj.spPr.ln.solidFill = marker_linesolidFill[i]
|
160
|
+
# 以下マーカーの設定
|
161
|
+
obj.marker.symbol = "circle" # シンボルを指定
|
162
|
+
obj.marker.size = 5 # サイズを指定
|
163
|
+
obj.marker.graphicalProperties.solidFill = marker_solidFill[i] # 塗りつぶし色
|
164
|
+
obj.marker.graphicalProperties.line.solidFill = marker_linesolidFill[i] # 枠線色
|
165
|
+
|
166
|
+
#各系列をグラフに追加
|
167
|
+
|
168
|
+
#第1軸となるグラフ
|
169
|
+
chart_h_O2.series.append(series_h)
|
170
|
+
chart_h_C8H18.series.append(series_h)
|
171
|
+
chart_h_r.series.append(series_h)
|
172
|
+
chart_C8H18_r.series.append(series_C8H18)
|
173
|
+
chart_O2_r.series.append(series_O2)
|
174
|
+
|
175
|
+
#第2軸となるグラフ
|
176
|
+
chart_O2_2.series.append(series_O2)
|
177
|
+
chart_C8H18_2.series.append(series_C8H18)
|
178
|
+
chart_r_2.series.append(series_r)
|
179
|
+
|
180
|
+
#第2軸のグラフを第1軸のグラフに合成
|
181
|
+
chart_h_O2 += chart_O2_2
|
182
|
+
chart_h_C8H18 += chart_C8H18_2
|
183
|
+
chart_h_r += chart_r_2
|
184
|
+
chart_C8H18_r += chart_r_2
|
185
|
+
chart_O2_r += chart_r_2
|
186
|
+
|
187
|
+
#第1軸となるグラフのリスト
|
188
|
+
chartlist = [chart_h_O2, chart_h_C8H18, chart_h_r, chart_C8H18_r, chart_O2_r]
|
189
|
+
for chart in chartlist:
|
190
|
+
chart.legend.legendPos = "b"
|
191
|
+
|
192
|
+
|
193
|
+
#第2軸となるグラフのリスト
|
194
|
+
chartlist2 = [chart_O2_2, chart_C8H18_2, chart_r_2]
|
195
|
+
for chart in chartlist2:
|
196
|
+
#自分のソースコードでは,第2軸が右に来るようにしています.
|
197
|
+
chart.y_axis.crosses = "max"
|
198
|
+
|
199
|
+
ws.add_chart(chart_h_r, 'AH2')
|
200
|
+
ws.add_chart(chart_O2_r, 'AH20')
|
201
|
+
ws.add_chart(chart_C8H18_r, 'AH38')
|
202
|
+
ws.add_chart(chart_h_O2, 'AH56')
|
203
|
+
ws.add_chart(chart_h_C8H18, 'AH74')
|
204
|
+
|
205
|
+
wb.save(file)
|
206
|
+
wb.close
|
207
|
+
```
|