From 217e84ee26ddce5e5a34d4018e656c3798aa451d Mon Sep 17 00:00:00 2001 From: Chetan Vardhan <51269425+VarLad@users.noreply.github.com> Date: Tue, 18 Jan 2022 19:32:57 +0530 Subject: [PATCH] Add instructions for changing plot attributes (#49) * Add attribute instruction plots * Update README.md * Delete attr_circuit_1.svg * Update README.md --- README.md | 30 +++++++ examples/attr_circuit_2.svg | 167 ++++++++++++++++++++++++++++++++++++ 2 files changed, 197 insertions(+) create mode 100644 examples/attr_circuit_2.svg diff --git a/README.md b/README.md index 3c18ffac..1f26be7f 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/examples/attr_circuit_2.svg b/examples/attr_circuit_2.svg new file mode 100644 index 00000000..59e6bd00 --- /dev/null +++ b/examples/attr_circuit_2.svg @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Rx(π/2) + + + + + + + Rx(π/2) + + + + + + + Rx(π/2) + + + + + + + Y + + + + + + + H + + + + + + + H + + + + + + + H + + + + + + + X + + + +