-
-
Notifications
You must be signed in to change notification settings - Fork 241
Description
The following code throws NotImplementedError: There is data outside of the box. Don't know how to handle during cleaning. Please check if x/ylim is to tight:
import matplotlib.pyplot as plt
from tikzplotlib import clean_figure
x = range(1001)
y = [1]*1001
y[500] = 100
fig = plt.figure()
plt.plot(x,y)
plt.xlim(400, 600)
plt.ylim(0,10)
clean_figure(fig)The reason lies in _move_points_closer that supposedly once was thought to map the points outside the visible domain to points on the edge of that domain.
However, it seems this was never implemented and this function only returns the data unchanged if there are no points outside the visible area or throws the above error otherwise.
In my actual use case I have a very long timesignal of which I only want to plot a short fraction. Cutting this out is already done by _prune_outside_box. However, the signal also has some peaks that lie outside the domain which trigger the above error.
Since _move_points_closer currently doesn't do anything anyway, it seems exaggerated to me to completely abort the figure cleaning process just because some values are still outside the axis area. I would suggest to change this into a warning instead.