Skip to content

A simple function plotter application built using PySide2 for the GUI and Matplotlib for plotting.

Notifications You must be signed in to change notification settings

HalemoGPA/Function-Plotter-GUI-PySide2-Matplotlib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Function Plotter

Overview

This project is a simple function plotter application built using PySide2 for the GUI and Matplotlib for plotting. The application allows users to input a mathematical function and plot its graph over a specified range.

Features

  • Input a function of x, e.g., 5*x^3 + 2*x.
  • Specify minimum and maximum values for x.
  • Supports operators: +, -, /, *, ^, log10(), sqrt().
  • Input validation with user-friendly error messages.
  • GUI built using PySide2.
  • Plotting powered by Matplotlib.

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/FunctionPlotterProject.git
    cd FunctionPlotterProject
  2. Create a virtual environment:

    python -m venv venv
    source venv/bin/activate   # On Windows, use `venv\Scripts\activate`
  3. Install the required dependencies:

    pip install -r requirements.txt

Running the Application

To run the application, execute the following command:

python src/main.py

Examples

Basic Function Input

  • Function: 5*x^3 + 2*x
  • Range: 0 to 10
  • Expected Output: Parabolic curve.

    Basic Function

Invalid Character in Function

  • Function: 5*x^3 + 2*x + !
  • Range: 0 to 10
  • Expected Output: Error message: "Function contains invalid characters."

    Invalid Character

Complex Formula Function

  • Function: 5*x^3 + 2*x -4/x + 7
  • Range: -10 to 10
  • Expected Output: Combined plot of Cubic and rational functions.

    Complex Formula

Using Sqrt & log10 in Function

  • Function: 2*x^4 - log10(x) + sqrt(x)
  • Range: 0 to 50
  • Expected Output: Combined plot of square root, logarithm, and quadratic function.

    Complex Formula

Negative Input to sqrt or log10

  • Function: 2*x^4 - log10(x) + sqrt(x)
  • Range: -50 to 500
  • Expected Output: Error message: "Min value must be non-negative for functions with log10 or sqrt."

    Negative Input

Wrong Input for Min and Max Values

  • Function: x
  • Range: a to 2
  • Expected Output: Error message: "Min and Max values must be numbers."

    Wrong Input

Using -inf and +inf for min and max values

  • Function: x
  • Range: -inf to inf
  • Expected Output: Straight 45deg line from -inf to +inf

    -inf to inf range

Constant Function Formula

  • Function: 5
  • Range: -10 to 10
  • Expected Output: Straight horizontal line from -inf to +inf

    constant function

automated tests. run some automated tests using pytest

tests passed

About

A simple function plotter application built using PySide2 for the GUI and Matplotlib for plotting.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages