File:Stretched exponential.svg

Summary

Description
English: Plot of en:stretched exponential functions for varying values of , as well as the degenerate cases . Stretched exponetials () are in reddish colors, compressed exponentials () are in greenish or bluish colors, and the standard exponential () is in yellow.
Date
Source Own work
Author LaundryPizza03
SVG development
InfoField
Source code
InfoField

Python code

Source code
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt

# Settings
mpl.rcParams['savefig.bbox'] = 'tight'
mpl.rcParams['figure.figsize'] = 6.4,4.8
mpl.rcParams['axes.titlesize'] = 10
mpl.rcParams['axes.labelsize'] = 10
mpl.rcParams['xtick.labelsize'] = 10
mpl.rcParams['ytick.labelsize'] = 10
mpl.rcParams['legend.fontsize'] = 10

# Parameters
x = np.linspace(0,4,513)
p = np.array([0,0.2,0.5,0.8,1,1.25,2,5,np.inf])

def getcolor(p):
    l = p**2/(1+p**2) if p < np.inf else 1.
    c = mpl.colormaps["Spectral"](l)
    c = mpl.colors.rgb_to_hsv(c[0:3])
    c[1] = 1 #Oversaturate
    c[2] *= 0.95
    c = mpl.colors.hsv_to_rgb(c[0:3])
    print(p, mpl.colors.to_hex(c), mpl.colors.rgb_to_hsv(c))
    return c

# Normal
fig,ax = plt.subplots()
for k in range(len(p)):
    if p[k] == 0:
        label = "$\\beta \\rightarrow 0$"
    elif p[k] == np.inf:
        label = "$\\beta \\rightarrow \\infty$"
    else:
        label = "$\\beta = %g$"%p[k]
    ax.plot(x, np.exp(-x**p[k]), color=getcolor(p[k]), label=label, ls='-' if 0<p[k]<np.inf else (2,(1,1)))

ax.set_xlim(min(x),max(x))

ax.set_ylabel("")
ax.set_ylim(0,None)

ax.minorticks_on()

ax.grid(True,c=(0.9,0.9,0.9),ls='-',which='major')

ax.legend(frameon=True, fancybox=False, framealpha=1, facecolor='white')
fig.savefig('Stretched exponential.svg')

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Category:CC-Zero#Stretched%20exponential.svgCategory:Self-published work
Category:Exponential functions
Category:CC-Zero Category:Exponential functions Category:Self-published work Category:Valid SVG created with Matplotlib code