fig = px.bar(df, x =' 구분 ',y = ' 세대수 ', title = '부산광역시 인구현황')
fig.show()
기본적인 동별 세대수
fig = go.Figure()
fig = make_subplots(rows=1,cols=2)
fig.add_trace(go.Bar(x=df[' 구분 '],y=df[' 인구수(남) '],name = "인구(남)"),row=1,col=1)
fig.add_trace(go.Bar(x=df[' 구분 '],y=df[' 인구수(여) '],name = "인구(여)"),row=1,col=2)
fig.update_xaxes(tickangle=45, row=1, col=1)#tick angle = 눈금 각도, 글자의 각도를 수정할 수 있게 해준다
fig.update_xaxes(tickangle=45, row=1, col=2)
fig.show()
fig = px.pie(df, values = ' 세대수 ',names = ' 구분 ')
fig.update_layout(title = "부산동별 세대수")
fig.show()
fig = px.scatter(df, x = ' 구분 ', y = ' 세대수 ')
fig.add_trace(go.Scatter(x=df[' 구분 '],y=df[' 세대수 '])name="세대수")
fig.update_xaxes(tickangle=0)
fig.show()
fig = go.Figure()
fig = make_subplots(rows=2,cols=2, subplot_titles=("인구수(남)","인구수(여)","18세이상인구수(남)","18세이상인구수(여)"))
fig.add_trace(go.Bar(x=df[' 구분 '],y=df[' 인구수(남) '],name = "인구(남)"),row=1,col=1)
fig.add_trace(go.Bar(x=df[' 구분 '],y=df[' 인구수(여) '],name = "인구(여)"),row=1,col=2)
fig.add_trace(go.Bar(x=df[' 구분 '],y=df[' 18세이상인구수(남) '],name = "18세이상인구(남)"),row=2,col=1)
fig.add_trace(go.Bar(x=df[' 구분 '],y=df[' 18세이상인구수(여) '],name = "18세이상인구(여)"),row=2,col=2)
fig.update_xaxes(tickangle=45, row=1, col=1)#tick angle = 눈금 각도, 글자의 각도를 수정할 수 있게 해준다
fig.update_xaxes(tickangle=45, row=1, col=2)
fig.update_xaxes(tickangle=45,row=2,col=1)
fig.update_xaxes(tickangle=45,row=2,col=2)
fig.update_layout(title_text="부산인구현황",)
fig.show()
fig = go.Figure()
fig = make_subplots(rows=2,cols=2, subplot_titles=("인구수(남)","인구수(여)","18세이상인구수(남)","18세이상인구수(여)"))
fig.add_trace(go.Bar(x=df[' 구분 '],y=df[' 인구수(남) '],name = "인구(남)"),row=1,col=1)
fig.add_trace(go.Bar(x=df[' 구분 '],y=df[' 인구수(여) '],name = "인구(여)"),row=1,col=2)
fig.add_trace(go.Scatter(x=df[' 구분 '],y=df[' 18세이상인구수(남) '],name = "18세이상인구(남)"),row=2,col=1)
fig.add_trace(go.Scatter(x=df[' 구분 '],y=df[' 18세이상인구수(여) '],name = "18세이상인구(여)"),row=2,col=2)
fig.update_xaxes(tickangle=45, row=1, col=1)#tick angle = 눈금 각도, 글자의 각도를 수정할 수 있게 해준다
fig.update_xaxes(tickangle=45, row=1, col=2)
fig.update_xaxes(tickangle=45,row=2,col=1)
fig.update_xaxes(tickangle=45,row=2,col=2)
fig.update_layout(title_text="부산인구현황",)
fig.show()
fig = px.scatter(df, x = ' 구분 ', y = ' 인구수(계) ')
fig.add_trace(go.Scatter(x=df[' 구분 '],y=df[' 인구수(계) '],mode='lines+markers',name='인구수'))
fig.add_trace(go.Scatter(x=df[' 구분 '],y=df[' 65세이상인구수(계) '],mode='lines+markers',name='65세이상인구수'))
fig.add_trace(go.Scatter(x=df[' 구분 '],y=df[' 18세이상인구수(계) '],mode='lines+markers',name='18세이상인구수'))
fig.update_xaxes(tickangle=0)
fig.update_layout(title = "총인구수 및 18,65세이상인구수")
fig.show()
fig = make_subplots(rows=2,cols=2, column_widths=[0.3, 0.7], row_heights =[0.7, 0.3], subplot_titles=("인구수(남)","인구수(여)","18세이상인구수(남)","18세이상인구수(여)"))
fig.add_trace(go.Bar(x=df[' 구분 '],y=df[' 인구수(남) '],name = "인구(남)"),row=1,col=1)
fig.add_trace(go.Bar(x=df[' 구분 '],y=df[' 인구수(여) '],name = "인구(여)"),row=1,col=2)
fig.add_trace(go.Scatter(x=df[' 구분 '],y=df[' 18세이상인구수(남) '],name = "18세이상인구(남)"),row=2,col=1)
fig.add_trace(go.Scatter(x=df[' 구분 '],y=df[' 18세이상인구수(여) '],name = "18세이상인구(여)"),row=2,col=2)
fig.update_xaxes(tickangle=45, row=1, col=1)#tick angle = 눈금 각도, 글자의 각도를 수정할 수 있게 해준다
fig.update_xaxes(tickangle=45, row=1, col=2)
fig.update_xaxes(tickangle=45,row=2,col=1)
fig.update_xaxes(tickangle=45,row=2,col=2)
fig.update_layout(title_text="부산인구현황",)
fig.show()
fig = px.scatter(df, x = ' 구분 ', y = ' 세대수 ')
fig.add_vrect(x0=1, x1=5, line_width=0, fillcolor="white", opacity=0.5,
annotation_text="편차가 크다",
annotation_position="bottom right",
annotation_font_size=10,
annotation_font_color="black",
annotation_font_family="Times New Roman")
fig.add_trace(go.Scatter(x=df[' 구분 '],y=df[' 세대수 '],name="세대수"))
fig.update_layout(title = "동별 세대수")
fig.update_xaxes(tickangle=0)
fig.show()
fig = go.Figure()
fig.add_trace(
go.Table(header=dict(values=["세대수","인구수","인구수(남)","인구수(여)"]), #헤더
cells=dict(values=[df[' 세대수 '], # 1열
df[' 인구수(계) '],
df[' 인구수(남) '],
df[' 인구수(여) ']]))) # 2열
fig.update_layout(title ="Table")
fig.show()