3

I want to redraw this Body Weight scale in bitmap editor pixel by pixel. As I understood this is a logarithmic scale, but what is the logarithm - binary or decimal?

How to calculate distance between lines in pixels. Maybe it's better to count from 1 to 70 and than reverse it.

values = []
for kilos, value in enumerate(range(1, 71)):
    //  some logic
    values.append([kilos, pixels])
reverse(values)

enter image description here

khex
  • 2,778
  • 6
  • 32
  • 56

1 Answers1

2

Assuming you want a height in pixels of 500, you can use this to get the intervals:

import math
pixels = 500
offset = math.log(10)
for x in range(10, 71, 10):
    print x, int(pixels * (math.log(x) - offset) / (math.log(70) - offset))

This is the output:

10 0
20 178
30 282
40 356
50 413
60 460
70 500

The pixel counts are just the differences between the start and end of each interval. Change 500 to fit your application.