Skip to content

Commit 0e1a541

Browse files
author
John Garrett
committed
Add example of std-colors
1 parent af282dd commit 0e1a541

File tree

6 files changed

+26
-14
lines changed

6 files changed

+26
-14
lines changed

examples/figures/fig2.jpg

-83.8 KB
Binary file not shown.

examples/figures/fig2a.jpg

89.5 KB
Loading

examples/figures/fig2b.jpg

95.6 KB
Loading

examples/figures/fig2b.pdf

86 KB
Binary file not shown.

examples/plot-examples.py

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,27 @@ def model(x, p):
2424

2525
with plt.style.context(['science', 'ieee']):
2626
fig, ax = plt.subplots()
27-
for p in [10, 20, 50]:
27+
for p in [10, 20, 40, 100]:
28+
ax.plot(x, model(x, p), label=p)
29+
ax.legend(title='Order')
30+
ax.autoscale(tight=True)
31+
ax.set(**pparam)
32+
# Note: $\mu$ doesn't work with Times font (used by ieee style)
33+
ax.set_ylabel(r'Current (\textmu A)')
34+
fig.savefig('figures/fig2a.pdf')
35+
fig.savefig('figures/fig2a.jpg', dpi=300)
36+
37+
with plt.style.context(['science', 'ieee', 'std-colors']):
38+
fig, ax = plt.subplots()
39+
for p in [10, 15, 20, 30, 50, 100]:
2840
ax.plot(x, model(x, p), label=p)
2941
ax.legend(title='Order')
3042
ax.autoscale(tight=True)
3143
ax.set(**pparam)
3244
# Note: $\mu$ doesn't work with Times font (used by ieee style)
3345
ax.set_ylabel(r'Current (\textmu A)')
34-
fig.savefig('figures/fig2.pdf')
35-
fig.savefig('figures/fig2.jpg', dpi=300)
46+
fig.savefig('figures/fig2b.pdf')
47+
fig.savefig('figures/fig2b.jpg', dpi=300)
3648

3749
with plt.style.context(['science', 'scatter']):
3850
fig, ax = plt.subplots(figsize=(4, 4))
@@ -163,8 +175,8 @@ def model(x, p):
163175
for p in [5, 7, 10, 15, 20, 30, 38, 50, 100]:
164176
ax.plot(x, model(x, p), label=p)
165177
ax.legend(title='Order', fontsize=7)
166-
ax.set(xlabel='電壓 (mV)')
167-
ax.set(ylabel='電流 ($\mu$A)')
178+
ax.set(xlabel=r'電壓 (mV)')
179+
ax.set(ylabel=r'電流 ($\mu$A)')
168180
ax.autoscale(tight=True)
169181
fig.savefig('figures/fig14a.jpg', dpi=300)
170182

@@ -173,8 +185,8 @@ def model(x, p):
173185
for p in [5, 7, 10, 15, 20, 30, 38, 50, 100]:
174186
ax.plot(x, model(x, p), label=p)
175187
ax.legend(title='Order', fontsize=7)
176-
ax.set(xlabel='电压 (mV)')
177-
ax.set(ylabel='电流 ($\mu$A)')
188+
ax.set(xlabel=r'电压 (mV)')
189+
ax.set(ylabel=r'电流 ($\mu$A)')
178190
ax.autoscale(tight=True)
179191
fig.savefig('figures/fig14b.jpg', dpi=300)
180192

@@ -183,8 +195,8 @@ def model(x, p):
183195
for p in [5, 7, 10, 15, 20, 30, 38, 50, 100]:
184196
ax.plot(x, model(x, p), label=p)
185197
ax.legend(title='Order', fontsize=7)
186-
ax.set(xlabel='電圧 (mV)')
187-
ax.set(ylabel='電気 ($\mu$A)')
198+
ax.set(xlabel=r'電圧 (mV)')
199+
ax.set(ylabel=r'電気 ($\mu$A)')
188200
ax.autoscale(tight=True)
189201
fig.savefig('figures/fig14c.jpg', dpi=300)
190202

@@ -193,8 +205,8 @@ def model(x, p):
193205
for p in [5, 7, 10, 15, 20, 30, 38, 50, 100]:
194206
ax.plot(x, model(x, p), label=p)
195207
ax.legend(title='Order', fontsize=7)
196-
ax.set(xlabel='전압 (mV)')
197-
ax.set(ylabel='전류 ($\mu$A)')
208+
ax.set(xlabel=r'전압 (mV)')
209+
ax.set(ylabel=r'전류 ($\mu$A)')
198210
ax.autoscale(tight=True)
199211
fig.savefig('figures/fig14d.jpg', dpi=300)
200212

@@ -211,12 +223,12 @@ def model(x, p):
211223
# ]
212224
# })
213225

214-
# with plt.style.context(['science', 'cjk-fonts']):
226+
# with plt.style.context(['science', 'cjk-tc-font']):
215227
# fig, ax = plt.subplots()
216228
# for p in [5, 7, 10, 15, 20, 30, 38, 50, 100]:
217229
# ax.plot(x, model(x, p), label=p)
218230
# ax.legend(title='Order', fontsize=7)
219-
# ax.set(xlabel='電壓电压電圧 (mV)') #전압
220-
# ax.set(ylabel='電流电流電気 ($\mu$A)') #전류
231+
# ax.set(xlabel=r'電壓 (mV)')
232+
# ax.set(ylabel=r'電流 ($\mu$A)')
221233
# ax.autoscale(tight=True)
222234
# fig.savefig('figures/fig15.pdf', backend='pgf')

0 commit comments

Comments
 (0)