Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/pandas/plotting/__init__.py: 100%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

4 statements  

1""" 

2Plotting public API. 

3 

4Authors of third-party plotting backends should implement a module with a 

5public ``plot(data, kind, **kwargs)``. The parameter `data` will contain 

6the data structure and can be a `Series` or a `DataFrame`. For example, 

7for ``df.plot()`` the parameter `data` will contain the DataFrame `df`. 

8In some cases, the data structure is transformed before being sent to 

9the backend (see PlotAccessor.__call__ in pandas/plotting/_core.py for 

10the exact transformations). 

11 

12The parameter `kind` will be one of: 

13 

14- line 

15- bar 

16- barh 

17- box 

18- hist 

19- kde 

20- area 

21- pie 

22- scatter 

23- hexbin 

24 

25See the pandas API reference for documentation on each kind of plot. 

26 

27Any other keyword argument is currently assumed to be backend specific, 

28but some parameters may be unified and added to the signature in the 

29future (e.g. `title` which should be useful for any backend). 

30 

31Besides ``plot``, the selected backend is used for these functions: 

32 

33- hist_series (for `Series.hist`) 

34- hist_frame (for `DataFrame.hist`) 

35- boxplot_frame (for `DataFrame.boxplot`) 

36- boxplot_frame_groupby (for `DataFrameGroupBy.boxplot`) 

37 

38The other functions in `pandas.plotting` (e.g. `pandas.plotting.boxplot`, 

39`scatter_matrix`, `register_matplotlib_converters`) always use Matplotlib, 

40regardless of the selected backend. 

41 

42Backends are found through the ``pandas_plotting_backends`` entry point, 

43falling back to importing the backend name as a module. 

44 

45Use the code in pandas/plotting/_matplotlib/ and 

46https://github.com/holoviz/hvplot as a reference on how to write a backend. 

47""" 

48 

49from pandas.plotting._core import ( 

50 PlotAccessor, 

51 boxplot, 

52 boxplot_frame, 

53 boxplot_frame_groupby, 

54 hist_frame, 

55 hist_series, 

56) 

57from pandas.plotting._misc import ( 

58 andrews_curves, 

59 autocorrelation_plot, 

60 bootstrap_plot, 

61 deregister as deregister_matplotlib_converters, 

62 lag_plot, 

63 parallel_coordinates, 

64 plot_params, 

65 radviz, 

66 register as register_matplotlib_converters, 

67 scatter_matrix, 

68 table, 

69) 

70 

71__all__ = [ 

72 "PlotAccessor", 

73 "andrews_curves", 

74 "autocorrelation_plot", 

75 "bootstrap_plot", 

76 "boxplot", 

77 "boxplot_frame", 

78 "boxplot_frame_groupby", 

79 "deregister_matplotlib_converters", 

80 "hist_frame", 

81 "hist_series", 

82 "lag_plot", 

83 "parallel_coordinates", 

84 "plot_params", 

85 "radviz", 

86 "register_matplotlib_converters", 

87 "scatter_matrix", 

88 "table", 

89]