How can I print small circles?
2 views (last 30 days)
Problem I am trying to print small (diameter=0.02 cm etc) filled circles to pdf in exact size. I am able to print exact circles with a diameter of 2 cm, 1 cm, 0.5 cm, but when I try to go below ~0.04 cm, printed figure does not include all circles. Let me show you what I mean with some sample pictures. Note that all circles are separated by their diameter length to obtain a nice stack of them. First image shows the output of same code with d=1, second is d=0.5 and final one is d=0.02.
First two images are correct. In the last image, you can see the most circles are not printed. Circles are in correct size but only a few of them are printed. It had to look stacked like first two, but only in smaller circles.
cm2pts=72/2.54; %cm to inch and inch to points = cm to points
height=cm2pts*220; % 'page' dimensions
ax.XLim=([0 width]); ax.XLim=([0 height]);
here is a loop that creates a x,y position vector for all dots
ax.Units='normalized'; ax.Position=[0 0 1 1]; ax.Units='points';
fig.PaperPositionMode = 'manual';
fig.PaperPosition=[0 0 width height];
fig.PaperSize = [PaperPosition(3) PaperPosition(4)];
-I tried up scaling everything, thinking that I would downscale while printing but it still failed, may be its about ratio of circle to drawing dimensions.
-I hand checked x, y positions, they are correct
-I tried changing marker to '.' but '.' cannot be less than ~2.5 mms even if you give MarkerSize as eps.
-I tried rectangle but it cannot be vectorized therefor its slow and causes too much ram and file size.
-I tried setting figure position to real size, output did not change.
-Output file dimensions are correct in all cases.
-I tried scatter but I simply could not get the real size I wanted from scatter. It says S (marker area) is points^2 in docs for scatter but I could not get any size, for instance d=1cm with scatter circles.
-Behaviour is same on Matlab Online.
KSSV on 30 Oct 2018
Edited: KSSV on 30 Oct 2018
dx = 0.25 ; % spacing in x
dy = 0.25 ; % spacing in y
x = 0:dx:1 ;
y = 0:dy:1 ;
[X,Y] = meshgrid(x,y) ; % generate mesh
% draw circle
th = linspace(0,2*pi) ;
r = 0.1 ; % radius of circle
xc = r*cos(th) ; yc = r*sin(th) ;
for i = 1:size(X,1)
for j = 1:size(X,2)
x = X(i,j)+xc ;
y = Y(i,j)+yc ;