What You'll Learn
- All visualization functions in Tigramite
- When to use each plot type
- Customization options
- Creating publication-ready figures
Plot Types Overview
| Function | Purpose | When to Use |
plot_timeseries() | Show raw data | Always first! |
plot_scatterplots() | Check linearity | Before choosing test |
plot_lagfuncs() | Find optimal tau_max | Before running PCMCI |
plot_graph() | Summary causal graph | Final results |
plot_time_series_graph() | Temporal causal graph | Detailed analysis |
1. plot_timeseries() - Always Start Here!
tp.plot_timeseries(dataframe, figsize=(12, 6))
plt.show()
2. plot_scatterplots() - Check for Linearity
tp.plot_scatterplots(dataframe=dataframe, figsize=(10, 10))
plt.show()
3. plot_lagfuncs() - Find Optimal tau_max
correlations = pcmci.get_lagged_dependencies(tau_max=20, val_only=True)['val_matrix']
tp.plot_lagfuncs(
val_matrix=correlations,
setup_args={'var_names': var_names, 'x_base': 5}
)
plt.show()
4. plot_graph() - Summary Causal Graph
tp.plot_graph(
graph=results['graph'],
val_matrix=results['val_matrix'],
var_names=var_names,
figsize=(8, 6)
)
plt.show()
Publication-Quality Graph
tp.plot_graph(
graph=results['graph'],
val_matrix=results['val_matrix'],
var_names=var_names,
figsize=(10, 8),
link_colorbar_label='MCI Strength',
node_colorbar_label='Auto-MCI',
show_autodependency_lags=True,
node_size=0.4,
arrow_linewidth=8,
curved_radius=0.2
)
plt.show()
5. plot_time_series_graph() - Detailed Temporal View
tp.plot_time_series_graph(
graph=results['graph'],
val_matrix=results['val_matrix'],
var_names=var_names,
figsize=(14, 6),
link_colorbar_label='MCI Strength'
)
plt.show()
Saving Figures
fig, ax = plt.subplots(figsize=(10, 8))
tp.plot_graph(
graph=results['graph'],
val_matrix=results['val_matrix'],
var_names=var_names,
fig_ax=(fig, ax)
)
fig.savefig('causal_graph.png', dpi=300, bbox_inches='tight')
fig.savefig('causal_graph.pdf', bbox_inches='tight')
Quick Reference: Customization Options
tp.plot_graph(
graph=results['graph'],
val_matrix=results['val_matrix'],
var_names=var_names,
figsize=(10, 8),
node_size=0.4,
node_aspect=1.0,
link_colorbar_label='Strength',
node_colorbar_label='Auto-effect',
cmap_edges='RdBu_r',
cmap_nodes='OrRd',
show_autodependency_lags=True,
node_label_size=12,
link_label_fontsize=10,
arrow_linewidth=8,
curved_radius=0.2,
)