@@ -203,10 +203,24 @@ def _xy_from_xy(self, x, y):
203203 if self .axes .xaxis is not None and self .axes .yaxis is not None :
204204 bx = self .axes .xaxis .update_units (x )
205205 by = self .axes .yaxis .update_units (y )
206- if bx :
207- x = self .axes .convert_xunits (x )
208- if by :
209- y = self .axes .convert_yunits (y )
206+
207+ if self .command != 'plot' :
208+ # the Line2D class can handle unitized data, with
209+ # support for post hoc unit changes etc. Other mpl
210+ # artists, eg Polygon which _process_plot_var_args
211+ # also serves on calls to fill, cannot. So this is a
212+ # hack to say: if you are not "plot", which is
213+ # creating Line2D, then convert the data now to
214+ # floats. If you are plot, pass the raw data through
215+ # to Line2D which will handle the conversion. So
216+ # polygons will not support post hoc conversions of
217+ # the unit type since they are not storing the orig
218+ # data. Hopefully we can rationalize this at a later
219+ # date - JDH
220+ if bx :
221+ x = self .axes .convert_xunits (x )
222+ if by :
223+ y = self .axes .convert_yunits (y )
210224
211225 x = np .atleast_1d (x ) #like asanyarray, but converts scalar to array
212226 y = np .atleast_1d (y )
@@ -4270,10 +4284,14 @@ def make_iterable(x):
42704284 if self .xaxis is not None :
42714285 left = self .convert_xunits ( left )
42724286 width = self .convert_xunits ( width )
4287+ if xerr is not None :
4288+ xerr = self .convert_xunits ( xerr )
42734289
42744290 if self .yaxis is not None :
42754291 bottom = self .convert_yunits ( bottom )
42764292 height = self .convert_yunits ( height )
4293+ if yerr is not None :
4294+ yerr = self .convert_yunits ( yerr )
42774295
42784296 if align == 'edge' :
42794297 pass
0 commit comments