`dict`-like object which acts as if the value for any key is the key itself. Objects of this class can be passed in to arguments like `color_discrete_map` to use the provided data values as colors, rather than mapping them to colors cycled from `color_discrete_sequence`. This works
| 1 | class IdentityMap(object): |
| 2 | """ |
| 3 | `dict`-like object which acts as if the value for any key is the key itself. Objects |
| 4 | of this class can be passed in to arguments like `color_discrete_map` to |
| 5 | use the provided data values as colors, rather than mapping them to colors cycled |
| 6 | from `color_discrete_sequence`. This works for any `_map` argument to Plotly Express |
| 7 | functions, such as `line_dash_map` and `symbol_map`. |
| 8 | """ |
| 9 | |
| 10 | def __getitem__(self, key): |
| 11 | return key |
| 12 | |
| 13 | def __contains__(self, key): |
| 14 | return True |
| 15 | |
| 16 | def copy(self): |
| 17 | return self |
| 18 | |
| 19 | |
| 20 | class Constant(object): |