matlab - matlab多维图例可能吗?
问题描述
我有一些绘图代码,我想在其中绘制 10 种不同类型的数据点。我想使用 5 种颜色和 2 个符号。
基本上,如果我的表条目的行或列包含一个包含子字符串“CSC”的字符串,我想更改使用的标记。c 设置在此循环之外并控制符号的颜色。
如何显示一个图例,显示我的颜色列表及其相关值,以及符号及其值。以文本形式,图例将是,例如:
Colours:
red = One noun
green = a second noun
yellow = another noun
Symbols:
+ = isn't in a row or column that has an entry containing "CSC"
o = is in a row or column with an entry containing "CSC
下面是我的代码片段...
for k_ind = 1:length(keepers)
row = T.Row(keepers(k_ind));
column = T.Col(keepers(k_ind));
%Does this row or column contain a 'CSC'?
if(any(contains(string(T{T.Row==row,'cell_cond'}), 'CSC')) || any(contains(string(T{T.Col==column,'cell_cond'}), 'CSC')) )
symbol = 'o';
plot(T.total_read_pairs(keepers(k_ind)), max(T.only_matched_arabidopsis(keepers(k_ind)),0.001), symbol, 'color', C(c,:), 'markersize', 12, 'linewidth', 2)
else
symbol = '+';
plot(T.total_read_pairs(keepers(k_ind)), max(T.only_matched_arabidopsis(keepers(k_ind)),0.001), symbol, 'color', C(c,:), 'markersize', 12, 'linewidth', 2)
end
end
end
#Draw the legend down here
legend(...)
解决方案
推荐阅读
- intersystems-cache - MUMPS 地址验证
- python - 评估表达式
- apache-spark - 如何验证 S3 上的 parquet 文件是否已排序
- c - 如何在 32 位汇编中编译?
- python - Python测试列表中的每个元素到数据框中的行元素,产生布尔数据框
- node.js - Express:使用客户端的 IP 地址向 Google Cloud Functions 创建新请求
- java - 如何将凌空响应发送到 Firebase 数据库
- javascript - 将数组中的数据插入饼图 (chart.js)
- javascript - 在 HTML5 画布中加载 TIF/TIFF 并避免下载
- c++ - 如何使用索引缓冲区绘制两个三角形?