@@ -714,3 +714,58 @@ def my_plotter(ax, data1, data2, param_dict):
714
714
# attempt at evenly spaced (along the *x* axis) sampling. See the
715
715
# :ref:`sphx_glr_gallery_lines_bars_and_markers_markevery_demo.py`
716
716
# for more information.
717
+ #
718
+ # Splitting lines into smaller chunks
719
+ # -----------------------------------
720
+ #
721
+ # If you are using the Agg backend (see :ref:`what-is-a-backend`),
722
+ # then you can make use of the ``agg.path.chunksize`` rc parameter.
723
+ # This allows you to specify a chunk size, and any lines with
724
+ # greater than that many vertices will be split into multiple
725
+ # lines, each of which have no more than ``agg.path.chunksize``
726
+ # many vertices. (Unless ``agg.path.chunksize`` is zero, in
727
+ # which case there is no chunking.) For some kind of data,
728
+ # chunking the line up into reasonable sizes can greatly
729
+ # decrease rendering time.
730
+ #
731
+ # The following script will first display the data without any
732
+ # chunk size restriction, and then display the same data with
733
+ # a chunk size of 10,000. The difference can best be seen when
734
+ # the figures are large, try maximizing the GUI and then
735
+ # interacting with them::
736
+ #
737
+ # import numpy as np
738
+ # import matplotlib.pyplot as plt
739
+ # import matplotlib as mpl
740
+ # mpl.rcParams['path.simplify_threshold'] = 1.0
741
+ #
742
+ # # Setup, and create the data to plot
743
+ # y = np.random.rand(100000)
744
+ # y[50000:] *= 2
745
+ # y[np.logspace(1,np.log10(50000), 400).astype(int)] = -1
746
+ # mpl.rcParams['path.simplify'] = True
747
+ #
748
+ # mpl.rcParams['agg.path.chunksize'] = 0
749
+ # plt.plot(y)
750
+ # plt.show()
751
+ #
752
+ # mpl.rcParams['agg.path.chunksize'] = 10000
753
+ # plt.plot(y)
754
+ # plt.show()
755
+ #
756
+ # Using the *fast* style
757
+ # ----------------------
758
+ #
759
+ # The *fast* style can be used to automatically set
760
+ # simplification and chunking parameters to reasonable
761
+ # settings to speed up plotting large amounts of data.
762
+ # It can be used simply by running::
763
+ #
764
+ # import matplotlib.style as mplstyle
765
+ # mplstyle.use('fast')
766
+ #
767
+ # It is very light weight, so it plays nicely with other
768
+ # styles, just make sure the fast style is applied last
769
+ # so that other styles do not overwrite the settings::
770
+ #
771
+ # mplstyle.use(['dark_background', 'ggplot', 'fast'])
0 commit comments