import matplotlib.pyplot as plt
import numpy as np
from cycler import cycler


def fig4_2():
    k = 1
    kc = 10
    a = 2 + k / kc
    n = 30

    ind = np.zeros(n)
    y = np.zeros(n)
    for in_value in range(1, n + 1):
        ind[in_value - 1] = in_value
        y[in_value - 1] = a + 2 * np.cos(in_value * np.pi / (n + 1))

    plt.close("all")
    # get(gcf)
    fig, ax = plt.subplots(figsize=(6.58, 2.30))
    fig.subplots_adjust(top=0.97, bottom=0.23, right=0.98, left=0.10)
    co = [
        (0, 0, 1),
        (0, 0.5, 0),
        (1, 0, 0),
        (0, 0.75, 0.75),
        (0.75, 0, 0.75),
        (0.75, 0.75, 0),
        (0.25, 0.25, 0.25),
    ]
    ax.set_prop_cycle(cycler(color=co))

    ax.plot(ind, y, "o", linewidth=2, markersize=7, markerfacecolor="none", markeredgewidth=2)
    # ax.axis([a, b, -2, 2])

    ax.set_ylabel("Eigenvalue", fontsize=12)
    ax.set_xlabel("i-axis", fontsize=12)
    ax.grid(True)
    for spine in ax.spines.values():
        spine.set_visible(True)
    ax.tick_params(labelsize=12)
    for label in ax.get_xticklabels() + ax.get_yticklabels():
        label.set_fontweight("bold")
    ax.xaxis.label.set_fontweight("bold")
    ax.yaxis.label.set_fontweight("bold")

    # fig.savefig('/Users/holmes/Desktop/fpu.eps')
    plt.show()


if __name__ == "__main__":
    fig4_2()
