Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ticklabels font using latex #11586

Copy link
Copy link
Closed
@photoniker

Description

@photoniker
Issue body actions

I can not change the fontstyle of the ticklabels to "sans-serif" when using latex.

import matplotlib.pyplot as plt
import numpy as np
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
rc('text', usetex=True)

def xticklabels_example():
    fig = plt.figure() 
    x = np.arange(20)
    y1 = np.cos(x)
    y2 = (x**2)
    y3 = (x**3)
    yn = (y1,y2,y3)
    COLORS = ('b','g','k')
    for i,y in enumerate(yn):
        ax = fig.add_subplot(len(yn),1,i+1)
        ax.plot(x, y, ls='solid', color=COLORS[i]) 
        if i != len(yn) - 1:
            # all but last 
            ax.set_xticklabels( () )
        else:
            for tick in ax.xaxis.get_major_ticks():
                tick.label.set_fontsize(14) 
                # specify integer or one of preset strings, e.g.
                #tick.label.set_fontsize('x-small') 
                tick.label.set_rotation('vertical')
    fig.suptitle('Matplotlib xticklabels Example')
    plt.show()

if __name__ == '__main__':
    xticklabels_example()

Matplotlib version

  • Operating system: python 3.6 (itom 3.1.0, www.itom.rocks)
  • Matplotlib version: 2.2.2
  • Python version: 3.6

pltbug2

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationGood first issueOpen a pull request against these issues if there are no active ones!Open a pull request against these issues if there are no active ones!keepItems to be ignored by the “Stale” Github ActionItems to be ignored by the “Stale” Github Actiontopic: text/usetex

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.