File tree Expand file tree Collapse file tree
examples/text_labels_and_annotations Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99described at http://matplotlib.org/users/usetex.html
1010properly installed on your system. The first time you run a script
1111you will see a lot of output from tex and associated tools. The next
12- time, the run may be silent, as a lot of the information is cached in
13- ~/.tex.cache
12+ time, the run may be silent, as a lot of the information is cached.
1413
1514Notice how the the label for the y axis is provided using unicode!
1615
2625t = np .linspace (0.0 , 1.0 , 100 )
2726s = np .cos (4 * np .pi * t ) + 2
2827
29- t = np .arange (0.0 , 1.0 + 0.01 , 0.01 )
30- s = np .cos (2 * 2 * np .pi * t ) + 2
31-
3228fig , ax = plt .subplots (figsize = (6 , 4 ), tight_layout = True )
3329ax .plot (t , s )
3430
3531ax .set_xlabel (r'\textbf{time (s)}' )
36- ax .set_ylabel ('\\ textit{Velocity (\u00B0 /sec)}' )
32+ ax .set_ylabel ('\\ textit{Velocity (\N{DEGREE SIGN} /sec)}' , fontsize = 16 )
3733ax .set_title (r'\TeX\ is Number $\displaystyle\sum_{n=1}^\infty'
38- r'\frac{-e^{i\pi}}{2^n}$!' )
34+ r'\frac{-e^{i\pi}}{2^n}$!' , fontsize = 16 , color = 'r' )
3935plt .show ()
You can’t perform that action at this time.
0 commit comments