plot_paths
Signature/Parameters
def plot_paths(self, exposure = None, outcome = None, adj_set = None, directed = False, show_full_dag = True, use_labels = True, title_fontsize = 10, figsize = (16, 9), path_color = 'black', **plot_kws)
Plot individual paths between exposure and outcome nodes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exposure
|
str or list[str] or None
|
Exposure node(s) to anchor the paths. Defaults to the DAG exposure role when omitted. |
None
|
outcome
|
str or list[str] or None
|
Outcome node(s) serving as path targets. Defaults to the DAG outcome role when omitted. |
None
|
adj_set
|
str or Sequence[str] or None
|
Adjustment set used to assess path openness. Strings are promoted to single-element lists. |
None
|
directed
|
bool
|
If |
False
|
show_full_dag
|
bool
|
Draw the entire DAG in the background with muted styling before
highlighting each path. Defaults to |
True
|
use_labels
|
bool
|
When |
True
|
title_fontsize
|
int
|
Font size for subplot titles. Defaults to |
10
|
figsize
|
tuple[float, float]
|
Size of the grid of path plots in inches. Defaults to |
(16, 9)
|
path_color
|
str
|
Color applied to highlighted path edges. Defaults to |
'black'
|
**plot_kws
|
Additional keyword arguments forwarded to |
{}
|
Returns:
| Type | Description |
|---|---|
list[Axes]
|
Axes objects for the generated subplots. The list is flattened even when the grid contains a single axis. |
Examples:
>>> G = DAG(graph="X -> Z -> Y")
>>> axes = G.plot_paths(exposure="X", outcome="Y", directed=True, show_full_dag=False)
>>> len(axes)
1
Source code in causalinf/gcm.py
1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 | |