-
Notifications
You must be signed in to change notification settings - Fork 40
Recipes
Mark Farragher edited this page Dec 22, 2022
·
5 revisions
A place to store recipes.
Assuming df = vault.get_note_metadata()
Matplotlib visualisation here is static (works best on small vaults). The colours are to distinguish between notes that exist and don't yet exist as files:
color_cat_map = {False: '#D3D3D3', True: '#826ED9'}
color_vals = (df['note_exists']
.map(color_cat_map)
.values)
fig, ax = plt.subplots(figsize=(13,7))
nx.draw(vault.graph, node_color=color_vals, with_labels=True, ax=ax)
ax.set_title('Vault graph')
plt.show()The example above is used in the obsidiantools demo.
If you wanted to use front matter title info, for example, change the labels argument of nx.draw:
fm_titles_dict = {k:v.get('title', '') for k,v
in vault.front_matter_index.items()}
# ...
nx.draw(vault.graph, node_color=color_vals, labels=fm_titles_dict, with_labels=True, ax=ax)
# ...Basic Pyvis graph, which can be interactive (500px height, 800px width view):
from pyvis.network import Network
nt = Network('500px', '800px', directed=True)
nt.from_nx(vault.graph)
nt.show('nx.html')