Section 0.3 - Science Plots

Section 0.3 - Science Plots#

This is the third notebook.

Open In Colab
import numpy as np
import matplotlib.pyplot as plt
import scienceplots

import os
def model(x, p):
    return x ** (2 * p + 1) / (1 + x ** (2 * p))


pparam = dict(xlabel='Voltage (mV)', ylabel=r'Current ($\mu$A)')

x = np.linspace(0.75, 1.25, 201)
with plt.style.context(['science', 'scatter']):
    fig, ax = plt.subplots(figsize=(4, 4))
    ax.plot([-2, 2], [-2, 2], 'k--')
    ax.fill_between([-2, 2], [-2.2, 1.8], [-1.8, 2.2], color='dodgerblue', alpha=0.2, lw=0)
    for i in range(7):
        x1 = np.random.normal(0, 0.5, 10)
        y1 = x1 + np.random.normal(0, 0.2, 10)
        ax.plot(x1, y1, label=r"$^\#${}".format(i+1))
    lgd = r"$\mathring{P}=\begin{cases}1&\text{if $\nu\geq0$}\\0&\text{if $\nu<0$}\end{cases}$"
    ax.legend(title=lgd, loc=2, ncol=2)
    xlbl = r"$\log_{10}\left(\frac{L_\mathrm{IR}}{\mathrm{L}_\odot}\right)$"
    ylbl = r"$\log_{10}\left(\frac{L_\circledast}{\mathrm{L}_\odot}\right)$"
    ax.set_xlabel(xlbl)
    ax.set_ylabel(ylbl)
    ax.set_xlim([-2, 2])
    ax.set_ylim([-2, 2])
    fig.savefig('figures/fig03.jpg', dpi=300)
    plt.show()
../../_images/1f33d6865569d01479ac46ca0b6e46fe941f360a59d205b92a9329430ac42346.png
with plt.style.context(['science','no-latex']):
    fig, ax = plt.subplots()
    for p in [10, 15, 20, 30, 50, 100]:
        ax.plot(x, model(x, p), label=p)
    ax.legend(title='Order')
    ax.autoscale(tight=True)
    ax.set(**pparam)
    fig.savefig('figures/fig01a.jpg', dpi=300)
    plt.show()
../../_images/c7ef15f080922ea9275b31f8d4bf56bb196a67e255a4531ccd139d2e729c63d4.png
with plt.style.context(['science', 'no-latex']):
    fig, ax = plt.subplots()
    for p in [10, 15, 20, 30, 50, 100]:
        ax.plot(x, model(x, p), label=p)
    ax.legend(title='Order')
    ax.autoscale(tight=True)
    ax.set(**pparam)
    fig.savefig('figures/fig01b.jpg', dpi=300)
    plt.show()
../../_images/c7ef15f080922ea9275b31f8d4bf56bb196a67e255a4531ccd139d2e729c63d4.png
with plt.style.context(['science', 'ieee','no-latex']):
    fig, ax = plt.subplots()
    for p in [10, 20, 40, 100]:
        ax.plot(x, model(x, p), label=p)
    ax.legend(title='Order')
    ax.autoscale(tight=True)
    ax.set(**pparam)
    fig.savefig('figures/fig02a.jpg', dpi=300)
    plt.show()
../../_images/3e9976e22a40ef452c081001db91a373232eabc1b7c695ae148553c6a02bcdf0.png
with plt.style.context(['science', 'ieee', 'std-colors','no-latex']):
    fig, ax = plt.subplots()
    for p in [10, 15, 20, 30, 50, 100]:
        ax.plot(x, model(x, p), label=p)
    ax.legend(title='Order')
    ax.autoscale(tight=True)
    ax.set(**pparam)
    fig.savefig('figures/fig02b.jpg', dpi=300)
    plt.show()
../../_images/37013854f371a395caf6214c76d52552cca7ec059433482276bf81b9f8052f4f.png
with plt.style.context(['science', 'nature','no-latex']):
    fig, ax = plt.subplots()
    for p in [10, 15, 20, 30, 50, 100]:
        ax.plot(x, model(x, p), label=p)
    ax.legend(title='Order')
    ax.autoscale(tight=True)
    ax.set(**pparam)
    fig.savefig('figures/fig02c.jpg', dpi=300)
    plt.show()
../../_images/683f209e1f3e1704334ebdb6ef96317609ea20c26906a64e7902a172cea10ec0.png
with plt.style.context(['science', 'high-vis','no-latex']):
    fig, ax = plt.subplots()
    for p in [10, 15, 20, 30, 50, 100]:
        ax.plot(x, model(x, p), label=p)
    ax.legend(title='Order')
    ax.autoscale(tight=True)
    ax.set(**pparam)
    fig.savefig('figures/fig04.jpg', dpi=300)
    plt.show()
