kitikiplot 0.1.4__py3-none-any.whl → 0.1.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
kitikiplot/kitiki_cell.py CHANGED
@@ -1,11 +1,12 @@
1
1
  """
2
2
  File Name: kitiki_cell.py
3
- Description: This file defines the 'KitikiCell' class for each rectangular cell in kitiki plot
3
+ Description: This file defines the 'KitikiCell' class for each rectangular cell in KitikiPlot
4
4
  Author: Boddu Sri Pavan
5
5
  Date Created: 21-10-2024
6
- Last Modified: 07-12-2024
6
+ Last Modified: 19-02-2025
7
7
  """
8
8
 
9
+ # Import necessary libraries
9
10
  from typing import List, Dict, Union
10
11
  import pandas as pd
11
12
  import matplotlib.patches as mpatches
@@ -156,6 +157,11 @@ class KitikiCell(ColorConfig):
156
157
  # Calculate dimensions for the rectangle based on grid position and size parameters for transposed layout
157
158
  rect_dim= (cell_height*(y+1)+ align_factor, window_gap*(self.rows- x+1)+ cell_width*(self.rows- x+1))
158
159
 
160
+
161
+ # Clean up all local variables for efficient memory management
162
+ # del align_factor, rect_dim, x, y, cell_width, cell_height, align, window_gap
163
+ locals().clear()
164
+
159
165
  # Return a Rectangle object with specified dimensions and styles based on input parameters
160
166
  return Rectangle( rect_dim,
161
167
  width= cell_width,
@@ -1,10 +1,12 @@
1
1
  """
2
2
  File Name: kitiki_color_config.py
3
- Description: This file defines the 'ColorConfig' class for managing input data(list, dataframe) and configuring color, hatch of kitiki plot
3
+ Description: This file defines the 'ColorConfig' class for managing input data(list, dataframe) and configuring color, hatch of KitikiPlot
4
4
  Author: Boddu Sri Pavan
5
5
  Date Created: 21-10-2024
6
- Last Modified: 23-11-2024
6
+ Last Modified: 19-02-2025
7
7
  """
8
+
9
+ # Import necessary libraries
8
10
  from typing import Tuple, Union, Dict
9
11
  import random
10
12
  import math
@@ -12,6 +14,7 @@ import numpy as np
12
14
  import pandas as pd
13
15
  import matplotlib
14
16
  import matplotlib.pyplot as plt
17
+ import gc
15
18
 
16
19
  class ColorConfig:
17
20
  """
@@ -134,7 +137,14 @@ class ColorConfig:
134
137
  # Append the row to the list
135
138
  l.append( row_data )
136
139
 
137
- # Convert the list of rows into a 'pd.DataFrame' and return it
140
+ # Clean up all local variables for efficient memory management
141
+ # del n_rows, data, window_length, stride, i, row_data
142
+ locals().clear()
143
+
144
+ # Trigger garbage collection for efficient memory management
145
+ gc.collect()
146
+
147
+ # Convert the list of rows into a 'pda.DataFrame' and return it
138
148
  return pd.DataFrame( l )
139
149
 
140
150
  def unique_config(self) -> Tuple[np.ndarray, int]:
@@ -156,6 +166,9 @@ class ColorConfig:
156
166
  # Calculate the number of unique values found in the DataFrame
157
167
  n_unique= unique_values.shape[0]
158
168
 
169
+ # Trigger garbage collection for efficient memory management
170
+ gc.collect()
171
+
159
172
  # Return both the array of unique values and their count
160
173
  return unique_values, n_unique
161
174
 
@@ -211,6 +224,13 @@ class ColorConfig:
211
224
  # Assign fallback color for any missing unique value
212
225
  color_map.update( {each_unique: fallback_color} )
213
226
 
227
+ # Clean up all local variables for efficient memory management
228
+ # del unique_values, n_unique, cmap, custom_palette, i
229
+ locals().clear()
230
+
231
+ # Trigger garbage collection for efficient memory management
232
+ gc.collect()
233
+
214
234
  # Return the final color mapping and the specified edge color
215
235
  return color_map, edge_color
216
236
 
@@ -262,5 +282,12 @@ class ColorConfig:
262
282
  elif display_hatch== True and len(h_map)==0:
263
283
  h_map= dict(zip(unique_values, HATCH_PATTERN[:n_unique]))
264
284
 
285
+ # Clean up all local variables for efficient memory management
286
+ # del HATCH_PATTERN, unique_values, n_unique, display_hatch, each_unique_value, fallback_hatch
287
+ locals().clear()
288
+
289
+ # Trigger garbage collection for efficient memory management
290
+ gc.collect()
291
+
265
292
  # Return the configured 'h_map'
266
293
  return h_map
kitikiplot/kitikiplot.py CHANGED
@@ -1,17 +1,19 @@
1
1
  """
2
- File Name: Kiti.py
3
- Description: This file defines the 'KitikiPlot' class for generating kitki plot for categorical sequential& time-series data
2
+ File Name: kitikiplot.py
3
+ Description: This file defines the 'KitikiPlot' class to visualize categorical sliding window data
4
4
  Author: Boddu Sri Pavan
5
5
  Date Created: 21-10-2024
6
- Last Modified: 23-11-2024
6
+ Last Modified: 19-02-2025
7
7
  """
8
8
 
9
+ # Import necessary libraries
9
10
  from typing import List, Union
10
11
  import pandas as pd
11
12
  import matplotlib
12
13
  import matplotlib.pyplot as plt
13
14
  import matplotlib.patches as mpatches
14
15
  from .kitiki_cell import KitikiCell
16
+ import gc
15
17
 
16
18
  class KitikiPlot(KitikiCell):
17
19
  """
@@ -90,6 +92,7 @@ class KitikiPlot(KitikiCell):
90
92
  display_grid: bool = False,
91
93
  display_legend: bool = False,
92
94
  legend_hatch: bool = False,
95
+ return_figure: bool = False,
93
96
  legend_kwargs: dict = {},
94
97
  kitiki_cell_kwargs: dict = {}
95
98
  ) -> None:
