

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to obtain the same font in Matplotlib output as in LaTex output?
To make bold font weight LaTeX axes label in matplotlib, we can take the following steps−
- Create data points for x.
- Create data points for y, i.e., y=sin(x).
- Plot the curve x and y with LaTex representation.
- To activate the label, use legend() method.
- To display the figure, use show() method.
Example
import numpy as np from matplotlib import pyplot as plt, font_manager as fm fprop = fm.FontProperties(fname='/usr/share/fonts/truetype/malayalam/Karumbi.ttf') plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True x = np.linspace(1, 10, 1000) y = np.sin(x) plt.plot(x, y, label=r'$\sin (x)$', c="red", lw=2) plt.title(label=r'$\sin (x)$', fontproperties=fprop) plt.show()
Output
- Related Questions & Answers
- Which function in MySQL returns the same output as BIN() function?
- Bold font weight for LaTeX axes label in Matplotlib
- When MySQL SUBSTRING_INDEX() function returns the same string, provided in the argument, as output?
- How can I get the output of a Matplotlib plot as an SVG?
- How to save the str output as a string in R?
- While fetching the data as output, how can I use multiple conditions on same column?
- How to sort the output in PowerShell?
- How to get different font sizes in the same annotation of Matplotlib?
- How do I change the axis tick font in a Matplotlib plot when rendering using LaTeX?
- When MySQL LOCATE() function returns NULL as the output?
- How to display output in javascript?
- Program to print its script name as output in Python
- How to use Font Awesome symbol as marker in matplotlib?
- How to round the summary output in R?
- How do I omit Matplotlib printed output in Python / Jupyter notebook?
Advertisements