Skip to main content

Automatically generates textbook graphs for mathematical functions.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plotmath-0.1.8.tar.gz (4.0 kB view hashes)

Uploaded Source

Built Distribution

plotmath-0.1.8-py3-none-any.whl (4.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page