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:
Basic Plotting question, Linewidth

Subject: Basic Plotting question, Linewidth

From: Michael

Date: 25 Sep, 2007 17:30:09

Message: 1 of 2

Hi, I have two lines, I want them to be of different
widths,

plot(b1x,b1y,b2x,b2y,'LineWidth',4)

works but they are both the same width.

plot(b1x,b1y,'LineWidth',2,b2x,b2y,'LineWidth',4)

returns

??? Error using ==> plot
Not enough input arguments.

Error in ==> Fields>myfunction at 125
plot(b1x,b1y,'LineWidth',4,b2x,b2y,'LineWidth',4)

Error in ==> Fields>Fields_OpeningFcn at 60
myfunction(hObject, eventdata, handles);

Error in ==> gui_mainfcn at 166
    feval(gui_State.gui_OpeningFcn, gui_hFigure, [], guidata
(gui_hFigure), varargin{:});

Error in ==> Fields at 42
    gui_mainfcn(gui_State, varargin{:});

Thank you

Subject: Basic Plotting question, Linewidth

From: Randy Poe

Date: 25 Sep, 2007 17:44:18

Message: 2 of 2

On Sep 25, 1:30 pm, "Michael " <mlcooper...@aol.com> wrote:
> Hi, I have two lines, I want them to be of different
> widths,
>
> plot(b1x,b1y,b2x,b2y,'LineWidth',4)
>
> works but they are both the same width.

You could make two calls, setting any properties
you wanted for each:

  plot(b1x,b1y, 'LineWidth', 2)
  hold on
  plot(b2x,b2y,'LineWidth',4,'color', [0 0.5 0])

or save the handles and set properties after plotting:

  h = plot(b1x,b1y,b2x,b2y);
  set(h(2), 'linewidth', 4);

              - Randy

Tags for this Thread

No tags are associated with 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