title: How to obtain the same font(-style, -size etc.) in matplotlib output as in latex output?
body: <p>I have one <code>.tex</code>-document in which one graph is made by the python module <code>matplotlib</code>. What I want is, that the graph blends in to the document as good as possible. So I want the characters used in the graph to look exactly like the other same characters in the rest of the document.</p>
  
  <p>My first try looks like this (the <code>matplotlibrc</code>-file):  </p>
  
  <pre><code>text.usetex   : True
  text.latex.preamble: \usepackage{lmodern} #Used in .tex-document
  font.size    : 11.0 #Same as in .tex-document
  backend: PDF
  </code></pre>
  
  <p>For compiling of the <code>.tex</code> in which the PDF output of <code>matplotlib</code> is included, <code>pdflatex</code> is used.</p>
  
  <p>Now, the output looks not bad, but it looks somewhat different, the characters in the graph seem weaker in stroke width.</p>
  
  <p>What is the best approach for this?</p>
  
  <p>EDIT: Minimum example: LaTeX-Input:  </p>
  
  <pre><code>\documentclass[11pt]{scrartcl}
  
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{lmodern}
  \usepackage{graphicx}
  
  \begin{document}
  
  \begin{figure}
  \includegraphics{./graph}
  \caption{Excitation-Energy}
  \label{fig:graph}
  \end{figure}
  
  \end{document}
  </code></pre>
  
  <p>Python-Script:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  
  plt.plot([1,2,3,4])
  plt.xlabel("Excitation-Energy")
  plt.ylabel("Intensität")
  plt.savefig("graph.pdf")
  </code></pre>
  
  <p>PDF output:</p>
  
  <p><img src="https://i.stack.imgur.com/dUSIg.png" alt="enter image description here"></p>