- Trending Categories
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
How to plot a watermark image in Matplotlib?
To plot a watermark image in Matplotlib, we can take the following steps −
- Set the figure size and adjust the padding between and around the subplots.
- Return a sample data file using get_sample_data() method.
- Create a figure and a set of subplots.
- Plot the data points using plot() method, with alpha=0.7 and marker face color mfc="orange".
- Add a non-resampled image to the figure.
- To display the figure, use show() method.
Example
import numpy as np import matplotlib.cbook as cbook import matplotlib.image as image import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True with cbook.get_sample_data('logo2.png') as file: im = image.imread(file) fig, ax = plt.subplots() ax.plot(np.sin(10 * np.linspace(0, 1)), '-o', ms=20, alpha=0.7, mfc='orange') fig.figimage(im, 10, 10, zorder=3, alpha=.5) plt.show()
Output
- Related Articles
- How to plot a layered image in Matplotlib in Python?
- How to plot an animated image matrix in matplotlib?
- How to use a custom png image marker in a plot (Matplotlib)?
- How to create a watermark on an image using OpenCV Python?
- How to plot a remote image from http url using Matplotlib?
- How to create a surface plot from a greyscale image with Matplotlib?
- How to create a watermark on an image using Java OpenCV library?
- How to apply pseudo color schemes to an image plot in Matplotlib?
- How to a plot stem plot in Matplotlib Python?
- How to insert a small image on the corner of a plot with Matplotlib?
- Matplotlib – Plot over an image background in Python
- How to plot a circle in Matplotlib?
- How to zoom a portion of an image and insert in the same plot in Matplotlib?
- How to animate a line plot in Matplotlib?
- How to remove lines in a Matplotlib plot?

Advertisements