Example #1
0
def SetScientificFmt(axis='y', min_order=-3, max_order=3):
    """
    Scalar format for axes
    ======================
    """
    # applies to current axis
    fmt = ScalarFormatter(useOffset=True)
    fmt.set_powerlimits((min_order, max_order))
    if axis == 'y': gca().yaxis.set_major_formatter(fmt)
    else: gca().xaxis.set_major_formatter(fmt)
Example #2
0
def SetScientificFmt(axis='y', min_order=-3, max_order=3):
    """
    Scalar format for axes
    ======================
    """
    # applies to current axis
    fmt = ScalarFormatter(useOffset=True)
    fmt.set_powerlimits((min_order,max_order))
    if axis=='y': gca().yaxis.set_major_formatter(fmt)
    else:         gca().xaxis.set_major_formatter(fmt)
Example #3
0
def create_bar(filename, emfretmax, emfretmax_error, a, units):
    # Creates x locations to place the bars
    ind = arange(len(emfretmax))
    fig, ax = subplots()

    width = 0.35

    unit_label = 'p'
    if (units == 'u'):
        #add micro symbol
        unit_label = u"\u00B5"
        unit_label = unit_label + 'M'
    elif (units == 'n'):
        #add nano symbol
        unit_label = 'nM'
    elif (units == 'p'):
        #pico
        unit_label = 'pM'

    ax.bar(ind, emfretmax, width, color='r', yerr=emfretmax_error)
    ax.set_ylabel("Em$_{FRETMAX}$", fontsize=14)
    ax.set_xticks(ind + width / 2)
    ax.set_xticklabels(a)
    xlabel('Concentration of Donor [' + unit_label + ']')
    gca().yaxis.set_major_formatter(ScalarFormatter(useMathText=True))
    ax.ticklabel_format(axis='y', style='sci', scilimits=(0, 0))
    savefig(filename, bbox_inches='tight', dpi=200)
Example #4
0
def plot_best_light_curve(field_id, ccd_id):
    field = pdb.Field(field_id, "R")
    lc = get_best_light_curve(field, ccd_id)
    fig = plt.figure(figsize=(15,5))
    ax = fig.add_subplot(111)
    lc.plot(ax)
    #ax.yaxis.set_ticks([])
    from pylab import ScalarFormatter
    ax.yaxis.set_major_formatter(ScalarFormatter(False))
    ax.set_xlabel("MJD", fontsize=20)
    ax.set_ylabel("$R$ [mag]", fontsize=20)
    fig.savefig("plots/new_detection_efficiency/example_light_curve_f{}_ccd{}.pdf".format(field.id, ccd_id), bbox_inches="tight")
Example #5
0
File: f3.py Project: jpcoles/ZM
 def __init__(self, everyother=False):
     self.everyother = everyother
     ScalarFormatter.__init__(self)
Example #6
0
    # Plot throughput
    # ax2 = ax1.twinx()
    # ax2.plot(throughput_data, 'o-', color=paleblue, linewidth=2, markersize=8)

    # Label the axis
    ax1.set_title(label)
    ax1.set_xlabel('Number of concurrent requests')
    # ax2.set_ylabel('Requests per second')
    ax1.set_ylabel('Milliseconds')

    ax1.set_xticks(range(1, len(plot_labels) + 1, 1))
    ax1.set_xticklabels(plot_labels[0::1])
    fig.subplots_adjust(top=0.9, bottom=0.15, right=0.85, left=0.15)

    # Turn off scientific notation for Y axis
    ax1.yaxis.set_major_formatter(ScalarFormatter(False))

    # Set the lower y limit to the match the first column
    ax1.set_ylim(bottom=bp['boxes'][0].get_ydata()[0])
    _, yend = ax1.get_ylim()
    yend = int(yend)
    step = 50
    if yend < 50:
        step = 5
    print(yend)
    if yend > 1000:
        step = 100
    if yend > 2000:
        step = 200
    if yend > 10000:
        step = 500
Example #7
0
def create_scatter(filename, result, x, y, a, stddev, i, units):
    xx = linspace(
        x.min(), x.max(), 50
    )  #so this returns 50 evenly spaced values between the start and stop points
    yy = emfret(
        result.params, xx,
        a)  #it uses each of these to calculate emfretmax (one per xx value)
    z = linspace(x.min(), x.max(), 50)

    #this plots all the values contained in Y
    points = ['b.', 'r.', 'g.', 'c.',
              'm.']  #colors are: Blue, Red, Green, Cyan, Magenta.
    #Do not use yellow, too hard to see against white background
    stddev_points = ['b_', 'r_', 'g_', 'c_',
                     'm_']  #will plot colored horizontal lines for std dev
    line_style = ['b-', 'r-', 'g-', 'c-', 'm-'
                  ]  #uses dashes, but generally connects into a straight line

    #tracks the number of colors used in the lists above. Rotate through this list as necessary
    num_colors = len(points)

    #note that markersize is completely arbitrary
    #this plots the points of the given data, the calculated line is done below
    plot(x, y, points[i % num_colors], markersize=15)

    #plot the std dev ( point +/- std dev)
    #again, markersize/width are arbitrary. Markeredgewith increases the size of the dashes used by expanding the border.
    #the border is the same color as the interior of the marker, so it appears only the dashes got thicker
    plot(x,
         y - stddev,
         stddev_points[i % num_colors],
         markersize=7,
         markeredgewidth=3)
    plot(x,
         y + stddev,
         stddev_points[i % num_colors],
         markersize=7,
         markeredgewidth=3)
    plot([x, x], [y - stddev, y + stddev],
         line_style[i % num_colors],
         linewidth=1)  #this plots a vertical line between stddev values

    unit_label = 'p'
    if (units == 'u'):
        #add micro symbol
        unit_label = u"\u00B5"
        unit_label = unit_label + 'M'
    elif (units == 'n'):
        #add nano symbol
        unit_label = 'nM'
    elif (units == 'p'):
        #pico
        unit_label = 'pM'

    #this plots the calcualted EMfret (xx,yy), and a black horizontal line through the origin (xx, z) for orientation of the axis
    line = plot(xx,
                yy,
                line_style[i % num_colors],
                linewidth=3,
                label='Donor [{}] = {}'.format(unit_label, str(a)))
    plot(xx, z, 'k-')

    gca().yaxis.set_major_formatter(ScalarFormatter(useMathText=True))
    ticklabel_format(axis='y', style='sci', scilimits=(
        0, 0))  #this forces labels on the y axis into scientific format

    # appropriately labels the x and y axis, fontsize is arbitary
    xlabel('Concentration of Acceptor [' + unit_label + ']')
    ylabel("Em$_{FRET}$ (RFU)", fontsize=14)

    legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
    savefig(filename, bbox_inches='tight', dpi=200)