Coding Day 10: Roll Your Own

I didn’t want to switch tools and use an already built plotting tool just to create my relatively simple graph, so I started to roll my own graph.  It’s coming along okay except I a) had to do some math; and b) my scale was making said math harder.  So here’s the deal.  Everyone knows that the y-axis of a graph starts at 0, which is usually at the bottom, right? Yes.  But y=0 in my graphics program at the top, not the bottom, so calculating where to plot, say 1400 calories when your bottom y value is 700 got a little complicated.  I’m not sure I have an accurate formula yet.  Note to self: Do not try to do these things after 8 p.m.! You can’t think clearly then!

I got close, I think, but I realized that with calories reaching to the thousands and weight not (thankfully!), it was going to be hard to visually compare the two.  So I think I’m going to normalize the calories by dividing by 10, which will mean that the top calorie count will be 140.  That might also help with my math formula because I can create better increments. I’m definitely missing something from my formula. I’m going to sleep on it, and it will probably come to me.

Even though there are plotting tools out there where I could easily type in something like Plot(300,400) and voila, two dots on my graph or it could generate a curve or something, I like rolling my own because you realize how amazing it is that there are things like Excel and MatLab and other cool graphing tools.  There’s a lot of math behind that and not just in generating the curves themselves.  It’s like a cool little puzzle.  Knowing that I can write a program to solve it is pretty cool, actually.

Leave a Reply

Your email address will not be published. Required fields are marked *