def plot(figure_path=None, figure_name=None, save_types=[]):
    #==============================================================================
    # title
    #==============================================================================
    title = ''
    #==============================================================================
    # figure format
    # http://matplotlib.org/users/customizing.html?highlight=rcparams
    #==============================================================================
    plot_format()
    mpl.rcParams['figure.figsize'] = (8, 6)
    fig, ax = plt.subplots()
    #==============================================================================
    # grid set up
    #==============================================================================
    #plt.grid(True, which='major',linestyle='-')
    #plt.grid(True, which='minor',linestyle='-')
    #plt.grid(True, which='major')
    #plt.grid(True, which='minor')
    #==============================================================================
    # print title
    #==============================================================================
    plt.title(title, fontsize=16)
    #==============================================================================
    # x,y limite
    #==============================================================================
    #    plt.xlim(1E1,1E5)
    plt.ylim(5E0, 1E2)
    #==============================================================================
    # xy axial equal
    #==============================================================================
    plt.gca().set_aspect('equal')
    plt.gca().set_aspect('auto')
    #==============================================================================
    # xy log scale
    #==============================================================================
    plt.xscale('log')
    plt.yscale('log')
    #==============================================================================
    # plot lines
    #==============================================================================
    plot_data = PlotData()
    plot_data.readFromFile(figure_path, figure_name)
    plot_data.plot()
    #==============================================================================
    # http://stackoverflow.com/questions/21920233/matplotlib-log-scale-tick-label-number-formatting
    #==============================================================================
    #    ax.xaxis.set_major_locator(MultipleLocator(0.5))
    #    ax.xaxis.set_minor_locator(MultipleLocator(0.1))
    #    ax.xaxis.set_major_formatter(ScalarFormatter())
    #    ax.yaxis.set_major_locator(MultipleLocator(5))
    #    ax.yaxis.set_minor_locator(MultipleLocator(5))
    #    ax.yaxis.set_major_formatter(ScalarFormatter())
    #==============================================================================
    # plot 1x lines
    #==============================================================================
    #    linewidth = 1.0
    #    plt.plot([10,1e5],[10,1e5],color='black',linewidth=linewidth)
    #==============================================================================
    # plot 2x lines
    #==============================================================================
    #    linewidth = 0.5
    #    plt.plot([20,1e5],[10,5e4],color='black',linewidth=linewidth)
    #    plt.plot([10,5e4],[20,1e5],color='black',linewidth=linewidth)
    #==============================================================================
    # plot 5x lines
    #==============================================================================
    #    plt.plot([50,1e5],[10,2e4],color='black',linewidth=linewidth)
    #    plt.plot([10,2e4],[50,1e5],color='black',linewidth=linewidth)
    #==============================================================================
    # show legend
    #==============================================================================
    plt.legend(loc=0)
    #==============================================================================
    # save figures
    #==============================================================================
    if figure_path <> None and figure_name <> None:
        for save_type in save_types:
            plt.savefig(figure_path + figure_name + save_type,
                        dpi=150,
                        transparent=True)
            print 'save as', figure_path + figure_name + save_type
    plt.show()
    plt.close()
Esempio n. 2
0
def plot_exp_coffin_manson(figure_path=None, figure_name=None, save_types=[]):
    #==============================================================================
    # title
    #==============================================================================
    title = ''
    #==============================================================================
    # figure format
    # http://matplotlib.org/users/customizing.html?highlight=rcparams
    #==============================================================================
    plot_format()
    #==============================================================================
    # grid set up
    #==============================================================================
    #plt.grid(True, which='major',linestyle='-')
    #plt.grid(True, which='minor',linestyle='-')
    #plt.grid(True, which='major')
    #plt.grid(True, which='minor')
    #==============================================================================
    # print title
    #==============================================================================
    plt.title(title, fontsize=16)
    #==============================================================================
    # x,y limite
    #==============================================================================
    plt.xlim(1E1, 2E6)
    plt.ylim(0.2, 2.0)
    #==============================================================================
    # xy log scale
    #==============================================================================
    plt.xscale('log')
    plt.yscale('log')
    #==============================================================================
    # xy axial equal
    #==============================================================================
    ax = plt.gca()
    ax.set_aspect('equal')
    ax.set_aspect('auto')
    #==============================================================================
    # http://stackoverflow.com/questions/21920233/matplotlib-log-scale-tick-label-number-formatting
    #==============================================================================
    #    ax.yaxis.set_major_locator(MultipleLocator(0.2))
    #    ax.yaxis.set_minor_locator(MultipleLocator(0.1))
    #    ax.yaxis.set_major_formatter(ScalarFormatter())
    #==============================================================================
    # plot lines
    #==============================================================================
    plot_data = PlotData()
    plot_data.readFromFile(figure_path, figure_name)
    plot_data.plot()
    #==============================================================================
    # Normalized
    #==============================================================================
    plt.yticks([])
    plt.ylabel('Normalized $\Delta\\varepsilon/2$')
    #==============================================================================
    # show legend
    #==============================================================================
    plt.legend(loc=0)
    #    plt.legend(loc=0,fontsize='small',frameon=True,numpoints=1,title='Temperature')
    #==============================================================================
    # save figures
    #==============================================================================
    if figure_path <> None and figure_name <> None:
        for save_type in save_types:
            plt.savefig(figure_path + figure_name + save_type,
                        dpi=150,
                        transparent=True)
            print 'save as', figure_path + figure_name + save_type
    plt.show()
    plt.close()
