|
From: Gökhan S. <gok...@gm...> - 2010-11-23 16:37:25
|
On Tue, Nov 23, 2010 at 10:22 AM, Alejandro Weinstein <ale...@gm...> wrote: > > Hi: > > I want to use the symbol corresponding to a marker in a text > annotation. Something like > > textstr = 'This is the square marker: ?' > ax.text(0.05, 0.95, textstr) > > Is there something I can place where the question mark is above to get > the actual square (or any other of the symbols you can use as a > marker)? > > This is similar to what the legend command does, but I need more flexibility. > > Alejandro. > As I have learnt from Michael Droettboom, you can simply use unicode characters with a supported font set: In my setup I prefer DejaVu-Sans. First install these fonts into your system, then edit your matplotlibrc font.family : sans-serif font.sans-serif : DejaVu Sans or alternatively using your favorite unicode font. then try this example (suggest using a unicode supported text editor (e.g., vim)): #!/usr/bin/env python # -*- coding: utf-8 -*- import matplotlib.pyplot as plt plt.plot(range(100)) plt.text(0.05, 0.95, u"This is the square marker: □", fontsize=20) plt.show() Unicode characters are great for putting units, but it is not easy to construct complex equations. Does anyone know if there is sub/super-script range alphabet (not only numbers) supported unicode font set? -- Gökhan |