인공지능 공부/컴퓨터 비전

2022_Ukraine Russia War visualization

import numpy as np
import pandas as pd

import plotly
import plotly.graph_objs as go
import plotly.express as px
from plotly.subplots import make_subplots
import seaborn as sns


ru_losses_per = pd.read_csv('/root/yj/yj/Kaggle/data/Ukraine_war/russia_losses_personnel.csv')
ru_losses_eq = pd.read_csv('/root/yj/yj/Kaggle/data/Ukraine_war/russia_losses_equipment.csv')
x, y = ru_losses_per['date'], ru_losses_per['personnel']

fig = go.Figure()

fig.add_trace(go.Scatter(x=x, y=y, mode='lines+markers', name='lines+markers'))

fig.show()

ru_losses_eq.head()

# Create data
x = ru_losses_eq['date']
y0 = ru_losses_eq['aircraft']
y1 = ru_losses_eq['helicopter']
y2 = ru_losses_eq['anti-aircraft warfare']
y3 = ru_losses_eq['drone']

# Create plot
fig = go.Figure()

# Add traces
fig.add_trace(go.Scatter(x=x, y=y0,
                    mode='lines+markers',
                    name='Aircraft'))
fig.add_trace(go.Scatter(x=x, y=y1,
                    mode='lines+markers',
                    name='Helicopter'))
fig.add_trace(go.Scatter(x=x, y=y2,
                    mode='lines+markers',
                    name='Anti-aircraft warfare'))
fig.add_trace(go.Scatter(x=x, y=y3,
                    mode='lines+markers',
                    name='Drone'))
fig.update_layout(legend_orientation="h",
                  legend=dict(x=0, y=1, traceorder="normal"),
                  title="Weapons: Air",
                  xaxis_title="Date",
                  yaxis_title="Weapons ",
                  margin=dict(l=0, r=0, t=30, b=0))
fig.show()

# Create data
x = ru_losses_eq['date']
y0 = ru_losses_eq['tank']
y1 = ru_losses_eq['field artillery']
y2 = ru_losses_eq['APC']
y3 = ru_losses_eq['military auto']

# Create plot
fig = go.Figure()

# Add traces
fig.add_trace(go.Scatter(x=x, y=y0,
                    mode='lines+markers',
                    name='Tank'))
fig.add_trace(go.Scatter(x=x, y=y1,
                    mode='lines+markers',
                    name='Field artillery'))
fig.add_trace(go.Scatter(x=x, y=y2,
                    mode='lines+markers',
                    name='APC'))
fig.add_trace(go.Scatter(x=x, y=y3,
                    mode='lines+markers',
                    name='Military auto'))
fig.update_layout(legend_orientation="h",
                  legend=dict(x=0, y=1, traceorder="normal"),
                  title="Weapons: Ground, Other",
                  xaxis_title="Date",
                  yaxis_title="Weapons ",
                  margin=dict(l=0, r=0, t=30, b=0))
fig.show()