I followed the code to add a title element to the top of the plot. I'd like to be able to hide the title programatically, but even setting the element not visible does not change the height of the element. I've also tried setting the maximum size of the element to 0, the margins to 0, the row,column stretch factors to basically zero.

None of the above seems to work. The only thing that seems to work is removing the layout element entirely