Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
text on figures

Subject: text on figures

From: Jonathan

Date: 16 Dec, 2011 00:42:08

Message: 1 of 5

Hi,

We have developed some code to display cross-sections of terrain. Part of the code displays multiple lines of text (predefined geomorphic variables) using the text code function in the plots. However, because the text function is dependent on predefined xy coordinates, and our plots have variable dimensions to the axes, sometimes the text is scrunched together so that the text is not legible, while in other figures the text may be spaced widely apart. Is there a way to get around this limitation, without coding in some predefined values that can be accessed based on say IF statements?

Thanks
Jon

Subject: text on figures

From: TideMan

Date: 16 Dec, 2011 01:24:57

Message: 2 of 5

On Dec 16, 1:42 pm, "Jonathan" <jkak...@yahoo.co.uk> wrote:
> Hi,
>
> We have developed some code to display cross-sections of terrain. Part of the code displays multiple lines of text (predefined geomorphic variables) using the text code function in the plots.  However, because the text function is dependent on predefined xy coordinates, and our plots have variable dimensions to the axes, sometimes the text is scrunched together so that the text is not legible, while in other figures the text may be spaced widely apart.  Is there a way to get around this limitation, without coding in some predefined values that can be accessed based on say IF statements?
>
> Thanks
> Jon

Well, I use the text function all the time and I've never seen
this......
IMHO, the size of the text written by the text function is governed by
FontSize and has nothing whatever to do with the size/scale of the
plot.

Subject: text on figures

From: Jonathan

Date: 16 Dec, 2011 02:26:08

Message: 3 of 5

TideMan <mulgor@gmail.com> wrote in message <23224179-862d-4f46-b525-3c4aad4d527d@32g2000yqp.googlegroups.com>...
> On Dec 16, 1:42 pm, "Jonathan" <jkak...@yahoo.co.uk> wrote:
> > Hi,
> >
> > We have developed some code to display cross-sections of terrain. Part of the code displays multiple lines of text (predefined geomorphic variables) using the text code function in the plots.  However, because the text function is dependent on predefined xy coordinates, and our plots have variable dimensions to the axes, sometimes the text is scrunched together so that the text is not legible, while in other figures the text may be spaced widely apart.  Is there a way to get around this limitation, without coding in some predefined values that can be accessed based on say IF statements?
> >
> > Thanks
> > Jon
>
> Well, I use the text function all the time and I've never seen
> this......
> IMHO, the size of the text written by the text function is governed by
> FontSize and has nothing whatever to do with the size/scale of the
> plot.

The issue is not the font but the placement of multiple lines of text, each with their own predefined xy coordinates. If the x-axis and y-axis scales vary significantly from plot to plot, this influences the lines of text (i.e. whether they scrunched up together or spread apart).

Subject: text on figures

From: TideMan

Date: 16 Dec, 2011 03:22:36

Message: 4 of 5

On Dec 16, 3:26 pm, "Jonathan" <jkak...@yahoo.co.uk> wrote:
> TideMan <mul...@gmail.com> wrote in message <23224179-862d-4f46-b525-3c4aad4d5...@32g2000yqp.googlegroups.com>...
> > On Dec 16, 1:42 pm, "Jonathan" <jkak...@yahoo.co.uk> wrote:
> > > Hi,
>
> > > We have developed some code to display cross-sections of terrain. Part of the code displays multiple lines of text (predefined geomorphic variables) using the text code function in the plots.  However, because the text function is dependent on predefined xy coordinates, and our plots have variable dimensions to the axes, sometimes the text is scrunched together so that the text is not legible, while in other figures the text may be spaced widely apart.  Is there a way to get around this limitation, without coding in some predefined values that can be accessed based on say IF statements?
>
> > > Thanks
> > > Jon
>
> > Well, I use the text function all the time and I've never seen
> > this......
> > IMHO, the size of the text written by the text function is governed by
> > FontSize and has nothing whatever to do with the size/scale of the
> > plot.
>
> The issue is not the font but the placement of multiple lines of text, each with their own predefined xy coordinates. If the x-axis and y-axis scales vary significantly from plot to plot, this influences the lines of text (i.e. whether they scrunched up together or spread apart).

Well, another option that gets around this is to insert LFs i.e.,
char(10), into your single string:
str=['This is the first line' char(10) 'and this is the second line'
char(10) 'See how clever Matlab is?'];

Subject: text on figures

From: Jonathan

Date: 16 Dec, 2011 16:27:07

Message: 5 of 5

TideMan <mulgor@gmail.com> wrote in message <4ae29463-de53-4ab3-8bca-9d3d90a1b357@y18g2000yqy.googlegroups.com>...
> On Dec 16, 3:26 pm, "Jonathan" <jkak...@yahoo.co.uk> wrote:
> > TideMan <mul...@gmail.com> wrote in message <23224179-862d-4f46-b525-3c4aad4d5...@32g2000yqp.googlegroups.com>...
> > > On Dec 16, 1:42 pm, "Jonathan" <jkak...@yahoo.co.uk> wrote:
> > > > Hi,
> >
> > > > We have developed some code to display cross-sections of terrain. Part of the code displays multiple lines of text (predefined geomorphic variables) using the text code function in the plots.  However, because the text function is dependent on predefined xy coordinates, and our plots have variable dimensions to the axes, sometimes the text is scrunched together so that the text is not legible, while in other figures the text may be spaced widely apart.  Is there a way to get around this limitation, without coding in some predefined values that can be accessed based on say IF statements?
> >
> > > > Thanks
> > > > Jon
> >
> > > Well, I use the text function all the time and I've never seen
> > > this......
> > > IMHO, the size of the text written by the text function is governed by
> > > FontSize and has nothing whatever to do with the size/scale of the
> > > plot.
> >
> > The issue is not the font but the placement of multiple lines of text, each with their own predefined xy coordinates. If the x-axis and y-axis scales vary significantly from plot to plot, this influences the lines of text (i.e. whether they scrunched up together or spread apart).
>
> Well, another option that gets around this is to insert LFs i.e.,
> char(10), into your single string:
> str=['This is the first line' char(10) 'and this is the second line'
> char(10) 'See how clever Matlab is?'];

Thanks TideMan! Very simple and it worked perfectly.

Cheers
Jon

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us