Alternative to scatter plot

24 ビュー (過去 30 日間)
Christian Mathiesen
Christian Mathiesen 2022 年 5 月 13 日
回答済み: Image Analyst 2022 年 5 月 14 日
I have a 3x100k matrix of scattered XYZ data over an an area that I wish to plot. So far I have been using scatter plot to visualize, but when I print the plot to .png it becomes 'blurry' like picture attached. Is there an alternative to the scatter plot take makes for a smoother image?
Thanks.
  3 件のコメント
Jan
Jan 2022 年 5 月 13 日
@Christian Mathiesen: Please mention, what you call "blurry". We do not see, what you expect instead. What should be "smoother"?
How do you "print the plot"? The image contains the icon of the axes menu. Is this a screen shot?
Christian Mathiesen
Christian Mathiesen 2022 年 5 月 14 日
@Jan I guess I was a little vague in my explanation. I use print to save the plot as a png. I was hoping to save the plot with a better resolution by for example converting the scattered data to a grid, so there is no space inbetween each point, making for a 'smoother' figure.
Thank you for your help.

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2022 年 5 月 14 日
Create an image of desired resolution and then assign every row to a point in the image. Then use imwrite(). Something like (untested because ou forgot to upload your x,y,z data):
minX = min(x);
maxX = max(x);
minY = min(y);
maxY = max(y);
aspectRatio = (maxY - minY) / (maxX - minX)
% Make an image with 1920 columns
columns = 1920;
rows = round(aspectRatio * 1920)
grayImage = zeros(rows, columns, 'uint8');
% Rescale x and y so they will be within the image dimensions.
xs = round(rescale(x, 1, columns));
ys = round(rescale(y, 1, rows));
zs = uint8(rescale(z, 0, 255)); % Convert z to gray levels in the range 0-255
% Assign pixels
for k = 1 : length(x)
grayImage(ys(k), xs(k)) = zs(k);
end
imshow(grayImage, []);
impixelinfo;
axis('on', 'image');

カテゴリ

Help Center および File ExchangePrinting and Saving についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by