compass plot offsetting the origin

4 ビュー (過去 30 日間)
Axel Grzy
Axel Grzy 2012 年 3 月 5 日
コメント済み: Filipe Ribeiro 2016 年 10 月 12 日
I would like to know if there is a way of offsetting the center of a compass plot, so that the vectors don't emanate from the center but rather from another pre-defined position. As I have two sets of data to be displayed on the same plot and sometimes these overlap, leaving one of the vectors completely covered.

回答 (1 件)

Andrew Newell
Andrew Newell 2012 年 3 月 5 日
You could make a couple of subplots:
subplot 211
compass(...)
subplot 212
compass(...)
EDIT: However, if you really want them on the same plot, here is an example of how to do it:
% Generate data sets for example
Z1 = eig(randn(20,20));
h1 = compass(Z1);
hold on
Z2 = eig(randn(20,20));
h2 = compass(Z2);
% Offset the second set of data in the x direction
offset = 1;
for ii=1:20
set(h2(ii),'Color','r') % Change color so you can tell the data sets apart
x = get(h2(ii),'XData');
set(h2(ii),'XData',x+offset)
end
  1 件のコメント
Filipe Ribeiro
Filipe Ribeiro 2016 年 10 月 12 日
Thanks. You know how can offset in y direction as well?

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

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by