Skip to content

Commit

Permalink
Add instructions for changing plot attributes (#49)
Browse files Browse the repository at this point in the history
* Add attribute instruction plots

* Update README.md

* Delete attr_circuit_1.svg

* Update README.md
  • Loading branch information
VarLad authored Jan 18, 2022
1 parent ae7b6ef commit 217e84e
Show file tree
Hide file tree
Showing 2 changed files with 197 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,36 @@ Otherwise, you might be interested to learn [how to save it as an image](https:/

See more [examples](examples/circuits.jl).

### Adjusting the plot attributes

Various attributes of the visualizations can be altered.
The plot can be modifiend, if we change the following attributes

- `YaoPlots.CircuitStyles.linecolor[]` for line color, default value being `"#000000"` (black color)
- `YaoPlots.CircuitStyles.gate_bgcolor[]` for background color of square blocks, the default value being `"#FFFFFF"` (white color)
- `YaoPlots.CircuitStyles.textcolor[]` for text color, default value being `"#000000`
- `YaoPlots.CircuitStyles.lw[]` for line width, default value being `1pt`
- `YaoPlots.CircuitStyles.textsize[]` for text size, default value being `16pt`
- `YaoPlots.CircuitStyles.paramtextsize[]` for parameter text size, for parameterized gates, default value being `10pt`

For example,

```julia
using YaoPlots, Yao
YaoPlots.CircuitStyles.linecolor[] = "pink"
YaoPlots.CircuitStyles.gate_bgcolor[] = "yellow"
YaoPlots.CircuitStyles.textcolor[] = "#000080" # the navy blue color
YaoPlots.CircuitStyles.fontfamily[] = "JuliaMono"
YaoPlots.CircuitStyles.lw[] = 2.5pt
YaoPlots.CircuitStyles.textsize[] = 13pt
YaoPlots.CircuitStyles.paramtextsize[] = 8pt

plot(chain(3, put(1=>X), repeat(3, H), put(2=>Y), repeat(3, Rx/2))))
```

![attribute_example_2](examples/attr_circuit_2.svg)


## Example 2: Visualize ZX-diagrams in ZXCalculus
```julia
using ZXCalculus, YaoPlots
Expand Down
167 changes: 167 additions & 0 deletions examples/attr_circuit_2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 217e84e

Please sign in to comment.