kitikiplot 0.2.4__py3-none-any.whl → 0.2.6__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.
@@ -79,6 +79,8 @@ class KitikiCell(ColorConfig):
79
79
  fallback_hatch: str,
80
80
  display_hatch: bool,
81
81
  transpose: bool,
82
+ focus,
83
+ focus_alpha,
82
84
  **kitiki_cell_kwargs: dict) -> mpatches.Rectangle:
83
85
 
84
86
  """
@@ -142,8 +144,28 @@ class KitikiCell(ColorConfig):
142
144
  # Calculate alignment factor based on whether alignment is enabled
143
145
  align_factor= (self.rows-x)*self.stride*cell_height if align else 0
144
146
 
145
- # Calculate dimensions for the rectangle based on grid position and size parameters
146
- rect_dim= (window_gap*(x+1)+ cell_width*(x+1) , cell_height*(self.cols-y-1)+align_factor)
147
+ dim_x= window_gap*(x+1)+ cell_width*(x+1)
148
+ dim_y= cell_height*(self.cols-y-1)+align_factor
149
+
150
+ if focus == None:
151
+
152
+ # Calculate dimensions for the rectangle based on grid position and size parameters
153
+ rect_dim= ( dim_x, dim_y )
154
+
155
+ else:
156
+
157
+ align_factor= (self.rows)*self.stride*cell_height
158
+ focus_dim_y= cell_height*(self.cols-y-1)+align_factor
159
+
160
+ # Calculate dimensions for the rectangle based on grid position and size parameters
161
+ rect_dim= ( dim_x, focus_dim_y )
162
+
163
+ max_y= cell_height*(self.cols-1)+ ((self.rows)*self.stride*cell_height)
164
+
165
+ if (focus_dim_y >= max_y - (cell_height*self.window_length + cell_height*x*self.stride)) and (focus_dim_y < max_y - (cell_height*x*self.stride)):
166
+ kitiki_cell_kwargs["alpha"]= 1
167
+ else:
168
+ kitiki_cell_kwargs["alpha"]= focus_alpha
147
169
 
148
170
  # Adjust dimensions if 'transpose' is set to 'True'
149
171
  else:
@@ -154,8 +176,11 @@ class KitikiCell(ColorConfig):
154
176
  # Calculate alignment factor for transposed configuration based on whether alignment is enabled
155
177
  align_factor= x*self.stride*cell_height if align else 0
156
178
 
179
+ dim_x= cell_height*(y+1)+ align_factor
180
+ dim_y= window_gap*(self.rows- x+1)+ cell_width*(self.rows- x+1)
157
181
  # Calculate dimensions for the rectangle based on grid position and size parameters for transposed layout
158
- rect_dim= (cell_height*(y+1)+ align_factor, window_gap*(self.rows- x+1)+ cell_width*(self.rows- x+1))
182
+ rect_dim= (dim_x, dim_y)
183
+
159
184
 
160
185
 
161
186
  # Clean up all local variables for efficient memory management
@@ -94,14 +94,10 @@ class ColorConfig:
94
94
  # Convert 'list' to 'pd.DataFrame' using stride and window_length, and initialize 'data' attribute
95
95
  self.data= self._convert_list_to_dataframe( list(data), stride, window_length)
96
96
 
97
- # Store the stride value
98
- self.stride= stride
99
-
100
- # Set 'rows' to number of rows in the DataFrame
101
97
  self.rows= self.data.shape[0]
102
-
103
- # Set 'cols' to number of columns in the DataFrame
104
98
  self.cols= self.data.shape[1]
99
+ self.stride= stride
100
+ self.window_length= window_length
105
101
 
106
102
  @staticmethod
107
103
  def _convert_list_to_dataframe( data: Union[pd.DataFrame, list], stride: int = 1, window_length: int = 10) -> pd.DataFrame:
@@ -8,6 +8,7 @@ Last Modified: 19-02-2025
8
8
 
9
9
  # Import necessary libraries
10
10
  from typing import List, Union
11
+ import numpy as np
11
12
  import pandas as pd
12
13
  import matplotlib
13
14
  import matplotlib.pyplot as plt
@@ -77,6 +78,8 @@ class KitikiPlot(KitikiCell):
77
78
  hmap: dict = {},
78
79
  fallback_hatch: str = " ",
79
80
  display_hatch: bool = False,
81
+ focus: Union[tuple, list] = None,
82
+ focus_alpha: float = 0.25,
80
83
  transpose: bool = False,
81
84
  xlabel: str = "Sliding Windows",
82
85
  ylabel: str = "Frames",
@@ -143,6 +146,13 @@ class KitikiPlot(KitikiCell):
143
146
  display_hatch : bool
144
147
  - A flag indicating whether to display hatch patterns on cells.
145
148
  - Default is False.
149
+ focus : tuple or list
150
+ - Index range to set focus/ highlight
151
+ - If focus is (i, j) then index values: i, i+1, i+2, ... j-1 are highlighted (0% transparent)
152
+ - Default is None
153
+ focus_alpha : float
154
+ - Transparency value to de-emphasize indices falling out of 'focus'
155
+ - Default is 0.25
146
156
  transpose : bool (optional)
147
157
  - A flag indicating whether to transpose the KitikiPlot.
148
158
  - Default is False.
@@ -236,13 +246,24 @@ class KitikiPlot(KitikiCell):
236
246
  # This allows for plotting only a subset of the data based on the user-defined range
237
247
  window_range= range( window_range[0], window_range[1])
238
248
 
249
+ if focus != None:
250
+ col_range= self.rows + self.window_length - 1
251
+ print( "COLUMN Range: ", col_range )
252
+ else:
253
+ col_range= self.cols
254
+
255
+ each_sample= np.concatenate( (data[0], data[1:data.shape[0], (-1)*self.stride:].flatten()) )
256
+
239
257
  # Generate cells for each sample in the specified window range and time frame columns
240
258
  for index in window_range:
241
259
 
242
- each_sample= data[ index ]
260
+ if focus == None:
261
+ each_sample= data[ index ]
243
262
 
244
- for time_frame in range(self.cols):
263
+ for time_frame in range( col_range ):
245
264
 
265
+ kitiki_cell_kwargs["alpha"]= focus_alpha if focus != None and ( time_frame< focus[0] or time_frame>= focus[1] ) else 1
266
+
246
267
  # Create each cell using specified parameters and add it to patches list
247
268
  cell_gen= self.create( x= index,
248
269
  y= time_frame,
@@ -258,6 +279,8 @@ class KitikiPlot(KitikiCell):
258
279
  fallback_hatch= fallback_hatch,
259
280
  display_hatch= display_hatch,
260
281
  transpose= transpose,
282
+ focus= focus,
283
+ focus_alpha= focus_alpha,
261
284
  **kitiki_cell_kwargs
262
285
  )
263
286
  patches.append( cell_gen )
@@ -0,0 +1,30 @@
1
+ """
2
+ File Name: linear.py
3
+ Description: This file defines linear concentration plot
4
+ Author: Boddu Sri Pavan
5
+ Date Created: 25-05-2025
6
+ Last Modified: 25-05-2025
7
+ """
8
+
9
+ from kitikiplot.core import KitikiPlot
10
+
11
+ def plot( data, focus, focus_alpha, xlabel, ylabel, xticks_values, ytick_prefix, cmap= {} ):
12
+
13
+ ktk= KitikiPlot( data= data, stride= 1, window_length= len(data) )
14
+
15
+ ktk.plot(
16
+ figsize= (20, 1),
17
+ cell_width= 2,
18
+ cmap= cmap,
19
+ focus= focus,
20
+ focus_alpha= focus_alpha,
21
+ transpose= True,
22
+ xlabel= xlabel,
23
+ ylabel= ylabel,
24
+ display_xticks= True,
25
+ xticks_values= xticks_values,
26
+ ytick_prefix= ytick_prefix,
27
+ xticks_rotation= 90,
28
+ display_legend= True,
29
+ title= "Linear Plot: Ecology Data Visualization",
30
+ legend_kwargs= {"bbox_to_anchor": (1.01, 1), "loc":'upper left', "borderaxespad": 0.})
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: kitikiplot
3
- Version: 0.2.4
3
+ Version: 0.2.6
4
4
  Summary: A Python library to visualize categorical sliding window data.
5
5
  License: MIT
6
6
  Keywords: sliding window,sequential,time-series,genome,categorical data
@@ -39,10 +39,8 @@ Description-Content-Type: text/markdown
39
39
  KitikiPlot is a Python library for visualizing sequential and time-series categorical "Sliding Window" data. <br>
40
40
  (The term 'kitiki' means 'window' in Telugu)
41
41
 
42
- Our preprint is published in **TechRxiv**. Find it <a href="https://www.techrxiv.org/users/877016/articles/1256589-kitikiplot-a-python-library-to-visualize-categorical-sliding-window-data"> here <a/>
42
+ Genome Grid Plot Generator: <a href= "https://huggingface.co/spaces/BodduSriPavan111/genomics">🤗 HuggingFace Demo</a>
43
43
 
44
- Research paper is published in **GIS Science Journal** Volume 12 Issue 1, 186-193, 2025 (Scopus indexed with Impact factor **6.1**). </br>
45
- Read it here: <a href="https://zenodo.org/records/14632005">https://zenodo.org/records/14632005</a>
46
44
  <!--
47
45
  ## Table of Contents</h2>
48
46
  - [Why Kitkiplot?](#What-and-why)
@@ -97,6 +95,11 @@ To join the Discord server for more discussion, click <a href="https://discord.g
97
95
  <a href="https://www.linkedin.com/in/boddusripavan/"> Boddu Sri Pavan </a>
98
96
 
99
97
  ## Citation
98
+ Our preprint is published in **TechRxiv**. Find it <a href="https://www.techrxiv.org/users/877016/articles/1256589-kitikiplot-a-python-library-to-visualize-categorical-sliding-window-data"> here <a/>
99
+
100
+ Research paper is published in **GIS Science Journal** Volume 12 Issue 1, 186-193, 2025 (Scopus indexed with Impact factor **6.1**). </br>
101
+ Read it here: <a href="https://zenodo.org/records/14632005">https://zenodo.org/records/14632005</a>
102
+
100
103
  APA <br>
101
104
  > Boddu Sri Pavan, Chandrasheker Thummanagoti, & Boddu Swathi Sree. (2025). KitikiPlot A Python library to visualize categorical sliding window data. https://doi.org/10.5281/zenodo.14632005.
102
105
 
@@ -0,0 +1,12 @@
1
+ kitikiplot/core/__init__.py,sha256=7LpJy1V-PZ-JlfjsnRMjMXxTKaFt0JP0mj-A0SgS-sE,34
2
+ kitikiplot/core/kitiki_cell.py,sha256=ijxGWJcKDPWX_8iDRJ-RnunCfYilPKwZxwpTMegeyzY,7960
3
+ kitikiplot/core/kitiki_color_config.py,sha256=yOWnJNoYo1BN7UMGTFgc8zpMljBbNpFDLLq7JZF3ATE,11857
4
+ kitikiplot/core/kitikiplot.py,sha256=dkF49TeO9jCQnXEXpjL-la-AvnqvlChVsar3tkZ6yNQ,20822
5
+ kitikiplot/ecology/linear.py,sha256=l1YVn7vcsKU-1g3SZ9kpOhHQiCRqP8U3LrWecy7_KFo,985
6
+ kitikiplot/genomics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ kitikiplot/genomics/grid.py,sha256=ohg5fBVezzxIOr2TlNPhND4PpBvzVG0eiSklTTbQp5s,1831
8
+ kitikiplot/genomics/linear.py,sha256=BNO-9xPVq6dsP8KuXx1fJRG_mLUf2orCM3h7etYqhBw,1280
9
+ kitikiplot-0.2.6.dist-info/LICENSE,sha256=14Bs-3ieyNjj9kCnVLv8CHRXEvQVM6P5uLe-pz7cBI0,1088
10
+ kitikiplot-0.2.6.dist-info/METADATA,sha256=9X8hRZ71UYxTgQ0KJEsoSst7RriD_bgi-d9zPxBk8xE,5445
11
+ kitikiplot-0.2.6.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
12
+ kitikiplot-0.2.6.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- kitikiplot/core/__init__.py,sha256=7LpJy1V-PZ-JlfjsnRMjMXxTKaFt0JP0mj-A0SgS-sE,34
2
- kitikiplot/core/kitiki_cell.py,sha256=9kn33x8-4Zp_fVdmp5NK-V7fm3hDXZOxwCNO3uDZqIo,7016
3
- kitikiplot/core/kitiki_color_config.py,sha256=34KEE1CQJeMnB6gA-FgTHiIEP7rF1_17xv2XOakh1ds,11969
4
- kitikiplot/core/kitikiplot.py,sha256=uH5eQnWxswQsDC1b77cu5U_2m3ODfKRGqCxcredRagQ,19746
5
- kitikiplot/genomics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- kitikiplot/genomics/grid.py,sha256=ohg5fBVezzxIOr2TlNPhND4PpBvzVG0eiSklTTbQp5s,1831
7
- kitikiplot/genomics/linear.py,sha256=BNO-9xPVq6dsP8KuXx1fJRG_mLUf2orCM3h7etYqhBw,1280
8
- kitikiplot-0.2.4.dist-info/LICENSE,sha256=14Bs-3ieyNjj9kCnVLv8CHRXEvQVM6P5uLe-pz7cBI0,1088
9
- kitikiplot-0.2.4.dist-info/METADATA,sha256=bkB0ujGDsKDB6T_vail583iQejQmZx3o2PGS--L1X_c,5322
10
- kitikiplot-0.2.4.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
11
- kitikiplot-0.2.4.dist-info/RECORD,,