Esempio n. 3
0
def plot_exp_nth_cycle(figure_title='',
                       figure_path=None,
                       figure_name=None,
                       save_types=[]):
    #==============================================================================
    # title
    #==============================================================================
    title = figure_title
    #==============================================================================
    # figure format
    # http://matplotlib.org/users/customizing.html?highlight=rcparams
    #==============================================================================
    plot_format()
    mpl.rcParams['figure.subplot.left'] = 0.15
    #==============================================================================
    # grid set up
    #==============================================================================
    #plt.grid(True, which='major',linestyle='-')
    #plt.grid(True, which='minor',linestyle='-')
    #plt.grid(True, which='major')
    #plt.grid(True, which='minor')
    #==============================================================================
    # print title
    #==============================================================================
    plt.title(title, fontsize=16)
    #==============================================================================
    # x,y limite
    #==============================================================================
    plt.xlim(-1, 1)
    plt.ylim(-1000, 1000)
    #==============================================================================
    # xy log scale
    #==============================================================================
    #    plt.xscale('log')
    #    plt.yscale('log')
    #==============================================================================
    # xy axial equal
    #==============================================================================
    ax = plt.gca()
    #    ax.set_aspect('equal')
    ax.set_aspect('auto')
    #==============================================================================
    # plot lines
    #==============================================================================
    plot_data = PlotData()
    plot_data.readFromFile(figure_path, figure_name)
    plot_data.plot()
    #==============================================================================
    # http://stackoverflow.com/questions/21920233/matplotlib-log-scale-tick-label-number-formatting
    #==============================================================================
    ax.xaxis.set_major_locator(MultipleLocator(0.5))
    ax.xaxis.set_minor_locator(MultipleLocator(0.1))
    ax.xaxis.set_major_formatter(ScalarFormatter())
    ax.yaxis.set_major_locator(MultipleLocator(500))
    ax.yaxis.set_minor_locator(MultipleLocator(100))
    ax.yaxis.set_major_formatter(ScalarFormatter())
    #==============================================================================
    # show legend
    #==============================================================================
    plt.legend(loc=0)
    #==============================================================================
    # save figures
    #==============================================================================
    if figure_path <> None and figure_name <> None:
        for save_type in save_types:
            plt.savefig(figure_path + figure_name + save_type,
                        dpi=150,
                        transparent=True)
            print 'save as', figure_path + figure_name + save_type


#    plt.show()
    plt.close()
Esempio n. 4
0
def plot_fatigue_life(figure_path=None, figure_name=None, save_types=[]):
    #==============================================================================
    # title
    #==============================================================================
    title = ''
    #==============================================================================
    # figure format
    # http://matplotlib.org/users/customizing.html?highlight=rcparams
    #==============================================================================
    plot_format()
    mpl.rcParams['figure.figsize'] = (8, 8)
    fig, ax = plt.subplots()
    #==============================================================================
    # grid set up
    #==============================================================================
    #plt.grid(True, which='major',linestyle='-')
    #plt.grid(True, which='minor',linestyle='-')
    #plt.grid(True, which='major')
    #plt.grid(True, which='minor')
    #==============================================================================
    # print title
    #==============================================================================
    plt.title(title, fontsize=16)
    #==============================================================================
    # x,y limite
    #==============================================================================
    plt.xlim(1E0, 1E5)
    plt.ylim(1E0, 1E5)
    #==============================================================================
    # xy axial equal
    #==============================================================================
    plt.gca().set_aspect('equal')
    plt.gca().set_aspect('auto')
    #==============================================================================
    # xy log scale
    #==============================================================================
    plt.xscale('log')
    plt.yscale('log')
    #==============================================================================
    # plot lines
    #==============================================================================
    plot_data = PlotData()
    plot_data.readFromFile(figure_path, figure_name)
    plot_data.plot()
    #==============================================================================
    # plot 1x lines
    #==============================================================================
    linewidth = 1.0
    plt.plot([1, 1e5], [1, 1e5], color='black', linewidth=linewidth)
    #==============================================================================
    # plot 2x lines
    #==============================================================================
    linewidth = 0.5
    plt.plot([2, 1e5], [1, 5e4], color='black', linewidth=linewidth)
    plt.plot([1, 5e4], [2, 1e5], color='black', linewidth=linewidth)
    #==============================================================================
    # plot 5x lines
    #==============================================================================
    plt.plot([5, 1e5], [1, 2e4], color='black', linewidth=linewidth)
    plt.plot([1, 2e4], [5, 1e5], color='black', linewidth=linewidth)
    #==============================================================================
    # show legend
    #==============================================================================
    plt.legend(loc=0)
    #    plt.show()
    #==============================================================================
    # save figures
    #==============================================================================
    if figure_path <> None and figure_name <> None:
        for save_type in save_types:
            plt.savefig(figure_path + figure_name + save_type,
                        dpi=150,
                        transparent=True)
            print 'save as', figure_path + figure_name + save_type
    plt.close()