JeroenDelcour / tplot

A library for creating text-based graphs in the terminal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

User-specified axis ranges

JeroenDelcour opened this issue · comments

Currently, the axis range is determined by the range of the input data, i.e. min(x), max(x) for the X axis. It would be nice to be able to override that, e.g. when plotting percentages you often want the range to be from 0 to 1.

Proposed syntax:

fig = tplot.Figure(xlim=(0, None), ylim=(0,1))

xlim and ylim each take a (min, max) tuple. None means the value should be taken from the input data. So in the above example, the X axis range would be from 0 to max(x) and the Y axis range would be from 0 to 1.

This may seem like a simple feature, but it affects the code in a bunch of different places. Care should also be taken to handle values in the input data that fall outside the specified range.