# -*- coding: utf-8 -*- """ Created on Tue Apr 21 16:42:24 2020 Author: Ian Morgan email: ilmorgan@ucsb.edu """ import matplotlib.pyplot as plt import pandas as pd from functions.utilities import logbins if __name__ == '__main__': data = pd.read_csv('../data/Fig2bdata.csv') # Get values in nms data['length_nm'] = data['length_um']*1000 params = {'backend': 'ps', 'axes.labelsize': 8, 'font.family': 'sans-serif', 'font.sans-serif': 'Arial', 'font.size': 8, 'legend.fontsize': 6, 'legend.handlelength': 1, 'xtick.labelsize': 6, 'ytick.labelsize': 6, 'text.usetex': True} plt.rcParams.update(params) # Start figure fig = plt.figure(dpi = 1200) fig.set_size_inches(1.75,1.75) # dimensions of axis [left,bottom,width,height] rect = [0.21,0.15,0.75,0.63] # add axis ax = fig.add_axes(rect) dfbinned = logbins(data,num=12) # Convert to length difference dfbinned['length_nm_mean'] -= dfbinned['length_nm_mean'].iloc[0] ax.errorbar('time_s_mean','length_nm_mean',yerr='length_nm_sem', data=dfbinned, fmt = 'o', ms = 2) # make line at 1 sec #ax.axhline(0,c='grey',lw = 1) # set xaxis scale to logarithmic ax.set_xscale('log') # set axes limits #ax.set_xlim(1,1000) # set axis ticks #ax.set_yticks([-10,0,30]) # set axis labels ax.set_xlabel('$t-t_w$ (s)', labelpad = 1) ax.set_ylabel('$L(t)-L(t_w)$ (nm)', labelpad = 1) # Set tick params ax.tick_params(direction="in", pad = 3, which = 'both') plt.savefig('../figures/Fig2b.pdf')