EqnPlot is a small PyQt5 desktop application for plotting one or more equations of the form y = f(x).
This file is meant as a short developer handoff so the project can be resumed later without needing the original implementation context.
-
main.pyEntry point. Starts the Qt application througheqnplot.main_window.run(). -
eqnplot/main_window.pyMain window and UI orchestration. Responsibilities:- builds the control panel
- manages recent expressions
- manages the curve list
- manages palettes and custom per-curve colors
- persists user settings with
QSettings - prepares
PlotOptionsand compiled functions for the plot widget
-
eqnplot/plot_widget.pyCustom drawing widget. Responsibilities:- evaluates functions over the current X range
- computes Y bounds automatically
- draws grid, axes, labels, legend, curves, hover markers, and hover tooltip
- handles zoom and pan interactions
- exports the current graph as PNG
-
eqnplot/parser.pySafe expression parser. Responsibilities:- validates user input via AST
- only allows approved operators, constants, and math functions
- returns a callable
f(x)
-
eqnplot/models.pyShared dataclasses:CurveSpecPlotOptions
-
tests/test_parser.pyParser validation tests. -
tests/test_plot_widget.pyPlot widget behavior tests. -
build.pyCross-platform PyInstaller build helper. -
build.ps1Windows wrapper aroundbuild.py. -
EqnPlot.specChecked-in PyInstaller spec for the normalonedirbuild. -
installer.issWindows Inno Setup installer script.
- Function sampling is based on plot width in pixels, not directly on
x_min/x_max. - Current rule:
sample_count = max(2, round(pixel_width) * 5). - This keeps plotting cost roughly tied to screen size instead of numeric range size.
-
Smooth mode:
- draws a classic Qt path/polyline style curve
- visually cleaner
- can become slower on very dense plots
-
Optimized mode:
- uses a faster rendering strategy for dense data
- intended for very large visible ranges
- may introduce minor visual artifacts in extreme cases
The optimized mode is optional and disabled by default.
- Hover can show:
- vertical guide line
- points on curves at current mouse X
- floating tooltip near the mouse cursor
- The tooltip can be turned on/off from the UI.
- The legend is drawn inside the plot area.
- It can be turned on/off from the UI.
-
Plot redraw is automatic on:
- expression edit completion
- Enter in expression or X bounds
- display option changes
- palette changes
- custom color changes
-
The old manual
Plotbutton was intentionally removed.
- Recent expressions are stored in
QSettings. - A built-in starter set of nice demo expressions is merged into recents so a fresh session always has quick examples.
- The curve list is the source of truth when it contains at least one item.
- If the curve list is empty, the current expression field is treated as a single curve.
LightandDarkpalettes provide default colors for at least 10 curves.Custommode enables per-curve colors.- In
Custom, double-clicking a curve in the list opens a color picker.
QSettings persists:
- expression and X range
- display toggles
- palette choice
- custom colors
- custom per-curve colors
- recent expressions
- current curve list
-
python build.pyNormalonedirbuild usingEqnPlot.spec -
python build.py --onefileDirect PyInstaller onefile build frommain.py -
UPXis disabled by default -
Enable it only explicitly with:
python build.py --upxpython build.py --onefile --upx
The checked-in spec is useful and should be kept.
It defines the stable onedir build and avoids relying on a generated spec. The onefile path is intentionally separate and writes temporary spec data under build/ so the repository spec is not overwritten.
- Packaging paths were converted to relative/pathlib-based paths.
build.pyis cross-platform.build.ps1andinstaller.issare Windows-specific.- The application code itself is mostly portable to Linux/macOS as long as PyQt5 and Qt runtime dependencies are available.
installer.iss currently supports:
- per-user install
- all-users install
- uninstall display icon
Per-user install should not require admin rights. All-users install may require elevation.
- No zoom rectangle
- No panning in Y
- No manual Y bounds
- No parametric or polar modes
- No packaging path yet for Linux distributions
- per-curve visibility checkbox
- per-curve rename/label
- better export options such as custom resolution
- Linux packaging path
- optional status bar instead of inline status label
- more widget tests for UI-specific behavior