MATRIXx

cancel
Showing results for 
Search instead for 
Did you mean: 

Graphic Title Size

Hello!

My question seems simple but no one know how to do this here! How could I modify the size of the font for the title, the axis labels and the legend of a graphic?
I tried using text_size keyword as follows but it did not work:
g5 = plot(t,[y(:,9:10)*1000,-y(:,11)*1000], {title="Measured Position of the S/C", xlab="Time (s)", ylab="Position (m)", legend=["North position", "East Position", "Down Position"], line_color = [2,3,5], text_size = 16});

Is there any way we can do this from a .ms script file (not directly on the graph, although I did not find how to do it from then either)?

Thanks a lot for the help!!! 😉
0 Kudos
Message 1 of 3
(7,280 Views)
Karina,
The text_size keyword only affects text placed with the text keyword. Unfortunately there is no way to modify the font size of the title. It uses the a default size of 12.
The way to work around it is to place text at the spot that the title would be. The only difficult thing is centering the text. Try the following commands:
y=sin(0:0.1:10);
plot(y,{text_size=20,text_position=[-0.1,1],text="Title Text",title=" "})



Use the text_position to place the text at the top of the graph. The center of the graph is 0,0 the top center is 0,1 the top left hand corner is -1,1. Using -0.1,1 centers the text in the example, but you would need to modify the -0.1 depending on the length of the text.

Carl L
National Instruments
Message 2 of 3
(7,280 Views)
Karina,
Here is an even better way. You can interactively modify the text properties of the title. Create the plot with a title. Once it is created go to Tools>Select (or just pick the arrow tool from the toolbar). Double-click on the title and you will get a dialog for it's properties where you can modify the text size and font type as you need.

To use it in a script you will need to create a template. After editing the title size then assign it to a variable (template = plot()). Next time you create a plot then use the copy keyword to use the information stored in the template.

Here is a script to try:
plot({title="Test Title"})
pause "Adjust the title properties"
template=plot()
plot(random(1:10),{copy=template,title="New Title"})


Note
that the plot used for the template does not contain any data. If it had data then the data would be part of the template, which is normally not desired. Also this same techique can be used to modify labels.

Carl L
National Instruments
Message 3 of 3
(7,280 Views)