Using UIPanel, how do I make a title with multiple lines?

6 views (last 30 days)
I am using the uipanel function to add a supertitle to my subplots https://www.mathworks.com/help/matlab/creating_plots/combine-multiple-plots.html#d119e2898, however, I can only have the title be one line. Is there a way to span the title across two or more lines?
Here's my code:
f = figure(13);
p = uipanel('Parent',f,'BorderType','none');
p.Title = {[cndname ' - CT to Blue Fluoro']; 'Bead Position Error vs Radial Bead Distance'};
p.TitlePosition = 'centertop';
p.FontSize = 11;
p.FontWeight = 'bold';
Additionally, is there a way to make certain word in the title a different color such as in this example - https://www.mathworks.com/help/matlab/ref/title.html#btpl69n-1_1. Once again, the uipanel function doesn't allow me to do this.
  2 Comments
Walter Roberson
Walter Roberson on 18 Jun 2018
My experiments suggest that the title property is not interpreted, so tex and latex and HTML cannot be used, and that only the first line of a cell array will be displayed. So I do not think it is possible except perhaps by going in at the java level
Ledoux Laboratory
Ledoux Laboratory on 18 Jun 2018
Thanks for the quick reply. Is there an alternative that can easily create a supertitle for subplots?

Sign in to comment.

Answers (2)

Walter Roberson
Walter Roberson on 18 Jun 2018

Frederic
Frederic on 8 Jul 2021
Example
fig = uifigure('Position',[100 100 200 200],...
'Name','My fig title');
title_line = "line1 ";
title_line = title_line + newline + "line2";
zone4 = uipanel(fig,...
'Title',title_line,'FontSize',12,...
'BackgroundColor','white',...
'Position',[25 25 75 150]);

Categories

Find more on Line Plots in Help Center and File Exchange

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!