89 lines
41 KiB
Plaintext
89 lines
41 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA28AAAK7CAYAAABlF7dxAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy80BEi2AAAACXBIWXMAAA9hAAAPYQGoP6dpAABzZ0lEQVR4nO3deXhU9dn/8c9MMtkTlmHHKDEIKFtRxCrQQgUUl4qIj1aRzYXa6k9ksaI+MFiVIrg8jcuDSw0qojXoo0FcYhQ3FEGwKgpoCBGCgAFCEgJhkjm/P2imiZmsM2dOTvJ+XVeu6+Sc73IPc3OSO9+Z7zgMwzAEAAAAAGjWnFYHAAAAAACoH8UbAAAAANgAxRsAAAAA2ADFGwAAAADYAMUbAAAAANgAxRsAAAAA2ADFGwAAAADYAMUbAAAAANhApNUB2J3P59Pu3buVmJgoh8NhdTgAAAAALGIYhoqLi9WtWzc5naFfJ6N4C9Lu3buVnJxsdRgAAAAAmomdO3fqhBNOCPm4FG9BSkxMlCTl5uaqffv2FkeDlsTr9eqdd97RmDFj5HK5rA4HLQz5BbOQWzAT+QWzhCq3ioqKlJyc7K8RQo3iLUiVL5VMTExUUlKSxdGgJfF6vYqLi1NSUhI/oBBy5BfMQm7BTOQXzBLq3DLr7VQUbyEyZUKO5CsI65yZaSvCOl+LMMBjdQQAAABAk7DbJAAAAADYAMUbAAAAANgAxRsAAAAA2ADFGwAAAADYAMUbAAAAANiArXabTE9P19SpU+ttl5WVpVGjRgW8lpOTo/vvv1/vvPOOfvrpJyUmJur000/XDTfcoMsuu6zpsWWkyu12N7l/03jCPB8AAAAAq9iqeKvkdDrVsWPHWq9HR0cHPL969WpdfvnlKi0tlSQlJSXpwIEDeuedd/T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Z6RqrcbncTom4Ij0njAgAAALCLVrETRtUdJqvuPPlLldf69u1rekwAAAAA0BgtqnjLyclRQcHx7fpTUlL854cNG+ZfbXvrrbcC9s3Ly9N3330nSRozZozJkQIAAABA49imeKtvXxXDMDRnzhxJx9//dtFFF/mvxcfH67LLLpMkPf744zp06FCN/osWLZJ0/P1u48aNC1HUAAAAABAatine8vLyNGTIEC1dulTbt2/3F3M+n0+fffaZxo4dq1dffVWSNH36dPXu3bta/7vvvlvx8fH66aefdPHFF+v777+XJB0+fFh33323/vd//1eSdNddd6ldu3ZhfGQAAAAAUD9bbViyfv16rV+/XtLxXR8TExNVXFxcbev+qVOn6u9//3uNvikpKfrnP/+pyy+/XB999JF69eqlNm3aqKSkRBUVFf6+lat3AAAAANCc2KZ469y5s9LS0vTpp5/qyy+/1M8//6yDBw8qJiZGKSkpOuecczRt2jQNHTq01jEuuOACffXVV1q0aJGysrL0008/qV27dho0aJCmT5/uf2llU0yZkCP5Cprcv7Ey01aEbS5YxOeUNFDavFDi4yIQauQXzEJuwUzkF35pgMfqCMLKNsVbbGysbrrpJt10001BjZOamqonnngiRFEBAAAAQHjY5j1vAAAAANCaUbwBAAAAgA1QvAEAAACADVC8AQAAAIAN2GbDkuYuPSNVbrc7jDN6wjgXLOH1Snmrpb5zJZfL6mjQ0pBfMAu5BTORX2jlWHkDAAAAABugeAMAAAAAG6B4AwAAAAAboHgDAAAAABugeAMAAAAAG2C3yRCZMiFH8hVYMndm2gpL5oXJfE5JA6XNCyWnz+poUJcBHqsjAAAArQArbwAAAABgAxRvAAAAAGADFG8AAAAAYAMUbwAAAABgAxRvAAAAAGAD7DYZIukZqXK73RbN7rFoXpjK65XyVkt950oul9XRAAAAwGKsvAEAAACADVC8AQAAAIANULwBAAAAgA1QvAEAAACADVC8AQAAAIANsNtkiEyZkCP5CqwOo5rMtBVWhyAN8FgdAQAAANAisPIGAAAAADZA8QYAAAAANkDxBgAAAAA2QPEGAAAAADZA8QYAAAAANsBukyGSnpEqt9ttdRi/4LE6AAAAAAAhwsobAAAAANgAxRsAAAAA2ADFGwAAAADYAMUbAAAAANgAxRsAAAAA2AC7TYbIlAk5kq8gbPNlpq0I21ymG+CxOgIAAACg2WPlDQAAAABsgOINAAAAAGyA4g0AAAAAbIDiDQAAAABsgOINAAAAAGzA9rtN/u1vf9PcuXP93xuGUaNNenq6pk6dWu9YWVlZGjVqVJPiSM9IldvtblLfpvGEcS4AAAAAVrN18bZ161YtWLCgwe2dTqc6duxY6/Xo6OhQhAUAAAAAIWfb4s3n82natGk6evSozj77bH366af19klOTtaOHTvMDw4AAAAAQsy273lLS0vT2rVrdfXVV2vMmDFWhwMAAAAAprJl8Zabm6s777xTbrdbDz30kNXhAAAAAIDpbPmyyeuvv16HDx/WY489Vud72AAAAACgpbBd8fbkk08qOztbo0aN0qRJkxrV9+eff9YZZ5yhrVu3qqKiQl27dtU555yj6667TiNGjAgqrikTciRfQVBjNEVm2oqwz4kw8TklDZQ2L5ScPqujabkGeKyOAAAAoEFs9bLJ/Px8zZkzR7GxsVq6dGmj+5eWlmrjxo2KioqSz+dTbm6uli9frpEjR2ratGkqLy83IWoAAAAACJ6tVt6mT5+uQ4cOadGiRTr55JMb3K9bt26aP3++xo8fr969eys6OloVFRVat26d5s+fr3fffVfPPPOM4uPjlZaWVudYZWVlKisr839fVFQkSXJFVkiqaNLjCobXZ6v6G41Q+dzyHJvM67U6Akt4//24va308cM85BbMRH7BLKHKLbNz02EE+lTrZuj555/XNddco1/96ldav369IiP/U3d6PB7/57019uH4fD6NHz9er732mpxOp7Zs2aJTTjml1vZV56rqhRdeUFxcXKP
|
||
|
"text/plain": [
|
||
|
"<Figure size 1000x800 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"import pandas as pd\n",
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"import numpy as np\n",
|
||
|
"\n",
|
||
|
"# 전체 글꼴 크기 설정\n",
|
||
|
"plt.rcParams.update({'font.size': 18})\n",
|
||
|
"\n",
|
||
|
"# CSV 파일 읽기\n",
|
||
|
"df = pd.read_csv('raw_data.csv')\n",
|
||
|
"\n",
|
||
|
"# ships_idx 별 전체 갯수 계산\n",
|
||
|
"total_counts = df['ships_idx'].value_counts().sort_index()\n",
|
||
|
"\n",
|
||
|
"# ships_idx 별 MDM=True 인 갯수 계산\n",
|
||
|
"mdm_true_counts = df[df['MDM'] == True]['ships_idx'].value_counts().sort_index()\n",
|
||
|
"\n",
|
||
|
"# 데이터프레임으로 합치기\n",
|
||
|
"summary_df = pd.DataFrame({\n",
|
||
|
" 'SD': total_counts,\n",
|
||
|
" 'PD': mdm_true_counts\n",
|
||
|
"}).fillna(0) # NaN 값을 0으로 대체\n",
|
||
|
"\n",
|
||
|
"# 시각화\n",
|
||
|
"fig, ax = plt.subplots(figsize=(10, 8))\n",
|
||
|
"\n",
|
||
|
"# Total Counts 먼저 그리기\n",
|
||
|
"summary_df['SD'].plot(kind='barh', ax=ax, color='orange', alpha=0.5, label='SD')\n",
|
||
|
"\n",
|
||
|
"# MDM=True Counts를 그 위에 겹쳐서 그리기\n",
|
||
|
"summary_df['PD'].plot(kind='barh', ax=ax, color='blue', alpha=0.7, label='PD')\n",
|
||
|
"\n",
|
||
|
"# y축 라벨 설정 (5 단위로만 표시)\n",
|
||
|
"y_labels = ax.get_yticks()\n",
|
||
|
"ax.set_yticks(np.arange(min(y_labels), max(y_labels)+1, 5))\n",
|
||
|
"ax.set_yticklabels([int(label) for label in np.arange(min(y_labels), max(y_labels)+1, 5)])\n",
|
||
|
"\n",
|
||
|
"# 그리드 추가\n",
|
||
|
"ax.grid(True)\n",
|
||
|
"\n",
|
||
|
"# 범례와 제목 설정\n",
|
||
|
"plt.legend(prop={'size': 18}) # 레전드 글꼴 크기 설정\n",
|
||
|
"plt.xlabel('Counts')\n",
|
||
|
"plt.ylabel('Ships')\n",
|
||
|
"plt.show()\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": "torch",
|
||
|
"language": "python",
|
||
|
"name": "python3"
|
||
|
},
|
||
|
"language_info": {
|
||
|
"codemirror_mode": {
|
||
|
"name": "ipython",
|
||
|
"version": 3
|
||
|
},
|
||
|
"file_extension": ".py",
|
||
|
"mimetype": "text/x-python",
|
||
|
"name": "python",
|
||
|
"nbconvert_exporter": "python",
|
||
|
"pygments_lexer": "ipython3",
|
||
|
"version": "3.10.14"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 2
|
||
|
}
|