フィルターのクリア

How to change plot figure resolution

74 ビュー (過去 30 日間)
xiaojuezi
xiaojuezi 2020 年 4 月 27 日
コメント済み: xiaojuezi 2020 年 4 月 28 日
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])
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])
How could I plot the same points on a smaller resolution but still keep their integrity?
Thank you very much!
  1 件のコメント
Ameer Hamza
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
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)
  1 件のコメント
xiaojuezi
xiaojuezi 2020 年 4 月 28 日
Hi, I find the solution work by explicitly set xlim and ylim as [1,512].
Thank you very much!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGrid Lines, Tick Values, and Labels についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by