How can I adjust the position of a 'scattergroup' (scatter3) figure?

3 ビュー (過去 30 日間)
John
John 2013 年 2 月 5 日
I'm trying set the size/position of my 3d scatter plot, hopefully using something like the following:
figure('Position', [x y a b]) % or
set(fig, 'OuterPosition', [x y a b])
But, working with a scatter3 plot, I get the following error:
The name 'Position' is not an accessible property for an instance of class 'scattergroup'
I looked up the scattergroup class, and I noticed that there are no position properties in it. Does anyone know how can I modify the the size/position of my scatter3 object?
scat=scatter3(x,y,z,size,intensity)
Thank you!

採用された回答

ChristianW
ChristianW 2013 年 2 月 6 日
scrsz = get(0,'ScreenSize');
set(gcf,'OuterPosition',[scrsz(3)/2 scrsz(2) scrsz(3)/2 scrsz(4)])
n = 20;
scatter3(rand(n,1),rand(n,1),rand(n,1),[],randi(3,n,1),'filled')
Ehehe, well I suspect your only fault was a wrong handle in your set position command. If you want to change figure properties, you've to give him the figure handle, not the plot handle.
  1 件のコメント
John
John 2013 年 2 月 6 日
Thank you!!
I learned a lot in past few hours :)

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

その他の回答 (1 件)

ChristianW
ChristianW 2013 年 2 月 5 日
n = 20;
scatter3(rand(n,1),rand(n,1),rand(n,1),[],randi(3,n,1),'filled')
axp = get(gca,'Position');
set(gca,'Position',[0 0 axp(3:4)/3])
  3 件のコメント
ChristianW
ChristianW 2013 年 2 月 5 日
Hi John, your trys with:
figure('Position', [x y a b]) % or
set(fig, 'OuterPosition', [x y a b])
should work. Whats your error or code?
For the "right half of the screen"-Position, you can try this:
scrsz = get(0,'ScreenSize');
figure('OuterPosition',[scrsz(3)/2 scrsz(2) scrsz(3)/2 scrsz(4)])
n = 20;
scatter3(rand(n,1),rand(n,1),rand(n,1),[],randi(3,n,1),'filled')
John
John 2013 年 2 月 6 日
編集済み: John 2013 年 2 月 6 日
Thank you for following up :)
The 'Outer Position' methods do not work, they return this error:
The first method you gave me - set(gca,'Position'...) results in the figure size staying the exact same, but the actually graph itself shrinking in that figure:
The figure('Position'...) method achieves exactly what I need and increases the size of the figure and the plot, but it also pops up an extra figure window which you can see here behind and to the left:
I'm looking to achieve the effect of the last method but without popping up extra windows! All of these methods work for normal plots so I'm not sure why there's this trouble with scatter3.
Thanks again, John

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

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by