def set_xlim(self, xmin=None, xmax=None, emit=True, **kwargs):
if xmax is None and iterable(xmin):<EOL><INDENT>xmin,xmax = xmin<EOL><DEDENT>self._process_unit_info(xdata=(xmin, xmax))<EOL>if xmin is not None:<EOL><INDENT>xmin = self.convert_xunits(xmin)<EOL><DEDENT>if xmax is not None:<EOL><INDENT>xmax = self.convert_xunits(xmax)<EOL><DEDENT>old_xmin,old_xmax = self.get_xlim()<EOL>if xmin is None: xmin = old_xmin<EOL>if xmax is None: xmax = old_xmax<EOL>xmin, xmax = mtransforms.nonsingular(xmin, xmax, increasing=False)<EOL>xmin, xmax = self.xaxis.limit_range_for_scale(xmin, xmax)<EOL>self.viewLim.intervalx = (xmin, xmax)<EOL>if emit:<EOL><INDENT>self.callbacks.process('<STR_LIT>', self)<EOL>for other in self._shared_x_axes.get_siblings(self):<EOL><INDENT>if other is not self:<EOL><INDENT>other.set_xlim(self.viewLim.intervalx, emit=False)<EOL>if (other.figure != self.figure and<EOL>other.figure.canvas is not None):<EOL><INDENT>other.figure.canvas.draw_idle()<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return xmin, xmax<EOL>
call signature::

  set_xlim(self, *args, **kwargs)

Set the limits for the xaxis

Returns the current xlimits as a length 2 tuple: [*xmin*, *xmax*]

Examples::

  set_xlim((valmin, valmax))
  set_xlim(valmin, valmax)
  set_xlim(xmin=1) # xmax unchanged
  set_xlim(xmax=1) # xmin unchanged

Keyword arguments:

  *ymin*: scalar
    the min of the ylim
  *ymax*: scalar
    the max of the ylim
  *emit*: [ True | False ]
    notify observers of lim change

ACCEPTS: len(2) sequence of floats