@@ -398,6 +401,16 @@ class KitikiPlot(KitikiCell):
398
401
  # Pass in the color map, hatch map, and any additional keyword arguments for customization
399
402
  self.legend( ax= ax, color_map= self.color_map,hatch_map= self.hatch_map, legend_hatch= legend_hatch, **legend_kwargs )
400
403
 
404
+ # Clean up all local variables for efficient memory management
405
+ locals().clear()
406
+
407
+ # Trigger garbage collection for efficient memory management
408
+ gc.collect()
409
+
410
+ # Return the figure object if 'return_figure' is set to True
411
+ if return_figure:
412
+ return fig
413
+
401
414
  # Show the plot with all configurations applied
402
415
  plt.show()
403
416
 
@@ -439,7 +452,11 @@ class KitikiPlot(KitikiCell):
439
452
  # The hatch pattern is specified based on the 'hatch_map', multiplied by 2 for visibility
440
453
  legend_patches= [mpatches.Patch(facecolor= color_map[0][key], label= key, hatch= r"{}".format(hatch_map[key]*2)) for key in color_map[0]]
441
454
 
442
- kwargs= legend_kwargs
455
+ # Clean up all local variables for efficient memory management
456
+ locals().clear()
457
+
458
+ # Trigger garbage collection for efficient memory management
459
+ gc.collect()
443
460
 
444
461
  # Return the created legend object, attaching the generated patches and any additional kwargs
445
462
  return ax.legend(handles=legend_patches, **legend_kwargs)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kitikiplot
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Summary: A Python library to visualize categorical sliding window data.
5
5
  Home-page: https://github.com/BodduSriPavan-111/kitikiplot
6
6
  Author: Boddu Sri Pavan
