@@ -588,6 +588,32 @@ def test_coord_strings(self):
588588 self .assertIn ('y' , self .darray .coords )
589589 self .plotmethod (y = 'y' , x = 'x' )
590590
591+ def test_non_linked_coords (self ):
592+ # plot with coordinate names that are not dimensions
593+ self .darray .coords ['newy' ] = self .darray .y + 150
594+ # Normal case, without transpose
595+ self .plotfunc (self .darray , x = 'x' , y = 'newy' )
596+ ax = plt .gca ()
597+ self .assertEqual ('x' , ax .get_xlabel ())
598+ self .assertEqual ('newy' , ax .get_ylabel ())
599+ # ax limits might change bewteen plotfuncs
600+ # simply ensure that these high coords were passed over
601+ self .assertTrue (np .min (ax .get_ylim ()) > 100. )
602+
603+ def test_non_linked_coords_transpose (self ):
604+ # plot with coordinate names that are not dimensions,
605+ # and with transposed y and x axes
606+ # This used to raise an error with pcolormesh and contour
607+ # https://github.com/pydata/xarray/issues/788
608+ self .darray .coords ['newy' ] = self .darray .y + 150
609+ self .plotfunc (self .darray , x = 'newy' , y = 'x' )
610+ ax = plt .gca ()
611+ self .assertEqual ('newy' , ax .get_xlabel ())
612+ self .assertEqual ('x' , ax .get_ylabel ())
613+ # ax limits might change bewteen plotfuncs
614+ # simply ensure that these high coords were passed over
615+ self .assertTrue (np .min (ax .get_xlim ()) > 100. )
616+
591617 def test_default_title (self ):
592618 a = DataArray (easy_array ((4 , 3 , 2 )), dims = ['a' , 'b' , 'c' ])
593619 a .coords ['d' ] = u'foo'
0 commit comments