Thread Subject: linewidth control

Subject: linewidth control

From: Godzilla

Date: 16 Mar, 2009 02:17:01

Message: 1 of 3

Is it possible to more accurately control the linewidth of a plotted line?

I would really like to scale the width of the line to some fraction of the x-axis tick marks. For example, my ticks are 1-second spacing and I want draw a line whose width corresponds to 100 msec.

 

Subject: linewidth control

From: Miroslav Balda

Date: 16 Mar, 2009 19:11:01

Message: 2 of 3

"Godzilla " <godzilla@tokyo.edu> wrote in message <gpkcqt$9n5$1@fred.mathworks.com>...
> Is it possible to more accurately control the linewidth of a plotted line?
>
> I would really like to scale the width of the line to some fraction of the x-axis tick marks. For example, my ticks are 1-second spacing and I want draw a line whose width corresponds to 100 msec.

Hi,
One solution is here:

lw = 0.1; % linewidth in seconds
set(gca,'Units','pixels');
xlim = get(gca,'XLim');
dt = xlim(2)-xlim(1); % displayed time in seconds
pos = get(gca,'Position');
w = (pos(3)-pos(1))/dx*lw;
plot(t,fun(t),'Linewidth',w);

Hope it hepls.

Mira

Subject: linewidth control

From: Godzilla

Date: 17 Mar, 2009 02:15:04

Message: 3 of 3

"Miroslav Balda" <miroslav.nospam@balda.cz> wrote in message <gpm885$s28$1@fred.mathworks.com>...
> "Godzilla " <godzilla@tokyo.edu> wrote in message <gpkcqt$9n5$1@fred.mathworks.com>...
> > Is it possible to more accurately control the linewidth of a plotted line?
> >
> > I would really like to scale the width of the line to some fraction of the x-axis tick marks. For example, my ticks are 1-second spacing and I want draw a line whose width corresponds to 100 msec.
>
> Hi,
> One solution is here:
>
> lw = 0.1; % linewidth in seconds
> set(gca,'Units','pixels');
> xlim = get(gca,'XLim');
> dt = xlim(2)-xlim(1); % displayed time in seconds
> pos = get(gca,'Position');
> w = (pos(3)-pos(1))/dx*lw;
> plot(t,fun(t),'Linewidth',w);
>
> Hope it hepls.
>
> Mira

Thanks. Just what I was looking for.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
linewidth Godzilla 15 Mar, 2009 22:20:04
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com