def optimal_row_and_column_count_for_subplots(n):
    """Returns the optimal number of rows and columns for a given number of subplots

    :param int n: number of subplots required
    :return: n_cols, n_rows
    """
    n_cols = 1
    n_rows = 1
    increase_next = 'cols'
    while n_rows * n_cols < n:
        if increase_next == 'cols':
            n_cols += 1
            increase_next = 'rows'
        elif increase_next == 'rows':
            n_rows += 1
            increase_next = 'cols'

    return n_cols, n_rows