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/text-and-annotations.md
+6-5
Original file line number
Diff line number
Diff line change
@@ -784,7 +784,7 @@ fig.show()
784
784
```
785
785
### Specifying Source Lines or Figure Notes on the Bottom of a Figure
786
786
787
-
This example shows how to add a note about the data source or interpretation at the bottom of the figure. This example aligns the note in the bottom right corner using the title element and container coordinates and then uses an annotation to add a figure title. A near zero container coordinate is an easy and robust way to put text -- such as a source line or figure note -- at the bottom of a figure. It is easier to specify the bottom of the figure in container coordinates than using paper coordinates, since uncertainty about the size of legends and x-axis labels make the paper coordinate of the bottom of the figure uncertain. Making the y container coordinate very slightly positive avoids cutting off the descending strokes of letters like y, p, and q. Only the title command supports container coordinates, so this example re-purposes the title element to insert the note and re-purposes an annotation element for the title. The top of the figure is typically less cluttered and more predictable, so an annotation with its bottom at a paper y-coordinate slightly greater than 1 is a reasonable title location on many graphs.
787
+
This example shows how to add a note about the data source or interpretation at the bottom of the figure. This example aligns the note in the bottom right corner using the title element and container coordinates and then uses an annotation to add a figure title. A near zero container coordinate is an easy and robust way to put text -- such as a source line or figure note -- at the bottom of a figure. It is easier to specify the bottom of the figure in container coordinates than using paper coordinates, since uncertainty about the size of legends and x-axis labels make the paper coordinate of the bottom of the figure uncertain. Making the y container coordinate very slightly positive avoids cutting off the descending strokes of letters like y, p, and q. Only the title command supports container coordinates, so this example re-purposes the title element to insert the note and re-purposes an annotation element for the title. The top of the figure is typically less cluttered and more predictable than the bottom of the figure, so an annotation with its bottom at a paper y-coordinate slightly greater than 1 is a reasonable title location on many graphs.
788
788
789
789
```python
790
790
import plotly.express as px
@@ -793,14 +793,15 @@ fig.update_layout(
793
793
title=dict(text="Note: this is the Plotly title element.",
794
794
# keeping this title string short avoids getting the text cut off in small windows
795
795
# if you need longer text, consider 1) embedding your graphic on a web page and
796
-
# putting the note in the HTML to use the browser's automated word wrap or
797
-
# 2) using this approach and also specifying a graph width that shows the whole title.
796
+
# putting the note in the HTML to use the browser's automated word wrap,
797
+
# 2) using this approach and also specifying a graph width that shows the whole title,
798
+
# or 3) using <BR> tags to wrap the text onto multiple lines
798
799
yref="container",
799
800
y=0.005,
800
801
# The "paper" x-coordinates lets us align this with either the right or left
801
802
# edge of the plot region.
802
-
#Aligning this flush with the right edge of the plot area is
803
-
# predictable and easy to code.
803
+
#The code to align this flush with the right edge of the plot area is
804
+
# predictable and simple.
804
805
# Putting the title in the lower left corner, aligned with the left edge of the axis labeling would
0 commit comments