stemflow.utils.plot_gif
            make_sample_gif(data, file_path, col='abundance', Spatio1='longitude', Spatio2='latitude', Temporal1='DOY', continental_boundary=True, figsize=(18, 9), xlims=None, ylims=None, grid=True, lng_size=20, lat_size=20, xtick_interval=None, ytick_interval=None, log_scale=False, vmin=0.0001, vmax=None, lightgrey_under=True, adder=1, dpi=300, fps=30, cmap='plasma', verbose=1, political_boundary=None, boundary_scale='110m', boundary_color='black', boundary_lw=0.4, boundary_alpha=0.7, boundary_zorder=2, show_major_lakes=True)
    Create a GIF visualizing spatio-temporal data using imshow, with optional Cartopy physical (continental) and political boundaries.
Parameters:
- 
            
data(DataFrame) –Input DataFrame containing spatio-temporal data.
 - 
            
file_path(str) –Output GIF file path.
 - 
            
col(str, default:'abundance') –Column name containing the values to visualize (e.g., abundance).
 - 
            
Spatio1(str, default:'longitude') –Column name for the first spatial variable (e.g., longitude).
 - 
            
Spatio2(str, default:'latitude') –Column name for the second spatial variable (e.g., latitude).
 - 
            
Temporal1(str, default:'DOY') –Column name for the temporal variable (e.g., DOY).
 - 
            
continental_boundary(bool, default:True) –Whether to display physical continental outlines using Cartopy.
 - 
            
figsize(Tuple[Union[float, int], Union[float, int]], default:(18, 9)) –Figure size in inches.
 - 
            
xlims(Tuple[Union[float, int], Union[float, int]], default:None) –Longitude limits (min, max).
 - 
            
ylims(Tuple[Union[float, int], Union[float, int]], default:None) –Latitude limits (min, max).
 - 
            
grid(bool, default:True) –Whether to draw gridlines on the plot.
 - 
            
lng_size(int, default:20) –Number of longitudinal grid cells (spatial resolution).
 - 
            
lat_size(int, default:20) –Number of latitudinal grid cells (spatial resolution).
 - 
            
xtick_interval(Union[float, int, None], default:None) –Custom x-axis tick interval (used only if continental_boundary=False).
 - 
            
ytick_interval(Union[float, int, None], default:None) –Custom y-axis tick interval (used only if continental_boundary=False).
 - 
            
log_scale(bool, default:False) –Apply logarithmic scaling to the plotted values.
 - 
            
vmin(Union[float, int], default:0.0001) –Minimum value for the colormap normalization.
 - 
            
vmax(Union[float, int, None], default:None) –Maximum value for the colormap normalization (auto-detected if None).
 - 
            
lightgrey_under(bool, default:True) –Use light grey color for values below vmin.
 - 
            
adder(Union[int, float], default:1) –Value added before log transformation to avoid log(0).
 - 
            
dpi(Union[float, int], default:300) –Output resolution (dots per inch).
 - 
            
fps(int, default:30) –Frames per second for the GIF animation.
 - 
            
cmap(str, default:'plasma') –Matplotlib colormap name.
 - 
            
verbose(int, default:1) –Verbosity level; 0 = silent, 1 = print progress.
 - 
            
political_boundary(Optional[str], default:None) –Type of political boundaries to overlay. Options: - None: No political boundaries - "country": Show country borders (admin-0) - "province": Show state/province boundaries (admin-1) - "both": Show both country and province boundaries
 - 
            
boundary_scale(str, default:'110m') –Scale for boundary data ("110m", "50m", or "10m").
 - 
            
boundary_color(str, default:'black') –Color of physical and political boundaries.
 - 
            
boundary_lw(float, default:0.4) –Line width of boundaries.
 - 
            
boundary_alpha(float, default:0.7) –Transparency (alpha) of boundary lines.
 - 
            
boundary_zorder(int, default:2) –Z-order (drawing order) of boundary layers.
 - 
            
show_major_lakes(bool, default:True) –Whether to draw outlines of major lakes.
 
Returns:
- 
          –
          
None. Saves the generated GIF to the specified file path.
 
Notes
- Spatial binning is performed using 
np.digitizeto create a gridded raster. - Each frame corresponds to a unique value in the temporal column.
 - The function supports both linear and log-scaled color mapping.
 - Requires 
cartopyfor geographic projections and natural features. 
Example
make_sample_gif( ... data=df, ... file_path="output.gif", ... col="abundance", ... Spatio1="longitude", ... Spatio2="latitude", ... Temporal1="DOY", ... political_boundary="both", ... log_scale=True ... )
Source code in stemflow/utils/plot_gif.py
              11 12 13 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 158 159 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  |  |