@@ -75,11 +75,18 @@ ktk.plot( display_legend= True ) # Display the legend
75
75
  ```
76
76
  Check out the complete <b>guide of customization</b> [here](https://github.com/BodduSriPavan-111/kitikiplot/blob/main/examples/Usage_Guide.ipynb).
77
77
 
78
+ ## To-do
79
+ - [ ] Streamlit Demo Interfaces
80
+ - [ ] Tooltip
81
+ - [ ] Interactive Plot
82
+ - [ ] Multithreading to decrease plotting latency
83
+ - [ ] CI/CD Pipeline
84
+ - [ ] Domain-specific modules
85
+
78
86
  Please refer <a href="https://github.com/BodduSriPavan-111/kitikiplot/blob/main/CONTRIBUTING.md">CONTRIBUTING.md</a> for <b>contributions</b> to kitikiplot.
79
87
 
80
- ### Author
81
- <a href="https://www.linkedin.com/in/boddusripavan/"> Boddu Sri Pavan </a> &
82
- <a href="https://www.linkedin.com/in/boddu-swathi-sree-2a2a58332/"> Boddu Swathi Sree </a>
88
+ ### Key Author
89
+ <a href="https://www.linkedin.com/in/boddusripavan/"> Boddu Sri Pavan </a>
83
90
 
84
91
  ## Citation
85
92
  APA <br>
@@ -0,0 +1,9 @@
1
+ kitikiplot/__init__.py,sha256=7LpJy1V-PZ-JlfjsnRMjMXxTKaFt0JP0mj-A0SgS-sE,34
2
+ kitikiplot/kitiki_cell.py,sha256=9kn33x8-4Zp_fVdmp5NK-V7fm3hDXZOxwCNO3uDZqIo,7016
3
+ kitikiplot/kitiki_color_config.py,sha256=No_ayqgQUYXRE7g62obFKVn6avn4jdGn3WuSqZ6F3tA,11677
4
+ kitikiplot/kitikiplot.py,sha256=uH5eQnWxswQsDC1b77cu5U_2m3ODfKRGqCxcredRagQ,19746
5
+ kitikiplot-0.1.5.dist-info/LICENSE,sha256=14Bs-3ieyNjj9kCnVLv8CHRXEvQVM6P5uLe-pz7cBI0,1088
6
+ kitikiplot-0.1.5.dist-info/METADATA,sha256=VYUoJF9Ob5Mqoa8RY3rf0r0jRgyLXLzTQON4axkEQig,4811
7
+ kitikiplot-0.1.5.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
8
+ kitikiplot-0.1.5.dist-info/top_level.txt,sha256=nqjD8Sil5L7rfBQtnmLdJMR-u2BdVFnusZlOIU0Yd00,11
9
+ kitikiplot-0.1.5.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (72.1.0)
2
+ Generator: bdist_wheel (0.44.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,9 +0,0 @@
1
- kitikiplot/__init__.py,sha256=7LpJy1V-PZ-JlfjsnRMjMXxTKaFt0JP0mj-A0SgS-sE,34
2
- kitikiplot/kitiki_cell.py,sha256=N356LoJACH7qjoVn0T0GpLPVmXnyr6bBmM19dhLY7J8,6796
3
- kitikiplot/kitiki_color_config.py,sha256=_HsOr1txgj8E4-Xro6-ekLSRH0FSrSnzvpXjAD2AbMw,10718
4
- kitikiplot/kitikiplot.py,sha256=eOxtrRjg2u7AeDw4l1qE6qwutTlmKur_xpqLAnJViSs,19203
5
- kitikiplot-0.1.4.dist-info/LICENSE,sha256=14Bs-3ieyNjj9kCnVLv8CHRXEvQVM6P5uLe-pz7cBI0,1088
6
- kitikiplot-0.1.4.dist-info/METADATA,sha256=HqGg3Gm714J-7zLjatXrKP13IvVv0irm-Xwe5qMdvAk,4714
7
- kitikiplot-0.1.4.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
8
- kitikiplot-0.1.4.dist-info/top_level.txt,sha256=nqjD8Sil5L7rfBQtnmLdJMR-u2BdVFnusZlOIU0Yd00,11
9
- kitikiplot-0.1.4.dist-info/RECORD,,