-
DescriptionI'm using Python and Graphviz code-blocks, and I'd like to reference a Python variable from within the Graphviz block. Something like so: ```{python}
num1 = 10
num2 = 5
print("variables reference different object!")
num1_1_to_graphviz = num1
num2_1_to_graphviz = num2
num2 = num1
print("variables reference the same object thanks to the default caching mechanisms!")
num2_2_to_graphviz = num2
```
```{dot}
digraph G {
num1 --- "`{python}num1_1_to_graphviz`"
num2 --- "`{python}num2_1_to_graphviz`"
num2 --> "`{python}num2_2_to_graphviz`"
}
```Would something like this be possible? I couldn't find any information about this case from my own research, besides a mention that variables cannot be passed between arbitrary languages. However, I figure this is different, since the first is Python, and I'm using the Jupyter kernel. I'm using Quarto 1.8.26. I can update if needed. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
You need to make your Python code emit the whole dot code cell with things like |
Beta Was this translation helpful? Give feedback.
You need to make your Python code emit the whole dot code cell with things like
display(markdown(...))and#| output: asis.