Browse Source

docs: update diagram options

tags/v0.3.0
mingrammer 4 years ago
parent
commit
e2d5601e5d
1 changed files with 19 additions and 3 deletions
  1. +19
    -3
      docs/diagram.md

+ 19
- 3
docs/diagram.md View File

@@ -23,7 +23,7 @@ And if you run the above script with below command,


```shell ```shell
$ python diagram.py $ python diagram.py
```
```


It will generate an image file with single `EC2` node drawn as `simple_diagram.png` on your working directory, and open that created image file immediately. It will generate an image file with single `EC2` node drawn as `simple_diagram.png` on your working directory, and open that created image file immediately.


@@ -49,5 +49,21 @@ from diagrams.aws.compute import EC2


with Diagram("Simple Diagram", show=False): with Diagram("Simple Diagram", show=False):
EC2("web") EC2("web")
```
```

If you are familiar with Graphviz, you can customize the diagrams with Graphviz attribute config options.

> `graph_attr`, `node_attr` and `edge_attr` are allowed. Here is a [reference link](https://www.graphviz.org/doc/info/attrs.html).

```python
from diagrams import Diagram
from diagrams.aws.compute import EC2

graph_attr = {
"fontsize": 45,
"bgcolor": "transparent"
}

with Diagram("Simple Diagram", show=False, graph_attr=graph_attr):
EC2("web")
```

Loading…
Cancel
Save