k20shores / life-graph Goto Github PK
View Code? Open in Web Editor NEWA graph of your life
License: MIT License
A graph of your life
License: MIT License
There is text in the graph produced by the annotation spillover file which shows the first limitation of the annotations. They do not automatically detect when the text is too large and would be printed off-screen.
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 highschool', 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/annotation_spillover.png")
Allow the user to pass in an axes instance instead of creating a new one each time
Honestly, I don't know if the paper sizes produced by this are correct. I also don't know how the paper sizes and the DPI play together. If anyone knows this information and can tell me what the relationship is and how to properly set both the page size and DPI if what I am doing is wrong, please let me know. Even links to an article would be appreciated in solving this.
Describe the bug
The image below shows that overlaps with hints are not detected.
from lifegraph.lifegraph import Lifegraph, Papersize, random_color, Point, Side
from datetime import date, datetime
if __name__ == '__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 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")
Pickle the graph information.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.