aboutsummaryrefslogtreecommitdiff
path: root/venv/lib/python3.8/site-packages/plotly/graph_objs/histogram/_xbins.py
blob: a0dd1a5ae8b321fce76090b0a9a4bed0e5317824 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
#                   --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.

from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy


class XBins(_BaseTraceHierarchyType):
    _parent_path_str = "histogram"
    _path_str = "histogram.xbins"
    _valid_props = {"end", "size", "start"}

    @property
    def end(self):
        """
        Sets the end value for the x axis bins. The last bin may not
        end exactly at this value, we increment the bin edge by `size`
        from `start` until we reach or exceed `end`. Defaults to the
        maximum data value. Like `start`, for dates use a date string,
        and for category data `end` is based on the category serial
        numbers.

        The 'end' property accepts values of any type

        Returns
        -------
        Any
        """
        return self["end"]

    @end.setter
    def end(self, val):
        self["end"] = val

    @property
    def size(self):
        """
        Sets the size of each x axis bin. Default behavior: If `nbinsx`
        is 0 or omitted, we choose a nice round bin size such that the
        number of bins is about the same as the typical number of
        samples in each bin. If `nbinsx` is provided, we choose a nice
        round bin size giving no more than that many bins. For date
        data, use milliseconds or "M<n>" for months, as in
        `axis.dtick`. For category data, the number of categories to
        bin together (always defaults to 1). If multiple non-overlaying
        histograms share a subplot, the first explicit `size` is used
        and all others discarded. If no `size` is provided,the sample
        data from all traces is combined to determine `size` as
        described above.

        The 'size' property accepts values of any type

        Returns
        -------
        Any
        """
        return self["size"]

    @size.setter
    def size(self, val):
        self["size"] = val

    @property
    def start(self):
        """
        Sets the starting value for the x axis bins. Defaults to the
        minimum data value, shifted down if necessary to make nice
        round values and to remove ambiguous bin edges. For example, if
        most of the data is integers we shift the bin edges 0.5 down,
        so a `size` of 5 would have a default `start` of -0.5, so it is
        clear that 0-4 are in the first bin, 5-9 in the second, but
        continuous data gets a start of 0 and bins [0,5), [5,10) etc.
        Dates behave similarly, and `start` should be a date string.
        For category data, `start` is based on the category serial
        numbers, and defaults to -0.5. If multiple non-overlaying
        histograms share a subplot, the first explicit `start` is used
        exactly and all others are shifted down (if necessary) to
        differ from that one by an integer number of bins.

        The 'start' property accepts values of any type

        Returns
        -------
        Any
        """
        return self["start"]

    @start.setter
    def start(self, val):
        self["start"] = val

    @property
    def _prop_descriptions(self):
        return """\
        end
            Sets the end value for the x axis bins. The last bin
            may not end exactly at this value, we increment the bin
            edge by `size` from `start` until we reach or exceed
            `end`. Defaults to the maximum data value. Like
            `start`, for dates use a date string, and for category
            data `end` is based on the category serial numbers.
        size
            Sets the size of each x axis bin. Default behavior: If
            `nbinsx` is 0 or omitted, we choose a nice round bin
            size such that the number of bins is about the same as
            the typical number of samples in each bin. If `nbinsx`
            is provided, we choose a nice round bin size giving no
            more than that many bins. For date data, use
            milliseconds or "M<n>" for months, as in `axis.dtick`.
            For category data, the number of categories to bin
            together (always defaults to 1). If multiple non-
            overlaying histograms share a subplot, the first
            explicit `size` is used and all others discarded. If no
            `size` is provided,the sample data from all traces is
            combined to determine `size` as described above.
        start
            Sets the starting value for the x axis bins. Defaults
            to the minimum data value, shifted down if necessary to
            make nice round values and to remove ambiguous bin
            edges. For example, if most of the data is integers we
            shift the bin edges 0.5 down, so a `size` of 5 would
            have a default `start` of -0.5, so it is clear that 0-4
            are in the first bin, 5-9 in the second, but continuous
            data gets a start of 0 and bins [0,5), [5,10) etc.
            Dates behave similarly, and `start` should be a date
            string. For category data, `start` is based on the
            category serial numbers, and defaults to -0.5. If
            multiple non-overlaying histograms share a subplot, the
            first explicit `start` is used exactly and all others
            are shifted down (if necessary) to differ from that one
            by an integer number of bins.
        """

    def __init__(self, arg=None, end=None, size=None, start=None, **kwargs):
        """
        Construct a new XBins object

        Parameters
        ----------
        arg
            dict of properties compatible with this constructor or
            an instance of
            :class:`plotly.graph_objs.histogram.XBins`
        end
            Sets the end value for the x axis bins. The last bin
            may not end exactly at this value, we increment the bin
            edge by `size` from `start` until we reach or exceed
            `end`. Defaults to the maximum data value. Like
            `start`, for dates use a date string, and for category
            data `end` is based on the category serial numbers.
        size
            Sets the size of each x axis bin. Default behavior: If
            `nbinsx` is 0 or omitted, we choose a nice round bin
            size such that the number of bins is about the same as
            the typical number of samples in each bin. If `nbinsx`
            is provided, we choose a nice round bin size giving no
            more than that many bins. For date data, use
            milliseconds or "M<n>" for months, as in `axis.dtick`.
            For category data, the number of categories to bin
            together (always defaults to 1). If multiple non-
            overlaying histograms share a subplot, the first
            explicit `size` is used and all others discarded. If no
            `size` is provided,the sample data from all traces is
            combined to determine `size` as described above.
        start
            Sets the starting value for the x axis bins. Defaults
            to the minimum data value, shifted down if necessary to
            make nice round values and to remove ambiguous bin
            edges. For example, if most of the data is integers we
            shift the bin edges 0.5 down, so a `size` of 5 would
            have a default `start` of -0.5, so it is clear that 0-4
            are in the first bin, 5-9 in the second, but continuous
            data gets a start of 0 and bins [0,5), [5,10) etc.
            Dates behave similarly, and `start` should be a date
            string. For category data, `start` is based on the
            category serial numbers, and defaults to -0.5. If
            multiple non-overlaying histograms share a subplot, the
            first explicit `start` is used exactly and all others
            are shifted down (if necessary) to differ from that one
            by an integer number of bins.

        Returns
        -------
        XBins
        """
        super().__init__("xbins")
        if "_parent" in kwargs:
            self._parent = kwargs["_parent"]
            return

        if arg is None:
            arg = {}
        elif isinstance(arg, self.__class__):
            arg = arg.to_plotly_json()
        elif isinstance(arg, dict):
            arg = _copy.copy(arg)
        else:
            raise ValueError("""\
The first argument to the plotly.graph_objs.histogram.XBins
constructor must be a dict or
an instance of :class:`plotly.graph_objs.histogram.XBins`""")

        self._skip_invalid = kwargs.pop("skip_invalid", False)
        self._validate = kwargs.pop("_validate", True)

        self._set_property("end", arg, end)
        self._set_property("size", arg, size)
        self._set_property("start", arg, start)
        self._process_kwargs(**dict(arg, **kwargs))
        self._skip_invalid = False