diff --git a/examples/figures/fig01.jpg b/examples/figures/fig01.jpg new file mode 100644 index 0000000..6ec931a Binary files /dev/null and b/examples/figures/fig01.jpg differ diff --git a/examples/figures/fig02a.jpg b/examples/figures/fig02a.jpg new file mode 100644 index 0000000..72f456e Binary files /dev/null and b/examples/figures/fig02a.jpg differ diff --git a/examples/figures/fig02b.jpg b/examples/figures/fig02b.jpg new file mode 100644 index 0000000..9523067 Binary files /dev/null and b/examples/figures/fig02b.jpg differ diff --git a/examples/figures/fig02c.jpg b/examples/figures/fig02c.jpg new file mode 100644 index 0000000..6b3b541 Binary files /dev/null and b/examples/figures/fig02c.jpg differ diff --git a/examples/figures/fig03.jpg b/examples/figures/fig03.jpg new file mode 100644 index 0000000..98525d7 Binary files /dev/null and b/examples/figures/fig03.jpg differ diff --git a/examples/figures/fig04.jpg b/examples/figures/fig04.jpg new file mode 100644 index 0000000..e2970b2 Binary files /dev/null and b/examples/figures/fig04.jpg differ diff --git a/examples/figures/fig05.jpg b/examples/figures/fig05.jpg new file mode 100644 index 0000000..fe074bd Binary files /dev/null and b/examples/figures/fig05.jpg differ diff --git a/examples/figures/fig06.jpg b/examples/figures/fig06.jpg new file mode 100644 index 0000000..3ee963e Binary files /dev/null and b/examples/figures/fig06.jpg differ diff --git a/examples/figures/fig07.jpg b/examples/figures/fig07.jpg new file mode 100644 index 0000000..d457fd5 Binary files /dev/null and b/examples/figures/fig07.jpg differ diff --git a/examples/figures/fig08.jpg b/examples/figures/fig08.jpg new file mode 100644 index 0000000..7db584b Binary files /dev/null and b/examples/figures/fig08.jpg differ diff --git a/examples/figures/fig09.jpg b/examples/figures/fig09.jpg new file mode 100644 index 0000000..937ff29 Binary files /dev/null and b/examples/figures/fig09.jpg differ diff --git a/examples/figures/fig1.jpg b/examples/figures/fig1.jpg deleted file mode 100644 index 67bb36e..0000000 Binary files a/examples/figures/fig1.jpg and /dev/null differ diff --git a/examples/figures/fig1.pdf b/examples/figures/fig1.pdf deleted file mode 100644 index f2fe933..0000000 Binary files a/examples/figures/fig1.pdf and /dev/null differ diff --git a/examples/figures/fig10.jpg b/examples/figures/fig10.jpg index 1fbcdea..b244d60 100644 Binary files a/examples/figures/fig10.jpg and b/examples/figures/fig10.jpg differ diff --git a/examples/figures/fig10.pdf b/examples/figures/fig10.pdf deleted file mode 100644 index c48c607..0000000 Binary files a/examples/figures/fig10.pdf and /dev/null differ diff --git a/examples/figures/fig11.jpg b/examples/figures/fig11.jpg index b26d079..be369f9 100644 Binary files a/examples/figures/fig11.jpg and b/examples/figures/fig11.jpg differ diff --git a/examples/figures/fig11.pdf b/examples/figures/fig11.pdf deleted file mode 100644 index 7cd99d3..0000000 Binary files a/examples/figures/fig11.pdf and /dev/null differ diff --git a/examples/figures/fig12.jpg b/examples/figures/fig12.jpg index ed1cdb9..f2ba509 100644 Binary files a/examples/figures/fig12.jpg and b/examples/figures/fig12.jpg differ diff --git a/examples/figures/fig12.pdf b/examples/figures/fig12.pdf deleted file mode 100644 index 2b7434c..0000000 Binary files a/examples/figures/fig12.pdf and /dev/null differ diff --git a/examples/figures/fig13.jpg b/examples/figures/fig13.jpg index f49d815..fb66880 100644 Binary files a/examples/figures/fig13.jpg and b/examples/figures/fig13.jpg differ diff --git a/examples/figures/fig13.pdf b/examples/figures/fig13.pdf deleted file mode 100644 index 9ff9697..0000000 Binary files a/examples/figures/fig13.pdf and /dev/null differ diff --git a/examples/figures/fig16.jpg b/examples/figures/fig16.jpg index 04b1c41..6514c11 100644 Binary files a/examples/figures/fig16.jpg and b/examples/figures/fig16.jpg differ diff --git a/examples/figures/fig17.jpg b/examples/figures/fig17.jpg index d0188d9..0d1a87e 100644 Binary files a/examples/figures/fig17.jpg and b/examples/figures/fig17.jpg differ diff --git a/examples/figures/fig2a.jpg b/examples/figures/fig2a.jpg deleted file mode 100644 index 7c16381..0000000 Binary files a/examples/figures/fig2a.jpg and /dev/null differ diff --git a/examples/figures/fig2a.pdf b/examples/figures/fig2a.pdf deleted file mode 100644 index 4bc373c..0000000 Binary files a/examples/figures/fig2a.pdf and /dev/null differ diff --git a/examples/figures/fig2b.jpg b/examples/figures/fig2b.jpg deleted file mode 100644 index 998a738..0000000 Binary files a/examples/figures/fig2b.jpg and /dev/null differ diff --git a/examples/figures/fig2b.pdf b/examples/figures/fig2b.pdf deleted file mode 100644 index 3d5563c..0000000 Binary files a/examples/figures/fig2b.pdf and /dev/null differ diff --git a/examples/figures/fig2c.jpg b/examples/figures/fig2c.jpg deleted file mode 100644 index 861482d..0000000 Binary files a/examples/figures/fig2c.jpg and /dev/null differ diff --git a/examples/figures/fig2c.pdf b/examples/figures/fig2c.pdf deleted file mode 100644 index d6fd3dd..0000000 Binary files a/examples/figures/fig2c.pdf and /dev/null differ diff --git a/examples/figures/fig3.jpg b/examples/figures/fig3.jpg deleted file mode 100644 index f9a526f..0000000 Binary files a/examples/figures/fig3.jpg and /dev/null differ diff --git a/examples/figures/fig3.pdf b/examples/figures/fig3.pdf deleted file mode 100644 index e170a17..0000000 Binary files a/examples/figures/fig3.pdf and /dev/null differ diff --git a/examples/figures/fig4.jpg b/examples/figures/fig4.jpg deleted file mode 100644 index c5ceed1..0000000 Binary files a/examples/figures/fig4.jpg and /dev/null differ diff --git a/examples/figures/fig4.pdf b/examples/figures/fig4.pdf deleted file mode 100644 index 0ed12d4..0000000 Binary files a/examples/figures/fig4.pdf and /dev/null differ diff --git a/examples/figures/fig5.jpg b/examples/figures/fig5.jpg deleted file mode 100644 index b887de1..0000000 Binary files a/examples/figures/fig5.jpg and /dev/null differ diff --git a/examples/figures/fig5.pdf b/examples/figures/fig5.pdf deleted file mode 100644 index 754afae..0000000 Binary files a/examples/figures/fig5.pdf and /dev/null differ diff --git a/examples/figures/fig6.jpg b/examples/figures/fig6.jpg deleted file mode 100644 index ea2d2d7..0000000 Binary files a/examples/figures/fig6.jpg and /dev/null differ diff --git a/examples/figures/fig6.pdf b/examples/figures/fig6.pdf deleted file mode 100644 index 231f6c1..0000000 Binary files a/examples/figures/fig6.pdf and /dev/null differ diff --git a/examples/figures/fig7.jpg b/examples/figures/fig7.jpg deleted file mode 100644 index 7ff208b..0000000 Binary files a/examples/figures/fig7.jpg and /dev/null differ diff --git a/examples/figures/fig7.pdf b/examples/figures/fig7.pdf deleted file mode 100644 index 4baad58..0000000 Binary files a/examples/figures/fig7.pdf and /dev/null differ diff --git a/examples/figures/fig8.jpg b/examples/figures/fig8.jpg deleted file mode 100644 index ea0ad9f..0000000 Binary files a/examples/figures/fig8.jpg and /dev/null differ diff --git a/examples/figures/fig8.pdf b/examples/figures/fig8.pdf deleted file mode 100644 index a95ef38..0000000 Binary files a/examples/figures/fig8.pdf and /dev/null differ diff --git a/examples/figures/fig9.jpg b/examples/figures/fig9.jpg deleted file mode 100644 index cdad195..0000000 Binary files a/examples/figures/fig9.jpg and /dev/null differ diff --git a/examples/figures/fig9.pdf b/examples/figures/fig9.pdf deleted file mode 100644 index fa24708..0000000 Binary files a/examples/figures/fig9.pdf and /dev/null differ diff --git a/examples/plot-examples.py b/examples/plot-examples.py index 8f19bed..6c3a1c4 100644 --- a/examples/plot-examples.py +++ b/examples/plot-examples.py @@ -4,6 +4,16 @@ import matplotlib.pyplot as plt import scienceplots +import os + +# Check we are in examples dir +current_dir = os.getcwd().lower() +if (current_dir.endswith('scienceplots')): + os.chdir('./examples') +# Create 'figures' folder if it does not exist +if (not os.path.exists('./figures')): + os.makedirs('figures') + def model(x, p): return x ** (2 * p + 1) / (1 + x ** (2 * p)) @@ -19,8 +29,8 @@ def model(x, p): ax.legend(title='Order') ax.autoscale(tight=True) ax.set(**pparam) - fig.savefig('figures/fig1.pdf') - fig.savefig('figures/fig1.jpg', dpi=300) + fig.savefig('figures/fig01.jpg', dpi=300) + plt.close() with plt.style.context(['science', 'ieee']): fig, ax = plt.subplots() @@ -29,10 +39,8 @@ def model(x, p): ax.legend(title='Order') ax.autoscale(tight=True) ax.set(**pparam) - # Note: $\mu$ doesn't work with Times font (used by ieee style) - ax.set_ylabel(r'Current (\textmu A)') - fig.savefig('figures/fig2a.pdf') - fig.savefig('figures/fig2a.jpg', dpi=300) + fig.savefig('figures/fig02a.jpg', dpi=300) + plt.close() with plt.style.context(['science', 'ieee', 'std-colors']): fig, ax = plt.subplots() @@ -41,10 +49,8 @@ def model(x, p): ax.legend(title='Order') ax.autoscale(tight=True) ax.set(**pparam) - # Note: $\mu$ doesn't work with Times font (used by ieee style) - ax.set_ylabel(r'Current (\textmu A)') - fig.savefig('figures/fig2b.pdf') - fig.savefig('figures/fig2b.jpg', dpi=300) + fig.savefig('figures/fig02b.jpg', dpi=300) + plt.close() with plt.style.context(['science', 'nature']): fig, ax = plt.subplots() @@ -53,8 +59,8 @@ def model(x, p): ax.legend(title='Order') ax.autoscale(tight=True) ax.set(**pparam) - fig.savefig('figures/fig2c.pdf') - fig.savefig('figures/fig2c.jpg', dpi=300) + fig.savefig('figures/fig02c.jpg', dpi=300) + plt.close() with plt.style.context(['science', 'scatter']): fig, ax = plt.subplots(figsize=(4, 4)) @@ -73,8 +79,8 @@ def model(x, p): ax.set_ylabel(ylbl) ax.set_xlim([-2, 2]) ax.set_ylim([-2, 2]) - fig.savefig('figures/fig3.pdf') - fig.savefig('figures/fig3.jpg', dpi=300) + fig.savefig('figures/fig03.jpg', dpi=300) + plt.close() with plt.style.context(['science', 'high-vis']): fig, ax = plt.subplots() @@ -83,8 +89,8 @@ def model(x, p): ax.legend(title='Order') ax.autoscale(tight=True) ax.set(**pparam) - fig.savefig('figures/fig4.pdf') - fig.savefig('figures/fig4.jpg', dpi=300) + fig.savefig('figures/fig04.jpg', dpi=300) + plt.close() with plt.style.context(['dark_background', 'science', 'high-vis']): fig, ax = plt.subplots() @@ -93,8 +99,8 @@ def model(x, p): ax.legend(title='Order') ax.autoscale(tight=True) ax.set(**pparam) - fig.savefig('figures/fig5.pdf') - fig.savefig('figures/fig5.jpg', dpi=300) + fig.savefig('figures/fig05.jpg', dpi=300) + plt.close() with plt.style.context(['science', 'notebook']): fig, ax = plt.subplots() @@ -103,8 +109,8 @@ def model(x, p): ax.legend(title='Order') ax.autoscale(tight=True) ax.set(**pparam) - fig.savefig('figures/fig10.pdf') fig.savefig('figures/fig10.jpg', dpi=300) + plt.close() # Plot different color cycles @@ -115,8 +121,8 @@ def model(x, p): ax.legend(title='Order') ax.autoscale(tight=True) ax.set(**pparam) - fig.savefig('figures/fig6.pdf') - fig.savefig('figures/fig6.jpg', dpi=300) + fig.savefig('figures/fig06.jpg', dpi=300) + plt.close() with plt.style.context(['science', 'vibrant']): fig, ax = plt.subplots() @@ -125,8 +131,8 @@ def model(x, p): ax.legend(title='Order') ax.autoscale(tight=True) ax.set(**pparam) - fig.savefig('figures/fig7.pdf') - fig.savefig('figures/fig7.jpg', dpi=300) + fig.savefig('figures/fig07.jpg', dpi=300) + plt.close() with plt.style.context(['science', 'muted']): fig, ax = plt.subplots() @@ -135,8 +141,8 @@ def model(x, p): ax.legend(title='Order', fontsize=7) ax.autoscale(tight=True) ax.set(**pparam) - fig.savefig('figures/fig8.pdf') - fig.savefig('figures/fig8.jpg', dpi=300) + fig.savefig('figures/fig08.jpg', dpi=300) + plt.close() with plt.style.context(['science', 'retro']): fig, ax = plt.subplots() @@ -145,8 +151,8 @@ def model(x, p): ax.legend(title='Order') ax.autoscale(tight=True) ax.set(**pparam) - fig.savefig('figures/fig9.pdf') - fig.savefig('figures/fig9.jpg', dpi=300) + fig.savefig('figures/fig09.jpg', dpi=300) + plt.close() with plt.style.context(['science', 'grid']): fig, ax = plt.subplots() @@ -155,8 +161,8 @@ def model(x, p): ax.legend(title='Order') ax.autoscale(tight=True) ax.set(**pparam) - fig.savefig('figures/fig11.pdf') fig.savefig('figures/fig11.jpg', dpi=300) + plt.close() with plt.style.context(['science', 'high-contrast']): fig, ax = plt.subplots() @@ -165,8 +171,8 @@ def model(x, p): ax.legend(title='Order') ax.autoscale(tight=True) ax.set(**pparam) - fig.savefig('figures/fig12.pdf') fig.savefig('figures/fig12.jpg', dpi=300) + plt.close() with plt.style.context(['science', 'light']): fig, ax = plt.subplots() @@ -175,8 +181,8 @@ def model(x, p): ax.legend(title='Order', fontsize=7) ax.autoscale(tight=True) ax.set(**pparam) - fig.savefig('figures/fig13.pdf') fig.savefig('figures/fig13.jpg', dpi=300) + plt.close() # Note: You need to install the Noto Serif CJK Fonts before running # examples 14 and 15. See FAQ in README. @@ -190,6 +196,7 @@ def model(x, p): ax.set(ylabel=r'電流 ($\mu$A)') ax.autoscale(tight=True) fig.savefig('figures/fig14a.jpg', dpi=300) + plt.close() with plt.style.context(['science', 'no-latex', 'cjk-sc-font']): fig, ax = plt.subplots() @@ -200,6 +207,7 @@ def model(x, p): ax.set(ylabel=r'电流 ($\mu$A)') ax.autoscale(tight=True) fig.savefig('figures/fig14b.jpg', dpi=300) + plt.close() with plt.style.context(['science', 'no-latex', 'cjk-jp-font']): fig, ax = plt.subplots() @@ -210,6 +218,7 @@ def model(x, p): ax.set(ylabel=r'電気 ($\mu$A)') ax.autoscale(tight=True) fig.savefig('figures/fig14c.jpg', dpi=300) + plt.close() with plt.style.context(['science', 'no-latex', 'cjk-kr-font']): fig, ax = plt.subplots() @@ -220,6 +229,7 @@ def model(x, p): ax.set(ylabel=r'전류 ($\mu$A)') ax.autoscale(tight=True) fig.savefig('figures/fig14d.jpg', dpi=300) + plt.close() # import matplotlib # matplotlib.use('pgf') # stwich backend to pgf @@ -243,6 +253,7 @@ def model(x, p): # ax.set(ylabel=r'電流 ($\mu$A)') # ax.autoscale(tight=True) # fig.savefig('figures/fig15.pdf', backend='pgf') +# plt.close() with plt.style.context(['science', 'russian-font']): fig, ax = plt.subplots() @@ -253,6 +264,7 @@ def model(x, p): ax.set(ylabel=r'Сила тока ($\mu$A)') ax.autoscale(tight=True) fig.savefig('figures/fig16.jpg', dpi=300) + plt.close() with plt.style.context(['science', 'turkish-font']): fig, ax = plt.subplots() @@ -263,3 +275,4 @@ def model(x, p): ax.set(ylabel=r'Mevcut Güç/Akım ($\mu$A)') ax.autoscale(tight=True) fig.savefig('figures/fig17.jpg', dpi=300) + plt.close()