Skip to content

reneaas/plotmath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mathplot

mathplot is a Python package to automatically create textbook graphs of mathematical functions.

Basic examples

Example 1

import plotmath


def f(x):
    return x**2 - x - 2


fix, ax = plotmath.make_figure(
    functions=[f],
)

plotmath.savefig(
    dirname="../figures",
    fname="example_1.svg",
)

plotmath.show()

This will generate the following figure:

figure 1

Example 2

import plotmath
import numpy as np


def f(x):
    return x**2 * np.cos(x)


fix, ax = plotmath.make_figure(
    functions=[f],
    xmin=-6,
    xmax=6,
    ymin=-12,
    ymax=8,
)

plotmath.savefig(
    dirname="../figures",
    fname="example_2.svg",
)

plotmath.show()

This will generate the following figure:

figure 2

Example 3

import plotmath


def f(x):
    return x**2 - 4


def g(x):
    return x + 2


fix, ax = plotmath.make_figure(
    functions=[f, g],
    xmin=-6,
    xmax=6,
    ymin=-6,
    ymax=6,
)

plotmath.savefig(
    dirname="../figures",
    fname="example_3.svg",
)

plotmath.show()

This will generate the following figure:

figure 3

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages