- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Setting the Matplotlib title in bold while using "Times New Roman"
To set the Matplotlib title in bold while using "Times New Roman", we can use fontweight="bold".
Steps
- Set the figure size and adjust the padding between and around the subplots.
- Create a figure and a set of subplots.
- Create x and y data points using numpy.
- Plot x and y data points using scatter() method.
- Set the title of the plot using fontname="Times New Roman" and fontweight="bold"
- To display the figure, use show() method.
Example
import numpy as np from matplotlib import pyplot as plt, font_manager as fm plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True fig, ax = plt.subplots() x = np.random.rand(100) y = np.random.rand(100) ax.scatter(x, y, c=y, marker="v") ax.set_title('Scatter Plot With Random Points', fontname="Times New Roman", size=28,fontweight="bold") plt.show()
Output
Advertisements