フィルターのクリア

About the function 'bar3', I want put the bar figure in the center of the cell.

1 回表示 (過去 30 日間)
Lilian
Lilian 2016 年 5 月 5 日
コメント済み: Lilian 2016 年 5 月 12 日
We can see the second figure, the bars are not in the cells, How can I move them into the cells?
Help me, please.
it bothers me for a long time! ! !
  4 件のコメント
the cyclist
the cyclist 2016 年 5 月 5 日
Sorry, I deleted my original comment accidentally. Lilian wants to be able to specify the (x,y) locations of the bars.
Walter Roberson
Walter Roberson 2016 年 5 月 10 日
Lilian comments
YES,you are right!

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

回答 (2 件)

the cyclist
the cyclist 2016 年 5 月 5 日

In the documentation, I don't actually see a method to specify the (x,y) coordinates of the bins. However, you can set the labels, which might be good enough:

figure
bar3(rand(3,2))
set(gca,'XTickLabel',[5 6],'YTickLabel',[12 13 14])

Here is the result:

  4 件のコメント
dpb
dpb 2016 年 5 月 6 日
Might want to search File Exchange for submissions--maybe somebody else has previously been frustrated and already solved the problem.
Lilian
Lilian 2016 年 5 月 9 日
編集済み: Lilian 2016 年 5 月 9 日
My solution is a little stupid,I used the 'patch' function to solve this problem.

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


Benjamin Kraus
Benjamin Kraus 2016 年 5 月 9 日
I don't believe the bar3 command allows you to specify both X and Y. However, the bar3 command creates surfaces, and you can specify the XData and YData for surfaces. You could try something like this:
data = ones(10);
x = 1.5:10.5;
h = bar3(x,data);
for i = 1:10;
set(h(i),'XData',get(h(i),'XData') + 0.5);
end
xlim([1 11])
ylim([1 11])
zlim([0 10])
  1 件のコメント
Lilian
Lilian 2016 年 5 月 12 日
Thanks@Benjamin Kraus, But my problem is that I create the surface firstly,After that I use the bar3 function.

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by