Skip to content

Instantly share code, notes, and snippets.

@trilusa
Created September 20, 2024 17:21
Show Gist options
  • Select an option

  • Save trilusa/3b67e4e9c77d597308f9efa1cc38a042 to your computer and use it in GitHub Desktop.

Select an option

Save trilusa/3b67e4e9c77d597308f9efa1cc38a042 to your computer and use it in GitHub Desktop.
'''
Code to plot Rs measurements.
Use ChatGPT to arrange the data from the spreadsheet into python arrays. Put in informative label on each trace
Adrian Salustri
'''
import pandas as pd
import matplotlib.pyplot as plt
strain_s1 = [0, 5, 10, 15, 20]
rs_s1 = [208.04, 292.01, 406.84, 1528.73, 3331.48]
strain_s2 = [0, 5, 10, 15]
rs_s2 = [172.28, 261.63, 389.03, 1560.49]
strain_s1_5umNylon = [0, 5, 10, 15, 20, 30, 40]
rs_s1_5umNylon = [209.15, 206.38, 245.34, 338.21, 628.39, 4884.62, 42522.32]
strain_s2_5umNylon = [0, 5, 10, 15, 20, 30, 40]
rs_s2_5umNylon = [270.87, 423.49, 526.04, 861.12, 1051.78, 1643.02, 22052.70]
strain_s3_5umNylon = [0, 5, 10, 15, 20, 30, 40, 50]
rs_s3_5umNylon = [161.86, 229.22, 405.24, 736.92, 1059.32, 3911.34, 30266.34, 327683.62]
# Plotting the data
fig = plt.figure(figsize=(10, 6))
labels = ['1 Layer', '2 Layer', '3 Layer']
# Plot the data with square markers
plt.plot(strain_s1, rs_s1, marker='s', label='S1 - 3 layer (NMT)')
plt.plot(strain_s2, rs_s2, marker='s', label='S2 - 2 layer (NMT)')
# Plot the data with diamond markers
plt.plot(strain_s1_5umNylon, rs_s1_5umNylon, marker='d', label='S1 - 2 layer (w/ 5um Nylon)')
plt.plot(strain_s2_5umNylon, rs_s2_5umNylon, marker='d', label='S2 - 1 layer (w/ 5um Nylon)')
plt.plot(strain_s3_5umNylon, rs_s3_5umNylon, marker='d', label='S3 - 1 layer (w/ 5um Nylon)')
# Adding labels and title
plt.xlabel('Strain (%)')
plt.ylabel('log Sheet Resistance (Ohms/square)')
plt.title('Sheet Resistance vs Strain for STEC-enhanced PEDOT:PSS')
plt.legend()
plt.grid(True)
#add equation used.
plt.text(0.55, 0.88, r'$R_s = R\frac{W}{L}$', ha='center', va='center', transform=plt.gca().transAxes, fontsize=20)
#(un)/comment for log scale
plt.ylabel('log Sheet Resistance (Ohms/square)')
plt.yscale('log')
plt.ylim(100,10**5)
## linear scale
# plt.yscale('linear')
# plt.ylim(0,1000)
# plt.ylabel('Sheet Resistance (Ohms/square)')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment