How to change plot figure resolution
조회 수: 73 (최근 30일)
이전 댓글 표시
I have a few points originally designed for 512x512 resolution, such as [128,450] and [336, 500]. When plotting them, I initially plotted then as:
set(gcf,'units','pixels','position',[500,500,512,512]);
h1 = axes;
set(h1,'position',[0 0 1 1])
set(gca,'XAxisLocation','top','YAxisLocation','left','ydir','reverse');
set (gca, 'visible' , 'off' )
set (gca, 'xtick' , [])
set (gcf, 'color', defaultColor)
axis equal
plot(x,y)
xlim([1 512])
ylim([1 512])
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/287961/image.png)
However, when I tried to plot with a smaller resolution, for example 256x256, I would only get part of the points:
set(gcf,'units','pixels','position',[500,500,300,300]);
h1 = axes;
set(h1,'position',[0 0 1 1])
set(gca,'XAxisLocation','top','YAxisLocation','left','ydir','reverse');
set (gca, 'visible' , 'off' )
set (gca, 'xtick' , [])
set (gcf, 'color', defaultColor)
axis equal
plot(x,y)
xlim([1 256])
ylim([1 256])
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/287962/image.png)
How could I plot the same points on a smaller resolution but still keep their integrity?
Thank you very much!
댓글 수: 1
Ameer Hamza
2020년 4월 27일
I am not sure how the plot alone can draw such a figure. Are you also plotting an image?
채택된 답변
Ameer Hamza
2020년 4월 27일
Try your code without the xlim and ylim lines
set(gcf,'units','pixels','position',[500,500,300,300]);
h1 = axes;
set(h1,'position',[0 0 1 1])
set(gca,'XAxisLocation','top','YAxisLocation','left','ydir','reverse');
set (gca, 'visible' , 'off' )
set (gca, 'xtick' , [])
set (gcf, 'color', defaultColor)
axis equal
plot(x,y)
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!