Skip to content

Commit cdc68a7

Browse files
added a comment about using <br> to break up long lines
1 parent 0e5108b commit cdc68a7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

doc/python/text-and-annotations.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ fig.show()
784784
```
785785
### Specifying Source Lines or Figure Notes on the Bottom of a Figure
786786

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.
788788

789789
```python
790790
import plotly.express as px
@@ -793,14 +793,15 @@ fig.update_layout(
793793
title=dict(text="Note: this is the Plotly title element.",
794794
# keeping this title string short avoids getting the text cut off in small windows
795795
# 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
798799
yref="container",
799800
y=0.005,
800801
# The "paper" x-coordinates lets us align this with either the right or left
801802
# 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.
804805
# Putting the title in the lower left corner, aligned with the left edge of the axis labeling would
805806
# require graph specific coordinate adjustments.
806807
xref="paper",

0 commit comments

Comments
 (0)