You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/python/shapes.md
+25-13Lines changed: 25 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,9 @@ jupyter:
6
6
extension: .md
7
7
format_name: markdown
8
8
format_version: '1.3'
9
-
jupytext_version: 1.14.1
9
+
jupytext_version: 1.14.5
10
10
kernelspec:
11
-
display_name: Python 3
11
+
display_name: Python 3 (ipykernel)
12
12
language: python
13
13
name: python3
14
14
language_info:
@@ -20,7 +20,7 @@ jupyter:
20
20
name: python
21
21
nbconvert_exporter: python
22
22
pygments_lexer: ipython3
23
-
version: 3.8.8
23
+
version: 3.10.9
24
24
plotly:
25
25
description: How to make SVG shapes in python. Examples of lines, circle, rectangle,
26
26
and path.
@@ -676,15 +676,23 @@ import plotly.graph_objects as go
676
676
677
677
fig = go.Figure()
678
678
679
-
fig.add_shape(type="rect", x0=1, y0=1, x1=2, y1=3, label=dict(text="Text in rectangle"))
679
+
fig.add_shape(
680
+
type="rect",
681
+
fillcolor='turquoise',
682
+
x0=1,
683
+
y0=1,
684
+
x1=2,
685
+
y1=3,
686
+
label=dict(text="Text in rectangle")
687
+
)
680
688
fig.add_shape(
681
689
type="line",
682
690
x0=3,
683
691
y0=0.5,
684
692
x1=5,
685
693
y1=0.8,
686
694
line_width=3,
687
-
label=dict(text="Text above line"),
695
+
label=dict(text="Text above line")
688
696
)
689
697
690
698
fig.show()
@@ -694,7 +702,7 @@ fig.show()
694
702
#### Styling Text Labels
695
703
696
704
Use the `font` property to configure the `color`, `size`, and `family` of the label font.
697
-
In this example, we change the label color of the first rectangle to "red", set the size of the text above the line to 20, and change the font family and set the font size on the second rectangle.
705
+
In this example, we change the label color of the first rectangle to "DarkOrange", set the size of the text above the line to 20, and change the font family and set the font size on the second rectangle.
698
706
699
707
```python
700
708
import plotly.graph_objects as go
@@ -703,11 +711,12 @@ fig = go.Figure()
703
711
704
712
fig.add_shape(
705
713
type="rect",
714
+
fillcolor='MediumSlateBlue',
706
715
x0=1,
707
716
y0=1,
708
717
x1=2,
709
718
y1=3,
710
-
label=dict(text="Text in rectangle", font=dict(color="red")),
719
+
label=dict(text="Text in rectangle", font=dict(color="DarkOrange")),
711
720
)
712
721
fig.add_shape(
713
722
type="line",
@@ -720,6 +729,7 @@ fig.add_shape(
720
729
)
721
730
fig.add_shape(
722
731
type="rect",
732
+
fillcolor='Lavender',
723
733
x0=2.5,
724
734
y0=2.5,
725
735
x1=5,
@@ -745,6 +755,7 @@ fig = go.Figure()
745
755
746
756
fig.add_shape(
747
757
type="rect",
758
+
fillcolor='Lavender',
748
759
x0=0,
749
760
y0=0,
750
761
x1=1.5,
@@ -754,6 +765,7 @@ fig.add_shape(
754
765
755
766
fig.add_shape(
756
767
type="rect",
768
+
fillcolor='Lavender',
757
769
x0=3,
758
770
y0=0,
759
771
x1=4.5,
@@ -764,6 +776,7 @@ fig.add_shape(
764
776
765
777
fig.add_shape(
766
778
type="line",
779
+
line_color="MediumSlateBlue",
767
780
x0=3,
768
781
y0=2,
769
782
x1=5,
@@ -775,6 +788,7 @@ fig.add_shape(
775
788
776
789
fig.add_shape(
777
790
type="line",
791
+
line_color="MediumSlateBlue",
778
792
x0=0,
779
793
y0=2,
780
794
x1=2,
@@ -798,6 +812,7 @@ fig = go.Figure()
798
812
799
813
fig.add_shape(
800
814
type="rect",
815
+
fillcolor='LightGreen',
801
816
x0=0,
802
817
y0=0,
803
818
x1=2,
@@ -807,6 +822,7 @@ fig.add_shape(
807
822
808
823
fig.add_shape(
809
824
type="rect",
825
+
fillcolor='Gold',
810
826
x0=3,
811
827
y0=0,
812
828
x1=5,
@@ -827,9 +843,9 @@ import plotly.graph_objects as go
827
843
828
844
fig = go.Figure()
829
845
830
-
831
846
fig.add_shape(
832
847
type="line",
848
+
line_color="RoyalBlue",
833
849
x0=3,
834
850
y0=0,
835
851
x1=5,
@@ -838,9 +854,9 @@ fig.add_shape(
838
854
label=dict(text="Label padding of 30", padding=30),
0 commit comments