如何修改 MATLAB 系统发育树工具中的轴?
我想为我在 Java 中生成的一些聚集集群显示漂亮的树状图。我将簇写入 Newick 格式的文件中。然后,我就可以得到一张几乎是我想要的漂亮照片。
tr = phytreeread('myfile.tree')
phytreetool(tr)
不幸的是,X 轴不是我想要的。我更喜欢“反转”轴,因为聚类的迭代从右到左进行,例如 firstName
和 setFirstName
在第一次迭代中聚类。有谁知道我该怎么做,或者至少关闭 X 轴标签? (无论如何,默认轴试图告诉我什么?)
I want to display pretty dendrograms for some agglomerative clusters I am generating in Java. I write the clusters out to a file in Newick format. Then, I can get a pretty picture that is almost what I want.
tr = phytreeread('myfile.tree')
phytreetool(tr)
Unfortunately, the X axis is not what I want. I would prefer to "reverse" the axis, because the iterations of the clustering progress from right to left, e.g. firstName
and setFirstName
get clustered in the first iteration. Does anybody know how I can do that, or at least turn off the X axis labeling? (What is the default axis trying to tell me anyway?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
首先,您需要访问绘制树状图的轴的句柄。如果它是唯一打开的图形,您可以使用函数 FINDALL ,如下所示:
现在,您想要更改的不是 x 轴方向,因为这也会反转绘制的树状图。您实际上只想更改 用于 x 轴刻度线的标签< /a>.如果你想关闭它们,你可以这样做:
现在,我不确定 x 轴意味着什么。在您的示例中,似乎每个分支点都位于沿 x 轴的整数值处,最左边的分支点(我猜是“根”)从 0 开始。包含
firstName
和setFirstName
的最右侧分支的位置为值 21。如果要更改轴标签,使最右侧分支位于 0 且最左边的分支位于 21,您可以按如下方式修改轴:First, you will need to gain access to the handle for the axes in which the dendrogram is plotted. If it's the only figure open, you can use the function FINDALL like so:
Now, what you want to change isn't the x-axis direction, since this will reverse the plotted dendrogram as well. You actually want to change just the labels used for the x-axis tick marks. If you want to just turn them off, you can do this:
Now, I'm not sure what the x-axis is meant to tell you. In your example, it appears that each branch point is positioned at an integer value along the x-axis starting at 0 for the left-most branch point (the "root", I guess). The right-most branch containing
firstName
andsetFirstName
is positioned at a value of 21. If you want to change the axis labeling so that the right-most branch is at 0 and the left-most branch is at 21, you can modify the axes as follows:这可以帮助你吗?
编辑
您可能会在此处找到很多有趣的内容。干杯!
This could help you?
EDIT
You may find a lot of interesting here. Cheers!
我需要类似的东西。我不知道Matlab R2021b 是否是新的,但现在有一个plot(tree) 函数,可以在常规Matlab 图形上绘制树。绘图后,我确定最大的 X 值并更新 XTickLabels。
具有反向 Xtick 标签的系统发育树
I needed something similar. I don't know if it is new to Matlab R2021b, but there is now a plot(tree) function which will draw the tree on a regular Matlab figure. After plotting, I identify the largest X value and update the XTickLabels.
Phylogenetic tree with reversed Xtick labels