Skip to content

Commit 2d2fcc0

Browse files
refactor _sampling_warning_msg
1 parent 54393fb commit 2d2fcc0

File tree

1 file changed

+14
-28
lines changed
  • bigframes/operations/_matplotlib

1 file changed

+14
-28
lines changed

bigframes/operations/_matplotlib/core.py

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@ def _kind(self):
5555

5656
@property
5757
def _sampling_warning_msg(self) -> typing.Optional[str]:
58-
return None
58+
return (
59+
"To optimize plotting performance, your data has been downsampled to {sampling_n} "
60+
"rows from the original {total_n} rows. This may result in some data points "
61+
"not being displayed. For a more comprehensive view, consider pre-processing "
62+
"your data by aggregating it or selecting the top categories."
63+
)
5964

6065
def __init__(self, data, **kwargs) -> None:
6166
self.kwargs = kwargs
@@ -92,6 +97,10 @@ def _compute_plot_data(self):
9297

9398

9499
class AreaPlot(SamplingPlot):
100+
@property
101+
def _sampling_warning_msg(self) -> typing.Optional[str]:
102+
return None
103+
95104
@property
96105
def _kind(self) -> typing.Literal["area"]:
97106
return "area"
@@ -102,45 +111,18 @@ class BarPlot(SamplingPlot):
102111
def _kind(self) -> typing.Literal["bar"]:
103112
return "bar"
104113

105-
@property
106-
def _sampling_warning_msg(self) -> typing.Optional[str]:
107-
return (
108-
"To optimize plotting performance, your data has been downsampled to {sampling_n} "
109-
"rows from the original {total_n} rows. This may result in some data points "
110-
"not being displayed. For a more comprehensive view, consider pre-processing "
111-
"your data by aggregating it or selecting the top categories."
112-
)
113-
114114

115115
class BarhPlot(SamplingPlot):
116116
@property
117117
def _kind(self) -> typing.Literal["barh"]:
118118
return "barh"
119119

120-
@property
121-
def _sampling_warning_msg(self) -> typing.Optional[str]:
122-
return (
123-
"To optimize plotting performance, your data has been downsampled to {sampling_n} "
124-
"rows from the original {total_n} rows. This may result in some data points "
125-
"not being displayed. For a more comprehensive view, consider pre-processing "
126-
"your data by aggregating it or selecting the top categories."
127-
)
128-
129120

130121
class PiePlot(SamplingPlot):
131122
@property
132123
def _kind(self) -> typing.Literal["pie"]:
133124
return "pie"
134125

135-
@property
136-
def _sampling_warning_msg(self) -> typing.Optional[str]:
137-
return (
138-
"To optimize plotting performance, your data has been downsampled to {sampling_n} "
139-
"rows from the original {total_n} rows. This may result in some data points "
140-
"not being displayed. For a more comprehensive view, consider pre-processing "
141-
"your data by aggregating it or selecting the top categories."
142-
)
143-
144126

145127
class LinePlot(SamplingPlot):
146128
@property
@@ -153,6 +135,10 @@ class ScatterPlot(SamplingPlot):
153135
def _kind(self) -> typing.Literal["scatter"]:
154136
return "scatter"
155137

138+
@property
139+
def _sampling_warning_msg(self) -> typing.Optional[str]:
140+
return None
141+
156142
def __init__(self, data, **kwargs) -> None:
157143
super().__init__(data, **kwargs)
158144

0 commit comments

Comments
 (0)