zerohertzLib.plot.bar_chart ¶
Functions:
| Name | Description |
|---|---|
barh | Dictionary로 입력받은 data를 세로 bar chart로 시각화 |
barv | Dictionary로 입력받은 data를 가로 bar chart로 시각화 |
hist | Dictionary로 입력받은 data를 histogram으로 시각화 |
barh ¶
barh(data: dict[str, Any], xlab: str | None = None, ylab: str | None = None, xlim: list[int | float] | None = None, ylim: list[int | float] | None = None, title: str = 'tmp', colors: str | list | None = None, figsize: tuple[int, int] = (10, 15), rot: int = 0, dim: str | None = None, dimsize: float = 10, sign: int = 1, dpi: int = 300) -> str | None
Dictionary로 입력받은 data를 세로 bar chart로 시각화
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data | dict[str, Any] | 입력 data | required |
xlab | str | None | Graph에 출력될 X축 label | None |
ylab | str | None | Graph에 출력될 Y축 label | None |
xlim | list[int | float] | None | Graph에 출력될 X축 limit | None |
ylim | list[int | float] | None | Graph에 출력될 Y축 limit | None |
title | str | Graph에 표시될 제목 및 file 이름 | 'tmp' |
colors | str | list | None | 각 요소의 색 | None |
figsize | tuple[int, int] | Graph의 가로, 세로 길이 | (10, 15) |
rot | int | X축의 눈금 회전 각도 | 0 |
dim | str | None | 각 bar 상단에 표시될 값의 단위 ( | None |
dimsize | float | 각 bar 상단에 표시될 값의 크기 | 10 |
sign | int | 각 bar 상단에 표시될 값의 유효숫자 | 1 |
dpi | int | Graph 저장 시 DPI (Dots Per Inch) | 300 |
Returns:
| Type | Description |
|---|---|
str | None | 저장된 graph의 절대 경로 |
Examples:
>>> data = {"Terran": 27, "Zerg": 40, "Protoss": -30}
>>> zz.plot.barh(data, xlab="Population", ylab="Races", title="Star Craft", dim="")
>>> data = {"yticks": ["Terran", "Zerg", "Protoss"], "Type A": [4, 5, 6], "Type B": [4, 3, 2], "Type C": [8, 5, 12], "Type D": [6, 3, 2]}
>>> zz.plot.barh(data, xlab="Time [Sec]", ylab="Races", title="Star Craft", dim="%", sign=2)
Source code in zerohertzLib/plot/bar_chart.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | |
barv ¶
barv(data: dict[str, Any], xlab: str | None = None, ylab: str | None = None, xlim: list[int | float] | None = None, ylim: list[int | float] | None = None, title: str = 'tmp', colors: str | list | None = None, figsize: tuple[int, int] = (15, 10), rot: int = 0, dim: str | None = None, dimsize: float = 10, sign: int = 1, dpi: int = 300) -> str | None
Dictionary로 입력받은 data를 가로 bar chart로 시각화
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data | dict[str, Any] | 입력 data | required |
xlab | str | None | Graph에 출력될 X축 label | None |
ylab | str | None | Graph에 출력될 Y축 label | None |
xlim | list[int | float] | None | Graph에 출력될 X축 limit | None |
ylim | list[int | float] | None | Graph에 출력될 Y축 limit | None |
title | str | Graph에 표시될 제목 및 file 이름 | 'tmp' |
colors | str | list | None | 각 요소의 색 | None |
figsize | tuple[int, int] | Graph의 가로, 세로 길이 | (15, 10) |
rot | int | X축의 눈금 회전 각도 | 0 |
dim | str | None | 각 bar 상단에 표시될 값의 단위 ( | None |
dimsize | float | 각 bar 상단에 표시될 값의 크기 | 10 |
sign | int | 각 bar 상단에 표시될 값의 유효숫자 | 1 |
dpi | int | Graph 저장 시 DPI (Dots Per Inch) | 300 |
Returns:
| Type | Description |
|---|---|
str | None | 저장된 graph의 절대 경로 |
Examples:
>>> data = {"Terran": 27, "Zerg": 40, "Protoss": -30}
>>> zz.plot.barv(data, xlab="Races", ylab="Population", title="Star Craft", dim="")
>>> data = {"xticks": ["Terran", "Zerg", "Protoss"], "Type A": [4, 5, 6], "Type B": [4, 3, 2], "Type C": [8, 5, 12], "Type D": [6, 3, 2]}
>>> zz.plot.barv(data, xlab="Races", ylab="Time [sec]", title="Star Craft", dim="%", sign=2)
Source code in zerohertzLib/plot/bar_chart.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
hist ¶
hist(data: dict[str, list[int | float]], xlab: str | None = None, ylab: str | None = None, xlim: list[int | float] | None = None, ylim: list[int | float] | None = None, title: str = 'tmp', colors: str | list | None = None, cnt: int = 30, ovp: bool = True, figsize: tuple[int, int] = (15, 10), dpi: int = 300) -> str | None
Dictionary로 입력받은 data를 histogram으로 시각화
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data | dict[str, list[int | float]] | 입력 data | required |
xlab | str | None | Graph에 출력될 X축 label | None |
ylab | str | None | Graph에 출력될 Y축 label | None |
xlim | list[int | float] | None | Graph에 출력될 X축 limit | None |
ylim | list[int | float] | None | Graph에 출력될 Y축 limit | None |
title | str | Graph에 표시될 제목 및 file 이름 | 'tmp' |
colors | str | list | None | 각 요소의 색 | None |
cnt | int | Bin의 개수 | 30 |
ovp | bool | Class에 따른 histogram overlap 여부 | True |
figsize | tuple[int, int] | Graph의 가로, 세로 길이 | (15, 10) |
dpi | int | Graph 저장 시 DPI (Dots Per Inch) | 300 |
Returns:
| Type | Description |
|---|---|
str | None | 저장된 graph의 절대 경로 |
Examples:
>>> data = {"Terran": list(np.random.rand(1000) * 10), "Zerg": list(np.random.rand(1000) * 10 + 1), "Protoss": list(np.random.rand(1000) * 10 + 2)}
>>> zz.plot.hist(data, xlab="Scores", ylab="Population", title="Star Craft")


