X Tutup
Skip to content

Latex Greek fonts not working in legend #7028

@mdepitta

Description

@mdepitta
  • Fedora 20; Python 2.7.5; Matplotlib 1.4.3 (installed by yum/pip)

For some reason, I can render Latex fonts including Greek ones in my axis labels but when I try to do it with my legends in the same figure, I cannot.

Enforcing explicitly Latex as described here won't solve the issue.

In my code:

fig,ax = plt.suplot(111)
ax.plot(x,y)
ax.set_ylabel(r'$\xi$ etc.')    # Rendered correctly

# Add Legend
labels_legend = {'js'   : '$W_S,U_A$',
                 'xi'   : r'$\xi$',
                 'taup' : r'$\tau_p$'
                 }
obj_legend  = []
colors = {'js'   : 'k',
          'xi'   : 'r',
          'taup' : 'y'
         }
for k,lbl in labels_legend.iteritems():
    # Add artist for legend
    obj_legend.append(ax.plot([],[],color=colors[k], marker=" ", ls='-', lw=lw, label=labels_legend[k])[0])
# Add Legend (NOT RENDERED CORRECTLY!!!)
legend = ax.legend(obj_legend,labels_legend,numpoints=1,fontsize=legfs,frameon=True,loc=1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup