Thread Subject: Urgent - Help Required in plotting data

Subject: Urgent - Help Required in plotting data

From: Joe Frank

Date: 19 Mar, 2009 21:07:01

Message: 1 of 5

I have time data ranging from [2790 till 2880] (This is my X- Axis)

I have this matrix

List =

        2804 2805 7
        2814 2816 16
        2823 2826 16
        2842 2844 16
        2994 2995 7

In this Column Number 1 is the Starting Time and Column Number 2 is Ending time and Column Number 3 is the Action occured between those two times.

Column Number 3 is my Y-Axis.

I need to plot a bar graph with this data. How do i do it. Can someone help me with this?

Subject: Urgent - Help Required in plotting data

From: us

Date: 19 Mar, 2009 22:10:03

Message: 2 of 5

"Joe Frank"
> I have time data ranging from [2790 till 2880] (This is my X- Axis)
> I have this matrix
> 2804 2805 7
> 2814 2816 16
> 2823 2826 16
> 2842 2844 16
> 2994 2995 7
> In this Column Number 1 is the Starting Time and Column Number 2 is Ending time and Column Number 3 is the Action occured between those two times.
> Column Number 3 is my Y-Axis.
> I need to plot a bar graph with this data...

one of the solutions

     d=[
          2804 2805 7
          2814 2816 16
          2823 2826 16
          2842 2844 16
          2994 2995 7
     ];
     line(d(:,1:2).',repmat(d(:,3),1,2).','linewidth',30,'color',[0,0,0]);
     set(gca,...
          'ytick',unique(d(:,3)),...
          'xlim',[2700,3100],...
          'ylim',[0,20]);

us

Subject: Urgent - Help Required in plotting data

From: Joe Frank

Date: 20 Mar, 2009 13:30:18

Message: 3 of 5

"us " <us@neurol.unizh.ch> wrote in message <gpufrr$md1$1@fred.mathworks.com>...
> "Joe Frank"
> > I have time data ranging from [2790 till 2880] (This is my X- Axis)
> > I have this matrix
> > 2804 2805 7
> > 2814 2816 16
> > 2823 2826 16
> > 2842 2844 16
> > 2994 2995 7
> > In this Column Number 1 is the Starting Time and Column Number 2 is Ending time and Column Number 3 is the Action occured between those two times.
> > Column Number 3 is my Y-Axis.
> > I need to plot a bar graph with this data...
>
> one of the solutions
>
> d=[
> 2804 2805 7
> 2814 2816 16
> 2823 2826 16
> 2842 2844 16
> 2994 2995 7
> ];
> line(d(:,1:2).',repmat(d(:,3),1,2).','linewidth',30,'color',[0,0,0]);
> set(gca,...
> 'ytick',unique(d(:,3)),...
> 'xlim',[2700,3100],...
> 'ylim',[0,20]);
>
> us

thanks but its not looking like a bar graph exactly.

Subject: Urgent - Help Required in plotting data

From: G. B.

Date: 20 Mar, 2009 13:39:01

Message: 4 of 5

"Joe Frank" <sascod@gmail.com> wrote in message <gq05pa$s8f$1@fred.mathworks.com>...
> "us " <us@neurol.unizh.ch> wrote in message <gpufrr$md1$1@fred.mathworks.com>...
> > "Joe Frank"
> > > I have time data ranging from [2790 till 2880] (This is my X- Axis)
> > > I have this matrix
> > > 2804 2805 7
> > > 2814 2816 16
> > > 2823 2826 16
> > > 2842 2844 16
> > > 2994 2995 7
> > > In this Column Number 1 is the Starting Time and Column Number 2 is Ending time and Column Number 3 is the Action occured between those two times.
> > > Column Number 3 is my Y-Axis.
> > > I need to plot a bar graph with this data...
> >
> > one of the solutions
> >
> > d=[
> > 2804 2805 7
> > 2814 2816 16
> > 2823 2826 16
> > 2842 2844 16
> > 2994 2995 7
> > ];
> > line(d(:,1:2).',repmat(d(:,3),1,2).','linewidth',30,'color',[0,0,0]);
> > set(gca,...
> > 'ytick',unique(d(:,3)),...
> > 'xlim',[2700,3100],...
> > 'ylim',[0,20]);
> >
> > us
>
> thanks but its not looking like a bar graph exactly.

type:

help bar

Subject: Urgent - Help Required in plotting data

From: us

Date: 20 Mar, 2009 19:06:02

Message: 5 of 5

"Joe Frank"
> thanks but its not looking like a bar graph exactly...

i could not agree more - however, the solution follows closely the description of what you want, eg,
- the pseudo-bar is drawn along the x-axis between the 1st and 2nd col...
- the 3rd col is the y-axis...
altogether, there is NO other solution this reader can think of given your request...
thus, please be more specific - or better, even - give an exemplary code snippet...

us

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
code us 19 Mar, 2009 18:17:45
line us 19 Mar, 2009 18:17:45
graphics handle us 19 Mar, 2009 18:17:45
unique us 19 Mar, 2009 18:17:45
rssFeed for this Thread

Contact us at files@mathworks.com