creating a timeline

I would need to create a timeline for a Latex document (eps output).
There may be other tools besides Matplotlib and I am open to
suggestions. But I were going to use mpl, what would it take to do
something along these lines:
http://www.timelinemaker.com/product-samplecharts-constructiontimeline.html

Basically, I would need a nicely formatted dates along the x-axis and
then lightly colored rectangles with text in them. The width would
show when I anticipate some part of the project starting and ending.
The y coordinate of the rectangle would used to allow project portions
to overlap. It would be nice but not essential if the rectangles had
a little fade in and out in their back ground color instead of a solid
color, but that is not essential.

Is there a clean way to do this with mpl?

Thanks,

Ryan

See examples/broken_barh.py (this also allows breaks in the horizontal
bars, eg if an event is interrupted and then resumes). I haven't
added gradient fills on bars because I don't think they convey little
if any information but just add to the glitz factor (an example of
"chart junk" to use Tufte's phrase) but at some point we should bow to
popular pressure and add it. Actually, you can hack gradient filled
bars and axes backgrounds -- be careful, viewing the figure below may
induce seizures.

from pylab import figure, show, nx, cm

def gbar(ax, x, y, width=0.5, bottom=0):
   X = [[.6, .6],[.7,.7]]
   for left,top in zip(x, y):
       right = left+width
       ax.imshow(X, interpolation='bicubic', cmap=cm.Blues,
                 extent=(left, right, bottom, top), alpha=1)

fig = figure()

xmin, xmax = xlim = 0,10
ymin, ymax = ylim = 0,1
ax = fig.add_subplot(111, xlim=xlim, ylim=ylim,
                    autoscale_on=False)
X = [[.6, .6],[.7,.7]]

ax.imshow(X, interpolation='bicubic', cmap=cm.copper,
         extent=(xmin, xmax, ymin, ymax), alpha=1)

N = 10
x = nx.arange(N)+0.25
y = nx.mlab.rand(N)
gbar(ax, x, y, width=0.7)
ax.set_aspect('normal')
show()

···

On 9/20/07, Ryan Krauss <ryanlists@...287...> wrote:

I would need to create a timeline for a Latex document (eps output).
There may be other tools besides Matplotlib and I am open to
suggestions. But I were going to use mpl, what would it take to do
something along these lines:
http://www.timelinemaker.com/product-samplecharts-constructiontimeline.html

Basically, I would need a nicely formatted dates along the x-axis and
then lightly colored rectangles with text in them. The width would
show when I anticipate some part of the project starting and ending.
The y coordinate of the rectangle would used to allow project portions
to overlap. It would be nice but not essential if the rectangles had
a little fade in and out in their back ground color instead of a solid
color, but that is not essential.

Is there a clean way to do this with mpl?

bling-bling. I know it is eye candy and in questionable taste, but I
think it fits my non-technical audience in this case. I think this is
enough to get me going. Thanks John.

Ryan

···

On 9/20/07, John Hunter <jdh2358@...287...> wrote:

On 9/20/07, Ryan Krauss <ryanlists@...287...> wrote:
> I would need to create a timeline for a Latex document (eps output).
> There may be other tools besides Matplotlib and I am open to
> suggestions. But I were going to use mpl, what would it take to do
> something along these lines:
> http://www.timelinemaker.com/product-samplecharts-constructiontimeline.html
>
> Basically, I would need a nicely formatted dates along the x-axis and
> then lightly colored rectangles with text in them. The width would
> show when I anticipate some part of the project starting and ending.
> The y coordinate of the rectangle would used to allow project portions
> to overlap. It would be nice but not essential if the rectangles had
> a little fade in and out in their back ground color instead of a solid
> color, but that is not essential.
>
> Is there a clean way to do this with mpl?

See examples/broken_barh.py (this also allows breaks in the horizontal
bars, eg if an event is interrupted and then resumes). I haven't
added gradient fills on bars because I don't think they convey little
if any information but just add to the glitz factor (an example of
"chart junk" to use Tufte's phrase) but at some point we should bow to
popular pressure and add it. Actually, you can hack gradient filled
bars and axes backgrounds -- be careful, viewing the figure below may
induce seizures.

from pylab import figure, show, nx, cm

def gbar(ax, x, y, width=0.5, bottom=0):
   X = [[.6, .6],[.7,.7]]
   for left,top in zip(x, y):
       right = left+width
       ax.imshow(X, interpolation='bicubic', cmap=cm.Blues,
                 extent=(left, right, bottom, top), alpha=1)

fig = figure()

xmin, xmax = xlim = 0,10
ymin, ymax = ylim = 0,1
ax = fig.add_subplot(111, xlim=xlim, ylim=ylim,
                    autoscale_on=False)
X = [[.6, .6],[.7,.7]]

ax.imshow(X, interpolation='bicubic', cmap=cm.copper,
         extent=(xmin, xmax, ymin, ymax), alpha=1)

N = 10
x = nx.arange(N)+0.25
y = nx.mlab.rand(N)
gbar(ax, x, y, width=0.7)
ax.set_aspect('normal')
show()

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

I am really just getting to mess with this now and ran into an issue.
I want to turn off the y axis and 3 sides of the border around the
plot area, so that I left with just the bottom x-axis and its tick
marks. Turning off the y axis is easy enough, but the only way I
found to get rid of the border is with

ax.set_frame_on(False)

which also gets rid of my bottom x axis and leaves tick marks along
the top (see attached). How do I get rid of the top tick marks, keep
the bottom ones, and get the bottom x-axis back?

Thanks,

Ryan

···

On 9/20/07, Ryan Krauss <ryanlists@...287...> wrote:

bling-bling. I know it is eye candy and in questionable taste, but I
think it fits my non-technical audience in this case. I think this is
enough to get me going. Thanks John.

Ryan

On 9/20/07, John Hunter <jdh2358@...287...> wrote:
> On 9/20/07, Ryan Krauss <ryanlists@...287...> wrote:
> > I would need to create a timeline for a Latex document (eps output).
> > There may be other tools besides Matplotlib and I am open to
> > suggestions. But I were going to use mpl, what would it take to do
> > something along these lines:
> > http://www.timelinemaker.com/product-samplecharts-constructiontimeline.html
> >
> > Basically, I would need a nicely formatted dates along the x-axis and
> > then lightly colored rectangles with text in them. The width would
> > show when I anticipate some part of the project starting and ending.
> > The y coordinate of the rectangle would used to allow project portions
> > to overlap. It would be nice but not essential if the rectangles had
> > a little fade in and out in their back ground color instead of a solid
> > color, but that is not essential.
> >
> > Is there a clean way to do this with mpl?
>
> See examples/broken_barh.py (this also allows breaks in the horizontal
> bars, eg if an event is interrupted and then resumes). I haven't
> added gradient fills on bars because I don't think they convey little
> if any information but just add to the glitz factor (an example of
> "chart junk" to use Tufte's phrase) but at some point we should bow to
> popular pressure and add it. Actually, you can hack gradient filled
> bars and axes backgrounds -- be careful, viewing the figure below may
> induce seizures.
>
> from pylab import figure, show, nx, cm
>
> def gbar(ax, x, y, width=0.5, bottom=0):
> X = [[.6, .6],[.7,.7]]
> for left,top in zip(x, y):
> right = left+width
> ax.imshow(X, interpolation='bicubic', cmap=cm.Blues,
> extent=(left, right, bottom, top), alpha=1)
>
> fig = figure()
>
> xmin, xmax = xlim = 0,10
> ymin, ymax = ylim = 0,1
> ax = fig.add_subplot(111, xlim=xlim, ylim=ylim,
> autoscale_on=False)
> X = [[.6, .6],[.7,.7]]
>
> ax.imshow(X, interpolation='bicubic', cmap=cm.copper,
> extent=(xmin, xmax, ymin, ymax), alpha=1)
>
> N = 10
> x = nx.arange(N)+0.25
> y = nx.mlab.rand(N)
> gbar(ax, x, y, width=0.7)
> ax.set_aspect('normal')
> show()
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> matplotlib-users List Signup and Options
>

I think I have something I like reasonably well. Is that attached
timeline fairly intuitive? I am proposing a project for next summer
that has two main parts. Each part has three subsections that are
roughly one month long.

Thanks,

Ryan

···

On 9/20/07, Ryan Krauss <ryanlists@...287...> wrote:

I am really just getting to mess with this now and ran into an issue.
I want to turn off the y axis and 3 sides of the border around the
plot area, so that I left with just the bottom x-axis and its tick
marks. Turning off the y axis is easy enough, but the only way I
found to get rid of the border is with

ax.set_frame_on(False)

which also gets rid of my bottom x axis and leaves tick marks along
the top (see attached). How do I get rid of the top tick marks, keep
the bottom ones, and get the bottom x-axis back?

Thanks,

Ryan

On 9/20/07, Ryan Krauss <ryanlists@...287...> wrote:
> bling-bling. I know it is eye candy and in questionable taste, but I
> think it fits my non-technical audience in this case. I think this is
> enough to get me going. Thanks John.
>
> Ryan
>
> On 9/20/07, John Hunter <jdh2358@...287...> wrote:
> > On 9/20/07, Ryan Krauss <ryanlists@...287...> wrote:
> > > I would need to create a timeline for a Latex document (eps output).
> > > There may be other tools besides Matplotlib and I am open to
> > > suggestions. But I were going to use mpl, what would it take to do
> > > something along these lines:
> > > http://www.timelinemaker.com/product-samplecharts-constructiontimeline.html
> > >
> > > Basically, I would need a nicely formatted dates along the x-axis and
> > > then lightly colored rectangles with text in them. The width would
> > > show when I anticipate some part of the project starting and ending.
> > > The y coordinate of the rectangle would used to allow project portions
> > > to overlap. It would be nice but not essential if the rectangles had
> > > a little fade in and out in their back ground color instead of a solid
> > > color, but that is not essential.
> > >
> > > Is there a clean way to do this with mpl?
> >
> > See examples/broken_barh.py (this also allows breaks in the horizontal
> > bars, eg if an event is interrupted and then resumes). I haven't
> > added gradient fills on bars because I don't think they convey little
> > if any information but just add to the glitz factor (an example of
> > "chart junk" to use Tufte's phrase) but at some point we should bow to
> > popular pressure and add it. Actually, you can hack gradient filled
> > bars and axes backgrounds -- be careful, viewing the figure below may
> > induce seizures.
> >
> > from pylab import figure, show, nx, cm
> >
> > def gbar(ax, x, y, width=0.5, bottom=0):
> > X = [[.6, .6],[.7,.7]]
> > for left,top in zip(x, y):
> > right = left+width
> > ax.imshow(X, interpolation='bicubic', cmap=cm.Blues,
> > extent=(left, right, bottom, top), alpha=1)
> >
> > fig = figure()
> >
> > xmin, xmax = xlim = 0,10
> > ymin, ymax = ylim = 0,1
> > ax = fig.add_subplot(111, xlim=xlim, ylim=ylim,
> > autoscale_on=False)
> > X = [[.6, .6],[.7,.7]]
> >
> > ax.imshow(X, interpolation='bicubic', cmap=cm.copper,
> > extent=(xmin, xmax, ymin, ymax), alpha=1)
> >
> > N = 10
> > x = nx.arange(N)+0.25
> > y = nx.mlab.rand(N)
> > gbar(ax, x, y, width=0.7)
> > ax.set_aspect('normal')
> > show()
> >
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Microsoft
> > Defy all challenges. Microsoft(R) Visual Studio 2005.
> > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> > _______________________________________________
> > Matplotlib-users mailing list
> > Matplotlib-users@lists.sourceforge.net
> > matplotlib-users List Signup and Options
> >
>

I think this is what you are looking for:

from pylab import figure, show

fig = figure()
ax = fig.add_subplot(111)

ax.axesFrame.set_data((0,0,1), (1,0,0))
ax.axesPatch.set_edgecolor('white')
ax.xaxis.set_ticks_position('bottom')
ax.yaxis.set_ticks_position('left')

ax.plot(range(10))

show()

···

On 9/20/07, Ryan Krauss <ryanlists@...287...> wrote:

which also gets rid of my bottom x axis and leaves tick marks along
the top (see attached). How do I get rid of the top tick marks, keep
the bottom ones, and get the bottom x-axis back?