Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9c07c32

Browse files
Merge pull request #53 from plotly/issue-49
'multialign' is a text property in mpl when *newlines* are present.
2 parents ff42b4c + f83e505 commit 9c07c32

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

‎plotly/matplotlylib/renderer.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,9 @@ def draw_text(self, **props):
492492
493493
"""
494494
self.msg += " Attempting to draw an mpl text object\n"
495+
align = props['mplobj']._multialignment
496+
if not align:
497+
align = props['style']['halign'] # mpl default
495498
if 'annotations' not in self.plotly_fig['layout']:
496499
self.plotly_fig['layout']['annotations'] = Annotations()
497500
if props['text_type'] == 'xlabel':
@@ -531,6 +534,7 @@ def draw_text(self, **props):
531534
y=y,
532535
xref=xref,
533536
yref=yref,
537+
align=align,
534538
xanchor=xanchor,
535539
yanchor=yanchor,
536540
showarrow=False, # change this later?

‎plotly/tests/test_matplotlylib/data/annotations.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
xref='paper',
5353
yref='paper',
5454
showarrow=False,
55+
align='left',
5556
font=Font(
5657
size=12.0,
5758
color='#000000'
@@ -66,6 +67,7 @@
6667
text='bottom-left',
6768
xref='paper',
6869
yref='paper',
70+
align='left',
6971
showarrow=False,
7072
font=Font(
7173
size=12.0,
@@ -81,6 +83,7 @@
8183
text='top-right',
8284
xref='paper',
8385
yref='paper',
86+
align='right',
8487
showarrow=False,
8588
font=Font(
8689
size=12.0,
@@ -96,6 +99,7 @@
9699
text='bottom-right',
97100
xref='paper',
98101
yref='paper',
102+
align='right',
99103
showarrow=False,
100104
font=Font(
101105
size=12.0,

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /