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

Skip to content

Commit bf7f49e

Browse files
committed
[ 1697287 ] imshow on log axes broken if axes limits != image extent
Adds a warning when an image is used on non-linear axes. Doesn't really address the problem (see bug report for the reason.) svn path=/trunk/matplotlib/; revision=4667
1 parent f51642b commit bf7f49e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/matplotlib/image.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
"""
66
from __future__ import division
7-
import sys, os
7+
import sys, os, warnings
88

99
import numpy as npy
1010

@@ -185,6 +185,9 @@ def make_image(self, magnification=1.0):
185185

186186
def draw(self, renderer, *args, **kwargs):
187187
if not self.get_visible(): return
188+
if (self.axes.get_xscale() != 'linear' or
189+
self.axes.get_yscale() != 'linear'):
190+
warnings.warn("Images are not supported on non-linear axes.")
188191
im = self.make_image(renderer.get_image_magnification())
189192
l, b, widthDisplay, heightDisplay = self.axes.bbox.get_bounds()
190193
renderer.draw_image(l, b, im, self.axes.bbox)

0 commit comments

Comments
 (0)