MATLAB Answers


How to flip a Matlab tree plot upside down?

Asked by Jonathan on 28 Oct 2018
Latest activity Edited by Jonathan on 1 Nov 2018
The documentation for treeplot describes an example where a unique root node located at the top of the graph is parent to several "layers" of nodes in a descending order.
I'd like to somehow flip this graph about the horizontal axis so that the root node ends up at the base of the now reversed tree. Then I'd like to add labels to the nodes.
Any idea to get me started?


Sign in to comment.





1 Answer

Answer by madhan ravi
on 28 Oct 2018
 Accepted Answer

yticklabels([1:10]) %an example
set ( gca, 'ydir', 'reverse' )


Thank you, that did exactly what I needed. I particularly appreciate that the labels I added to the treeplot before flipping it stayed attached to the right nodes and were not flipped themselves. I had anticipated more complication in that regard!
Anytime buddy :)

Sign in to comment.