Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make sans serif superscript or subscript text in matplotlib?

I want to use a subscript in an axis label in a matplotlib figure. Using LaTeX I would set it as $N_i$, which gives me the italic serif font. I know I can get non-italic mathfont with \mathrm. But I would like to get the text in the default matplotlib sans-serif font so it matches the rest of the text in the figure. Is there a way to subscript text without using latex?

like image 266
frixhax Avatar asked Dec 30 '14 01:12

frixhax


People also ask

How do I create a superscript in Matplotlib?

Write Superscript in Matplotlib Plots Using the Dollar Sign To make subscripts, you have to write the expression inside the dollar sign using the _ and ^ symbols. If you use the _ symbol, the superscript will be under the character. If you use the ^ symbol, the superscript will be over the character.

How do you make a subscript in text?

To make text appear slightly above (superscript) or below (subscript) your regular text, you can use keyboard shortcuts. Select the character that you want to format. For superscript, press Ctrl, Shift, and the Plus sign (+) at the same time. For subscript, press Ctrl and the Equal sign (=) at the same time.

What is the difference between subscripted and superscript text give example?

It is used when writing chemical compounds. An example of subscript is N2. Superscript is the small letter / number above a particular letter / number. An example of superscript is 25.

What is the difference between subscript and superscript tag?

Subscript text appears half a character below the normal line and is sometimes rendered in a smaller font. Subscript text can be used for chemical formulas, like H2O to be written as H2O. Superscript: The <sup> tag is used to add a superscript text to the HTML document. The <sup> tag defines the superscript text.


1 Answers

Use \mathregular to use the font used for regular text outside of mathtext:

$\mathregular{N_i}$ 

Take a look here for more information.

like image 134
skytux Avatar answered Sep 24 '22 08:09

skytux