def _plotting_decimation(trace, max_len=<NUM_LIT>, decimation_step=<NUM_LIT:4>):
trace_len = trace.stats.npts<EOL>while trace_len > max_len:<EOL><INDENT>trace.decimate(decimation_step)<EOL>trace_len = trace.stats.npts<EOL><DEDENT>return trace<EOL>
Decimate data until required length reached.

:type trace: obspy.core.stream.Trace
:param trace: Trace to decimate
type max_len: int
:param max_len: Maximum length in samples
:type decimation_step: int
:param decimation_step: Decimation factor to use for each step.

:return: obspy.core.stream.Trace

.. rubric: Example

>>> from obspy import Trace
>>> import numpy as np
>>> trace = Trace(np.random.randn(1000))
>>> trace = _plotting_decimation(trace, max_len=100, decimation_step=2)
>>> print(trace.stats.npts)
63