MatplotLibAPI 4.0.3__py3-none-any.whl → 4.0.4__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.
- MatplotLibAPI/accessor.py +51 -0
- MatplotLibAPI/network/core.py +27 -0
- MatplotLibAPI/network/plot.py +2 -0
- {matplotlibapi-4.0.3.dist-info → matplotlibapi-4.0.4.dist-info}/METADATA +1 -1
- {matplotlibapi-4.0.3.dist-info → matplotlibapi-4.0.4.dist-info}/RECORD +8 -8
- {matplotlibapi-4.0.3.dist-info → matplotlibapi-4.0.4.dist-info}/WHEEL +0 -0
- {matplotlibapi-4.0.3.dist-info → matplotlibapi-4.0.4.dist-info}/entry_points.txt +0 -0
- {matplotlibapi-4.0.3.dist-info → matplotlibapi-4.0.4.dist-info}/licenses/LICENSE +0 -0
MatplotLibAPI/accessor.py
CHANGED
|
@@ -1278,6 +1278,57 @@ class DataFrameAccessor:
|
|
|
1278
1278
|
**kwargs,
|
|
1279
1279
|
)
|
|
1280
1280
|
|
|
1281
|
+
def fplot_network(
|
|
1282
|
+
self,
|
|
1283
|
+
edge_source_col: str = "source",
|
|
1284
|
+
edge_target_col: str = "target",
|
|
1285
|
+
edge_weight_col: str = "weight",
|
|
1286
|
+
title: Optional[str] = None,
|
|
1287
|
+
style: Optional[StyleTemplate] = None,
|
|
1288
|
+
layout_seed: Optional[int] = None,
|
|
1289
|
+
figsize: Tuple[float, float] = FIG_SIZE,
|
|
1290
|
+
) -> Figure:
|
|
1291
|
+
"""Plot a network graph on a new figure.
|
|
1292
|
+
|
|
1293
|
+
Parameters
|
|
1294
|
+
----------
|
|
1295
|
+
edge_source_col : str, optional
|
|
1296
|
+
Column for source nodes. The default is "source".
|
|
1297
|
+
edge_target_col : str, optional
|
|
1298
|
+
Column for target nodes. The default is "target".
|
|
1299
|
+
edge_weight_col : str, optional
|
|
1300
|
+
Column for edge weights. The default is "weight".
|
|
1301
|
+
title : str, optional
|
|
1302
|
+
Chart title.
|
|
1303
|
+
style : StyleTemplate, optional
|
|
1304
|
+
Styling template. The default is `NETWORK_STYLE_TEMPLATE`.
|
|
1305
|
+
layout_seed : int, optional
|
|
1306
|
+
Seed forwarded to the spring layout. The default is ``_DEFAULT["SPRING_LAYOUT_SEED"]``.
|
|
1307
|
+
figsize : tuple[float, float], optional
|
|
1308
|
+
Figure size. The default is FIG_SIZE.
|
|
1309
|
+
|
|
1310
|
+
Returns
|
|
1311
|
+
-------
|
|
1312
|
+
Figure
|
|
1313
|
+
The new Matplotlib figure with the plot.
|
|
1314
|
+
"""
|
|
1315
|
+
kwargs: Dict[str, Any] = {}
|
|
1316
|
+
if layout_seed is not None:
|
|
1317
|
+
kwargs["layout_seed"] = layout_seed
|
|
1318
|
+
|
|
1319
|
+
from .network import NETWORK_STYLE_TEMPLATE, fplot_network
|
|
1320
|
+
|
|
1321
|
+
return fplot_network(
|
|
1322
|
+
pd_df=self._obj,
|
|
1323
|
+
edge_source_col=edge_source_col,
|
|
1324
|
+
edge_target_col=edge_target_col,
|
|
1325
|
+
edge_weight_col=edge_weight_col,
|
|
1326
|
+
title=title,
|
|
1327
|
+
style=style or NETWORK_STYLE_TEMPLATE,
|
|
1328
|
+
figsize=figsize,
|
|
1329
|
+
**kwargs,
|
|
1330
|
+
)
|
|
1331
|
+
|
|
1281
1332
|
def aplot_network_components(
|
|
1282
1333
|
self,
|
|
1283
1334
|
edge_source_col: str = "source",
|
MatplotLibAPI/network/core.py
CHANGED
|
@@ -453,6 +453,33 @@ class NetworkGraph(BasePlot):
|
|
|
453
453
|
"""Return the degree assortativity coefficient of the graph."""
|
|
454
454
|
return nx.degree_assortativity_coefficient(self._nx_graph)
|
|
455
455
|
|
|
456
|
+
@property
|
|
457
|
+
def degree_distribution(self) -> Dict[int, int]:
|
|
458
|
+
"""Return the count of nodes for each degree.
|
|
459
|
+
|
|
460
|
+
Returns
|
|
461
|
+
-------
|
|
462
|
+
dict[int, int]
|
|
463
|
+
Mapping from node degree to number of nodes with that degree.
|
|
464
|
+
"""
|
|
465
|
+
distribution: Dict[int, int] = defaultdict(int)
|
|
466
|
+
for _, degree in self._nx_graph.degree():
|
|
467
|
+
distribution[int(degree)] += 1
|
|
468
|
+
return dict(sorted(distribution.items()))
|
|
469
|
+
|
|
470
|
+
@property
|
|
471
|
+
def degree_sequence(self) -> List[int]:
|
|
472
|
+
"""Return node degrees sorted in descending order.
|
|
473
|
+
|
|
474
|
+
Returns
|
|
475
|
+
-------
|
|
476
|
+
list[int]
|
|
477
|
+
Degree for each node sorted from highest to lowest.
|
|
478
|
+
"""
|
|
479
|
+
return sorted(
|
|
480
|
+
(int(degree) for _, degree in self._nx_graph.degree()), reverse=True
|
|
481
|
+
)
|
|
482
|
+
|
|
456
483
|
def add_node(self, node: Any, **attributes: Any):
|
|
457
484
|
"""Add a node with optional attributes.
|
|
458
485
|
|
MatplotLibAPI/network/plot.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
MatplotLibAPI/__init__.py,sha256=3eYMzW-R3VbXAWrA6ab6opQNj1LaCsI8qc_ZNfCepzw,188
|
|
2
|
-
MatplotLibAPI/accessor.py,sha256=
|
|
2
|
+
MatplotLibAPI/accessor.py,sha256=vjV9mfUz-gJAor-VZ-lZV9auobdX_7fzieA-22YySfM,53722
|
|
3
3
|
MatplotLibAPI/area.py,sha256=nh9Lur1q8FoSGZu_PVaGF1NIzJOcENjp26rG3rRjOWY,5465
|
|
4
4
|
MatplotLibAPI/bar.py,sha256=beDTQ2bMqB0tkDSn_6FfSPHrWS-vLtlhXQfy53vHfIw,4293
|
|
5
5
|
MatplotLibAPI/base_plot.py,sha256=OJXljQRHJFFRtUsETaoBXwJzT1FaRu-u5zmnjx0iU7g,5314
|
|
@@ -25,11 +25,11 @@ MatplotLibAPI/mcp/metadata.py,sha256=G0SJSG4XX5fZQy5F2Ii3FVOM1uprFcBvbGpK7BxMDrg
|
|
|
25
25
|
MatplotLibAPI/mcp/renderers.py,sha256=mB7B9ytr1ahxkK8MSIFQKtQ3nz5jYmX2JgKhQUe0W4k,1293
|
|
26
26
|
MatplotLibAPI/network/__init__.py,sha256=qkAwW7aQTEORaFB7qcja4rSEpBXy5STveAwhDmV2o2E,784
|
|
27
27
|
MatplotLibAPI/network/constants.py,sha256=857G_-7Gaa1L-8dsdRvWv681TpWfde9ixgrkTdzpY5A,467
|
|
28
|
-
MatplotLibAPI/network/core.py,sha256
|
|
29
|
-
MatplotLibAPI/network/plot.py,sha256=
|
|
28
|
+
MatplotLibAPI/network/core.py,sha256=4bwUAMuNHD1TTOlQ8XjEmNp7L_jrBZ0KYWfDRbiIfAU,46300
|
|
29
|
+
MatplotLibAPI/network/plot.py,sha256=cPtVC0jiXqj6JJkzpt6Pr7WgRasRnnIbFVFn9itCe6E,23327
|
|
30
30
|
MatplotLibAPI/network/scaling.py,sha256=gdbusWHN-yKYWJjSZ0viqM5S31tZfLH8hojoc2fML2c,1632
|
|
31
|
-
matplotlibapi-4.0.
|
|
32
|
-
matplotlibapi-4.0.
|
|
33
|
-
matplotlibapi-4.0.
|
|
34
|
-
matplotlibapi-4.0.
|
|
35
|
-
matplotlibapi-4.0.
|
|
31
|
+
matplotlibapi-4.0.4.dist-info/METADATA,sha256=OE5rn8vXTR20_tFtXcAdjIpImth1yxntQoCvExM55t8,8457
|
|
32
|
+
matplotlibapi-4.0.4.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
33
|
+
matplotlibapi-4.0.4.dist-info/entry_points.txt,sha256=x_X45-YKZXmwaEiyYqQiPVHFJ5Rj66qwNesDDq3-rWg,68
|
|
34
|
+
matplotlibapi-4.0.4.dist-info/licenses/LICENSE,sha256=hMErKLb6YZR3lRR5zr-vxeFkvY69QAaafgSpZ5-P1dQ,1067
|
|
35
|
+
matplotlibapi-4.0.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|