@ -76,6 +76,15 @@
< pre > < code class = "hljs css language-shell" > < span class = "hljs-meta" > $< / span > < span class = "bash" > python diagram.py< / span >
< / code > < / pre >
< p > It will generate an image file with single < code > EC2< / code > node drawn as < code > simple_diagram.png< / code > on your working directory, and open that created image file immediately.< / p >
< h2 > < a class = "anchor" aria-hidden = "true" id = "jupyter-notebooks" > < / a > < a href = "#jupyter-notebooks" aria-hidden = "true" class = "hash-link" > < svg class = "hash-link-icon" aria-hidden = "true" height = "16" version = "1.1" viewBox = "0 0 16 16" width = "16" > < path fill-rule = "evenodd" d = "M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z" > < / path > < / svg > < / a > Jupyter Notebooks< / h2 >
< p > Diagrams can be also rendered directly inside the notebook as like this:< / p >
< pre > < code class = "hljs css language-python" > < span class = "hljs-keyword" > from< / span > diagrams < span class = "hljs-keyword" > import< / span > Diagram
< span class = "hljs-keyword" > from< / span > diagrams.aws.compute < span class = "hljs-keyword" > import< / span > EC2
< span class = "hljs-keyword" > with< / span > Diagram(< span class = "hljs-string" > "Simple Diagram"< / span > ) < span class = "hljs-keyword" > as< / span > diag:
EC2(< span class = "hljs-string" > "web"< / span > )
diag
< / code > < / pre >
< h2 > < a class = "anchor" aria-hidden = "true" id = "options" > < / a > < a href = "#options" aria-hidden = "true" class = "hash-link" > < svg class = "hash-link-icon" aria-hidden = "true" height = "16" version = "1.1" viewBox = "0 0 16 16" width = "16" > < path fill-rule = "evenodd" d = "M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z" > < / path > < / svg > < / a > Options< / h2 >
< p > You can specify the output file format with < code > outformat< / code > parameter. Default is < strong > png< / strong > .< / p >
< blockquote >
@ -116,4 +125,4 @@ graph_attr = {
< span class = "hljs-keyword" > with< / span > Diagram(< span class = "hljs-string" > "Simple Diagram"< / span > , show=< span class = "hljs-literal" > False< / span > , graph_attr=graph_attr):
EC2(< span class = "hljs-string" > "web"< / span > )
< / code > < / pre >
< / span > < / div > < / article > < / div > < div class = "docLastUpdate" > < em > Last updated on 2/20/2020 < / em > < / div > < div class = "docs-prevnext" > < a class = "docs-prev button" href = "/docs/getting-started/examples" > < span class = "arrow-prev" > ← < / span > < span > Examples< / span > < / a > < a class = "docs-next button" href = "/docs/guides/node" > < span > Nodes< / span > < span class = "arrow-next" > →< / span > < / a > < / div > < / div > < / div > < nav class = "onPageNav" > < ul class = "toc-headings" > < li > < a href = "#basic" > Basic< / a > < / li > < li > < a href = "#options" > Options< / a > < / li > < / ul > < / nav > < / div > < footer class = "nav-footer" id = "footer" > < section class = "sitemap" > < a href = "/" class = "nav-home" > < img src = "/img/diagrams.ico" alt = "Diagrams" width = "66" height = "58" / > < / a > < div > < h5 > Docs< / h5 > < a href = "/docs/getting-started/installation" > Getting Started< / a > < a href = "/docs/guides/diagram" > Guides< / a > < a href = "/docs/nodes/aws" > Nodes< / a > < / div > < div > < h5 > More< / h5 > < a href = "https://github.com/mingrammer/diagrams" > GitHub< / a > < a class = "github-button" data-icon = "octicon-star" data-count-href = "/mingrammer/diagrams/stargazers" data-show-count = "true" data-count-aria-label = "# stargazers on GitHub" aria-label = "Star this project on GitHub" > Star< / a > < / div > < / section > < section class = "copyright" > Copyright © 2020 mingrammer< / section > < / footer > < / div > < / body > < / html >
< / span > < / div > < / article > < / div > < div class = "docLastUpdate" > < em > Last updated on 2020-2-26 < / em > < / div > < div class = "docs-prevnext" > < a class = "docs-prev button" href = "/docs/getting-started/examples" > < span class = "arrow-prev" > ← < / span > < span > Examples< / span > < / a > < a class = "docs-next button" href = "/docs/guides/node" > < span > Nodes< / span > < span class = "arrow-next" > →< / span > < / a > < / div > < / div > < / div > < nav class = "onPageNav" > < ul class = "toc-headings" > < li > < a href = "#basic" > Basic< / a > < / li > < li > < a href = "#jupyter-notebooks" > Jupyter Notebooks< / a > < / li > < li > < a href = "#options" > Options< / a > < / li > < / ul > < / nav > < / div > < footer class = "nav-footer" id = "footer" > < section class = "sitemap" > < a href = "/" class = "nav-home" > < img src = "/img/diagrams.ico" alt = "Diagrams" width = "66" height = "58" / > < / a > < div > < h5 > Docs< / h5 > < a href = "/docs/getting-started/installation" > Getting Started< / a > < a href = "/docs/guides/diagram" > Guides< / a > < a href = "/docs/nodes/aws" > Nodes< / a > < / div > < div > < h5 > More< / h5 > < a href = "https://github.com/mingrammer/diagrams" > GitHub< / a > < a class = "github-button" data-icon = "octicon-star" data-count-href = "/mingrammer/diagrams/stargazers" data-show-count = "true" data-count-aria-label = "# stargazers on GitHub" aria-label = "Star this project on GitHub" > Star< / a > < / div > < / section > < section class = "copyright" > Copyright © 2020 mingrammer< / section > < / footer > < / div > < / body > < / html >