../../_images/a12c161e47f7bd1dc74aa429066f2cb8d571cbed93b8df720f307fa9c0821f33.png
with plt.style.context(['dark_background', 'science', 'high-vis','no-latex']):
    fig, ax = plt.subplots()
    for p in [10, 15, 20, 30, 50, 100]:
        ax.plot(x, model(x, p), label=p)
    ax.legend(title='Order')
    ax.autoscale(tight=True)
    ax.set(**pparam)
    fig.savefig('figures/fig05.jpg', dpi=300)
    plt.show()
../../_images/ada5ba305d694a7bfee68c38211cf5d096d178c3d9923bc8c96be2abc07d709b.png
with plt.style.context(['science', 'notebook','no-latex']):
    fig, ax = plt.subplots()
    for p in [10, 15, 20, 30, 50, 100]:
        ax.plot(x, model(x, p), label=p)
    ax.legend(title='Order')
    ax.autoscale(tight=True)
    ax.set(**pparam)
    fig.savefig('figures/fig10.jpg', dpi=300)
    plt.show()
../../_images/652e20263306d9b56c4aeb0c0807417482d4b2157d55d55678e64e851ed42945.png
with plt.style.context(['science', 'bright','no-latex']):
    fig, ax = plt.subplots()
    for p in [5, 10, 15, 20, 30, 50, 100]:
        ax.plot(x, model(x, p), label=p)
    ax.legend(title='Order')
    ax.autoscale(tight=True)
    ax.set(**pparam)
    fig.savefig('figures/fig06.jpg', dpi=300)
    plt.show()
../../_images/8aa59c036f1e2a957c2ab387206816f52149b5e2c43303a5fcfe409fc00b4cec.png
with plt.style.context(['science', 'vibrant','no-latex']):
    fig, ax = plt.subplots()
    for p in [5, 10, 15, 20, 30, 50, 100]:
        ax.plot(x, model(x, p), label=p)
    ax.legend(title='Order')
    ax.autoscale(tight=True)
    ax.set(**pparam)
    fig.savefig('figures/fig07.jpg', dpi=300)
    plt.show()
../../_images/71f7c1193ce991b6c7bf7c37936f51c9a4905ec31343c92d3fd83a6e73a4e6c3.png
with plt.style.context(['science', 'muted','no-latex']):
    fig, ax = plt.subplots()
    for p in [5, 7, 10, 15, 20, 30, 38, 50, 100, 500]:
        ax.plot(x, model(x, p), label=p)
    ax.legend(title='Order', fontsize=7)
    ax.autoscale(tight=True)
    ax.set(**pparam)
    fig.savefig('figures/fig08.jpg', dpi=300)
    plt.show()
../../_images/9793680db809d8ec6e17ced2c9172f97f10282c465bbaa763b9dfc04f1f1f6ed.png
with plt.style.context(['science', 'retro','no-latex']):
    fig, ax = plt.subplots()
    for p in [10, 15, 20, 30, 50, 100]:
        ax.plot(x, model(x, p), label=p)
    ax.legend(title='Order')
    ax.autoscale(tight=True)
    ax.set(**pparam)
    fig.savefig('figures/fig09.jpg', dpi=300)
    plt.show()
../../_images/e116a586073a7f0fecf83f3285d0159be12170774c0b0bfcfe4469e788662cf4.png
with plt.style.context(['science', 'grid','no-latex']):
    fig, ax = plt.subplots()
    for p in [10, 15, 20, 30, 50, 100]:
        ax.plot(x, model(x, p), label=p)
    ax.legend(title='Order')
    ax.autoscale(tight=True)
    ax.set(**pparam)
    fig.savefig('figures/fig11.jpg', dpi=300)
    plt.show()
../../_images/ebc67dc8ba68186cf814c9f63c74dd9cd09d0109db06d3b7c57ec0903c3362eb.png
with plt.style.context(['science', 'high-contrast','no-latex']):
    fig, ax = plt.subplots()
    for p in [10, 20, 50]:
        ax.plot(x, model(x, p), label=p)
    ax.legend(title='Order')
    ax.autoscale(tight=True)
    ax.set(**pparam)
    fig.savefig('figures/fig12.jpg', dpi=300)
    plt.show()
../../_images/92c6aa30e48c07f9ac44617d038453300b5086577e3499a38b54bbe040fc2c6e.png
with plt.style.context(['science', 'light','no-latex']):
    fig, ax = plt.subplots()
    for p in [5, 7, 10, 15, 20, 30, 38, 50, 100]:
        ax.plot(x, model(x, p), label=p)
    ax.legend(title='Order', fontsize=7)
    ax.autoscale(tight=True)
    ax.set(**pparam)
    fig.savefig('figures/fig13.jpg', dpi=300)
    plt.show()
../../_images/c7bad73b94b27a5c084f511539f1bb4f5d70e8e31e30f4624bf729fbb96a6fee.png