MCPcopy Index your code
hub / github.com/plotly/plotly.py / IdentityMap

Class IdentityMap

plotly/express/_special_inputs.py:1–17  ·  view source on GitHub ↗

`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

Source from the content-addressed store, hash-verified

1class 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
20class Constant(object):

Callers 1

make_mappingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected