Example #1
0
from lifegraph.lifegraph import Lifegraph, Papersize
from datetime import date

if __name__ == '__main__':
    birthday = date(1990, 11, 1)
    g = Lifegraph(birthday, dpi=300, size=Papersize.A4)
    g.add_title("Time is Not Equal to Money")
    g.save("images/grid_with_title.png")
Example #2
0
from lifegraph.lifegraph import Lifegraph, Papersize
from datetime import date

if __name__ == '__main__':
    birthday = date(1990, 11, 1)
    g = Lifegraph(birthday, dpi=300, size=Papersize.A4, max_age=100)

    g.add_title("Time is Not Equal to Money")
    g.show_max_age_label()

    g.settings.rcParams["lines.marker"] = 'v'
    g.settings.rcParams["lines.markersize"] = 2.0

    g.save("images/grid_customization.png")
Example #3
0
from lifegraph.lifegraph import Lifegraph, Papersize
from datetime import date

if __name__ == '__main__':
    birthday = date(1990, 11, 1)
    g = Lifegraph(birthday, dpi=300, size=Papersize.A4, max_age=100)

    g.add_title("Time is Not Equal to Money")
    g.show_max_age_label()

    # random color will be used
    g.add_era('That one thing\nI did as a kid', date(2000, 3, 4),
              date(2005, 8, 22))

    # you can also choose the color
    g.add_era('Running for city\ncouncil',
              date(2019, 12, 10),
              date(2020, 11, 5),
              color="#4423fe")

    g.save("images/grid_era.png")
Example #4
0
def main():
    birthday = date(1995, 11, 20)
    g = Lifegraph(birthday, dpi=300, size=Papersize.Letter, label_space_epsilon=1)

    g.add_life_event('Won an award', date(2013, 11, 20), '#014421')
    g.add_life_event('Hiked the Rocky Mountains', date(2014, 2, 14), '#DC143C', hint=(25, -3))
    g.add_life_event('Ran first marathon', date(2017, 9, 11), '#990000')
    g.add_life_event('Built a canoe', date(2018, 12, 8), '#87CEFA')
    g.add_life_event('Started working at\nEcosia', date(2019, 1, 7), '#00008B')

    now = datetime.utcnow()
    g.add_life_event('Today', date(now.year, now.month, now.day), (0.75, 0, 0.75))

    g.add_era("Elementary School", date(2001, 8, 24), date(2007, 6, 5), 'r')
    g.add_era("Intermediate School", date(2007, 8, 24), date(2008, 6, 5), '#00838f')
    g.add_era("Middle School", date(2008, 8, 24), date(2010, 6, 5), 'b')
    g.add_era("High School", date(2010, 8, 24), date(2014, 6, 5), '#00838f')
    g.add_era("College", date(2014, 9, 1), date(2018, 12, 14), (80/255, 0, 0), side=Side.LEFT)

    g.add_era_span("Longest vacation ever", date(2016, 8, 22), date(2016, 12, 16), '#D2691E', hint=Point(53, 28))

    g.add_title("The life of Someone")

    g.show_max_age_label()

    g.save("images/alife.png")
Example #5
0
from lifegraph.lifegraph import Lifegraph, Papersize
from datetime import date

if __name__ == '__main__':
    birthday = date(1990, 11, 1)
    g = Lifegraph(birthday, dpi=300, size=Papersize.A4, max_age=100)

    g.add_title("Time is Not Equal to Money")
    g.show_max_age_label()

    g.add_image("couple.jpg", alpha=0.5)

    g.save("images/grid_add_image.png")
Example #6
0
from lifegraph.lifegraph import Lifegraph, Papersize, Side
from datetime import date

if __name__ == '__main__':
    birthday = date(1990, 11, 1)
    g = Lifegraph(birthday, dpi=300, size=Papersize.A4, max_age=100)

    g.add_title("Time is Not Equal to Money")
    g.show_max_age_label()

    # a random color will be chosen if you don't provide one
    g.add_life_event('My first paycheck', date(2006, 8, 23))

    # colors can be added as hex strings
    # and you can hint at which side you want the text on
    g.add_life_event('Graduated\nhighschool', date(2008, 6, 2), color="#00FF00", side=Side.LEFT)

    # or RGB
    g.add_life_event('First car purchased', date(2010, 7, 14), color = (1, 0, 0))

    g.save("images/grid_life_event.png")
Example #7
0
from lifegraph.lifegraph import Lifegraph, Papersize
from datetime import date

if __name__ == '__main__':
    birthday = date(1990, 11, 1)
    g = Lifegraph(birthday,
                  dpi=300,
                  size=Papersize.A4,
                  axes_rect=[.1, .1, .8, .8])
    g.save("images/grid.png")
Example #8
0
from lifegraph.lifegraph import Lifegraph, Papersize, Side
from datetime import date

if __name__ == '__main__':
    birthday = date(1990, 11, 1)
    g = Lifegraph(birthday, dpi=300, size=Papersize.A4, max_age=100)

    g.add_title("Time is Not Equal to Money")
    g.show_max_age_label()

    # the default placement
    g.add_life_event('My first paycheck', date(2006, 1, 23), color='r')

    # a hint, in data coordinates
    g.add_life_event('My first paycheck',
                     date(2006, 1, 23),
                     color='r',
                     hint=(10, -10))

    # a side
    g.add_life_event('My first paycheck',
                     date(2006, 1, 23),
                     color='r',
                     side=Side.RIGHT)

    # the default placement
    g.add_era_span('Green thing',
                   start_date=date(2010, 2, 1),
                   end_date=date(2011, 8, 1),
                   color='g')
Example #9
0
from lifegraph.lifegraph import Lifegraph, Papersize, random_color, Point, Side
from datetime import date, datetime, timedelta

if __name__ == '__main__':
    birthday = date(1990, 11, 1)

    for sz in Papersize:
        print(f"{sz}")
        g = Lifegraph(birthday, dpi=600, size=sz, label_space_epsilon=1)

        g.add_life_event('Married', date(2010, 2, 14), '#DC143C')
        g.add_life_event('Five Years\nTogether', date(2015, 2, 14), '#DC143C')

        g.add_watermark("A Person")

        g.add_era("Elementary School", date(1996, 8, 24), date(2002, 6, 5), 'r')
        g.add_era("Intermediate School", date(2002, 8, 24), date(2003, 6, 5), '#00838f')
        g.add_era("Middle School", date(2003, 8, 24), date(2005, 6, 5), 'b')
        g.add_era("High School", date(2005, 8, 24), date(2009, 6, 5), '#00838f')
        g.add_era("College", date(2009, 9, 1), date(2013, 12, 14), (80/255, 0, 0), side=Side.LEFT)

        g.add_era_span("Pregnant with\nBilbo Bagginses", date(2016, 1, 22), date(2016, 10, 16), '#D2691E', hint=Point(54, 28))

        g.add_title("Our Life, Together")

        g.add_image("couple.jpg", alpha=0.3)

        g.show_max_age_label()

        g.save(f"images/lifegraph_{sz.name}.png")
        g.close()
Example #10
0
def main():
    birthday = date(1995, 11, 20)
    g = Lifegraph(birthday,
                  dpi=300,
                  size=Papersize.A4,
                  max_age=100,
                  label_space_epsilon=1)

    g.settings.otherParams["annotation.left.offset"] = 3
    g.settings.otherParams["annotation.right.offset"] = 3

    # same day that I was accepted onto performance team :`)
    g.add_life_event('thing 1', date(2017, 9, 11), '#990000')
    g.add_life_event('thing 2', date(2019, 1, 7), '#00008B')
    g.add_life_event('thing 3', date(2018, 12, 8), '#87CEFA')
    g.add_life_event('thing 4', date(2013, 11, 20), '#014421')
    g.add_life_event('thing 5', date(2014, 2, 14), '#DC143C', hint=(25, -5))
    g.add_life_event(r'thing 6', date(2020, 2, 14), (.522, .733, .396))

    now = date(2020, 8, 22)
    g.add_life_event('Today', date(now.year, now.month, now.day),
                     (0.75, 0, 0.75))

    g.add_era("thing 7", date(2001, 8, 24), date(2007, 6, 5), 'r')
    g.add_era("thing 8", date(2007, 8, 24), date(2008, 6, 5), '#00838f')
    g.add_era("thing 9", date(2008, 8, 24), date(2010, 6, 5), 'b')
    g.add_era("thing 10", date(2010, 8, 24), date(2014, 6, 5), '#00838f')
    g.add_era("thing 11",
              date(2014, 9, 1),
              date(2018, 12, 14), (80 / 255, 0, 0),
              side=Side.LEFT)

    g.add_era_span("thing 12",
                   date(2016, 8, 22),
                   date(2016, 12, 16),
                   '#D2691E',
                   hint=Point(53, 28))

    g.add_title("Title")

    g.show_max_age_label()

    g.save("images/hint_collision.png")