Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7f1f81f

Browse files
committed
RendererBase: improve draw_image() docstring
1 parent d931283 commit 7f1f81f

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -508,30 +508,31 @@ def get_image_magnification(self):
508508
"""
509509
return 1.0
510510

511-
def draw_image(self, gc, x, y, im, trans=None):
511+
def draw_image(self, gc, x, y, im, transform=None):
512512
"""
513-
Draw the image instance into the current axes;
513+
Draw an RGBA image.
514514
515515
*gc*
516-
a GraphicsContext containing clipping information
516+
a :class:`GraphicsContextBase` instance with clipping information.
517517
518518
*x*
519-
is the distance in pixels from the left hand side of the canvas.
519+
the distance in pixels from the left hand side of the canvas.
520520
521521
*y*
522-
the distance from the origin. That is, if origin is
523-
upper, y is the distance from top. If origin is lower, y
524-
is the distance from bottom
522+
the distance in pixels from the bottom side of the canvas.
525523
526524
*im*
527525
An NxMx4 array of RGBA pixels (of dtype uint8).
528526
529-
*trans*
530-
If the concrete backend is written such that
531-
`option_scale_image` returns `True`, an affine
532-
transformation may also be passed to `draw_image`. The
533-
backend should apply the transformation to the image
534-
before applying the translation of `x` and `y`.
527+
*transform*
528+
If and only if the concrete backend is written such that
529+
:meth:`option_scale_image` returns ``True``, an affine
530+
transformation *may* be passed to :meth:`draw_image`. It takes the
531+
form of a :class:`~matplotlib.transforms.Affine2DBase` instance,
532+
with translation given in pixels. Note that this transformation
533+
does not override `x` and `y`, and has to be applied *before*
534+
translating the result by `x` and `y` (this can be accomplished
535+
by adding `x` and `y` to the translation defined by `transform`).
535536
"""
536537
raise NotImplementedError
537538

@@ -544,8 +545,8 @@ def option_image_nocomposite(self):
544545

545546
def option_scale_image(self):
546547
"""
547-
override this method for renderers that support arbitrary
548-
scaling of image (most of the vector backend).
548+
override this method for renderers that support arbitrary affine
549+
transformations in :meth:`draw_image` (most vector backends).
549550
"""
550551
return False
551552

0 commit comments

Comments
 (0)