def rel2abs_x(x, axis=None):
  r'''
Transform relative x-coordinates to absolute x-coordinates. Relative coordinates correspond to a
fraction of the relevant axis. Be sure to set the limits and scale before calling this function!

:arguments:

  **x** (``float``, ``list``)
    Relative coordinates.

:options:

  **axis** ([``plt.gca()``] | ...)
    Specify the axis to which to apply the limits.

:returns:

  **x** (``float``, ``list``)
    Absolute coordinates.
  '''

  # get current axis
  if axis is None:
    axis = plt.gca()

  # get current limits
  xmin, xmax = axis.get_xlim()

  # transform
  # - log scale
  if axis.get_xscale() == 'log':
    try   : return [10.**(np.log10(xmin)+i*(np.log10(xmax)-np.log10(xmin))) if i is not None else i for i in x]
    except: return  10.**(np.log10(xmin)+x*(np.log10(xmax)-np.log10(xmin)))
  # - normal scale
  else:
    try   : return [xmin+i*(xmax-xmin) if i is not None else i for i in x]
    except: return  xmin+x*(xmax-xmin)