Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/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

3 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 

31Currently, all the Matplotlib functions in pandas are accessed through 

32the selected backend. For example, `pandas.plotting.boxplot` (equivalent 

33to `DataFrame.boxplot`) is also accessed in the selected backend. This 

34is expected to change, and the exact API is under discussion. But with 

35the current version, backends are expected to implement the next functions: 

36 

37- plot (describe above, used for `Series.plot` and `DataFrame.plot`) 

38- hist_series and hist_frame (for `Series.hist` and `DataFrame.hist`) 

39- boxplot (`pandas.plotting.boxplot(df)` equivalent to `DataFrame.boxplot`) 

40- boxplot_frame and boxplot_frame_groupby 

41- register and deregister (register converters for the tick formats) 

42- Plots not called as `Series` and `DataFrame` methods: 

43 - table 

44 - andrews_curves 

45 - autocorrelation_plot 

46 - bootstrap_plot 

47 - lag_plot 

48 - parallel_coordinates 

49 - radviz 

50 - scatter_matrix 

51 

52Use the code in pandas/plotting/_matplotib.py and 

53https://github.com/pyviz/hvplot as a reference on how to write a backend. 

54 

55For the discussion about the API see 

56https://github.com/pandas-dev/pandas/issues/26747. 

57""" 

58from pandas.plotting._core import ( 

59 PlotAccessor, 

60 boxplot, 

61 boxplot_frame, 

62 boxplot_frame_groupby, 

63 hist_frame, 

64 hist_series, 

65) 

66from pandas.plotting._misc import ( 

67 andrews_curves, 

68 autocorrelation_plot, 

69 bootstrap_plot, 

70 deregister as deregister_matplotlib_converters, 

71 lag_plot, 

72 parallel_coordinates, 

73 plot_params, 

74 radviz, 

75 register as register_matplotlib_converters, 

76 scatter_matrix, 

77 table, 

78) 

79 

80__all__ = [ 

81 "PlotAccessor", 

82 "boxplot", 

83 "boxplot_frame", 

84 "boxplot_frame_groupby", 

85 "hist_frame", 

86 "hist_series", 

87 "scatter_matrix", 

88 "radviz", 

89 "andrews_curves", 

90 "bootstrap_plot", 

91 "parallel_coordinates", 

92 "lag_plot", 

93 "autocorrelation_plot", 

94 "table", 

95 "plot_params", 

96 "register_matplotlib_converters", 

97 "deregister_matplotlib_converters", 

98]