How to plot high resolution?

조회 수: 48 (최근 30일)
Mr M.
Mr M. 2017년 10월 21일
댓글: Akira Agata 2018년 2월 22일
I would like to plot a histogram with 2048 bins. Is it possible plot and save it? pdf? retina display
  댓글 수: 3
Mr M.
Mr M. 2018년 2월 14일
My problem is that I have retina display (2880x1800) but MATLAB cannot use it. The biggest plot window is 1440x900px (this is the fullscreen).
Jan
Jan 2018년 2월 14일
@Mr. M: Please insert this important information on top of your question: You are using a Mac with Retina display.

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

답변 (2개)

Akira Agata
Akira Agata 2017년 10월 23일
How about adjusting a resolution by setting 'Position' property of figure. Here is an example.
% Sample data
mu = 0.0;
sigma = 1.0;
x = normrnd(mu,sigma,100000,1);
% Plot histogram with 2048 bins in full HD (1920x1080) resolution
figure('Position',[0 0 1920 1080])
histogram(x,'NumBins',2048)
  댓글 수: 2
Mr M.
Mr M. 2018년 2월 14일
Fisrt, my retina resolution is greater (2880x1800), however there is a problem with any resolution less than 2048 because of information loss. I need at least one pixel column for each bar on the histogram!
Akira Agata
Akira Agata 2018년 2월 22일
OK. Then, how about saving your histogram as a high-resolution image?
mu = 0.0;
sigma = 1.0;
x = normrnd(mu,sigma,100000,1);
dpi = 150; % Resolution
sz = [0 0 2880 1800]; % Image size in pixels
% Plot histogram with 2048 bins
% and save as an .tiff image file
% with 2880x1800 pixel and 150 dpi
figure(...
'PaperUnits','inches',...
'PaperPosition', sz/dpi,...
'PaperPositionMode','manual',...
'Visible', 'off')
histogram(x,'NumBins',2048)
print('-r150','-dtiff','histogram.tiff');

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


Mr M.
Mr M. 2018년 2월 14일
Could anyone solve this question?
  댓글 수: 5
Mr M.
Mr M. 2018년 2월 21일
편집: Mr M. 2018년 2월 21일
This is not a rendering problem what I am talking about! this is a resolution setting problem! Once more: set(gcf,'unit','pixel','position',[0 0 1600 1200]); fullfills the screen!!
Walter Roberson
Walter Roberson 2018년 2월 21일
The reason that set(gcf,'unit','pixel','position',[0 0 1600 1200]) fills the screen is that for Retina displays, MATLAB arbitrarily declares that a "pixel" is to be 1/72 of an inch (which just happens to be the same as a "point") -- as described at https://www.mathworks.com/help/matlab/creating_guis/dpi-aware-behavior-in-matlab.html#buyrn8d
"Units Property
When you set the Units property of a graphics or UI object to 'pixels', the size of each pixel is now device-independent on Windows and Macintosh systems:
  • On Windows systems, 1 pixel = 1/96 inch.
  • On Macintosh systems, 1 pixel = 1/72 inch."
The full hardware resolution is still there and you can still put up images at the full hardware resolution: you just have to be careful about specifying sizes in units of Pixel. For example, you could:
set(gcf,'unit','norm','position',[0 0 1 1])

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

카테고리

Help CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by