Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

How Can I Modify the Font Size of a Plots Title or Label in Xmath?

Primary Software: MATRIXx
Primary Software Version: 6.3
Primary Software Fixed Version: N/A
Secondary Software:

Problem: How can I modify the size of the font for the title or the axis labels of a plot in Xmath? I tried using text_size keyword but it did not work. Is there any way we can do this from a script file?

Solution: The text_size keyword only affects text placed with the text keyword.  However, you can change the size of the title or label by using the interactive tools in the plot window. The select tool is the default tool (if it is not the current tool go to Tools>Select or pick the Arrow tool from the toolbar). Use it to double click on the title or label and you will get a dialog for it's properties where you can modify the text size and font type as you need.

There are two options to change the font size programmatically in a script:
  • Create a template that contains the correct title and label sizes. This works as long as you know the font size a head of time. Create a plot with a title and/or label and the modify the font size as described above. After editing the title size then assign it to a variable (template = plot()).  Next time you create a plot, 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.

  • If you need to have a variable font size then you can place text in the spot that the title or label would be.  The only difficult part 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.


Related Links:

Attachments:





Report Date: 09/08/2003
Last Updated: 09/10/2003
Document ID: 3179IUOH

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit