pythonmatplotlibitalic

How to disable italics font in python when defined xlabel or ylabel using subscript


import matplotlib.pyplot as plt
plt.plot()
plt.xlabel(r'Production$_{world}$')

enter image description here

As shown in image red frame, the word 'World' I don't want it to be italicized.


Solution

  • You can do this by adding font settings.

    import matplotlib.pyplot as plt
    fig = plt.figure(figsize=(4,3),dpi=144)
    
    plt.plot()
    plt.xlabel(r'Production$_\mathrm{world}$')
    

    enter image description here