On Tue, Nov 23, 2010 at 10:22 AM, Alejandro Weinstein
<alejandro.weinst...@gmail.com> 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

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to