Is it possible to plot the image of a pdf file within subplot?

조회 수: 22 (최근 30일)
Yoni Verhaegen -WE-1718-
Yoni Verhaegen -WE-1718- 2023년 1월 22일
답변: Daksh 2023년 2월 3일
Hi all.
I have an image stored in a PDF file which I would like to display as a part of a subplot in Matlab (see attachment). Is this possible? Thanks!
  댓글 수: 1
Jan
Jan 2023년 1월 22일
What is the problem exactly? Displaying an image a subplot? This is solved by the image() command easily. Or extracting the image from the PDF? If so, should the be done automatically? If so, how can the page and position of the wanted image be identified? Or do you want to extract the image manually, e.g. by AcrobatPro or other software to process PDFs? Do you mean a screenshot of the PDF or do you want to import a diagram in vector format?
Please edit the question and add more details.

댓글을 달려면 로그인하십시오.

답변 (1개)

Daksh
Daksh 2023년 2월 3일
It is my understanding that alongside MATLAB-created plots, you wish to put a PDF-contained image inside a plot layout created by subplot() method.
I'm assuming that you've already snipped the PDF portion of image of use as a file (eg. my_image.jpg) and saved it into the working directory. If not, proceed to use the Snipping Tool or any 3rd party screenshot and crop tool to save the image for use as a file.
Refer to this script for the next steps:
subplot(2,2,1)
x = linspace(0,10);
y1 = sin(x);
plot(x,y1)
title('Subplot 1: sin(x)')
subplot(2,2,2)
y2 = sin(2*x);
plot(x,y2)
title('Subplot 2: sin(2x)')
subplot(2,2,[3,4])
y3 = sin(4*x);
% use imshow() command that displays image for the given file path
imshow('my_image.jpg');
title('My Image')
This will yield the desired output, as showcased by you in the attached image. Hope this helps!

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by