def _relabelAxes(plot, text):
    """Relabel {xlabel} and {ylabel} from this text using the corresponding
    plot axis label. If the axis label is empty, label it with "X" and "Y".

    :rtype: str
    """
    xLabel = plot.getXAxis().getLabel()
    if not xLabel:
        xLabel = "X"
    yLabel = plot.getYAxis().getLabel()
    if not yLabel:
        yLabel = "Y"
    return text.format(xlabel=xLabel, ylabel=yLabel)