tammoippen / plotille

Plot in the terminal using braille dots.
MIT License
398 stars 17 forks source link

weird spike at zero #23

Closed quantumdot closed 5 years ago

quantumdot commented 5 years ago

Cool library! I'm trying to plot some simple data, but the result has an odd spike at 0 on the x-axis: sys.stderr.write(plotille.plot(np.arange(len(diff)).tolist(), diff.tolist(), x_min=0, height=20, X_label="Frame #", Y_label='Lag-Time (ms)'))

(Lag-Time (ms)) ^
180.205040 |
172.148096 | ⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
164.091152 | ⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
156.034208 | ⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
147.977264 | ⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
139.920320 | ⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
131.863376 | ⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
123.806432 | ⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
115.749488 | ⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
107.692544 | ⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
99.6356000 | ⡇⠀⠀⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⠀⡀⠀⠀⡀⡀⠀⠀⠀⢸⢀⠀⡀⠀⠀⠀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⠀⠀⡀⠀⠀⣀⠀⣀⢀⣀⣀⠀⡀⠀⢀⢀⠀⠀⢀⣀⡀⠀⡀⠀⠀⠀⠀⠀⠀⠀
91.5786560 | ⡇⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⡇⠀⠀⡇⡇⠀⠀⠀⢸⣿⠀⡇⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⠀⠀⡇⠀⠀⣿⠀⣿⢸⣿⣿⠀⡇⠀⢸⢸⠀⠀⢸⣿⡇⠀⡇⠀⠀⠀⠀⠀⠀⠀
83.5217120 | ⡇⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⡇⠀⠀⡇⡇⠀⠀⠀⢸⣿⠀⡇⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⠀⠀⡇⠀⠀⣿⠀⣿⢸⣿⣿⠀⡇⠀⢸⢸⠀⠀⢸⣿⡇⠀⡇⠀⠀⠀⠀⠀⠀⠀
75.4647680 | ⡇⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⡇⠀⠀⡇⡇⠀⠀⠀⢸⣿⠀⡇⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⠀⠀⡇⠀⠀⣿⠀⣿⢸⣿⣿⠀⡇⠀⢸⢸⠀⠀⢸⣿⡇⠀⡇⠀⠀⠀⠀⠀⠀⠀
67.4078240 | ⡇⢀⡀⢀⢸⠀⣀⠀⢀⠀⠀⡀⢀⠀⣀⠀⡀⣀⣀⢀⣸⣀⣀⣇⣀⣀⣇⣇⣀⣀⣀⣸⣿⣀⡇⣀⢀⢀⣇⣀⣀⣀⣀⣀⣀⣀⣀⣀⣿⣿⣀⣀⣇⣀⣀⣿⡀⣿⣸⣿⣿⡀⣇⣀⣸⣸⣀⣀⣸⣿⡇⣀⣇⠀⠀⠀⠀⠀⠀⠀
59.3508800 | ⡇⢸⡇⢸⢸⠀⣿⠀⢸⠀⠀⣿⣿⡇⣿⢸⡇⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⣿⢸⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⣿⣿⠀⠀⠀⠀⠀⠀⠀
51.2939360 | ⡇⢸⡇⢸⢸⠀⣿⠀⢸⠀⠀⣿⣿⡇⣿⢸⡇⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⣿⢸⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⣿⣿⠀⠀⠀⠀⠀⠀⠀
43.2369920 | ⡇⢸⡇⢸⢸⠀⣿⠀⢸⠀⠀⣿⣿⡇⣿⢸⡇⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⣿⢸⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⣿⣿⠀⠀⠀⠀⠀⠀⠀
35.1800480 | ⡇⢸⣇⢸⢸⠀⣿⢀⢸⠀⣀⣿⣿⡇⣿⣸⡇⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⣿⣸⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⣿⣿⠀⠀⠀⠀⠀⠀⠀
27.1231040 | ⡏⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀
19.0661600 | ⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
-----------|-|---------|---------|---------|---------|---------|---------|---------|---------|-> (Frame #)
           | 0         869.96250 1739.9250 2609.8875 3479.8500 4349.8125 5219.7750 6089.7375 6959.7000

Compared to matplotlib: plt.plot(np.arange(len(diff)).tolist(), diff.tolist())

Figure_1

tammoippen commented 5 years ago

Hi @quantumdot ,

Glad that you like it! 🤘 Regarding the 'spike' at 0, i guess it is the origin (cf the images in the readme). You could, give your plot some color (lc='red'), then the origin should stay black (if you have a tty). Or you could start the plot just after 0, eg increase all x values by 1 and / or set x_min=0.1 (you have to experiment a bit i guess).

If you want an option to not print the origin, please let me know.

Best

quantumdot commented 5 years ago

Ok, I suppose that makes sense.

Your suggestion of an option to not print the origin would be really nice. It is hard to disambiguate the data points from the origin, and I really don't need the origin plotted (the y-ticks serve this purpose well). The data I'm plotting is pretty dense (~40,000 points) but I'm just trying to get a mile-high view for anomalies, but the origin makes it look like there is a huge spike there.

tammoippen commented 5 years ago

@quantumdot please have a look at the 3.7 release: plot and scatter and Figure now have an option origin. If you set that to False the origin will not be printed.

quantumdot commented 5 years ago

Works great, thanks!