|
11 | 11 | from . import mpltools
|
12 | 12 | from .. graph_objs import *
|
13 | 13 |
|
| 14 | +# Warning format |
| 15 | +def warning_on_one_line(message, category, filename, lineno, file=None, line=None): |
| 16 | + return ' %s:%s: %s:\n%s\n' % (filename, lineno, category.__name__, message) |
| 17 | +warnings.formatwarning = warning_on_one_line |
14 | 18 |
|
15 | 19 | class PlotlyRenderer(Renderer):
|
16 | 20 | """A renderer class inheriting from base for rendering mpl plots in plotly.
|
@@ -499,11 +503,14 @@ def draw_text(self, **props):
|
499 | 503 | """
|
500 | 504 | self.msg += " Attempting to draw an mpl text object\n"
|
501 | 505 | if not mpltools.check_corners(props['mplobj'], self.mpl_fig):
|
502 |
| - warnings.warn("\n" |
503 |
| - "The annotation you're trying to draw lies outside " |
504 |
| - "the given figure size. Therefore, the resulting " |
505 |
| - "Plotly figure may not be large enough to view the " |
506 |
| - "full text.") |
| 506 | + warnings.warn("Looks like the annotation(s) you are trying " |
| 507 | + "to draw lies/lay outside the given figure size.\n" |
| 508 | + "Therefore, the resulting Plotly figure may not be " |
| 509 | + "large enough to view the full text.\n" |
| 510 | + "To adjust the size of the figure, use the " |
| 511 | + "'width' and 'height' keys in the Layout object. " |
| 512 | + "Alternatively, use the Margin object to adjust the " |
| 513 | + "figure's margins.") |
507 | 514 | align = props['mplobj']._multialignment
|
508 | 515 | if not align:
|
509 | 516 | align = props['style']['halign'] # mpl default
|
|
0 commit comments