Error with adding Datatip

5 ビュー (過去 30 日間)
Andrew Luce
Andrew Luce 2021 年 8 月 8 日
回答済み: Walter Roberson 2021 年 8 月 9 日
Hello,
I am trying to add a data tip based a data from a structure. However, whenever I do this it comes back with the error
"Dot indexing is not supported for variables of this type."
I was wondering what was I doing wrong.
row1 = dataTipTextRow('Nitrogen',Elements.Nitrogen);
row2 = dataTipTextRow('Phosphate',Elements.Phosphate);
row3 = dataTipTextRow('Potassium',Elements.Potassium);
Map.DataTipTemplate.DataTipRows(end+1) = row1;
Map.DataTipTemplate.DataTipRows(end+1) = row2;
Map.DataTipTemplate.DataTipRows(end+1) = row3;
  2 件のコメント
Walter Roberson
Walter Roberson 2021 年 8 月 9 日
What is class(Map) ?
I suspect that Map might be empty, []
Andrew Luce
Andrew Luce 2021 年 8 月 9 日
編集済み: Andrew Luce 2021 年 8 月 9 日
Sorry forgot to add this line, it is for a color map
C= [0 1 0; 0.5 0 0; 1 1 0; 0 0 1]; % Color map
Map = colormap(C)

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

回答 (1 件)

Walter Roberson
Walter Roberson 2021 年 8 月 9 日
C= [0 1 0; 0.5 0 0; 1 1 0; 0 0 1]; % Color map
Map = colormap(C)
Map = 4×3
0 1.0000 0 0.5000 0 0 1.0000 1.0000 0 0 0 1.0000
class(Map)
ans = 'double'
The return from colormap() is the content of the color map that is in effect after any parameters to colormap() has been processed.
I wonder if you are trying to attach a datatip to a colorbar? colorbar() is not a Chart object and does not support DataTipTemplate

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by