Search code examples
pythonmatplotlibspydertex

How can I include a "\DeltaT" as a subscript in Matplotlib?


I would like to write q, with the subscript \DeltaT. When I write r'q${\DeltaT}$', I get the error: Unknown symbol: \DeltaT, found ''. When I simply write r'q$\Delta$' or r'q$_T$', it works fine, but I can't manage to have the "\Delta" and the "T" together. Does anyone know how to fix this?

thanks!


Solution

  • You need to put a space between \Delta and T:

    from matplotlib import pyplot
    fig, ax = pyplot.subplots()
    ax.text(0.5, 0.5, r"$x_{\Delta T}$", fontsize=40)
    

    enter image description here