fortplot provides comprehensive support for Unicode characters and LaTeX-style Greek letter commands across all backends (PNG, PDF, ASCII). This enables professional scientific plotting with mathematical notation directly from Fortran code.
All 24 Greek letters are supported in both uppercase and lowercase forms:
\alpha
→ α, \beta
→ β, \gamma
→ γ, \delta
→ δ\epsilon
→ ε, \zeta
→ ζ, \eta
→ η, \theta
→ θ\iota
→ ι, \kappa
→ κ, \lambda
→ λ, \mu
→ μ\nu
→ ν, \xi
→ ξ, \omicron
→ ο, \pi
→ π\rho
→ ρ, \sigma
→ σ, \tau
→ τ, \upsilon
→ υ\phi
→ φ, \chi
→ χ, \psi
→ ψ, \omega
→ ω\Alpha
→ Α, \Beta
→ Β, \Gamma
→ Γ, \Delta
→ Δ\Epsilon
→ Ε, \Zeta
→ Ζ, \Eta
→ Η, \Theta
→ Θ\Iota
→ Ι, \Kappa
→ Κ, \Lambda
→ Λ, \Mu
→ Μ\Nu
→ Ν, \Xi
→ Ξ, \Omicron
→ Ο, \Pi
→ Π\Rho
→ Ρ, \Sigma
→ Σ, \Tau
→ Τ, \Upsilon
→ Υ\Phi
→ Φ, \Chi
→ Χ, \Psi
→ Ψ, \Omega
→ Ωuse fortplot
type(figure_t) :: fig
call fig%initialize()
call fig%set_title("Schrödinger Equation: i\hbar\partial\psi/\partial t = H\psi")
call fig%set_xlabel("Position \xi")
call fig%set_ylabel("Wavefunction \Psi(\xi)")
call fig%add_plot(x, psi_real, label="Re[\psi]")
call fig%add_plot(x, psi_imag, label="Im[\psi]")
call fig%legend()
! Works with all backends
call fig%savefig("schrodinger.png") ! PNG with Unicode
call fig%savefig("schrodinger.pdf") ! PDF with Unicode
call fig%savefig("schrodinger.txt") ! ASCII with Unicode
! Wave equations
call fig%set_title("Wave: \psi = A e^{i(\omega t - kx)}")
! Thermodynamics
call fig%set_xlabel("Temperature T (K)")
call fig%set_ylabel("Entropy \Delta S")
! Electromagnetic fields
call fig%add_plot(time, electric_field, label="E-field: \epsilon E")
call fig%add_plot(time, magnetic_field, label="B-field: \mu B")
! Statistical mechanics
call fig%set_title("Distribution: P(\xi) = e^{-\beta H(\xi)}/Z")
! Maxwell's equations
call fig%set_title("Maxwell: \nabla \times E = -\partial B/\partial t")
! Quantum mechanics
call fig%set_xlabel("Momentum p = \hbar k")
call fig%set_ylabel("Energy E = \hbar \omega")
! Statistical physics
call fig%add_plot(temp, entropy, label="S = k_B ln(\Omega)")
\command
patterns in textThe Unicode support is implemented through several modules:
fortplot_latex_parser
: LaTeX command recognition and parsingfortplot_unicode
: Unicode detection and UTF-8 handling\nabla
, \partial
, etc.) are preserved as-isComprehensive test coverage includes:
Run Unicode tests:
make test ARGS="--target test_comprehensive_unicode_coverage"
make test ARGS="--target test_unicode_png_pdf_rendering"
make test ARGS="--target test_unicode_ascii_rendering_simple"
See the complete working example:
make example ARGS="unicode_demo"
This generates demonstration plots showing Unicode rendering across all backends with comprehensive mathematical notation examples.
Potential future additions:
- Mathematical operators (\nabla
, \partial
, \int
, etc.)
- Subscripts and superscripts
- Additional symbol sets (arrows, operators, etc.)
- LaTeX math mode parsing
- Custom symbol definitions