Function Plotter is a Python application built with PySide2 and Matplotlib that allows users to plot mathematical functions (e.g., 5x^3 + 2x) and visualize the results on a graphical interface.
- Clone the repository to your local machine:
git clone https://github.com/youssefkhaled08/Function-Plotter.git
- Navigate to the project directory:
cd function-plotter
- Create a virtual environment for the required dependencies:
virtualenv venv
- Install the required dependencies:
pip install -r requirements.txt
-
Run the
Function Plotter.py
file:python "Function Plotter.py"
-
The Function Plotter application window will appear.
-
Enter the equation of the function you want to plot in the "Function of X" field.
-
Provide the minimum and maximum values of X in the corresponding fields.
-
Click the "Plot" button to generate the plot.
-
The plot graph will be displayed in the application window.
Invalid Function | Invalid Input | Missing Input |
---|---|---|
- I followed the Camel Case Naming Convention.
- When naming the GUI compnents, I started the name of each component with its type, such as
ptnPlot
for a button component, andtxtFunction
for a text input component. This way, it becomes easier to search and identify the purpose or functionality of each component just by looking at its name.
Consists of 3 Layers:
- First layer: The
validateUserInputs
function checks if the user provided all required inputs or not, and provides an error message box for any missing input. - Second Layer: The
validateFunction
function cheks if the inputted function in the right format.- It removes whitespaces from the inputted function.
- Replaces
**
with the^
operator to support its funcionality. - Uses Regular Expressions to check if there's any invalid operator in the function, and provides an error message box that shows the unsupported operator.
- Third Layer: The
validateUserInput
function cheks if the user provided valid inputs for the minimum and maxiumu values of X, and provides an error message box for any invalid value.
Used Pytest to perform end to end testing.
- IDE: VSCode
- GUI: PySide2
- Visualization Tool (used for plotting): Matplotlib
- Testing: Pytest