質問編集履歴

1

コードを修正してfigを変えた

2020/05/25 23:56

投稿

samankoar
samankoar

スコア7

test CHANGED
File without changes
test CHANGED
@@ -95,3 +95,75 @@
95
95
 
96
96
 
97
97
  よろしくお願いします。
98
+
99
+ ### 修正ソースコード
100
+
101
+
102
+
103
+ ```ここに言語名を入力
104
+
105
+ fig = plt.figure(figsize=(10, 5))
106
+
107
+
108
+
109
+ ax1 = fig.add_subplot(1,2,1)
110
+
111
+ ax2 = fig.add_subplot(1,2,2)
112
+
113
+
114
+
115
+ year=international_couples_1965_2015['Year']
116
+
117
+ international_couples=international_couples_1965_2015['International_couple_Number']
118
+
119
+ japanese_couples=international_couples_1965_2015['Total_marriages_couple']-international_couples_1965_2015['International_couple_Number']
120
+
121
+ ax1.plot(year,international_couples,label='international_couples')
122
+
123
+ ax1.plot(year,japanese_couples,label='japanese_couples')
124
+
125
+
126
+
127
+ ax1.set_xlim(1960,2020,5)
128
+
129
+ ax1.set_xlabel('Year')
130
+
131
+ ax1.set_ylabel('Marriages Couple Number')
132
+
133
+
134
+
135
+ ax1.legend()
136
+
137
+ ax2.plot(year,
138
+
139
+ international_couples_1965_2015['Japanese groom and foreign bride'],
140
+
141
+ label='husband:japanese', color='blue')
142
+
143
+ ax2.plot(international_couples_1965_2015['Year'],
144
+
145
+ international_couples_1965_2015['Japanese bride and foreign groom'],
146
+
147
+ label='husband:non-japanese', color='orange')
148
+
149
+ ax2.set_xlim(1960,2020,5)
150
+
151
+ ax2.set_xlabel('Year')
152
+
153
+ ax2.set_ylabel('Marriages Couple Number')
154
+
155
+
156
+
157
+ ![イメージ説明]![イメージ説明](b102fc303de44e352693c8c78c1c7b68.png)
158
+
159
+
160
+
161
+ plt.subplots_adjust(wspace=0.6, hspace=0.4)
162
+
163
+
164
+
165
+ plt.show()
166
+
167
+ plt.tight_layout()
168
+
169
+ ```