Search is not available for this dataset
identifier
stringlengths 1
155
| parameters
stringlengths 2
6.09k
| docstring
stringlengths 11
63.4k
| docstring_summary
stringlengths 0
63.4k
| function
stringlengths 29
99.8k
| function_tokens
list | start_point
list | end_point
list | language
stringclasses 1
value | docstring_language
stringlengths 2
7
| docstring_language_predictions
stringlengths 18
23
| is_langid_reliable
stringclasses 2
values |
---|---|---|---|---|---|---|---|---|---|---|---|
BaseSettings.copy | (self) | Produce a copy of the settings instance. | Produce a copy of the settings instance. | def copy(self) -> "BaseSettings":
"""Produce a copy of the settings instance.""" | [
"def",
"copy",
"(",
"self",
")",
"->",
"\"BaseSettings\"",
":"
] | [
87,
4
] | [
88,
54
] | python | en | ['en', 'en', 'en'] | True |
BaseSettings.extend | (self, other: Mapping[str, object]) | Merge another mapping to produce a new settings instance. | Merge another mapping to produce a new settings instance. | def extend(self, other: Mapping[str, object]) -> "BaseSettings":
"""Merge another mapping to produce a new settings instance.""" | [
"def",
"extend",
"(",
"self",
",",
"other",
":",
"Mapping",
"[",
"str",
",",
"object",
"]",
")",
"->",
"\"BaseSettings\"",
":"
] | [
91,
4
] | [
92,
71
] | python | en | ['en', 'en', 'en'] | True |
BaseSettings.__repr__ | (self) | Provide a human readable representation of this object. | Provide a human readable representation of this object. | def __repr__(self) -> str:
"""Provide a human readable representation of this object."""
items = ("{}={}".format(k, self[k]) for k in self)
return "<{}({})>".format(self.__class__.__name__, ", ".join(items)) | [
"def",
"__repr__",
"(",
"self",
")",
"->",
"str",
":",
"items",
"=",
"(",
"\"{}={}\"",
".",
"format",
"(",
"k",
",",
"self",
"[",
"k",
"]",
")",
"for",
"k",
"in",
"self",
")",
"return",
"\"<{}({})>\"",
".",
"format",
"(",
"self",
".",
"__class__",
".",
"__name__",
",",
"\", \"",
".",
"join",
"(",
"items",
")",
")"
] | [
94,
4
] | [
97,
75
] | python | en | ['en', 'en', 'en'] | True |
BaseInjector.inject | (
self,
base_cls: type,
settings: Mapping[str, object] = None,
*,
required: bool = True
) |
Get the provided instance of a given class identifier.
Args:
cls: The base class to retrieve an instance of
settings: An optional mapping providing configuration to the provider
Returns:
An instance of the base class, or None
|
Get the provided instance of a given class identifier. | async def inject(
self,
base_cls: type,
settings: Mapping[str, object] = None,
*,
required: bool = True
) -> object:
"""
Get the provided instance of a given class identifier.
Args:
cls: The base class to retrieve an instance of
settings: An optional mapping providing configuration to the provider
Returns:
An instance of the base class, or None
""" | [
"async",
"def",
"inject",
"(",
"self",
",",
"base_cls",
":",
"type",
",",
"settings",
":",
"Mapping",
"[",
"str",
",",
"object",
"]",
"=",
"None",
",",
"*",
",",
"required",
":",
"bool",
"=",
"True",
")",
"->",
"object",
":"
] | [
108,
4
] | [
125,
11
] | python | en | ['en', 'error', 'th'] | False |
BaseInjector.copy | (self) | Produce a copy of the injector instance. | Produce a copy of the injector instance. | def copy(self) -> "BaseInjector":
"""Produce a copy of the injector instance.""" | [
"def",
"copy",
"(",
"self",
")",
"->",
"\"BaseInjector\"",
":"
] | [
128,
4
] | [
129,
54
] | python | en | ['en', 'en', 'en'] | True |
BaseProvider.provide | (self, settings: BaseSettings, injector: BaseInjector) | Provide the object instance given a config and injector. | Provide the object instance given a config and injector. | async def provide(self, settings: BaseSettings, injector: BaseInjector):
"""Provide the object instance given a config and injector.""" | [
"async",
"def",
"provide",
"(",
"self",
",",
"settings",
":",
"BaseSettings",
",",
"injector",
":",
"BaseInjector",
")",
":"
] | [
139,
4
] | [
140,
70
] | python | en | ['en', 'en', 'en'] | True |
TorchRankerAgent.add_cmdline_args | (
cls, parser: ParlaiParser, partial_opt: Optional[Opt] = None
) |
Add CLI args.
|
Add CLI args.
| def add_cmdline_args(
cls, parser: ParlaiParser, partial_opt: Optional[Opt] = None
) -> ParlaiParser:
"""
Add CLI args.
"""
super().add_cmdline_args(parser, partial_opt=partial_opt)
agent = parser.add_argument_group('TorchRankerAgent')
agent.add_argument(
'-cands',
'--candidates',
type=str,
default='inline',
choices=['batch', 'inline', 'fixed', 'batch-all-cands'],
help='The source of candidates during training '
'(see TorchRankerAgent._build_candidates() for details).',
)
agent.add_argument(
'-ecands',
'--eval-candidates',
type=str,
default='inline',
choices=['batch', 'inline', 'fixed', 'vocab', 'batch-all-cands'],
help='The source of candidates during evaluation (defaults to the same'
'value as --candidates if no flag is given)',
)
agent.add_argument(
'-icands',
'--interactive-candidates',
type=str,
default='fixed',
choices=['fixed', 'inline', 'vocab'],
help='The source of candidates during interactive mode. Since in '
'interactive mode, batchsize == 1, we cannot use batch candidates.',
)
agent.add_argument(
'--repeat-blocking-heuristic',
type='bool',
default=True,
help='Block repeating previous utterances. '
'Helpful for many models that score repeats highly, so switched '
'on by default.',
)
agent.add_argument(
'-fcp',
'--fixed-candidates-path',
type=str,
help='A text file of fixed candidates to use for all examples, one '
'candidate per line',
)
agent.add_argument(
'--fixed-candidate-vecs',
type=str,
default='reuse',
help='One of "reuse", "replace", or a path to a file with vectors '
'corresponding to the candidates at --fixed-candidates-path. '
'The default path is a /path/to/model-file.<cands_name>, where '
'<cands_name> is the name of the file (not the full path) passed by '
'the flag --fixed-candidates-path. By default, this file is created '
'once and reused. To replace it, use the "replace" option.',
)
agent.add_argument(
'--encode-candidate-vecs',
type='bool',
default=True,
help='Cache and save the encoding of the candidate vecs. This '
'might be used when interacting with the model in real time '
'or evaluating on fixed candidate set when the encoding of '
'the candidates is independent of the input.',
)
agent.add_argument(
'--encode-candidate-vecs-batchsize',
type=int,
default=256,
hidden=True,
help='Batchsize when encoding candidate vecs',
)
agent.add_argument(
'--init-model',
type=str,
default=None,
help='Initialize model with weights from this file.',
)
agent.add_argument(
'--train-predict',
type='bool',
default=False,
help='Get predictions and calculate mean rank during the train '
'step. Turning this on may slow down training.',
)
agent.add_argument(
'--cap-num-predictions',
type=int,
default=100,
help='Limit to the number of predictions in output.text_candidates',
)
agent.add_argument(
'--ignore-bad-candidates',
type='bool',
default=False,
help='Ignore examples for which the label is not present in the '
'label candidates. Default behavior results in RuntimeError. ',
)
agent.add_argument(
'--rank-top-k',
type=int,
default=-1,
help='Ranking returns the top k results of k > 0, otherwise sorts every '
'single candidate according to the ranking.',
)
agent.add_argument(
'--inference',
choices={'max', 'topk'},
default='max',
help='Final response output algorithm',
)
agent.add_argument(
'--topk',
type=int,
default=5,
help='K used in Top K sampling inference, when selected',
)
agent.add_argument(
'--return-cand-scores',
type='bool',
default=False,
help='Return sorted candidate scores from eval_step',
)
return parser | [
"def",
"add_cmdline_args",
"(",
"cls",
",",
"parser",
":",
"ParlaiParser",
",",
"partial_opt",
":",
"Optional",
"[",
"Opt",
"]",
"=",
"None",
")",
"->",
"ParlaiParser",
":",
"super",
"(",
")",
".",
"add_cmdline_args",
"(",
"parser",
",",
"partial_opt",
"=",
"partial_opt",
")",
"agent",
"=",
"parser",
".",
"add_argument_group",
"(",
"'TorchRankerAgent'",
")",
"agent",
".",
"add_argument",
"(",
"'-cands'",
",",
"'--candidates'",
",",
"type",
"=",
"str",
",",
"default",
"=",
"'inline'",
",",
"choices",
"=",
"[",
"'batch'",
",",
"'inline'",
",",
"'fixed'",
",",
"'batch-all-cands'",
"]",
",",
"help",
"=",
"'The source of candidates during training '",
"'(see TorchRankerAgent._build_candidates() for details).'",
",",
")",
"agent",
".",
"add_argument",
"(",
"'-ecands'",
",",
"'--eval-candidates'",
",",
"type",
"=",
"str",
",",
"default",
"=",
"'inline'",
",",
"choices",
"=",
"[",
"'batch'",
",",
"'inline'",
",",
"'fixed'",
",",
"'vocab'",
",",
"'batch-all-cands'",
"]",
",",
"help",
"=",
"'The source of candidates during evaluation (defaults to the same'",
"'value as --candidates if no flag is given)'",
",",
")",
"agent",
".",
"add_argument",
"(",
"'-icands'",
",",
"'--interactive-candidates'",
",",
"type",
"=",
"str",
",",
"default",
"=",
"'fixed'",
",",
"choices",
"=",
"[",
"'fixed'",
",",
"'inline'",
",",
"'vocab'",
"]",
",",
"help",
"=",
"'The source of candidates during interactive mode. Since in '",
"'interactive mode, batchsize == 1, we cannot use batch candidates.'",
",",
")",
"agent",
".",
"add_argument",
"(",
"'--repeat-blocking-heuristic'",
",",
"type",
"=",
"'bool'",
",",
"default",
"=",
"True",
",",
"help",
"=",
"'Block repeating previous utterances. '",
"'Helpful for many models that score repeats highly, so switched '",
"'on by default.'",
",",
")",
"agent",
".",
"add_argument",
"(",
"'-fcp'",
",",
"'--fixed-candidates-path'",
",",
"type",
"=",
"str",
",",
"help",
"=",
"'A text file of fixed candidates to use for all examples, one '",
"'candidate per line'",
",",
")",
"agent",
".",
"add_argument",
"(",
"'--fixed-candidate-vecs'",
",",
"type",
"=",
"str",
",",
"default",
"=",
"'reuse'",
",",
"help",
"=",
"'One of \"reuse\", \"replace\", or a path to a file with vectors '",
"'corresponding to the candidates at --fixed-candidates-path. '",
"'The default path is a /path/to/model-file.<cands_name>, where '",
"'<cands_name> is the name of the file (not the full path) passed by '",
"'the flag --fixed-candidates-path. By default, this file is created '",
"'once and reused. To replace it, use the \"replace\" option.'",
",",
")",
"agent",
".",
"add_argument",
"(",
"'--encode-candidate-vecs'",
",",
"type",
"=",
"'bool'",
",",
"default",
"=",
"True",
",",
"help",
"=",
"'Cache and save the encoding of the candidate vecs. This '",
"'might be used when interacting with the model in real time '",
"'or evaluating on fixed candidate set when the encoding of '",
"'the candidates is independent of the input.'",
",",
")",
"agent",
".",
"add_argument",
"(",
"'--encode-candidate-vecs-batchsize'",
",",
"type",
"=",
"int",
",",
"default",
"=",
"256",
",",
"hidden",
"=",
"True",
",",
"help",
"=",
"'Batchsize when encoding candidate vecs'",
",",
")",
"agent",
".",
"add_argument",
"(",
"'--init-model'",
",",
"type",
"=",
"str",
",",
"default",
"=",
"None",
",",
"help",
"=",
"'Initialize model with weights from this file.'",
",",
")",
"agent",
".",
"add_argument",
"(",
"'--train-predict'",
",",
"type",
"=",
"'bool'",
",",
"default",
"=",
"False",
",",
"help",
"=",
"'Get predictions and calculate mean rank during the train '",
"'step. Turning this on may slow down training.'",
",",
")",
"agent",
".",
"add_argument",
"(",
"'--cap-num-predictions'",
",",
"type",
"=",
"int",
",",
"default",
"=",
"100",
",",
"help",
"=",
"'Limit to the number of predictions in output.text_candidates'",
",",
")",
"agent",
".",
"add_argument",
"(",
"'--ignore-bad-candidates'",
",",
"type",
"=",
"'bool'",
",",
"default",
"=",
"False",
",",
"help",
"=",
"'Ignore examples for which the label is not present in the '",
"'label candidates. Default behavior results in RuntimeError. '",
",",
")",
"agent",
".",
"add_argument",
"(",
"'--rank-top-k'",
",",
"type",
"=",
"int",
",",
"default",
"=",
"-",
"1",
",",
"help",
"=",
"'Ranking returns the top k results of k > 0, otherwise sorts every '",
"'single candidate according to the ranking.'",
",",
")",
"agent",
".",
"add_argument",
"(",
"'--inference'",
",",
"choices",
"=",
"{",
"'max'",
",",
"'topk'",
"}",
",",
"default",
"=",
"'max'",
",",
"help",
"=",
"'Final response output algorithm'",
",",
")",
"agent",
".",
"add_argument",
"(",
"'--topk'",
",",
"type",
"=",
"int",
",",
"default",
"=",
"5",
",",
"help",
"=",
"'K used in Top K sampling inference, when selected'",
",",
")",
"agent",
".",
"add_argument",
"(",
"'--return-cand-scores'",
",",
"type",
"=",
"'bool'",
",",
"default",
"=",
"False",
",",
"help",
"=",
"'Return sorted candidate scores from eval_step'",
",",
")",
"return",
"parser"
] | [
53,
4
] | [
181,
21
] | python | en | ['en', 'error', 'th'] | False |
TorchRankerAgent.build_criterion | (self) |
Construct and return the loss function.
By default torch.nn.CrossEntropyLoss.
|
Construct and return the loss function. | def build_criterion(self):
"""
Construct and return the loss function.
By default torch.nn.CrossEntropyLoss.
"""
if self.fp16:
return FP16SafeCrossEntropy(reduction='none')
else:
return torch.nn.CrossEntropyLoss(reduction='none') | [
"def",
"build_criterion",
"(",
"self",
")",
":",
"if",
"self",
".",
"fp16",
":",
"return",
"FP16SafeCrossEntropy",
"(",
"reduction",
"=",
"'none'",
")",
"else",
":",
"return",
"torch",
".",
"nn",
".",
"CrossEntropyLoss",
"(",
"reduction",
"=",
"'none'",
")"
] | [
254,
4
] | [
263,
62
] | python | en | ['en', 'error', 'th'] | False |
TorchRankerAgent._set_candidate_variables | (self, opt) |
Sets candidate variables from opt.
NOTE: we call this function prior to `super().__init__` so
that these variables are set properly during the call to the
`set_interactive_mode` function.
|
Sets candidate variables from opt. | def _set_candidate_variables(self, opt):
"""
Sets candidate variables from opt.
NOTE: we call this function prior to `super().__init__` so
that these variables are set properly during the call to the
`set_interactive_mode` function.
"""
# candidate variables
self.candidates = opt['candidates']
self.eval_candidates = opt['eval_candidates']
# options
self.fixed_candidates_path = opt['fixed_candidates_path']
self.ignore_bad_candidates = opt['ignore_bad_candidates']
self.encode_candidate_vecs = opt['encode_candidate_vecs'] | [
"def",
"_set_candidate_variables",
"(",
"self",
",",
"opt",
")",
":",
"# candidate variables",
"self",
".",
"candidates",
"=",
"opt",
"[",
"'candidates'",
"]",
"self",
".",
"eval_candidates",
"=",
"opt",
"[",
"'eval_candidates'",
"]",
"# options",
"self",
".",
"fixed_candidates_path",
"=",
"opt",
"[",
"'fixed_candidates_path'",
"]",
"self",
".",
"ignore_bad_candidates",
"=",
"opt",
"[",
"'ignore_bad_candidates'",
"]",
"self",
".",
"encode_candidate_vecs",
"=",
"opt",
"[",
"'encode_candidate_vecs'",
"]"
] | [
265,
4
] | [
279,
65
] | python | en | ['en', 'error', 'th'] | False |
TorchRankerAgent.set_interactive_mode | (self, mode, shared=False) |
Set interactive mode defaults.
In interactive mode, we set `ignore_bad_candidates` to True.
Additionally, we change the `eval_candidates` to the option
specified in `--interactive-candidates`, which defaults to False.
Interactive mode possibly changes the fixed candidates path if it
does not exist, automatically creating a candidates file from the
specified task.
|
Set interactive mode defaults. | def set_interactive_mode(self, mode, shared=False):
"""
Set interactive mode defaults.
In interactive mode, we set `ignore_bad_candidates` to True.
Additionally, we change the `eval_candidates` to the option
specified in `--interactive-candidates`, which defaults to False.
Interactive mode possibly changes the fixed candidates path if it
does not exist, automatically creating a candidates file from the
specified task.
"""
super().set_interactive_mode(mode, shared)
if not mode:
# Not in interactive mode, nothing to do
return
# Override eval_candidates to interactive_candidates
self.eval_candidates = self.opt.get('interactive_candidates', 'fixed')
if self.eval_candidates == 'fixed':
# Set fixed candidates path if it does not exist
if self.fixed_candidates_path is None or self.fixed_candidates_path == '':
# Attempt to get a standard candidate set for the given task
path = self.get_task_candidates_path()
if path:
if not shared:
logging.info(f'Setting fixed_candidates path to: {path}')
self.fixed_candidates_path = path
# Ignore bad candidates in interactive mode
self.ignore_bad_candidates = True
return | [
"def",
"set_interactive_mode",
"(",
"self",
",",
"mode",
",",
"shared",
"=",
"False",
")",
":",
"super",
"(",
")",
".",
"set_interactive_mode",
"(",
"mode",
",",
"shared",
")",
"if",
"not",
"mode",
":",
"# Not in interactive mode, nothing to do",
"return",
"# Override eval_candidates to interactive_candidates",
"self",
".",
"eval_candidates",
"=",
"self",
".",
"opt",
".",
"get",
"(",
"'interactive_candidates'",
",",
"'fixed'",
")",
"if",
"self",
".",
"eval_candidates",
"==",
"'fixed'",
":",
"# Set fixed candidates path if it does not exist",
"if",
"self",
".",
"fixed_candidates_path",
"is",
"None",
"or",
"self",
".",
"fixed_candidates_path",
"==",
"''",
":",
"# Attempt to get a standard candidate set for the given task",
"path",
"=",
"self",
".",
"get_task_candidates_path",
"(",
")",
"if",
"path",
":",
"if",
"not",
"shared",
":",
"logging",
".",
"info",
"(",
"f'Setting fixed_candidates path to: {path}'",
")",
"self",
".",
"fixed_candidates_path",
"=",
"path",
"# Ignore bad candidates in interactive mode",
"self",
".",
"ignore_bad_candidates",
"=",
"True",
"return"
] | [
281,
4
] | [
313,
14
] | python | en | ['en', 'error', 'th'] | False |
TorchRankerAgent.score_candidates | (self, batch, cand_vecs, cand_encs=None) |
Given a batch and candidate set, return scores (for ranking).
:param Batch batch:
a Batch object (defined in torch_agent.py)
:param LongTensor cand_vecs:
padded and tokenized candidates
:param FloatTensor cand_encs:
encoded candidates, if these are passed into the function (in cases
where we cache the candidate encodings), you do not need to call
self.model on cand_vecs
|
Given a batch and candidate set, return scores (for ranking). | def score_candidates(self, batch, cand_vecs, cand_encs=None):
"""
Given a batch and candidate set, return scores (for ranking).
:param Batch batch:
a Batch object (defined in torch_agent.py)
:param LongTensor cand_vecs:
padded and tokenized candidates
:param FloatTensor cand_encs:
encoded candidates, if these are passed into the function (in cases
where we cache the candidate encodings), you do not need to call
self.model on cand_vecs
"""
pass | [
"def",
"score_candidates",
"(",
"self",
",",
"batch",
",",
"cand_vecs",
",",
"cand_encs",
"=",
"None",
")",
":",
"pass"
] | [
332,
4
] | [
345,
12
] | python | en | ['en', 'error', 'th'] | False |
TorchRankerAgent._get_batch_train_metrics | (self, scores) |
Get fast metrics calculations if we train with batch candidates.
Specifically, calculate accuracy ('train_accuracy'), average rank, and mean
reciprocal rank.
|
Get fast metrics calculations if we train with batch candidates. | def _get_batch_train_metrics(self, scores):
"""
Get fast metrics calculations if we train with batch candidates.
Specifically, calculate accuracy ('train_accuracy'), average rank, and mean
reciprocal rank.
"""
batchsize = scores.size(0)
# get accuracy
targets = scores.new_empty(batchsize).long()
targets = torch.arange(batchsize, out=targets)
nb_ok = (scores.max(dim=1)[1] == targets).float()
self.record_local_metric('train_accuracy', AverageMetric.many(nb_ok))
# calculate mean_rank
above_dot_prods = scores - scores.diag().view(-1, 1)
ranks = (above_dot_prods > 0).float().sum(dim=1) + 1
mrr = 1.0 / (ranks + 0.00001)
self.record_local_metric('rank', AverageMetric.many(ranks))
self.record_local_metric('mrr', AverageMetric.many(mrr)) | [
"def",
"_get_batch_train_metrics",
"(",
"self",
",",
"scores",
")",
":",
"batchsize",
"=",
"scores",
".",
"size",
"(",
"0",
")",
"# get accuracy",
"targets",
"=",
"scores",
".",
"new_empty",
"(",
"batchsize",
")",
".",
"long",
"(",
")",
"targets",
"=",
"torch",
".",
"arange",
"(",
"batchsize",
",",
"out",
"=",
"targets",
")",
"nb_ok",
"=",
"(",
"scores",
".",
"max",
"(",
"dim",
"=",
"1",
")",
"[",
"1",
"]",
"==",
"targets",
")",
".",
"float",
"(",
")",
"self",
".",
"record_local_metric",
"(",
"'train_accuracy'",
",",
"AverageMetric",
".",
"many",
"(",
"nb_ok",
")",
")",
"# calculate mean_rank",
"above_dot_prods",
"=",
"scores",
"-",
"scores",
".",
"diag",
"(",
")",
".",
"view",
"(",
"-",
"1",
",",
"1",
")",
"ranks",
"=",
"(",
"above_dot_prods",
">",
"0",
")",
".",
"float",
"(",
")",
".",
"sum",
"(",
"dim",
"=",
"1",
")",
"+",
"1",
"mrr",
"=",
"1.0",
"/",
"(",
"ranks",
"+",
"0.00001",
")",
"self",
".",
"record_local_metric",
"(",
"'rank'",
",",
"AverageMetric",
".",
"many",
"(",
"ranks",
")",
")",
"self",
".",
"record_local_metric",
"(",
"'mrr'",
",",
"AverageMetric",
".",
"many",
"(",
"mrr",
")",
")"
] | [
351,
4
] | [
369,
64
] | python | en | ['en', 'error', 'th'] | False |
TorchRankerAgent._get_train_preds | (self, scores, label_inds, cands, cand_vecs) |
Return predictions from training.
|
Return predictions from training.
| def _get_train_preds(self, scores, label_inds, cands, cand_vecs):
"""
Return predictions from training.
"""
# TODO: speed these calculations up
batchsize = scores.size(0)
if self.rank_top_k > 0:
_, ranks = scores.topk(
min(self.rank_top_k, scores.size(1)), 1, largest=True
)
else:
_, ranks = scores.sort(1, descending=True)
ranks_m = []
mrrs_m = []
for b in range(batchsize):
rank = (ranks[b] == label_inds[b]).nonzero()
rank = rank.item() if len(rank) == 1 else scores.size(1)
ranks_m.append(1 + rank)
mrrs_m.append(1.0 / (1 + rank))
self.record_local_metric('rank', AverageMetric.many(ranks_m))
self.record_local_metric('mrr', AverageMetric.many(mrrs_m))
ranks = ranks.cpu()
# Here we get the top prediction for each example, but do not
# return the full ranked list for the sake of training speed
preds = []
for i, ordering in enumerate(ranks):
if cand_vecs.dim() == 2: # num cands x max cand length
cand_list = cands
elif cand_vecs.dim() == 3: # batchsize x num cands x max cand length
cand_list = cands[i]
if len(ordering) != len(cand_list):
# We may have added padded cands to fill out the batch;
# Here we break after finding the first non-pad cand in the
# ranked list
for x in ordering:
if x < len(cand_list):
preds.append(cand_list[x])
break
else:
preds.append(cand_list[ordering[0]])
return Output(preds) | [
"def",
"_get_train_preds",
"(",
"self",
",",
"scores",
",",
"label_inds",
",",
"cands",
",",
"cand_vecs",
")",
":",
"# TODO: speed these calculations up",
"batchsize",
"=",
"scores",
".",
"size",
"(",
"0",
")",
"if",
"self",
".",
"rank_top_k",
">",
"0",
":",
"_",
",",
"ranks",
"=",
"scores",
".",
"topk",
"(",
"min",
"(",
"self",
".",
"rank_top_k",
",",
"scores",
".",
"size",
"(",
"1",
")",
")",
",",
"1",
",",
"largest",
"=",
"True",
")",
"else",
":",
"_",
",",
"ranks",
"=",
"scores",
".",
"sort",
"(",
"1",
",",
"descending",
"=",
"True",
")",
"ranks_m",
"=",
"[",
"]",
"mrrs_m",
"=",
"[",
"]",
"for",
"b",
"in",
"range",
"(",
"batchsize",
")",
":",
"rank",
"=",
"(",
"ranks",
"[",
"b",
"]",
"==",
"label_inds",
"[",
"b",
"]",
")",
".",
"nonzero",
"(",
")",
"rank",
"=",
"rank",
".",
"item",
"(",
")",
"if",
"len",
"(",
"rank",
")",
"==",
"1",
"else",
"scores",
".",
"size",
"(",
"1",
")",
"ranks_m",
".",
"append",
"(",
"1",
"+",
"rank",
")",
"mrrs_m",
".",
"append",
"(",
"1.0",
"/",
"(",
"1",
"+",
"rank",
")",
")",
"self",
".",
"record_local_metric",
"(",
"'rank'",
",",
"AverageMetric",
".",
"many",
"(",
"ranks_m",
")",
")",
"self",
".",
"record_local_metric",
"(",
"'mrr'",
",",
"AverageMetric",
".",
"many",
"(",
"mrrs_m",
")",
")",
"ranks",
"=",
"ranks",
".",
"cpu",
"(",
")",
"# Here we get the top prediction for each example, but do not",
"# return the full ranked list for the sake of training speed",
"preds",
"=",
"[",
"]",
"for",
"i",
",",
"ordering",
"in",
"enumerate",
"(",
"ranks",
")",
":",
"if",
"cand_vecs",
".",
"dim",
"(",
")",
"==",
"2",
":",
"# num cands x max cand length",
"cand_list",
"=",
"cands",
"elif",
"cand_vecs",
".",
"dim",
"(",
")",
"==",
"3",
":",
"# batchsize x num cands x max cand length",
"cand_list",
"=",
"cands",
"[",
"i",
"]",
"if",
"len",
"(",
"ordering",
")",
"!=",
"len",
"(",
"cand_list",
")",
":",
"# We may have added padded cands to fill out the batch;",
"# Here we break after finding the first non-pad cand in the",
"# ranked list",
"for",
"x",
"in",
"ordering",
":",
"if",
"x",
"<",
"len",
"(",
"cand_list",
")",
":",
"preds",
".",
"append",
"(",
"cand_list",
"[",
"x",
"]",
")",
"break",
"else",
":",
"preds",
".",
"append",
"(",
"cand_list",
"[",
"ordering",
"[",
"0",
"]",
"]",
")",
"return",
"Output",
"(",
"preds",
")"
] | [
371,
4
] | [
413,
28
] | python | en | ['en', 'error', 'th'] | False |
TorchRankerAgent.is_valid | (self, obs) |
Override from TorchAgent.
Check to see if label candidates contain the label.
|
Override from TorchAgent. | def is_valid(self, obs):
"""
Override from TorchAgent.
Check to see if label candidates contain the label.
"""
if not self.ignore_bad_candidates:
return super().is_valid(obs)
if not super().is_valid(obs):
return False
# skip examples for which the set of label candidates do not
# contain the label
if 'labels_vec' in obs and 'label_candidates_vecs' in obs:
cand_vecs = obs['label_candidates_vecs']
label_vec = obs['labels_vec']
matches = [x for x in cand_vecs if torch.equal(x, label_vec)]
if len(matches) == 0:
warn_once(
'At least one example has a set of label candidates that '
'does not contain the label.'
)
return False
return True | [
"def",
"is_valid",
"(",
"self",
",",
"obs",
")",
":",
"if",
"not",
"self",
".",
"ignore_bad_candidates",
":",
"return",
"super",
"(",
")",
".",
"is_valid",
"(",
"obs",
")",
"if",
"not",
"super",
"(",
")",
".",
"is_valid",
"(",
"obs",
")",
":",
"return",
"False",
"# skip examples for which the set of label candidates do not",
"# contain the label",
"if",
"'labels_vec'",
"in",
"obs",
"and",
"'label_candidates_vecs'",
"in",
"obs",
":",
"cand_vecs",
"=",
"obs",
"[",
"'label_candidates_vecs'",
"]",
"label_vec",
"=",
"obs",
"[",
"'labels_vec'",
"]",
"matches",
"=",
"[",
"x",
"for",
"x",
"in",
"cand_vecs",
"if",
"torch",
".",
"equal",
"(",
"x",
",",
"label_vec",
")",
"]",
"if",
"len",
"(",
"matches",
")",
"==",
"0",
":",
"warn_once",
"(",
"'At least one example has a set of label candidates that '",
"'does not contain the label.'",
")",
"return",
"False",
"return",
"True"
] | [
415,
4
] | [
440,
19
] | python | en | ['en', 'error', 'th'] | False |
TorchRankerAgent.train_step | (self, batch) |
Train on a single batch of examples.
|
Train on a single batch of examples.
| def train_step(self, batch):
"""
Train on a single batch of examples.
"""
self._maybe_invalidate_fixed_encs_cache()
if batch.text_vec is None and batch.image is None:
return
self.model.train()
self.zero_grad()
cands, cand_vecs, label_inds = self._build_candidates(
batch, source=self.candidates, mode='train'
)
try:
scores = self.score_candidates(batch, cand_vecs)
loss = self.criterion(scores, label_inds)
self.record_local_metric('mean_loss', AverageMetric.many(loss))
loss = loss.mean()
self.backward(loss)
self.update_params()
except RuntimeError as e:
# catch out of memory exceptions during fwd/bck (skip batch)
if 'out of memory' in str(e):
logging.error(
'Ran out of memory, skipping batch. '
'if this happens frequently, decrease batchsize or '
'truncate the inputs to the model.'
)
return Output()
else:
raise e
# Get train predictions
if self.candidates == 'batch':
self._get_batch_train_metrics(scores)
return Output()
if not self.opt.get('train_predict', False):
warn_once(
"Some training metrics are omitted for speed. Set the flag "
"`--train-predict` to calculate train metrics."
)
return Output()
return self._get_train_preds(scores, label_inds, cands, cand_vecs) | [
"def",
"train_step",
"(",
"self",
",",
"batch",
")",
":",
"self",
".",
"_maybe_invalidate_fixed_encs_cache",
"(",
")",
"if",
"batch",
".",
"text_vec",
"is",
"None",
"and",
"batch",
".",
"image",
"is",
"None",
":",
"return",
"self",
".",
"model",
".",
"train",
"(",
")",
"self",
".",
"zero_grad",
"(",
")",
"cands",
",",
"cand_vecs",
",",
"label_inds",
"=",
"self",
".",
"_build_candidates",
"(",
"batch",
",",
"source",
"=",
"self",
".",
"candidates",
",",
"mode",
"=",
"'train'",
")",
"try",
":",
"scores",
"=",
"self",
".",
"score_candidates",
"(",
"batch",
",",
"cand_vecs",
")",
"loss",
"=",
"self",
".",
"criterion",
"(",
"scores",
",",
"label_inds",
")",
"self",
".",
"record_local_metric",
"(",
"'mean_loss'",
",",
"AverageMetric",
".",
"many",
"(",
"loss",
")",
")",
"loss",
"=",
"loss",
".",
"mean",
"(",
")",
"self",
".",
"backward",
"(",
"loss",
")",
"self",
".",
"update_params",
"(",
")",
"except",
"RuntimeError",
"as",
"e",
":",
"# catch out of memory exceptions during fwd/bck (skip batch)",
"if",
"'out of memory'",
"in",
"str",
"(",
"e",
")",
":",
"logging",
".",
"error",
"(",
"'Ran out of memory, skipping batch. '",
"'if this happens frequently, decrease batchsize or '",
"'truncate the inputs to the model.'",
")",
"return",
"Output",
"(",
")",
"else",
":",
"raise",
"e",
"# Get train predictions",
"if",
"self",
".",
"candidates",
"==",
"'batch'",
":",
"self",
".",
"_get_batch_train_metrics",
"(",
"scores",
")",
"return",
"Output",
"(",
")",
"if",
"not",
"self",
".",
"opt",
".",
"get",
"(",
"'train_predict'",
",",
"False",
")",
":",
"warn_once",
"(",
"\"Some training metrics are omitted for speed. Set the flag \"",
"\"`--train-predict` to calculate train metrics.\"",
")",
"return",
"Output",
"(",
")",
"return",
"self",
".",
"_get_train_preds",
"(",
"scores",
",",
"label_inds",
",",
"cands",
",",
"cand_vecs",
")"
] | [
442,
4
] | [
484,
74
] | python | en | ['en', 'error', 'th'] | False |
TorchRankerAgent.eval_step | (self, batch) |
Evaluate a single batch of examples.
|
Evaluate a single batch of examples.
| def eval_step(self, batch):
"""
Evaluate a single batch of examples.
"""
if batch.text_vec is None and batch.image is None:
return
batchsize = (
batch.text_vec.size(0)
if batch.text_vec is not None
else batch.image.size(0)
)
self.model.eval()
cands, cand_vecs, label_inds = self._build_candidates(
batch, source=self.eval_candidates, mode='eval'
)
cand_encs = None
if self.encode_candidate_vecs and self.eval_candidates in ['fixed', 'vocab']:
# if we cached candidate encodings for a fixed list of candidates,
# pass those into the score_candidates function
if self.fixed_candidate_encs is None:
self.fixed_candidate_encs = self._make_candidate_encs(
cand_vecs
).detach()
if self.eval_candidates == 'fixed':
cand_encs = self.fixed_candidate_encs
elif self.eval_candidates == 'vocab':
cand_encs = self.vocab_candidate_encs
scores = self.score_candidates(batch, cand_vecs, cand_encs=cand_encs)
if self.rank_top_k > 0:
sorted_scores, ranks = scores.topk(
min(self.rank_top_k, scores.size(1)), 1, largest=True
)
else:
sorted_scores, ranks = scores.sort(1, descending=True)
if self.opt.get('return_cand_scores', False):
sorted_scores = sorted_scores.cpu()
else:
sorted_scores = None
# Update metrics
if label_inds is not None:
loss = self.criterion(scores, label_inds)
self.record_local_metric('loss', AverageMetric.many(loss))
ranks_m = []
mrrs_m = []
for b in range(batchsize):
rank = (ranks[b] == label_inds[b]).nonzero()
rank = rank.item() if len(rank) == 1 else scores.size(1)
ranks_m.append(1 + rank)
mrrs_m.append(1.0 / (1 + rank))
self.record_local_metric('rank', AverageMetric.many(ranks_m))
self.record_local_metric('mrr', AverageMetric.many(mrrs_m))
ranks = ranks.cpu()
max_preds = self.opt['cap_num_predictions']
cand_preds = []
for i, ordering in enumerate(ranks):
if cand_vecs.dim() == 2:
cand_list = cands
elif cand_vecs.dim() == 3:
cand_list = cands[i]
# using a generator instead of a list comprehension allows
# to cap the number of elements.
cand_preds_generator = (
cand_list[rank] for rank in ordering if rank < len(cand_list)
)
cand_preds.append(list(islice(cand_preds_generator, max_preds)))
if (
self.opt.get('repeat_blocking_heuristic', True)
and self.eval_candidates == 'fixed'
):
cand_preds = self.block_repeats(cand_preds)
if self.opt.get('inference', 'max') == 'max':
preds = [cand_preds[i][0] for i in range(batchsize)]
else:
# Top-k inference.
preds = []
for i in range(batchsize):
preds.append(random.choice(cand_preds[i][0 : self.opt['topk']]))
return Output(preds, cand_preds, sorted_scores=sorted_scores) | [
"def",
"eval_step",
"(",
"self",
",",
"batch",
")",
":",
"if",
"batch",
".",
"text_vec",
"is",
"None",
"and",
"batch",
".",
"image",
"is",
"None",
":",
"return",
"batchsize",
"=",
"(",
"batch",
".",
"text_vec",
".",
"size",
"(",
"0",
")",
"if",
"batch",
".",
"text_vec",
"is",
"not",
"None",
"else",
"batch",
".",
"image",
".",
"size",
"(",
"0",
")",
")",
"self",
".",
"model",
".",
"eval",
"(",
")",
"cands",
",",
"cand_vecs",
",",
"label_inds",
"=",
"self",
".",
"_build_candidates",
"(",
"batch",
",",
"source",
"=",
"self",
".",
"eval_candidates",
",",
"mode",
"=",
"'eval'",
")",
"cand_encs",
"=",
"None",
"if",
"self",
".",
"encode_candidate_vecs",
"and",
"self",
".",
"eval_candidates",
"in",
"[",
"'fixed'",
",",
"'vocab'",
"]",
":",
"# if we cached candidate encodings for a fixed list of candidates,",
"# pass those into the score_candidates function",
"if",
"self",
".",
"fixed_candidate_encs",
"is",
"None",
":",
"self",
".",
"fixed_candidate_encs",
"=",
"self",
".",
"_make_candidate_encs",
"(",
"cand_vecs",
")",
".",
"detach",
"(",
")",
"if",
"self",
".",
"eval_candidates",
"==",
"'fixed'",
":",
"cand_encs",
"=",
"self",
".",
"fixed_candidate_encs",
"elif",
"self",
".",
"eval_candidates",
"==",
"'vocab'",
":",
"cand_encs",
"=",
"self",
".",
"vocab_candidate_encs",
"scores",
"=",
"self",
".",
"score_candidates",
"(",
"batch",
",",
"cand_vecs",
",",
"cand_encs",
"=",
"cand_encs",
")",
"if",
"self",
".",
"rank_top_k",
">",
"0",
":",
"sorted_scores",
",",
"ranks",
"=",
"scores",
".",
"topk",
"(",
"min",
"(",
"self",
".",
"rank_top_k",
",",
"scores",
".",
"size",
"(",
"1",
")",
")",
",",
"1",
",",
"largest",
"=",
"True",
")",
"else",
":",
"sorted_scores",
",",
"ranks",
"=",
"scores",
".",
"sort",
"(",
"1",
",",
"descending",
"=",
"True",
")",
"if",
"self",
".",
"opt",
".",
"get",
"(",
"'return_cand_scores'",
",",
"False",
")",
":",
"sorted_scores",
"=",
"sorted_scores",
".",
"cpu",
"(",
")",
"else",
":",
"sorted_scores",
"=",
"None",
"# Update metrics",
"if",
"label_inds",
"is",
"not",
"None",
":",
"loss",
"=",
"self",
".",
"criterion",
"(",
"scores",
",",
"label_inds",
")",
"self",
".",
"record_local_metric",
"(",
"'loss'",
",",
"AverageMetric",
".",
"many",
"(",
"loss",
")",
")",
"ranks_m",
"=",
"[",
"]",
"mrrs_m",
"=",
"[",
"]",
"for",
"b",
"in",
"range",
"(",
"batchsize",
")",
":",
"rank",
"=",
"(",
"ranks",
"[",
"b",
"]",
"==",
"label_inds",
"[",
"b",
"]",
")",
".",
"nonzero",
"(",
")",
"rank",
"=",
"rank",
".",
"item",
"(",
")",
"if",
"len",
"(",
"rank",
")",
"==",
"1",
"else",
"scores",
".",
"size",
"(",
"1",
")",
"ranks_m",
".",
"append",
"(",
"1",
"+",
"rank",
")",
"mrrs_m",
".",
"append",
"(",
"1.0",
"/",
"(",
"1",
"+",
"rank",
")",
")",
"self",
".",
"record_local_metric",
"(",
"'rank'",
",",
"AverageMetric",
".",
"many",
"(",
"ranks_m",
")",
")",
"self",
".",
"record_local_metric",
"(",
"'mrr'",
",",
"AverageMetric",
".",
"many",
"(",
"mrrs_m",
")",
")",
"ranks",
"=",
"ranks",
".",
"cpu",
"(",
")",
"max_preds",
"=",
"self",
".",
"opt",
"[",
"'cap_num_predictions'",
"]",
"cand_preds",
"=",
"[",
"]",
"for",
"i",
",",
"ordering",
"in",
"enumerate",
"(",
"ranks",
")",
":",
"if",
"cand_vecs",
".",
"dim",
"(",
")",
"==",
"2",
":",
"cand_list",
"=",
"cands",
"elif",
"cand_vecs",
".",
"dim",
"(",
")",
"==",
"3",
":",
"cand_list",
"=",
"cands",
"[",
"i",
"]",
"# using a generator instead of a list comprehension allows",
"# to cap the number of elements.",
"cand_preds_generator",
"=",
"(",
"cand_list",
"[",
"rank",
"]",
"for",
"rank",
"in",
"ordering",
"if",
"rank",
"<",
"len",
"(",
"cand_list",
")",
")",
"cand_preds",
".",
"append",
"(",
"list",
"(",
"islice",
"(",
"cand_preds_generator",
",",
"max_preds",
")",
")",
")",
"if",
"(",
"self",
".",
"opt",
".",
"get",
"(",
"'repeat_blocking_heuristic'",
",",
"True",
")",
"and",
"self",
".",
"eval_candidates",
"==",
"'fixed'",
")",
":",
"cand_preds",
"=",
"self",
".",
"block_repeats",
"(",
"cand_preds",
")",
"if",
"self",
".",
"opt",
".",
"get",
"(",
"'inference'",
",",
"'max'",
")",
"==",
"'max'",
":",
"preds",
"=",
"[",
"cand_preds",
"[",
"i",
"]",
"[",
"0",
"]",
"for",
"i",
"in",
"range",
"(",
"batchsize",
")",
"]",
"else",
":",
"# Top-k inference.",
"preds",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"batchsize",
")",
":",
"preds",
".",
"append",
"(",
"random",
".",
"choice",
"(",
"cand_preds",
"[",
"i",
"]",
"[",
"0",
":",
"self",
".",
"opt",
"[",
"'topk'",
"]",
"]",
")",
")",
"return",
"Output",
"(",
"preds",
",",
"cand_preds",
",",
"sorted_scores",
"=",
"sorted_scores",
")"
] | [
486,
4
] | [
572,
69
] | python | en | ['en', 'error', 'th'] | False |
TorchRankerAgent.block_repeats | (self, cand_preds) |
Heuristic to block a model repeating a line from the history.
|
Heuristic to block a model repeating a line from the history.
| def block_repeats(self, cand_preds):
"""
Heuristic to block a model repeating a line from the history.
"""
history_strings = []
for h in self.history.history_raw_strings:
# Heuristic: Block any given line in the history, splitting by '\n'.
history_strings.extend(h.split('\n'))
new_preds = []
for cp in cand_preds:
np = []
for c in cp:
if c not in history_strings:
np.append(c)
new_preds.append(np)
return new_preds | [
"def",
"block_repeats",
"(",
"self",
",",
"cand_preds",
")",
":",
"history_strings",
"=",
"[",
"]",
"for",
"h",
"in",
"self",
".",
"history",
".",
"history_raw_strings",
":",
"# Heuristic: Block any given line in the history, splitting by '\\n'.",
"history_strings",
".",
"extend",
"(",
"h",
".",
"split",
"(",
"'\\n'",
")",
")",
"new_preds",
"=",
"[",
"]",
"for",
"cp",
"in",
"cand_preds",
":",
"np",
"=",
"[",
"]",
"for",
"c",
"in",
"cp",
":",
"if",
"c",
"not",
"in",
"history_strings",
":",
"np",
".",
"append",
"(",
"c",
")",
"new_preds",
".",
"append",
"(",
"np",
")",
"return",
"new_preds"
] | [
574,
4
] | [
590,
24
] | python | en | ['en', 'error', 'th'] | False |
TorchRankerAgent._set_label_cands_vec | (self, *args, **kwargs) |
Set the 'label_candidates_vec' field in the observation.
Useful to override to change vectorization behavior.
|
Set the 'label_candidates_vec' field in the observation. | def _set_label_cands_vec(self, *args, **kwargs):
"""
Set the 'label_candidates_vec' field in the observation.
Useful to override to change vectorization behavior.
"""
obs = args[0]
if 'labels' in obs:
cands_key = 'candidates'
else:
cands_key = 'eval_candidates'
if self.opt[cands_key] not in ['inline', 'batch-all-cands']:
# vectorize label candidates if and only if we are using inline
# candidates
return obs
return super()._set_label_cands_vec(*args, **kwargs) | [
"def",
"_set_label_cands_vec",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"obs",
"=",
"args",
"[",
"0",
"]",
"if",
"'labels'",
"in",
"obs",
":",
"cands_key",
"=",
"'candidates'",
"else",
":",
"cands_key",
"=",
"'eval_candidates'",
"if",
"self",
".",
"opt",
"[",
"cands_key",
"]",
"not",
"in",
"[",
"'inline'",
",",
"'batch-all-cands'",
"]",
":",
"# vectorize label candidates if and only if we are using inline",
"# candidates",
"return",
"obs",
"return",
"super",
"(",
")",
".",
"_set_label_cands_vec",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | [
592,
4
] | [
607,
60
] | python | en | ['en', 'error', 'th'] | False |
TorchRankerAgent._build_candidates | (self, batch, source, mode) |
Build a candidate set for this batch.
:param batch:
a Batch object (defined in torch_agent.py)
:param source:
the source from which candidates should be built, one of
['batch', 'batch-all-cands', 'inline', 'fixed']
:param mode:
'train' or 'eval'
:return: tuple of tensors (label_inds, cands, cand_vecs)
label_inds: A [bsz] LongTensor of the indices of the labels for each
example from its respective candidate set
cands: A [num_cands] list of (text) candidates
OR a [batchsize] list of such lists if source=='inline'
cand_vecs: A padded [num_cands, seqlen] LongTensor of vectorized candidates
OR a [batchsize, num_cands, seqlen] LongTensor if source=='inline'
Possible sources of candidates:
* batch: the set of all labels in this batch
Use all labels in the batch as the candidate set (with all but the
example's label being treated as negatives).
Note: with this setting, the candidate set is identical for all
examples in a batch. This option may be undesirable if it is possible
for duplicate labels to occur in a batch, since the second instance of
the correct label will be treated as a negative.
* batch-all-cands: the set of all candidates in this batch
Use all candidates in the batch as candidate set.
Note 1: This can result in a very large number of candidates.
Note 2: In this case we will deduplicate candidates.
Note 3: just like with 'batch' the candidate set is identical
for all examples in a batch.
* inline: batch_size lists, one list per example
If each example comes with a list of possible candidates, use those.
Note: With this setting, each example will have its own candidate set.
* fixed: one global candidate list, provided in a file from the user
If self.fixed_candidates is not None, use a set of fixed candidates for
all examples.
Note: this setting is not recommended for training unless the
universe of possible candidates is very small.
* vocab: one global candidate list, extracted from the vocabulary with the
exception of self.NULL_IDX.
|
Build a candidate set for this batch. | def _build_candidates(self, batch, source, mode):
"""
Build a candidate set for this batch.
:param batch:
a Batch object (defined in torch_agent.py)
:param source:
the source from which candidates should be built, one of
['batch', 'batch-all-cands', 'inline', 'fixed']
:param mode:
'train' or 'eval'
:return: tuple of tensors (label_inds, cands, cand_vecs)
label_inds: A [bsz] LongTensor of the indices of the labels for each
example from its respective candidate set
cands: A [num_cands] list of (text) candidates
OR a [batchsize] list of such lists if source=='inline'
cand_vecs: A padded [num_cands, seqlen] LongTensor of vectorized candidates
OR a [batchsize, num_cands, seqlen] LongTensor if source=='inline'
Possible sources of candidates:
* batch: the set of all labels in this batch
Use all labels in the batch as the candidate set (with all but the
example's label being treated as negatives).
Note: with this setting, the candidate set is identical for all
examples in a batch. This option may be undesirable if it is possible
for duplicate labels to occur in a batch, since the second instance of
the correct label will be treated as a negative.
* batch-all-cands: the set of all candidates in this batch
Use all candidates in the batch as candidate set.
Note 1: This can result in a very large number of candidates.
Note 2: In this case we will deduplicate candidates.
Note 3: just like with 'batch' the candidate set is identical
for all examples in a batch.
* inline: batch_size lists, one list per example
If each example comes with a list of possible candidates, use those.
Note: With this setting, each example will have its own candidate set.
* fixed: one global candidate list, provided in a file from the user
If self.fixed_candidates is not None, use a set of fixed candidates for
all examples.
Note: this setting is not recommended for training unless the
universe of possible candidates is very small.
* vocab: one global candidate list, extracted from the vocabulary with the
exception of self.NULL_IDX.
"""
label_vecs = batch.label_vec # [bsz] list of lists of LongTensors
label_inds = None
batchsize = (
batch.text_vec.size(0)
if batch.text_vec is not None
else batch.image.size(0)
)
if label_vecs is not None:
assert label_vecs.dim() == 2
if source == 'batch':
warn_once(
'[ Executing {} mode with batch labels as set of candidates. ]'
''.format(mode)
)
if batchsize == 1:
warn_once(
"[ Warning: using candidate source 'batch' and observed a "
"batch of size 1. This may be due to uneven batch sizes at "
"the end of an epoch. ]"
)
if label_vecs is None:
raise ValueError(
"If using candidate source 'batch', then batch.label_vec cannot be "
"None."
)
cands = batch.labels
cand_vecs = label_vecs
label_inds = label_vecs.new_tensor(range(batchsize))
elif source == 'batch-all-cands':
warn_once(
'[ Executing {} mode with all candidates provided in the batch ]'
''.format(mode)
)
if batch.candidate_vecs is None:
raise ValueError(
"If using candidate source 'batch-all-cands', then batch."
"candidate_vecs cannot be None. If your task does not have "
"inline candidates, consider using one of "
"--{m}={{'batch','fixed','vocab'}}."
"".format(m='candidates' if mode == 'train' else 'eval-candidates')
)
# initialize the list of cands with the labels
cands = []
all_cands_vecs = []
# dictionary used for deduplication
cands_to_id = {}
for i, cands_for_sample in enumerate(batch.candidates):
for j, cand in enumerate(cands_for_sample):
if cand not in cands_to_id:
cands.append(cand)
cands_to_id[cand] = len(cands_to_id)
all_cands_vecs.append(batch.candidate_vecs[i][j])
cand_vecs, _ = self._pad_tensor(all_cands_vecs)
label_inds = label_vecs.new_tensor(
[cands_to_id[label] for label in batch.labels]
)
elif source == 'inline':
warn_once(
'[ Executing {} mode with provided inline set of candidates ]'
''.format(mode)
)
if batch.candidate_vecs is None:
raise ValueError(
"If using candidate source 'inline', then batch.candidate_vecs "
"cannot be None. If your task does not have inline candidates, "
"consider using one of --{m}={{'batch','fixed','vocab'}}."
"".format(m='candidates' if mode == 'train' else 'eval-candidates')
)
cands = batch.candidates
cand_vecs = padded_3d(
batch.candidate_vecs,
self.NULL_IDX,
use_cuda=self.use_cuda,
fp16friendly=self.fp16,
)
if label_vecs is not None:
label_inds = label_vecs.new_empty((batchsize))
bad_batch = False
for i, label_vec in enumerate(label_vecs):
label_vec_pad = label_vec.new_zeros(cand_vecs[i].size(1)).fill_(
self.NULL_IDX
)
if cand_vecs[i].size(1) < len(label_vec):
label_vec = label_vec[0 : cand_vecs[i].size(1)]
label_vec_pad[0 : label_vec.size(0)] = label_vec
label_inds[i] = self._find_match(cand_vecs[i], label_vec_pad)
if label_inds[i] == -1:
bad_batch = True
if bad_batch:
if self.ignore_bad_candidates and not self.is_training:
label_inds = None
else:
raise RuntimeError(
'At least one of your examples has a set of label candidates '
'that does not contain the label. To ignore this error '
'set `--ignore-bad-candidates True`.'
)
elif source == 'fixed':
if self.fixed_candidates is None:
raise ValueError(
"If using candidate source 'fixed', then you must provide the path "
"to a file of candidates with the flag --fixed-candidates-path or "
"the name of a task with --fixed-candidates-task."
)
warn_once(
"[ Executing {} mode with a common set of fixed candidates "
"(n = {}). ]".format(mode, len(self.fixed_candidates))
)
cands = self.fixed_candidates
cand_vecs = self.fixed_candidate_vecs
if label_vecs is not None:
label_inds = label_vecs.new_empty((batchsize))
bad_batch = False
for batch_idx, label_vec in enumerate(label_vecs):
max_c_len = cand_vecs.size(1)
label_vec_pad = label_vec.new_zeros(max_c_len).fill_(self.NULL_IDX)
if max_c_len < len(label_vec):
label_vec = label_vec[0:max_c_len]
label_vec_pad[0 : label_vec.size(0)] = label_vec
label_inds[batch_idx] = self._find_match(cand_vecs, label_vec_pad)
if label_inds[batch_idx] == -1:
bad_batch = True
if bad_batch:
if self.ignore_bad_candidates and not self.is_training:
label_inds = None
else:
raise RuntimeError(
'At least one of your examples has a set of label candidates '
'that does not contain the label. To ignore this error '
'set `--ignore-bad-candidates True`.'
)
elif source == 'vocab':
warn_once(
'[ Executing {} mode with tokens from vocabulary as candidates. ]'
''.format(mode)
)
cands = self.vocab_candidates
cand_vecs = self.vocab_candidate_vecs
# NOTE: label_inds is None here, as we will not find the label in
# the set of vocab candidates
else:
raise Exception("Unrecognized source: %s" % source)
return (cands, cand_vecs, label_inds) | [
"def",
"_build_candidates",
"(",
"self",
",",
"batch",
",",
"source",
",",
"mode",
")",
":",
"label_vecs",
"=",
"batch",
".",
"label_vec",
"# [bsz] list of lists of LongTensors",
"label_inds",
"=",
"None",
"batchsize",
"=",
"(",
"batch",
".",
"text_vec",
".",
"size",
"(",
"0",
")",
"if",
"batch",
".",
"text_vec",
"is",
"not",
"None",
"else",
"batch",
".",
"image",
".",
"size",
"(",
"0",
")",
")",
"if",
"label_vecs",
"is",
"not",
"None",
":",
"assert",
"label_vecs",
".",
"dim",
"(",
")",
"==",
"2",
"if",
"source",
"==",
"'batch'",
":",
"warn_once",
"(",
"'[ Executing {} mode with batch labels as set of candidates. ]'",
"''",
".",
"format",
"(",
"mode",
")",
")",
"if",
"batchsize",
"==",
"1",
":",
"warn_once",
"(",
"\"[ Warning: using candidate source 'batch' and observed a \"",
"\"batch of size 1. This may be due to uneven batch sizes at \"",
"\"the end of an epoch. ]\"",
")",
"if",
"label_vecs",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"If using candidate source 'batch', then batch.label_vec cannot be \"",
"\"None.\"",
")",
"cands",
"=",
"batch",
".",
"labels",
"cand_vecs",
"=",
"label_vecs",
"label_inds",
"=",
"label_vecs",
".",
"new_tensor",
"(",
"range",
"(",
"batchsize",
")",
")",
"elif",
"source",
"==",
"'batch-all-cands'",
":",
"warn_once",
"(",
"'[ Executing {} mode with all candidates provided in the batch ]'",
"''",
".",
"format",
"(",
"mode",
")",
")",
"if",
"batch",
".",
"candidate_vecs",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"If using candidate source 'batch-all-cands', then batch.\"",
"\"candidate_vecs cannot be None. If your task does not have \"",
"\"inline candidates, consider using one of \"",
"\"--{m}={{'batch','fixed','vocab'}}.\"",
"\"\"",
".",
"format",
"(",
"m",
"=",
"'candidates'",
"if",
"mode",
"==",
"'train'",
"else",
"'eval-candidates'",
")",
")",
"# initialize the list of cands with the labels",
"cands",
"=",
"[",
"]",
"all_cands_vecs",
"=",
"[",
"]",
"# dictionary used for deduplication",
"cands_to_id",
"=",
"{",
"}",
"for",
"i",
",",
"cands_for_sample",
"in",
"enumerate",
"(",
"batch",
".",
"candidates",
")",
":",
"for",
"j",
",",
"cand",
"in",
"enumerate",
"(",
"cands_for_sample",
")",
":",
"if",
"cand",
"not",
"in",
"cands_to_id",
":",
"cands",
".",
"append",
"(",
"cand",
")",
"cands_to_id",
"[",
"cand",
"]",
"=",
"len",
"(",
"cands_to_id",
")",
"all_cands_vecs",
".",
"append",
"(",
"batch",
".",
"candidate_vecs",
"[",
"i",
"]",
"[",
"j",
"]",
")",
"cand_vecs",
",",
"_",
"=",
"self",
".",
"_pad_tensor",
"(",
"all_cands_vecs",
")",
"label_inds",
"=",
"label_vecs",
".",
"new_tensor",
"(",
"[",
"cands_to_id",
"[",
"label",
"]",
"for",
"label",
"in",
"batch",
".",
"labels",
"]",
")",
"elif",
"source",
"==",
"'inline'",
":",
"warn_once",
"(",
"'[ Executing {} mode with provided inline set of candidates ]'",
"''",
".",
"format",
"(",
"mode",
")",
")",
"if",
"batch",
".",
"candidate_vecs",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"If using candidate source 'inline', then batch.candidate_vecs \"",
"\"cannot be None. If your task does not have inline candidates, \"",
"\"consider using one of --{m}={{'batch','fixed','vocab'}}.\"",
"\"\"",
".",
"format",
"(",
"m",
"=",
"'candidates'",
"if",
"mode",
"==",
"'train'",
"else",
"'eval-candidates'",
")",
")",
"cands",
"=",
"batch",
".",
"candidates",
"cand_vecs",
"=",
"padded_3d",
"(",
"batch",
".",
"candidate_vecs",
",",
"self",
".",
"NULL_IDX",
",",
"use_cuda",
"=",
"self",
".",
"use_cuda",
",",
"fp16friendly",
"=",
"self",
".",
"fp16",
",",
")",
"if",
"label_vecs",
"is",
"not",
"None",
":",
"label_inds",
"=",
"label_vecs",
".",
"new_empty",
"(",
"(",
"batchsize",
")",
")",
"bad_batch",
"=",
"False",
"for",
"i",
",",
"label_vec",
"in",
"enumerate",
"(",
"label_vecs",
")",
":",
"label_vec_pad",
"=",
"label_vec",
".",
"new_zeros",
"(",
"cand_vecs",
"[",
"i",
"]",
".",
"size",
"(",
"1",
")",
")",
".",
"fill_",
"(",
"self",
".",
"NULL_IDX",
")",
"if",
"cand_vecs",
"[",
"i",
"]",
".",
"size",
"(",
"1",
")",
"<",
"len",
"(",
"label_vec",
")",
":",
"label_vec",
"=",
"label_vec",
"[",
"0",
":",
"cand_vecs",
"[",
"i",
"]",
".",
"size",
"(",
"1",
")",
"]",
"label_vec_pad",
"[",
"0",
":",
"label_vec",
".",
"size",
"(",
"0",
")",
"]",
"=",
"label_vec",
"label_inds",
"[",
"i",
"]",
"=",
"self",
".",
"_find_match",
"(",
"cand_vecs",
"[",
"i",
"]",
",",
"label_vec_pad",
")",
"if",
"label_inds",
"[",
"i",
"]",
"==",
"-",
"1",
":",
"bad_batch",
"=",
"True",
"if",
"bad_batch",
":",
"if",
"self",
".",
"ignore_bad_candidates",
"and",
"not",
"self",
".",
"is_training",
":",
"label_inds",
"=",
"None",
"else",
":",
"raise",
"RuntimeError",
"(",
"'At least one of your examples has a set of label candidates '",
"'that does not contain the label. To ignore this error '",
"'set `--ignore-bad-candidates True`.'",
")",
"elif",
"source",
"==",
"'fixed'",
":",
"if",
"self",
".",
"fixed_candidates",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"If using candidate source 'fixed', then you must provide the path \"",
"\"to a file of candidates with the flag --fixed-candidates-path or \"",
"\"the name of a task with --fixed-candidates-task.\"",
")",
"warn_once",
"(",
"\"[ Executing {} mode with a common set of fixed candidates \"",
"\"(n = {}). ]\"",
".",
"format",
"(",
"mode",
",",
"len",
"(",
"self",
".",
"fixed_candidates",
")",
")",
")",
"cands",
"=",
"self",
".",
"fixed_candidates",
"cand_vecs",
"=",
"self",
".",
"fixed_candidate_vecs",
"if",
"label_vecs",
"is",
"not",
"None",
":",
"label_inds",
"=",
"label_vecs",
".",
"new_empty",
"(",
"(",
"batchsize",
")",
")",
"bad_batch",
"=",
"False",
"for",
"batch_idx",
",",
"label_vec",
"in",
"enumerate",
"(",
"label_vecs",
")",
":",
"max_c_len",
"=",
"cand_vecs",
".",
"size",
"(",
"1",
")",
"label_vec_pad",
"=",
"label_vec",
".",
"new_zeros",
"(",
"max_c_len",
")",
".",
"fill_",
"(",
"self",
".",
"NULL_IDX",
")",
"if",
"max_c_len",
"<",
"len",
"(",
"label_vec",
")",
":",
"label_vec",
"=",
"label_vec",
"[",
"0",
":",
"max_c_len",
"]",
"label_vec_pad",
"[",
"0",
":",
"label_vec",
".",
"size",
"(",
"0",
")",
"]",
"=",
"label_vec",
"label_inds",
"[",
"batch_idx",
"]",
"=",
"self",
".",
"_find_match",
"(",
"cand_vecs",
",",
"label_vec_pad",
")",
"if",
"label_inds",
"[",
"batch_idx",
"]",
"==",
"-",
"1",
":",
"bad_batch",
"=",
"True",
"if",
"bad_batch",
":",
"if",
"self",
".",
"ignore_bad_candidates",
"and",
"not",
"self",
".",
"is_training",
":",
"label_inds",
"=",
"None",
"else",
":",
"raise",
"RuntimeError",
"(",
"'At least one of your examples has a set of label candidates '",
"'that does not contain the label. To ignore this error '",
"'set `--ignore-bad-candidates True`.'",
")",
"elif",
"source",
"==",
"'vocab'",
":",
"warn_once",
"(",
"'[ Executing {} mode with tokens from vocabulary as candidates. ]'",
"''",
".",
"format",
"(",
"mode",
")",
")",
"cands",
"=",
"self",
".",
"vocab_candidates",
"cand_vecs",
"=",
"self",
".",
"vocab_candidate_vecs",
"# NOTE: label_inds is None here, as we will not find the label in",
"# the set of vocab candidates",
"else",
":",
"raise",
"Exception",
"(",
"\"Unrecognized source: %s\"",
"%",
"source",
")",
"return",
"(",
"cands",
",",
"cand_vecs",
",",
"label_inds",
")"
] | [
609,
4
] | [
809,
45
] | python | en | ['en', 'error', 'th'] | False |
TorchRankerAgent.share | (self) |
Share model parameters.
|
Share model parameters.
| def share(self):
"""
Share model parameters.
"""
shared = super().share()
shared['fixed_candidates'] = self.fixed_candidates
shared['fixed_candidate_vecs'] = self.fixed_candidate_vecs
shared['fixed_candidate_encs'] = self.fixed_candidate_encs
shared['num_fixed_candidates'] = self.num_fixed_candidates
shared['vocab_candidates'] = self.vocab_candidates
shared['vocab_candidate_vecs'] = self.vocab_candidate_vecs
shared['vocab_candidate_encs'] = self.vocab_candidate_encs
if hasattr(self, 'optimizer'):
shared['optimizer'] = self.optimizer
return shared | [
"def",
"share",
"(",
"self",
")",
":",
"shared",
"=",
"super",
"(",
")",
".",
"share",
"(",
")",
"shared",
"[",
"'fixed_candidates'",
"]",
"=",
"self",
".",
"fixed_candidates",
"shared",
"[",
"'fixed_candidate_vecs'",
"]",
"=",
"self",
".",
"fixed_candidate_vecs",
"shared",
"[",
"'fixed_candidate_encs'",
"]",
"=",
"self",
".",
"fixed_candidate_encs",
"shared",
"[",
"'num_fixed_candidates'",
"]",
"=",
"self",
".",
"num_fixed_candidates",
"shared",
"[",
"'vocab_candidates'",
"]",
"=",
"self",
".",
"vocab_candidates",
"shared",
"[",
"'vocab_candidate_vecs'",
"]",
"=",
"self",
".",
"vocab_candidate_vecs",
"shared",
"[",
"'vocab_candidate_encs'",
"]",
"=",
"self",
".",
"vocab_candidate_encs",
"if",
"hasattr",
"(",
"self",
",",
"'optimizer'",
")",
":",
"shared",
"[",
"'optimizer'",
"]",
"=",
"self",
".",
"optimizer",
"return",
"shared"
] | [
818,
4
] | [
832,
21
] | python | en | ['en', 'error', 'th'] | False |
TorchRankerAgent.set_vocab_candidates | (self, shared) |
Load the tokens from the vocab as candidates.
self.vocab_candidates will contain a [num_cands] list of strings
self.vocab_candidate_vecs will contain a [num_cands, 1] LongTensor
|
Load the tokens from the vocab as candidates. | def set_vocab_candidates(self, shared):
"""
Load the tokens from the vocab as candidates.
self.vocab_candidates will contain a [num_cands] list of strings
self.vocab_candidate_vecs will contain a [num_cands, 1] LongTensor
"""
if shared:
self.vocab_candidates = shared['vocab_candidates']
self.vocab_candidate_vecs = shared['vocab_candidate_vecs']
self.vocab_candidate_encs = shared['vocab_candidate_encs']
else:
if 'vocab' in (self.opt['candidates'], self.opt['eval_candidates']):
cands = []
vecs = []
for ind in range(1, len(self.dict)):
cands.append(self.dict.ind2tok[ind])
vecs.append(ind)
self.vocab_candidates = cands
self.vocab_candidate_vecs = torch.LongTensor(vecs).unsqueeze(1)
logging.info(
"Loaded fixed candidate set (n = {}) from vocabulary"
"".format(len(self.vocab_candidates))
)
if self.use_cuda:
self.vocab_candidate_vecs = self.vocab_candidate_vecs.cuda()
if self.encode_candidate_vecs:
# encode vocab candidate vecs
self.vocab_candidate_encs = self._make_candidate_encs(
self.vocab_candidate_vecs
)
if self.use_cuda:
self.vocab_candidate_encs = self.vocab_candidate_encs.cuda()
if self.fp16:
self.vocab_candidate_encs = self.vocab_candidate_encs.half()
else:
self.vocab_candidate_encs = self.vocab_candidate_encs.float()
else:
self.vocab_candidate_encs = None
else:
self.vocab_candidates = None
self.vocab_candidate_vecs = None
self.vocab_candidate_encs = None | [
"def",
"set_vocab_candidates",
"(",
"self",
",",
"shared",
")",
":",
"if",
"shared",
":",
"self",
".",
"vocab_candidates",
"=",
"shared",
"[",
"'vocab_candidates'",
"]",
"self",
".",
"vocab_candidate_vecs",
"=",
"shared",
"[",
"'vocab_candidate_vecs'",
"]",
"self",
".",
"vocab_candidate_encs",
"=",
"shared",
"[",
"'vocab_candidate_encs'",
"]",
"else",
":",
"if",
"'vocab'",
"in",
"(",
"self",
".",
"opt",
"[",
"'candidates'",
"]",
",",
"self",
".",
"opt",
"[",
"'eval_candidates'",
"]",
")",
":",
"cands",
"=",
"[",
"]",
"vecs",
"=",
"[",
"]",
"for",
"ind",
"in",
"range",
"(",
"1",
",",
"len",
"(",
"self",
".",
"dict",
")",
")",
":",
"cands",
".",
"append",
"(",
"self",
".",
"dict",
".",
"ind2tok",
"[",
"ind",
"]",
")",
"vecs",
".",
"append",
"(",
"ind",
")",
"self",
".",
"vocab_candidates",
"=",
"cands",
"self",
".",
"vocab_candidate_vecs",
"=",
"torch",
".",
"LongTensor",
"(",
"vecs",
")",
".",
"unsqueeze",
"(",
"1",
")",
"logging",
".",
"info",
"(",
"\"Loaded fixed candidate set (n = {}) from vocabulary\"",
"\"\"",
".",
"format",
"(",
"len",
"(",
"self",
".",
"vocab_candidates",
")",
")",
")",
"if",
"self",
".",
"use_cuda",
":",
"self",
".",
"vocab_candidate_vecs",
"=",
"self",
".",
"vocab_candidate_vecs",
".",
"cuda",
"(",
")",
"if",
"self",
".",
"encode_candidate_vecs",
":",
"# encode vocab candidate vecs",
"self",
".",
"vocab_candidate_encs",
"=",
"self",
".",
"_make_candidate_encs",
"(",
"self",
".",
"vocab_candidate_vecs",
")",
"if",
"self",
".",
"use_cuda",
":",
"self",
".",
"vocab_candidate_encs",
"=",
"self",
".",
"vocab_candidate_encs",
".",
"cuda",
"(",
")",
"if",
"self",
".",
"fp16",
":",
"self",
".",
"vocab_candidate_encs",
"=",
"self",
".",
"vocab_candidate_encs",
".",
"half",
"(",
")",
"else",
":",
"self",
".",
"vocab_candidate_encs",
"=",
"self",
".",
"vocab_candidate_encs",
".",
"float",
"(",
")",
"else",
":",
"self",
".",
"vocab_candidate_encs",
"=",
"None",
"else",
":",
"self",
".",
"vocab_candidates",
"=",
"None",
"self",
".",
"vocab_candidate_vecs",
"=",
"None",
"self",
".",
"vocab_candidate_encs",
"=",
"None"
] | [
834,
4
] | [
877,
48
] | python | en | ['en', 'error', 'th'] | False |
TorchRankerAgent.set_fixed_candidates | (self, shared) |
Load a set of fixed candidates and their vectors (or vectorize them here).
self.fixed_candidates will contain a [num_cands] list of strings
self.fixed_candidate_vecs will contain a [num_cands, seq_len] LongTensor
See the note on the --fixed-candidate-vecs flag for an explanation of the
'reuse', 'replace', or path options.
Note: TorchRankerAgent by default converts candidates to vectors by vectorizing
in the common sense (i.e., replacing each token with its index in the
dictionary). If a child model wants to additionally perform encoding, it can
overwrite the vectorize_fixed_candidates() method to produce encoded vectors
instead of just vectorized ones.
|
Load a set of fixed candidates and their vectors (or vectorize them here). | def set_fixed_candidates(self, shared):
"""
Load a set of fixed candidates and their vectors (or vectorize them here).
self.fixed_candidates will contain a [num_cands] list of strings
self.fixed_candidate_vecs will contain a [num_cands, seq_len] LongTensor
See the note on the --fixed-candidate-vecs flag for an explanation of the
'reuse', 'replace', or path options.
Note: TorchRankerAgent by default converts candidates to vectors by vectorizing
in the common sense (i.e., replacing each token with its index in the
dictionary). If a child model wants to additionally perform encoding, it can
overwrite the vectorize_fixed_candidates() method to produce encoded vectors
instead of just vectorized ones.
"""
if shared:
self.fixed_candidates = shared['fixed_candidates']
self.fixed_candidate_vecs = shared['fixed_candidate_vecs']
self.fixed_candidate_encs = shared['fixed_candidate_encs']
self.num_fixed_candidates = shared['num_fixed_candidates']
else:
self.num_fixed_candidates = 0
opt = self.opt
cand_path = self.fixed_candidates_path
if 'fixed' in (self.candidates, self.eval_candidates):
if not cand_path:
# Attempt to get a standard candidate set for the given task
path = self.get_task_candidates_path()
if path:
logging.info(f"setting fixed_candidates path to: {path}")
self.fixed_candidates_path = path
cand_path = self.fixed_candidates_path
# Load candidates
logging.info(f"Loading fixed candidate set from {cand_path}")
with PathManager.open(cand_path, 'r', encoding='utf-8') as f:
cands = [line.strip() for line in f.readlines()]
# Load or create candidate vectors
if PathManager.exists(self.opt['fixed_candidate_vecs']):
vecs_path = opt['fixed_candidate_vecs']
vecs = self.load_candidates(vecs_path)
else:
setting = self.opt['fixed_candidate_vecs']
model_dir, model_file = os.path.split(self.opt['model_file'])
model_name = os.path.splitext(model_file)[0]
cands_name = os.path.splitext(os.path.basename(cand_path))[0]
vecs_path = os.path.join(
model_dir, '.'.join([model_name, cands_name, 'vecs'])
)
if setting == 'reuse' and PathManager.exists(vecs_path):
vecs = self.load_candidates(vecs_path)
else: # setting == 'replace' OR generating for the first time
vecs = self._make_candidate_vecs(cands)
self._save_candidates(vecs, vecs_path)
self.fixed_candidates = cands
self.num_fixed_candidates = len(self.fixed_candidates)
self.fixed_candidate_vecs = vecs
if self.use_cuda:
self.fixed_candidate_vecs = self.fixed_candidate_vecs.cuda()
if self.encode_candidate_vecs:
# candidate encodings are fixed so set them up now
enc_path = os.path.join(
model_dir, '.'.join([model_name, cands_name, 'encs'])
)
if setting == 'reuse' and PathManager.exists(enc_path):
encs = self.load_candidates(enc_path, cand_type='encodings')
else:
encs = self._make_candidate_encs(self.fixed_candidate_vecs)
self._save_candidates(
encs, path=enc_path, cand_type='encodings'
)
self.fixed_candidate_encs = encs
if self.use_cuda:
self.fixed_candidate_encs = self.fixed_candidate_encs.cuda()
if self.fp16:
self.fixed_candidate_encs = self.fixed_candidate_encs.half()
else:
self.fixed_candidate_encs = self.fixed_candidate_encs.float()
else:
self.fixed_candidate_encs = None
else:
self.fixed_candidates = None
self.fixed_candidate_vecs = None
self.fixed_candidate_encs = None | [
"def",
"set_fixed_candidates",
"(",
"self",
",",
"shared",
")",
":",
"if",
"shared",
":",
"self",
".",
"fixed_candidates",
"=",
"shared",
"[",
"'fixed_candidates'",
"]",
"self",
".",
"fixed_candidate_vecs",
"=",
"shared",
"[",
"'fixed_candidate_vecs'",
"]",
"self",
".",
"fixed_candidate_encs",
"=",
"shared",
"[",
"'fixed_candidate_encs'",
"]",
"self",
".",
"num_fixed_candidates",
"=",
"shared",
"[",
"'num_fixed_candidates'",
"]",
"else",
":",
"self",
".",
"num_fixed_candidates",
"=",
"0",
"opt",
"=",
"self",
".",
"opt",
"cand_path",
"=",
"self",
".",
"fixed_candidates_path",
"if",
"'fixed'",
"in",
"(",
"self",
".",
"candidates",
",",
"self",
".",
"eval_candidates",
")",
":",
"if",
"not",
"cand_path",
":",
"# Attempt to get a standard candidate set for the given task",
"path",
"=",
"self",
".",
"get_task_candidates_path",
"(",
")",
"if",
"path",
":",
"logging",
".",
"info",
"(",
"f\"setting fixed_candidates path to: {path}\"",
")",
"self",
".",
"fixed_candidates_path",
"=",
"path",
"cand_path",
"=",
"self",
".",
"fixed_candidates_path",
"# Load candidates",
"logging",
".",
"info",
"(",
"f\"Loading fixed candidate set from {cand_path}\"",
")",
"with",
"PathManager",
".",
"open",
"(",
"cand_path",
",",
"'r'",
",",
"encoding",
"=",
"'utf-8'",
")",
"as",
"f",
":",
"cands",
"=",
"[",
"line",
".",
"strip",
"(",
")",
"for",
"line",
"in",
"f",
".",
"readlines",
"(",
")",
"]",
"# Load or create candidate vectors",
"if",
"PathManager",
".",
"exists",
"(",
"self",
".",
"opt",
"[",
"'fixed_candidate_vecs'",
"]",
")",
":",
"vecs_path",
"=",
"opt",
"[",
"'fixed_candidate_vecs'",
"]",
"vecs",
"=",
"self",
".",
"load_candidates",
"(",
"vecs_path",
")",
"else",
":",
"setting",
"=",
"self",
".",
"opt",
"[",
"'fixed_candidate_vecs'",
"]",
"model_dir",
",",
"model_file",
"=",
"os",
".",
"path",
".",
"split",
"(",
"self",
".",
"opt",
"[",
"'model_file'",
"]",
")",
"model_name",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"model_file",
")",
"[",
"0",
"]",
"cands_name",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"cand_path",
")",
")",
"[",
"0",
"]",
"vecs_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"model_dir",
",",
"'.'",
".",
"join",
"(",
"[",
"model_name",
",",
"cands_name",
",",
"'vecs'",
"]",
")",
")",
"if",
"setting",
"==",
"'reuse'",
"and",
"PathManager",
".",
"exists",
"(",
"vecs_path",
")",
":",
"vecs",
"=",
"self",
".",
"load_candidates",
"(",
"vecs_path",
")",
"else",
":",
"# setting == 'replace' OR generating for the first time",
"vecs",
"=",
"self",
".",
"_make_candidate_vecs",
"(",
"cands",
")",
"self",
".",
"_save_candidates",
"(",
"vecs",
",",
"vecs_path",
")",
"self",
".",
"fixed_candidates",
"=",
"cands",
"self",
".",
"num_fixed_candidates",
"=",
"len",
"(",
"self",
".",
"fixed_candidates",
")",
"self",
".",
"fixed_candidate_vecs",
"=",
"vecs",
"if",
"self",
".",
"use_cuda",
":",
"self",
".",
"fixed_candidate_vecs",
"=",
"self",
".",
"fixed_candidate_vecs",
".",
"cuda",
"(",
")",
"if",
"self",
".",
"encode_candidate_vecs",
":",
"# candidate encodings are fixed so set them up now",
"enc_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"model_dir",
",",
"'.'",
".",
"join",
"(",
"[",
"model_name",
",",
"cands_name",
",",
"'encs'",
"]",
")",
")",
"if",
"setting",
"==",
"'reuse'",
"and",
"PathManager",
".",
"exists",
"(",
"enc_path",
")",
":",
"encs",
"=",
"self",
".",
"load_candidates",
"(",
"enc_path",
",",
"cand_type",
"=",
"'encodings'",
")",
"else",
":",
"encs",
"=",
"self",
".",
"_make_candidate_encs",
"(",
"self",
".",
"fixed_candidate_vecs",
")",
"self",
".",
"_save_candidates",
"(",
"encs",
",",
"path",
"=",
"enc_path",
",",
"cand_type",
"=",
"'encodings'",
")",
"self",
".",
"fixed_candidate_encs",
"=",
"encs",
"if",
"self",
".",
"use_cuda",
":",
"self",
".",
"fixed_candidate_encs",
"=",
"self",
".",
"fixed_candidate_encs",
".",
"cuda",
"(",
")",
"if",
"self",
".",
"fp16",
":",
"self",
".",
"fixed_candidate_encs",
"=",
"self",
".",
"fixed_candidate_encs",
".",
"half",
"(",
")",
"else",
":",
"self",
".",
"fixed_candidate_encs",
"=",
"self",
".",
"fixed_candidate_encs",
".",
"float",
"(",
")",
"else",
":",
"self",
".",
"fixed_candidate_encs",
"=",
"None",
"else",
":",
"self",
".",
"fixed_candidates",
"=",
"None",
"self",
".",
"fixed_candidate_vecs",
"=",
"None",
"self",
".",
"fixed_candidate_encs",
"=",
"None"
] | [
879,
4
] | [
965,
48
] | python | en | ['en', 'error', 'th'] | False |
TorchRankerAgent.load_candidates | (self, path, cand_type='vectors') |
Load fixed candidates from a path.
|
Load fixed candidates from a path.
| def load_candidates(self, path, cand_type='vectors'):
"""
Load fixed candidates from a path.
"""
logging.info(f"Loading fixed candidate set {cand_type} from {path}")
with PathManager.open(path, 'rb') as f:
return torch.load(f, map_location=lambda cpu, _: cpu) | [
"def",
"load_candidates",
"(",
"self",
",",
"path",
",",
"cand_type",
"=",
"'vectors'",
")",
":",
"logging",
".",
"info",
"(",
"f\"Loading fixed candidate set {cand_type} from {path}\"",
")",
"with",
"PathManager",
".",
"open",
"(",
"path",
",",
"'rb'",
")",
"as",
"f",
":",
"return",
"torch",
".",
"load",
"(",
"f",
",",
"map_location",
"=",
"lambda",
"cpu",
",",
"_",
":",
"cpu",
")"
] | [
967,
4
] | [
973,
65
] | python | en | ['en', 'error', 'th'] | False |
TorchRankerAgent._make_candidate_vecs | (self, cands) |
Prebuild cached vectors for fixed candidates.
|
Prebuild cached vectors for fixed candidates.
| def _make_candidate_vecs(self, cands):
"""
Prebuild cached vectors for fixed candidates.
"""
cand_batches = [cands[i : i + 512] for i in range(0, len(cands), 512)]
logging.info(
f"Vectorizing fixed candidate set ({len(cand_batches)} batch(es) of up to 512)"
)
cand_vecs = []
for batch in tqdm(cand_batches):
cand_vecs.extend(self.vectorize_fixed_candidates(batch))
return padded_3d(
[cand_vecs], pad_idx=self.NULL_IDX, dtype=cand_vecs[0].dtype
).squeeze(0) | [
"def",
"_make_candidate_vecs",
"(",
"self",
",",
"cands",
")",
":",
"cand_batches",
"=",
"[",
"cands",
"[",
"i",
":",
"i",
"+",
"512",
"]",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"cands",
")",
",",
"512",
")",
"]",
"logging",
".",
"info",
"(",
"f\"Vectorizing fixed candidate set ({len(cand_batches)} batch(es) of up to 512)\"",
")",
"cand_vecs",
"=",
"[",
"]",
"for",
"batch",
"in",
"tqdm",
"(",
"cand_batches",
")",
":",
"cand_vecs",
".",
"extend",
"(",
"self",
".",
"vectorize_fixed_candidates",
"(",
"batch",
")",
")",
"return",
"padded_3d",
"(",
"[",
"cand_vecs",
"]",
",",
"pad_idx",
"=",
"self",
".",
"NULL_IDX",
",",
"dtype",
"=",
"cand_vecs",
"[",
"0",
"]",
".",
"dtype",
")",
".",
"squeeze",
"(",
"0",
")"
] | [
975,
4
] | [
988,
20
] | python | en | ['en', 'error', 'th'] | False |
TorchRankerAgent._save_candidates | (self, vecs, path, cand_type='vectors') |
Save cached vectors.
|
Save cached vectors.
| def _save_candidates(self, vecs, path, cand_type='vectors'):
"""
Save cached vectors.
"""
logging.info(f"Saving fixed candidate set {cand_type} to {path}")
with PathManager.open(path, 'wb') as f:
torch.save(vecs, f) | [
"def",
"_save_candidates",
"(",
"self",
",",
"vecs",
",",
"path",
",",
"cand_type",
"=",
"'vectors'",
")",
":",
"logging",
".",
"info",
"(",
"f\"Saving fixed candidate set {cand_type} to {path}\"",
")",
"with",
"PathManager",
".",
"open",
"(",
"path",
",",
"'wb'",
")",
"as",
"f",
":",
"torch",
".",
"save",
"(",
"vecs",
",",
"f",
")"
] | [
990,
4
] | [
996,
31
] | python | en | ['en', 'error', 'th'] | False |
TorchRankerAgent.encode_candidates | (self, padded_cands) |
Convert the given candidates to vectors.
This is an abstract method that must be implemented by the user.
:param padded_cands:
The padded candidates.
|
Convert the given candidates to vectors. | def encode_candidates(self, padded_cands):
"""
Convert the given candidates to vectors.
This is an abstract method that must be implemented by the user.
:param padded_cands:
The padded candidates.
"""
raise NotImplementedError(
'Abstract method: user must implement encode_candidates(). '
'If your agent encodes candidates independently '
'from context, you can get performance gains with fixed cands by '
'implementing this function and running with the flag '
'--encode-candidate-vecs True.'
) | [
"def",
"encode_candidates",
"(",
"self",
",",
"padded_cands",
")",
":",
"raise",
"NotImplementedError",
"(",
"'Abstract method: user must implement encode_candidates(). '",
"'If your agent encodes candidates independently '",
"'from context, you can get performance gains with fixed cands by '",
"'implementing this function and running with the flag '",
"'--encode-candidate-vecs True.'",
")"
] | [
998,
4
] | [
1013,
9
] | python | en | ['en', 'error', 'th'] | False |
TorchRankerAgent._make_candidate_encs | (self, vecs) |
Encode candidates from candidate vectors.
Requires encode_candidates() to be implemented.
|
Encode candidates from candidate vectors. | def _make_candidate_encs(self, vecs):
"""
Encode candidates from candidate vectors.
Requires encode_candidates() to be implemented.
"""
cand_encs = []
bsz = self.opt.get('encode_candidate_vecs_batchsize', 256)
vec_batches = [vecs[i : i + bsz] for i in range(0, len(vecs), bsz)]
logging.info(
"Encoding fixed candidates set from ({} batch(es) of up to {}) ]"
"".format(len(vec_batches), bsz)
)
# Put model into eval mode when encoding candidates
self.model.eval()
with torch.no_grad():
for vec_batch in tqdm(vec_batches):
cand_encs.append(self.encode_candidates(vec_batch).cpu())
return torch.cat(cand_encs, 0).to(vec_batch.device) | [
"def",
"_make_candidate_encs",
"(",
"self",
",",
"vecs",
")",
":",
"cand_encs",
"=",
"[",
"]",
"bsz",
"=",
"self",
".",
"opt",
".",
"get",
"(",
"'encode_candidate_vecs_batchsize'",
",",
"256",
")",
"vec_batches",
"=",
"[",
"vecs",
"[",
"i",
":",
"i",
"+",
"bsz",
"]",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"vecs",
")",
",",
"bsz",
")",
"]",
"logging",
".",
"info",
"(",
"\"Encoding fixed candidates set from ({} batch(es) of up to {}) ]\"",
"\"\"",
".",
"format",
"(",
"len",
"(",
"vec_batches",
")",
",",
"bsz",
")",
")",
"# Put model into eval mode when encoding candidates",
"self",
".",
"model",
".",
"eval",
"(",
")",
"with",
"torch",
".",
"no_grad",
"(",
")",
":",
"for",
"vec_batch",
"in",
"tqdm",
"(",
"vec_batches",
")",
":",
"cand_encs",
".",
"append",
"(",
"self",
".",
"encode_candidates",
"(",
"vec_batch",
")",
".",
"cpu",
"(",
")",
")",
"return",
"torch",
".",
"cat",
"(",
"cand_encs",
",",
"0",
")",
".",
"to",
"(",
"vec_batch",
".",
"device",
")"
] | [
1015,
4
] | [
1034,
59
] | python | en | ['en', 'error', 'th'] | False |
TorchRankerAgent.vectorize_fixed_candidates | (self, cands_batch, add_start=False, add_end=False) |
Convert a batch of candidates from text to vectors.
:param cands_batch:
a [batchsize] list of candidates (strings)
:returns:
a [num_cands] list of candidate vectors
By default, candidates are simply vectorized (tokens replaced by token ids).
A child class may choose to overwrite this method to perform vectorization as
well as encoding if so desired.
|
Convert a batch of candidates from text to vectors. | def vectorize_fixed_candidates(self, cands_batch, add_start=False, add_end=False):
"""
Convert a batch of candidates from text to vectors.
:param cands_batch:
a [batchsize] list of candidates (strings)
:returns:
a [num_cands] list of candidate vectors
By default, candidates are simply vectorized (tokens replaced by token ids).
A child class may choose to overwrite this method to perform vectorization as
well as encoding if so desired.
"""
return [
self._vectorize_text(
cand,
truncate=self.label_truncate,
truncate_left=False,
add_start=add_start,
add_end=add_end,
)
for cand in cands_batch
] | [
"def",
"vectorize_fixed_candidates",
"(",
"self",
",",
"cands_batch",
",",
"add_start",
"=",
"False",
",",
"add_end",
"=",
"False",
")",
":",
"return",
"[",
"self",
".",
"_vectorize_text",
"(",
"cand",
",",
"truncate",
"=",
"self",
".",
"label_truncate",
",",
"truncate_left",
"=",
"False",
",",
"add_start",
"=",
"add_start",
",",
"add_end",
"=",
"add_end",
",",
")",
"for",
"cand",
"in",
"cands_batch",
"]"
] | [
1036,
4
] | [
1058,
9
] | python | en | ['en', 'error', 'th'] | False |
PlotlyGraphObjectError.__init__ | (self, message="", path=(), notes=()) |
General graph object error for validation failures.
:param (str|unicode) message: The error message.
:param (iterable) path: A path pointing to the error.
:param notes: Add additional notes, but keep default exception message.
|
General graph object error for validation failures. | def __init__(self, message="", path=(), notes=()):
"""
General graph object error for validation failures.
:param (str|unicode) message: The error message.
:param (iterable) path: A path pointing to the error.
:param notes: Add additional notes, but keep default exception message.
"""
self.message = message
self.plain_message = message # for backwards compat
self.path = list(path)
self.notes = notes
super(PlotlyGraphObjectError, self).__init__(message) | [
"def",
"__init__",
"(",
"self",
",",
"message",
"=",
"\"\"",
",",
"path",
"=",
"(",
")",
",",
"notes",
"=",
"(",
")",
")",
":",
"self",
".",
"message",
"=",
"message",
"self",
".",
"plain_message",
"=",
"message",
"# for backwards compat",
"self",
".",
"path",
"=",
"list",
"(",
"path",
")",
"self",
".",
"notes",
"=",
"notes",
"super",
"(",
"PlotlyGraphObjectError",
",",
"self",
")",
".",
"__init__",
"(",
"message",
")"
] | [
9,
4
] | [
22,
61
] | python | en | ['en', 'error', 'th'] | False |
PlotlyGraphObjectError.__str__ | (self) | This is called by Python to present the error message. | This is called by Python to present the error message. | def __str__(self):
"""This is called by Python to present the error message."""
format_dict = {
"message": self.message,
"path": "[" + "][".join(repr(k) for k in self.path) + "]",
"notes": "\n".join(self.notes),
}
return "{message}\n\nPath To Error: {path}\n\n{notes}".format(**format_dict) | [
"def",
"__str__",
"(",
"self",
")",
":",
"format_dict",
"=",
"{",
"\"message\"",
":",
"self",
".",
"message",
",",
"\"path\"",
":",
"\"[\"",
"+",
"\"][\"",
".",
"join",
"(",
"repr",
"(",
"k",
")",
"for",
"k",
"in",
"self",
".",
"path",
")",
"+",
"\"]\"",
",",
"\"notes\"",
":",
"\"\\n\"",
".",
"join",
"(",
"self",
".",
"notes",
")",
",",
"}",
"return",
"\"{message}\\n\\nPath To Error: {path}\\n\\n{notes}\"",
".",
"format",
"(",
"*",
"*",
"format_dict",
")"
] | [
24,
4
] | [
31,
84
] | python | en | ['en', 'en', 'en'] | True |
PlotlyDictKeyError.__init__ | (self, obj, path, notes=()) | See PlotlyGraphObjectError.__init__ for param docs. | See PlotlyGraphObjectError.__init__ for param docs. | def __init__(self, obj, path, notes=()):
"""See PlotlyGraphObjectError.__init__ for param docs."""
format_dict = {"attribute": path[-1], "object_name": obj._name}
message = "'{attribute}' is not allowed in '{object_name}'".format(
**format_dict
)
notes = [obj.help(return_help=True)] + list(notes)
super(PlotlyDictKeyError, self).__init__(
message=message, path=path, notes=notes
) | [
"def",
"__init__",
"(",
"self",
",",
"obj",
",",
"path",
",",
"notes",
"=",
"(",
")",
")",
":",
"format_dict",
"=",
"{",
"\"attribute\"",
":",
"path",
"[",
"-",
"1",
"]",
",",
"\"object_name\"",
":",
"obj",
".",
"_name",
"}",
"message",
"=",
"\"'{attribute}' is not allowed in '{object_name}'\"",
".",
"format",
"(",
"*",
"*",
"format_dict",
")",
"notes",
"=",
"[",
"obj",
".",
"help",
"(",
"return_help",
"=",
"True",
")",
"]",
"+",
"list",
"(",
"notes",
")",
"super",
"(",
"PlotlyDictKeyError",
",",
"self",
")",
".",
"__init__",
"(",
"message",
"=",
"message",
",",
"path",
"=",
"path",
",",
"notes",
"=",
"notes",
")"
] | [
35,
4
] | [
44,
9
] | python | en | ['en', 'mg', 'hi'] | False |
PlotlyDictValueError.__init__ | (self, obj, path, notes=()) | See PlotlyGraphObjectError.__init__ for param docs. | See PlotlyGraphObjectError.__init__ for param docs. | def __init__(self, obj, path, notes=()):
"""See PlotlyGraphObjectError.__init__ for param docs."""
format_dict = {"attribute": path[-1], "object_name": obj._name}
message = "'{attribute}' has invalid value inside '{object_name}'".format(
**format_dict
)
notes = [obj.help(path[-1], return_help=True)] + list(notes)
super(PlotlyDictValueError, self).__init__(
message=message, notes=notes, path=path
) | [
"def",
"__init__",
"(",
"self",
",",
"obj",
",",
"path",
",",
"notes",
"=",
"(",
")",
")",
":",
"format_dict",
"=",
"{",
"\"attribute\"",
":",
"path",
"[",
"-",
"1",
"]",
",",
"\"object_name\"",
":",
"obj",
".",
"_name",
"}",
"message",
"=",
"\"'{attribute}' has invalid value inside '{object_name}'\"",
".",
"format",
"(",
"*",
"*",
"format_dict",
")",
"notes",
"=",
"[",
"obj",
".",
"help",
"(",
"path",
"[",
"-",
"1",
"]",
",",
"return_help",
"=",
"True",
")",
"]",
"+",
"list",
"(",
"notes",
")",
"super",
"(",
"PlotlyDictValueError",
",",
"self",
")",
".",
"__init__",
"(",
"message",
"=",
"message",
",",
"notes",
"=",
"notes",
",",
"path",
"=",
"path",
")"
] | [
48,
4
] | [
57,
9
] | python | en | ['en', 'mg', 'hi'] | False |
PlotlyListEntryError.__init__ | (self, obj, path, notes=()) | See PlotlyGraphObjectError.__init__ for param docs. | See PlotlyGraphObjectError.__init__ for param docs. | def __init__(self, obj, path, notes=()):
"""See PlotlyGraphObjectError.__init__ for param docs."""
format_dict = {"index": path[-1], "object_name": obj._name}
message = "Invalid entry found in '{object_name}' at index, '{index}'".format(
**format_dict
)
notes = [obj.help(return_help=True)] + list(notes)
super(PlotlyListEntryError, self).__init__(
message=message, path=path, notes=notes
) | [
"def",
"__init__",
"(",
"self",
",",
"obj",
",",
"path",
",",
"notes",
"=",
"(",
")",
")",
":",
"format_dict",
"=",
"{",
"\"index\"",
":",
"path",
"[",
"-",
"1",
"]",
",",
"\"object_name\"",
":",
"obj",
".",
"_name",
"}",
"message",
"=",
"\"Invalid entry found in '{object_name}' at index, '{index}'\"",
".",
"format",
"(",
"*",
"*",
"format_dict",
")",
"notes",
"=",
"[",
"obj",
".",
"help",
"(",
"return_help",
"=",
"True",
")",
"]",
"+",
"list",
"(",
"notes",
")",
"super",
"(",
"PlotlyListEntryError",
",",
"self",
")",
".",
"__init__",
"(",
"message",
"=",
"message",
",",
"path",
"=",
"path",
",",
"notes",
"=",
"notes",
")"
] | [
61,
4
] | [
70,
9
] | python | en | ['en', 'mg', 'hi'] | False |
PlotlyDataTypeError.__init__ | (self, obj, path, notes=()) | See PlotlyGraphObjectError.__init__ for param docs. | See PlotlyGraphObjectError.__init__ for param docs. | def __init__(self, obj, path, notes=()):
"""See PlotlyGraphObjectError.__init__ for param docs."""
format_dict = {"index": path[-1], "object_name": obj._name}
message = "Invalid entry found in '{object_name}' at index, '{index}'".format(
**format_dict
)
note = "It's invalid because it doesn't contain a valid 'type' value."
notes = [note] + list(notes)
super(PlotlyDataTypeError, self).__init__(
message=message, path=path, notes=notes
) | [
"def",
"__init__",
"(",
"self",
",",
"obj",
",",
"path",
",",
"notes",
"=",
"(",
")",
")",
":",
"format_dict",
"=",
"{",
"\"index\"",
":",
"path",
"[",
"-",
"1",
"]",
",",
"\"object_name\"",
":",
"obj",
".",
"_name",
"}",
"message",
"=",
"\"Invalid entry found in '{object_name}' at index, '{index}'\"",
".",
"format",
"(",
"*",
"*",
"format_dict",
")",
"note",
"=",
"\"It's invalid because it doesn't contain a valid 'type' value.\"",
"notes",
"=",
"[",
"note",
"]",
"+",
"list",
"(",
"notes",
")",
"super",
"(",
"PlotlyDataTypeError",
",",
"self",
")",
".",
"__init__",
"(",
"message",
"=",
"message",
",",
"path",
"=",
"path",
",",
"notes",
"=",
"notes",
")"
] | [
74,
4
] | [
84,
9
] | python | en | ['en', 'mg', 'hi'] | False |
XAxis.autorange | (self) |
Determines whether or not the range of this axis is computed in
relation to the input data. See `rangemode` for more info. If
`range` is provided, then `autorange` is set to False.
The 'autorange' property is an enumeration that may be specified as:
- One of the following enumeration values:
[True, False, 'reversed']
Returns
-------
Any
|
Determines whether or not the range of this axis is computed in
relation to the input data. See `rangemode` for more info. If
`range` is provided, then `autorange` is set to False.
The 'autorange' property is an enumeration that may be specified as:
- One of the following enumeration values:
[True, False, 'reversed'] | def autorange(self):
"""
Determines whether or not the range of this axis is computed in
relation to the input data. See `rangemode` for more info. If
`range` is provided, then `autorange` is set to False.
The 'autorange' property is an enumeration that may be specified as:
- One of the following enumeration values:
[True, False, 'reversed']
Returns
-------
Any
"""
return self["autorange"] | [
"def",
"autorange",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"autorange\"",
"]"
] | [
71,
4
] | [
85,
32
] | python | en | ['en', 'error', 'th'] | False |
XAxis.backgroundcolor | (self) |
Sets the background color of this axis' wall.
The 'backgroundcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
Returns
-------
str
|
Sets the background color of this axis' wall.
The 'backgroundcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen | def backgroundcolor(self):
"""
Sets the background color of this axis' wall.
The 'backgroundcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
Returns
-------
str
"""
return self["backgroundcolor"] | [
"def",
"backgroundcolor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"backgroundcolor\"",
"]"
] | [
94,
4
] | [
144,
38
] | python | en | ['en', 'error', 'th'] | False |
XAxis.calendar | (self) |
Sets the calendar system to use for `range` and `tick0` if this
is a date axis. This does not set the calendar for interpreting
data on this axis, that's specified in the trace or via the
global `layout.calendar`
The 'calendar' property is an enumeration that may be specified as:
- One of the following enumeration values:
['gregorian', 'chinese', 'coptic', 'discworld',
'ethiopian', 'hebrew', 'islamic', 'julian', 'mayan',
'nanakshahi', 'nepali', 'persian', 'jalali', 'taiwan',
'thai', 'ummalqura']
Returns
-------
Any
|
Sets the calendar system to use for `range` and `tick0` if this
is a date axis. This does not set the calendar for interpreting
data on this axis, that's specified in the trace or via the
global `layout.calendar`
The 'calendar' property is an enumeration that may be specified as:
- One of the following enumeration values:
['gregorian', 'chinese', 'coptic', 'discworld',
'ethiopian', 'hebrew', 'islamic', 'julian', 'mayan',
'nanakshahi', 'nepali', 'persian', 'jalali', 'taiwan',
'thai', 'ummalqura'] | def calendar(self):
"""
Sets the calendar system to use for `range` and `tick0` if this
is a date axis. This does not set the calendar for interpreting
data on this axis, that's specified in the trace or via the
global `layout.calendar`
The 'calendar' property is an enumeration that may be specified as:
- One of the following enumeration values:
['gregorian', 'chinese', 'coptic', 'discworld',
'ethiopian', 'hebrew', 'islamic', 'julian', 'mayan',
'nanakshahi', 'nepali', 'persian', 'jalali', 'taiwan',
'thai', 'ummalqura']
Returns
-------
Any
"""
return self["calendar"] | [
"def",
"calendar",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"calendar\"",
"]"
] | [
153,
4
] | [
171,
31
] | python | en | ['en', 'error', 'th'] | False |
XAxis.categoryarray | (self) |
Sets the order in which categories on this axis appear. Only
has an effect if `categoryorder` is set to "array". Used with
`categoryorder`.
The 'categoryarray' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
|
Sets the order in which categories on this axis appear. Only
has an effect if `categoryorder` is set to "array". Used with
`categoryorder`.
The 'categoryarray' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | def categoryarray(self):
"""
Sets the order in which categories on this axis appear. Only
has an effect if `categoryorder` is set to "array". Used with
`categoryorder`.
The 'categoryarray' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
"""
return self["categoryarray"] | [
"def",
"categoryarray",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"categoryarray\"",
"]"
] | [
180,
4
] | [
193,
36
] | python | en | ['en', 'error', 'th'] | False |
XAxis.categoryarraysrc | (self) |
Sets the source reference on Chart Studio Cloud for
categoryarray .
The 'categoryarraysrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for
categoryarray .
The 'categoryarraysrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def categoryarraysrc(self):
"""
Sets the source reference on Chart Studio Cloud for
categoryarray .
The 'categoryarraysrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["categoryarraysrc"] | [
"def",
"categoryarraysrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"categoryarraysrc\"",
"]"
] | [
202,
4
] | [
214,
39
] | python | en | ['en', 'error', 'th'] | False |
XAxis.categoryorder | (self) |
Specifies the ordering logic for the case of categorical
variables. By default, plotly uses "trace", which specifies the
order that is present in the data supplied. Set `categoryorder`
to *category ascending* or *category descending* if order
should be determined by the alphanumerical order of the
category names. Set `categoryorder` to "array" to derive the
ordering from the attribute `categoryarray`. If a category is
not found in the `categoryarray` array, the sorting behavior
for that attribute will be identical to the "trace" mode. The
unspecified categories will follow the categories in
`categoryarray`. Set `categoryorder` to *total ascending* or
*total descending* if order should be determined by the
numerical order of the values. Similarly, the order can be
determined by the min, max, sum, mean or median of all the
values.
The 'categoryorder' property is an enumeration that may be specified as:
- One of the following enumeration values:
['trace', 'category ascending', 'category descending',
'array', 'total ascending', 'total descending', 'min
ascending', 'min descending', 'max ascending', 'max
descending', 'sum ascending', 'sum descending', 'mean
ascending', 'mean descending', 'median ascending', 'median
descending']
Returns
-------
Any
|
Specifies the ordering logic for the case of categorical
variables. By default, plotly uses "trace", which specifies the
order that is present in the data supplied. Set `categoryorder`
to *category ascending* or *category descending* if order
should be determined by the alphanumerical order of the
category names. Set `categoryorder` to "array" to derive the
ordering from the attribute `categoryarray`. If a category is
not found in the `categoryarray` array, the sorting behavior
for that attribute will be identical to the "trace" mode. The
unspecified categories will follow the categories in
`categoryarray`. Set `categoryorder` to *total ascending* or
*total descending* if order should be determined by the
numerical order of the values. Similarly, the order can be
determined by the min, max, sum, mean or median of all the
values.
The 'categoryorder' property is an enumeration that may be specified as:
- One of the following enumeration values:
['trace', 'category ascending', 'category descending',
'array', 'total ascending', 'total descending', 'min
ascending', 'min descending', 'max ascending', 'max
descending', 'sum ascending', 'sum descending', 'mean
ascending', 'mean descending', 'median ascending', 'median
descending'] | def categoryorder(self):
"""
Specifies the ordering logic for the case of categorical
variables. By default, plotly uses "trace", which specifies the
order that is present in the data supplied. Set `categoryorder`
to *category ascending* or *category descending* if order
should be determined by the alphanumerical order of the
category names. Set `categoryorder` to "array" to derive the
ordering from the attribute `categoryarray`. If a category is
not found in the `categoryarray` array, the sorting behavior
for that attribute will be identical to the "trace" mode. The
unspecified categories will follow the categories in
`categoryarray`. Set `categoryorder` to *total ascending* or
*total descending* if order should be determined by the
numerical order of the values. Similarly, the order can be
determined by the min, max, sum, mean or median of all the
values.
The 'categoryorder' property is an enumeration that may be specified as:
- One of the following enumeration values:
['trace', 'category ascending', 'category descending',
'array', 'total ascending', 'total descending', 'min
ascending', 'min descending', 'max ascending', 'max
descending', 'sum ascending', 'sum descending', 'mean
ascending', 'mean descending', 'median ascending', 'median
descending']
Returns
-------
Any
"""
return self["categoryorder"] | [
"def",
"categoryorder",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"categoryorder\"",
"]"
] | [
223,
4
] | [
254,
36
] | python | en | ['en', 'error', 'th'] | False |
XAxis.color | (self) |
Sets default for all colors associated with this axis all at
once: line, font, tick, and grid colors. Grid color is
lightened by blending this with the plot background Individual
pieces can override this.
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
Returns
-------
str
|
Sets default for all colors associated with this axis all at
once: line, font, tick, and grid colors. Grid color is
lightened by blending this with the plot background Individual
pieces can override this.
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen | def color(self):
"""
Sets default for all colors associated with this axis all at
once: line, font, tick, and grid colors. Grid color is
lightened by blending this with the plot background Individual
pieces can override this.
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
Returns
-------
str
"""
return self["color"] | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
263,
4
] | [
316,
28
] | python | en | ['en', 'error', 'th'] | False |
XAxis.dtick | (self) |
Sets the step in-between ticks on this axis. Use with `tick0`.
Must be a positive number, or special strings available to
"log" and "date" axes. If the axis `type` is "log", then ticks
are set every 10^(n*dtick) where n is the tick number. For
example, to set a tick mark at 1, 10, 100, 1000, ... set dtick
to 1. To set tick marks at 1, 100, 10000, ... set dtick to 2.
To set tick marks at 1, 5, 25, 125, 625, 3125, ... set dtick to
log_10(5), or 0.69897000433. "log" has several special values;
"L<f>", where `f` is a positive number, gives ticks linearly
spaced in value (but not position). For example `tick0` = 0.1,
`dtick` = "L0.5" will put ticks at 0.1, 0.6, 1.1, 1.6 etc. To
show powers of 10 plus small digits between, use "D1" (all
digits) or "D2" (only 2 and 5). `tick0` is ignored for "D1" and
"D2". If the axis `type` is "date", then you must convert the
time to milliseconds. For example, to set the interval between
ticks to one day, set `dtick` to 86400000.0. "date" also has
special values "M<n>" gives ticks spaced by a number of months.
`n` must be a positive integer. To set ticks on the 15th of
every third month, set `tick0` to "2000-01-15" and `dtick` to
"M3". To set ticks every 4 years, set `dtick` to "M48"
The 'dtick' property accepts values of any type
Returns
-------
Any
|
Sets the step in-between ticks on this axis. Use with `tick0`.
Must be a positive number, or special strings available to
"log" and "date" axes. If the axis `type` is "log", then ticks
are set every 10^(n*dtick) where n is the tick number. For
example, to set a tick mark at 1, 10, 100, 1000, ... set dtick
to 1. To set tick marks at 1, 100, 10000, ... set dtick to 2.
To set tick marks at 1, 5, 25, 125, 625, 3125, ... set dtick to
log_10(5), or 0.69897000433. "log" has several special values;
"L<f>", where `f` is a positive number, gives ticks linearly
spaced in value (but not position). For example `tick0` = 0.1,
`dtick` = "L0.5" will put ticks at 0.1, 0.6, 1.1, 1.6 etc. To
show powers of 10 plus small digits between, use "D1" (all
digits) or "D2" (only 2 and 5). `tick0` is ignored for "D1" and
"D2". If the axis `type` is "date", then you must convert the
time to milliseconds. For example, to set the interval between
ticks to one day, set `dtick` to 86400000.0. "date" also has
special values "M<n>" gives ticks spaced by a number of months.
`n` must be a positive integer. To set ticks on the 15th of
every third month, set `tick0` to "2000-01-15" and `dtick` to
"M3". To set ticks every 4 years, set `dtick` to "M48"
The 'dtick' property accepts values of any type | def dtick(self):
"""
Sets the step in-between ticks on this axis. Use with `tick0`.
Must be a positive number, or special strings available to
"log" and "date" axes. If the axis `type` is "log", then ticks
are set every 10^(n*dtick) where n is the tick number. For
example, to set a tick mark at 1, 10, 100, 1000, ... set dtick
to 1. To set tick marks at 1, 100, 10000, ... set dtick to 2.
To set tick marks at 1, 5, 25, 125, 625, 3125, ... set dtick to
log_10(5), or 0.69897000433. "log" has several special values;
"L<f>", where `f` is a positive number, gives ticks linearly
spaced in value (but not position). For example `tick0` = 0.1,
`dtick` = "L0.5" will put ticks at 0.1, 0.6, 1.1, 1.6 etc. To
show powers of 10 plus small digits between, use "D1" (all
digits) or "D2" (only 2 and 5). `tick0` is ignored for "D1" and
"D2". If the axis `type` is "date", then you must convert the
time to milliseconds. For example, to set the interval between
ticks to one day, set `dtick` to 86400000.0. "date" also has
special values "M<n>" gives ticks spaced by a number of months.
`n` must be a positive integer. To set ticks on the 15th of
every third month, set `tick0` to "2000-01-15" and `dtick` to
"M3". To set ticks every 4 years, set `dtick` to "M48"
The 'dtick' property accepts values of any type
Returns
-------
Any
"""
return self["dtick"] | [
"def",
"dtick",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"dtick\"",
"]"
] | [
325,
4
] | [
354,
28
] | python | en | ['en', 'error', 'th'] | False |
XAxis.exponentformat | (self) |
Determines a formatting rule for the tick exponents. For
example, consider the number 1,000,000,000. If "none", it
appears as 1,000,000,000. If "e", 1e+9. If "E", 1E+9. If
"power", 1x10^9 (with 9 in a super script). If "SI", 1G. If
"B", 1B.
The 'exponentformat' property is an enumeration that may be specified as:
- One of the following enumeration values:
['none', 'e', 'E', 'power', 'SI', 'B']
Returns
-------
Any
|
Determines a formatting rule for the tick exponents. For
example, consider the number 1,000,000,000. If "none", it
appears as 1,000,000,000. If "e", 1e+9. If "E", 1E+9. If
"power", 1x10^9 (with 9 in a super script). If "SI", 1G. If
"B", 1B.
The 'exponentformat' property is an enumeration that may be specified as:
- One of the following enumeration values:
['none', 'e', 'E', 'power', 'SI', 'B'] | def exponentformat(self):
"""
Determines a formatting rule for the tick exponents. For
example, consider the number 1,000,000,000. If "none", it
appears as 1,000,000,000. If "e", 1e+9. If "E", 1E+9. If
"power", 1x10^9 (with 9 in a super script). If "SI", 1G. If
"B", 1B.
The 'exponentformat' property is an enumeration that may be specified as:
- One of the following enumeration values:
['none', 'e', 'E', 'power', 'SI', 'B']
Returns
-------
Any
"""
return self["exponentformat"] | [
"def",
"exponentformat",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"exponentformat\"",
"]"
] | [
363,
4
] | [
379,
37
] | python | en | ['en', 'error', 'th'] | False |
XAxis.gridcolor | (self) |
Sets the color of the grid lines.
The 'gridcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
Returns
-------
str
|
Sets the color of the grid lines.
The 'gridcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen | def gridcolor(self):
"""
Sets the color of the grid lines.
The 'gridcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
Returns
-------
str
"""
return self["gridcolor"] | [
"def",
"gridcolor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"gridcolor\"",
"]"
] | [
388,
4
] | [
438,
32
] | python | en | ['en', 'error', 'th'] | False |
XAxis.gridwidth | (self) |
Sets the width (in px) of the grid lines.
The 'gridwidth' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
|
Sets the width (in px) of the grid lines.
The 'gridwidth' property is a number and may be specified as:
- An int or float in the interval [0, inf] | def gridwidth(self):
"""
Sets the width (in px) of the grid lines.
The 'gridwidth' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
"""
return self["gridwidth"] | [
"def",
"gridwidth",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"gridwidth\"",
"]"
] | [
447,
4
] | [
458,
32
] | python | en | ['en', 'error', 'th'] | False |
XAxis.hoverformat | (self) |
Sets the hover text formatting rule using d3 formatting mini-
languages which are very similar to those in Python. For
numbers, see: https://github.com/d3/d3-3.x-api-
reference/blob/master/Formatting.md#d3_format And for dates
see: https://github.com/d3/d3-3.x-api-
reference/blob/master/Time-Formatting.md#format We add one item
to d3's date formatter: "%{n}f" for fractional seconds with n
digits. For example, *2016-10-13 09:15:23.456* with tickformat
"%H~%M~%S.%2f" would display "09~15~23.46"
The 'hoverformat' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
|
Sets the hover text formatting rule using d3 formatting mini-
languages which are very similar to those in Python. For
numbers, see: https://github.com/d3/d3-3.x-api-
reference/blob/master/Formatting.md#d3_format And for dates
see: https://github.com/d3/d3-3.x-api-
reference/blob/master/Time-Formatting.md#format We add one item
to d3's date formatter: "%{n}f" for fractional seconds with n
digits. For example, *2016-10-13 09:15:23.456* with tickformat
"%H~%M~%S.%2f" would display "09~15~23.46"
The 'hoverformat' property is a string and must be specified as:
- A string
- A number that will be converted to a string | def hoverformat(self):
"""
Sets the hover text formatting rule using d3 formatting mini-
languages which are very similar to those in Python. For
numbers, see: https://github.com/d3/d3-3.x-api-
reference/blob/master/Formatting.md#d3_format And for dates
see: https://github.com/d3/d3-3.x-api-
reference/blob/master/Time-Formatting.md#format We add one item
to d3's date formatter: "%{n}f" for fractional seconds with n
digits. For example, *2016-10-13 09:15:23.456* with tickformat
"%H~%M~%S.%2f" would display "09~15~23.46"
The 'hoverformat' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
"""
return self["hoverformat"] | [
"def",
"hoverformat",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"hoverformat\"",
"]"
] | [
467,
4
] | [
487,
34
] | python | en | ['en', 'error', 'th'] | False |
XAxis.linecolor | (self) |
Sets the axis line color.
The 'linecolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
Returns
-------
str
|
Sets the axis line color.
The 'linecolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen | def linecolor(self):
"""
Sets the axis line color.
The 'linecolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
Returns
-------
str
"""
return self["linecolor"] | [
"def",
"linecolor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"linecolor\"",
"]"
] | [
496,
4
] | [
546,
32
] | python | en | ['en', 'error', 'th'] | False |
XAxis.linewidth | (self) |
Sets the width (in px) of the axis line.
The 'linewidth' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
|
Sets the width (in px) of the axis line.
The 'linewidth' property is a number and may be specified as:
- An int or float in the interval [0, inf] | def linewidth(self):
"""
Sets the width (in px) of the axis line.
The 'linewidth' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
"""
return self["linewidth"] | [
"def",
"linewidth",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"linewidth\"",
"]"
] | [
555,
4
] | [
566,
32
] | python | en | ['en', 'error', 'th'] | False |
XAxis.mirror | (self) |
Determines if the axis lines or/and ticks are mirrored to the
opposite side of the plotting area. If True, the axis lines are
mirrored. If "ticks", the axis lines and ticks are mirrored. If
False, mirroring is disable. If "all", axis lines are mirrored
on all shared-axes subplots. If "allticks", axis lines and
ticks are mirrored on all shared-axes subplots.
The 'mirror' property is an enumeration that may be specified as:
- One of the following enumeration values:
[True, 'ticks', False, 'all', 'allticks']
Returns
-------
Any
|
Determines if the axis lines or/and ticks are mirrored to the
opposite side of the plotting area. If True, the axis lines are
mirrored. If "ticks", the axis lines and ticks are mirrored. If
False, mirroring is disable. If "all", axis lines are mirrored
on all shared-axes subplots. If "allticks", axis lines and
ticks are mirrored on all shared-axes subplots.
The 'mirror' property is an enumeration that may be specified as:
- One of the following enumeration values:
[True, 'ticks', False, 'all', 'allticks'] | def mirror(self):
"""
Determines if the axis lines or/and ticks are mirrored to the
opposite side of the plotting area. If True, the axis lines are
mirrored. If "ticks", the axis lines and ticks are mirrored. If
False, mirroring is disable. If "all", axis lines are mirrored
on all shared-axes subplots. If "allticks", axis lines and
ticks are mirrored on all shared-axes subplots.
The 'mirror' property is an enumeration that may be specified as:
- One of the following enumeration values:
[True, 'ticks', False, 'all', 'allticks']
Returns
-------
Any
"""
return self["mirror"] | [
"def",
"mirror",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"mirror\"",
"]"
] | [
575,
4
] | [
592,
29
] | python | en | ['en', 'error', 'th'] | False |
XAxis.nticks | (self) |
Specifies the maximum number of ticks for the particular axis.
The actual number of ticks will be chosen automatically to be
less than or equal to `nticks`. Has an effect only if
`tickmode` is set to "auto".
The 'nticks' property is a integer and may be specified as:
- An int (or float that will be cast to an int)
in the interval [0, 9223372036854775807]
Returns
-------
int
|
Specifies the maximum number of ticks for the particular axis.
The actual number of ticks will be chosen automatically to be
less than or equal to `nticks`. Has an effect only if
`tickmode` is set to "auto".
The 'nticks' property is a integer and may be specified as:
- An int (or float that will be cast to an int)
in the interval [0, 9223372036854775807] | def nticks(self):
"""
Specifies the maximum number of ticks for the particular axis.
The actual number of ticks will be chosen automatically to be
less than or equal to `nticks`. Has an effect only if
`tickmode` is set to "auto".
The 'nticks' property is a integer and may be specified as:
- An int (or float that will be cast to an int)
in the interval [0, 9223372036854775807]
Returns
-------
int
"""
return self["nticks"] | [
"def",
"nticks",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"nticks\"",
"]"
] | [
601,
4
] | [
616,
29
] | python | en | ['en', 'error', 'th'] | False |
XAxis.range | (self) |
Sets the range of this axis. If the axis `type` is "log", then
you must take the log of your desired range (e.g. to set the
range from 1 to 100, set the range from 0 to 2). If the axis
`type` is "date", it should be date strings, like date data,
though Date objects and unix milliseconds will be accepted and
converted to strings. If the axis `type` is "category", it
should be numbers, using the scale where each category is
assigned a serial number from zero in the order it appears.
The 'range' property is an info array that may be specified as:
* a list or tuple of 2 elements where:
(0) The 'range[0]' property accepts values of any type
(1) The 'range[1]' property accepts values of any type
Returns
-------
list
|
Sets the range of this axis. If the axis `type` is "log", then
you must take the log of your desired range (e.g. to set the
range from 1 to 100, set the range from 0 to 2). If the axis
`type` is "date", it should be date strings, like date data,
though Date objects and unix milliseconds will be accepted and
converted to strings. If the axis `type` is "category", it
should be numbers, using the scale where each category is
assigned a serial number from zero in the order it appears.
The 'range' property is an info array that may be specified as:
* a list or tuple of 2 elements where:
(0) The 'range[0]' property accepts values of any type
(1) The 'range[1]' property accepts values of any type | def range(self):
"""
Sets the range of this axis. If the axis `type` is "log", then
you must take the log of your desired range (e.g. to set the
range from 1 to 100, set the range from 0 to 2). If the axis
`type` is "date", it should be date strings, like date data,
though Date objects and unix milliseconds will be accepted and
converted to strings. If the axis `type` is "category", it
should be numbers, using the scale where each category is
assigned a serial number from zero in the order it appears.
The 'range' property is an info array that may be specified as:
* a list or tuple of 2 elements where:
(0) The 'range[0]' property accepts values of any type
(1) The 'range[1]' property accepts values of any type
Returns
-------
list
"""
return self["range"] | [
"def",
"range",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"range\"",
"]"
] | [
625,
4
] | [
646,
28
] | python | en | ['en', 'error', 'th'] | False |
XAxis.rangemode | (self) |
If "normal", the range is computed in relation to the extrema
of the input data. If *tozero*`, the range extends to 0,
regardless of the input data If "nonnegative", the range is
non-negative, regardless of the input data. Applies only to
linear axes.
The 'rangemode' property is an enumeration that may be specified as:
- One of the following enumeration values:
['normal', 'tozero', 'nonnegative']
Returns
-------
Any
|
If "normal", the range is computed in relation to the extrema
of the input data. If *tozero*`, the range extends to 0,
regardless of the input data If "nonnegative", the range is
non-negative, regardless of the input data. Applies only to
linear axes.
The 'rangemode' property is an enumeration that may be specified as:
- One of the following enumeration values:
['normal', 'tozero', 'nonnegative'] | def rangemode(self):
"""
If "normal", the range is computed in relation to the extrema
of the input data. If *tozero*`, the range extends to 0,
regardless of the input data If "nonnegative", the range is
non-negative, regardless of the input data. Applies only to
linear axes.
The 'rangemode' property is an enumeration that may be specified as:
- One of the following enumeration values:
['normal', 'tozero', 'nonnegative']
Returns
-------
Any
"""
return self["rangemode"] | [
"def",
"rangemode",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"rangemode\"",
"]"
] | [
655,
4
] | [
671,
32
] | python | en | ['en', 'error', 'th'] | False |
XAxis.separatethousands | (self) |
If "true", even 4-digit integers are separated
The 'separatethousands' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
If "true", even 4-digit integers are separated
The 'separatethousands' property must be specified as a bool
(either True, or False) | def separatethousands(self):
"""
If "true", even 4-digit integers are separated
The 'separatethousands' property must be specified as a bool
(either True, or False)
Returns
-------
bool
"""
return self["separatethousands"] | [
"def",
"separatethousands",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"separatethousands\"",
"]"
] | [
680,
4
] | [
691,
40
] | python | en | ['en', 'error', 'th'] | False |
XAxis.showaxeslabels | (self) |
Sets whether or not this axis is labeled
The 'showaxeslabels' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
Sets whether or not this axis is labeled
The 'showaxeslabels' property must be specified as a bool
(either True, or False) | def showaxeslabels(self):
"""
Sets whether or not this axis is labeled
The 'showaxeslabels' property must be specified as a bool
(either True, or False)
Returns
-------
bool
"""
return self["showaxeslabels"] | [
"def",
"showaxeslabels",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"showaxeslabels\"",
"]"
] | [
700,
4
] | [
711,
37
] | python | en | ['en', 'error', 'th'] | False |
XAxis.showbackground | (self) |
Sets whether or not this axis' wall has a background color.
The 'showbackground' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
Sets whether or not this axis' wall has a background color.
The 'showbackground' property must be specified as a bool
(either True, or False) | def showbackground(self):
"""
Sets whether or not this axis' wall has a background color.
The 'showbackground' property must be specified as a bool
(either True, or False)
Returns
-------
bool
"""
return self["showbackground"] | [
"def",
"showbackground",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"showbackground\"",
"]"
] | [
720,
4
] | [
731,
37
] | python | en | ['en', 'error', 'th'] | False |
XAxis.showexponent | (self) |
If "all", all exponents are shown besides their significands.
If "first", only the exponent of the first tick is shown. If
"last", only the exponent of the last tick is shown. If "none",
no exponents appear.
The 'showexponent' property is an enumeration that may be specified as:
- One of the following enumeration values:
['all', 'first', 'last', 'none']
Returns
-------
Any
|
If "all", all exponents are shown besides their significands.
If "first", only the exponent of the first tick is shown. If
"last", only the exponent of the last tick is shown. If "none",
no exponents appear.
The 'showexponent' property is an enumeration that may be specified as:
- One of the following enumeration values:
['all', 'first', 'last', 'none'] | def showexponent(self):
"""
If "all", all exponents are shown besides their significands.
If "first", only the exponent of the first tick is shown. If
"last", only the exponent of the last tick is shown. If "none",
no exponents appear.
The 'showexponent' property is an enumeration that may be specified as:
- One of the following enumeration values:
['all', 'first', 'last', 'none']
Returns
-------
Any
"""
return self["showexponent"] | [
"def",
"showexponent",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"showexponent\"",
"]"
] | [
740,
4
] | [
755,
35
] | python | en | ['en', 'error', 'th'] | False |
XAxis.showgrid | (self) |
Determines whether or not grid lines are drawn. If True, the
grid lines are drawn at every tick mark.
The 'showgrid' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
Determines whether or not grid lines are drawn. If True, the
grid lines are drawn at every tick mark.
The 'showgrid' property must be specified as a bool
(either True, or False) | def showgrid(self):
"""
Determines whether or not grid lines are drawn. If True, the
grid lines are drawn at every tick mark.
The 'showgrid' property must be specified as a bool
(either True, or False)
Returns
-------
bool
"""
return self["showgrid"] | [
"def",
"showgrid",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"showgrid\"",
"]"
] | [
764,
4
] | [
776,
31
] | python | en | ['en', 'error', 'th'] | False |
XAxis.showline | (self) |
Determines whether or not a line bounding this axis is drawn.
The 'showline' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
Determines whether or not a line bounding this axis is drawn.
The 'showline' property must be specified as a bool
(either True, or False) | def showline(self):
"""
Determines whether or not a line bounding this axis is drawn.
The 'showline' property must be specified as a bool
(either True, or False)
Returns
-------
bool
"""
return self["showline"] | [
"def",
"showline",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"showline\"",
"]"
] | [
785,
4
] | [
796,
31
] | python | en | ['en', 'error', 'th'] | False |
XAxis.showspikes | (self) |
Sets whether or not spikes starting from data points to this
axis' wall are shown on hover.
The 'showspikes' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
Sets whether or not spikes starting from data points to this
axis' wall are shown on hover.
The 'showspikes' property must be specified as a bool
(either True, or False) | def showspikes(self):
"""
Sets whether or not spikes starting from data points to this
axis' wall are shown on hover.
The 'showspikes' property must be specified as a bool
(either True, or False)
Returns
-------
bool
"""
return self["showspikes"] | [
"def",
"showspikes",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"showspikes\"",
"]"
] | [
805,
4
] | [
817,
33
] | python | en | ['en', 'error', 'th'] | False |
XAxis.showticklabels | (self) |
Determines whether or not the tick labels are drawn.
The 'showticklabels' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
Determines whether or not the tick labels are drawn.
The 'showticklabels' property must be specified as a bool
(either True, or False) | def showticklabels(self):
"""
Determines whether or not the tick labels are drawn.
The 'showticklabels' property must be specified as a bool
(either True, or False)
Returns
-------
bool
"""
return self["showticklabels"] | [
"def",
"showticklabels",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"showticklabels\"",
"]"
] | [
826,
4
] | [
837,
37
] | python | en | ['en', 'error', 'th'] | False |
XAxis.showtickprefix | (self) |
If "all", all tick labels are displayed with a prefix. If
"first", only the first tick is displayed with a prefix. If
"last", only the last tick is displayed with a suffix. If
"none", tick prefixes are hidden.
The 'showtickprefix' property is an enumeration that may be specified as:
- One of the following enumeration values:
['all', 'first', 'last', 'none']
Returns
-------
Any
|
If "all", all tick labels are displayed with a prefix. If
"first", only the first tick is displayed with a prefix. If
"last", only the last tick is displayed with a suffix. If
"none", tick prefixes are hidden.
The 'showtickprefix' property is an enumeration that may be specified as:
- One of the following enumeration values:
['all', 'first', 'last', 'none'] | def showtickprefix(self):
"""
If "all", all tick labels are displayed with a prefix. If
"first", only the first tick is displayed with a prefix. If
"last", only the last tick is displayed with a suffix. If
"none", tick prefixes are hidden.
The 'showtickprefix' property is an enumeration that may be specified as:
- One of the following enumeration values:
['all', 'first', 'last', 'none']
Returns
-------
Any
"""
return self["showtickprefix"] | [
"def",
"showtickprefix",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"showtickprefix\"",
"]"
] | [
846,
4
] | [
861,
37
] | python | en | ['en', 'error', 'th'] | False |
XAxis.showticksuffix | (self) |
Same as `showtickprefix` but for tick suffixes.
The 'showticksuffix' property is an enumeration that may be specified as:
- One of the following enumeration values:
['all', 'first', 'last', 'none']
Returns
-------
Any
|
Same as `showtickprefix` but for tick suffixes.
The 'showticksuffix' property is an enumeration that may be specified as:
- One of the following enumeration values:
['all', 'first', 'last', 'none'] | def showticksuffix(self):
"""
Same as `showtickprefix` but for tick suffixes.
The 'showticksuffix' property is an enumeration that may be specified as:
- One of the following enumeration values:
['all', 'first', 'last', 'none']
Returns
-------
Any
"""
return self["showticksuffix"] | [
"def",
"showticksuffix",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"showticksuffix\"",
"]"
] | [
870,
4
] | [
882,
37
] | python | en | ['en', 'error', 'th'] | False |
XAxis.spikecolor | (self) |
Sets the color of the spikes.
The 'spikecolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
Returns
-------
str
|
Sets the color of the spikes.
The 'spikecolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen | def spikecolor(self):
"""
Sets the color of the spikes.
The 'spikecolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
Returns
-------
str
"""
return self["spikecolor"] | [
"def",
"spikecolor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"spikecolor\"",
"]"
] | [
891,
4
] | [
941,
33
] | python | en | ['en', 'error', 'th'] | False |
XAxis.spikesides | (self) |
Sets whether or not spikes extending from the projection data
points to this axis' wall boundaries are shown on hover.
The 'spikesides' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
Sets whether or not spikes extending from the projection data
points to this axis' wall boundaries are shown on hover.
The 'spikesides' property must be specified as a bool
(either True, or False) | def spikesides(self):
"""
Sets whether or not spikes extending from the projection data
points to this axis' wall boundaries are shown on hover.
The 'spikesides' property must be specified as a bool
(either True, or False)
Returns
-------
bool
"""
return self["spikesides"] | [
"def",
"spikesides",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"spikesides\"",
"]"
] | [
950,
4
] | [
962,
33
] | python | en | ['en', 'error', 'th'] | False |
XAxis.spikethickness | (self) |
Sets the thickness (in px) of the spikes.
The 'spikethickness' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
|
Sets the thickness (in px) of the spikes.
The 'spikethickness' property is a number and may be specified as:
- An int or float in the interval [0, inf] | def spikethickness(self):
"""
Sets the thickness (in px) of the spikes.
The 'spikethickness' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
"""
return self["spikethickness"] | [
"def",
"spikethickness",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"spikethickness\"",
"]"
] | [
971,
4
] | [
982,
37
] | python | en | ['en', 'error', 'th'] | False |
XAxis.tick0 | (self) |
Sets the placement of the first tick on this axis. Use with
`dtick`. If the axis `type` is "log", then you must take the
log of your starting tick (e.g. to set the starting tick to
100, set the `tick0` to 2) except when `dtick`=*L<f>* (see
`dtick` for more info). If the axis `type` is "date", it should
be a date string, like date data. If the axis `type` is
"category", it should be a number, using the scale where each
category is assigned a serial number from zero in the order it
appears.
The 'tick0' property accepts values of any type
Returns
-------
Any
|
Sets the placement of the first tick on this axis. Use with
`dtick`. If the axis `type` is "log", then you must take the
log of your starting tick (e.g. to set the starting tick to
100, set the `tick0` to 2) except when `dtick`=*L<f>* (see
`dtick` for more info). If the axis `type` is "date", it should
be a date string, like date data. If the axis `type` is
"category", it should be a number, using the scale where each
category is assigned a serial number from zero in the order it
appears.
The 'tick0' property accepts values of any type | def tick0(self):
"""
Sets the placement of the first tick on this axis. Use with
`dtick`. If the axis `type` is "log", then you must take the
log of your starting tick (e.g. to set the starting tick to
100, set the `tick0` to 2) except when `dtick`=*L<f>* (see
`dtick` for more info). If the axis `type` is "date", it should
be a date string, like date data. If the axis `type` is
"category", it should be a number, using the scale where each
category is assigned a serial number from zero in the order it
appears.
The 'tick0' property accepts values of any type
Returns
-------
Any
"""
return self["tick0"] | [
"def",
"tick0",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"tick0\"",
"]"
] | [
991,
4
] | [
1009,
28
] | python | en | ['en', 'error', 'th'] | False |
XAxis.tickangle | (self) |
Sets the angle of the tick labels with respect to the
horizontal. For example, a `tickangle` of -90 draws the tick
labels vertically.
The 'tickangle' property is a angle (in degrees) that may be
specified as a number between -180 and 180. Numeric values outside this
range are converted to the equivalent value
(e.g. 270 is converted to -90).
Returns
-------
int|float
|
Sets the angle of the tick labels with respect to the
horizontal. For example, a `tickangle` of -90 draws the tick
labels vertically.
The 'tickangle' property is a angle (in degrees) that may be
specified as a number between -180 and 180. Numeric values outside this
range are converted to the equivalent value
(e.g. 270 is converted to -90). | def tickangle(self):
"""
Sets the angle of the tick labels with respect to the
horizontal. For example, a `tickangle` of -90 draws the tick
labels vertically.
The 'tickangle' property is a angle (in degrees) that may be
specified as a number between -180 and 180. Numeric values outside this
range are converted to the equivalent value
(e.g. 270 is converted to -90).
Returns
-------
int|float
"""
return self["tickangle"] | [
"def",
"tickangle",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"tickangle\"",
"]"
] | [
1018,
4
] | [
1033,
32
] | python | en | ['en', 'error', 'th'] | False |
XAxis.tickcolor | (self) |
Sets the tick color.
The 'tickcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
Returns
-------
str
|
Sets the tick color.
The 'tickcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen | def tickcolor(self):
"""
Sets the tick color.
The 'tickcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
Returns
-------
str
"""
return self["tickcolor"] | [
"def",
"tickcolor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"tickcolor\"",
"]"
] | [
1042,
4
] | [
1092,
32
] | python | en | ['en', 'error', 'th'] | False |
XAxis.tickfont | (self) |
Sets the tick font.
The 'tickfont' property is an instance of Tickfont
that may be specified as:
- An instance of :class:`plotly.graph_objs.layout.scene.xaxis.Tickfont`
- A dict of string/value properties that will be passed
to the Tickfont constructor
Supported dict properties:
color
family
HTML font family - the typeface that will be
applied by the web browser. The web browser
will only be able to apply a font if it is
available on the system which it operates.
Provide multiple font families, separated by
commas, to indicate the preference in which to
apply fonts if they aren't available on the
system. The Chart Studio Cloud (at
https://chart-studio.plotly.com or on-premise)
generates images on a server, where only a
select number of fonts are installed and
supported. These include "Arial", "Balto",
"Courier New", "Droid Sans",, "Droid Serif",
"Droid Sans Mono", "Gravitas One", "Old
Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
size
Returns
-------
plotly.graph_objs.layout.scene.xaxis.Tickfont
|
Sets the tick font.
The 'tickfont' property is an instance of Tickfont
that may be specified as:
- An instance of :class:`plotly.graph_objs.layout.scene.xaxis.Tickfont`
- A dict of string/value properties that will be passed
to the Tickfont constructor
Supported dict properties:
color
family
HTML font family - the typeface that will be
applied by the web browser. The web browser
will only be able to apply a font if it is
available on the system which it operates.
Provide multiple font families, separated by
commas, to indicate the preference in which to
apply fonts if they aren't available on the
system. The Chart Studio Cloud (at
https://chart-studio.plotly.com or on-premise)
generates images on a server, where only a
select number of fonts are installed and
supported. These include "Arial", "Balto",
"Courier New", "Droid Sans",, "Droid Serif",
"Droid Sans Mono", "Gravitas One", "Old
Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
size | def tickfont(self):
"""
Sets the tick font.
The 'tickfont' property is an instance of Tickfont
that may be specified as:
- An instance of :class:`plotly.graph_objs.layout.scene.xaxis.Tickfont`
- A dict of string/value properties that will be passed
to the Tickfont constructor
Supported dict properties:
color
family
HTML font family - the typeface that will be
applied by the web browser. The web browser
will only be able to apply a font if it is
available on the system which it operates.
Provide multiple font families, separated by
commas, to indicate the preference in which to
apply fonts if they aren't available on the
system. The Chart Studio Cloud (at
https://chart-studio.plotly.com or on-premise)
generates images on a server, where only a
select number of fonts are installed and
supported. These include "Arial", "Balto",
"Courier New", "Droid Sans",, "Droid Serif",
"Droid Sans Mono", "Gravitas One", "Old
Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
size
Returns
-------
plotly.graph_objs.layout.scene.xaxis.Tickfont
"""
return self["tickfont"] | [
"def",
"tickfont",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"tickfont\"",
"]"
] | [
1101,
4
] | [
1138,
31
] | python | en | ['en', 'error', 'th'] | False |
XAxis.tickformat | (self) |
Sets the tick label formatting rule using d3 formatting mini-
languages which are very similar to those in Python. For
numbers, see: https://github.com/d3/d3-3.x-api-
reference/blob/master/Formatting.md#d3_format And for dates
see: https://github.com/d3/d3-3.x-api-
reference/blob/master/Time-Formatting.md#format We add one item
to d3's date formatter: "%{n}f" for fractional seconds with n
digits. For example, *2016-10-13 09:15:23.456* with tickformat
"%H~%M~%S.%2f" would display "09~15~23.46"
The 'tickformat' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
|
Sets the tick label formatting rule using d3 formatting mini-
languages which are very similar to those in Python. For
numbers, see: https://github.com/d3/d3-3.x-api-
reference/blob/master/Formatting.md#d3_format And for dates
see: https://github.com/d3/d3-3.x-api-
reference/blob/master/Time-Formatting.md#format We add one item
to d3's date formatter: "%{n}f" for fractional seconds with n
digits. For example, *2016-10-13 09:15:23.456* with tickformat
"%H~%M~%S.%2f" would display "09~15~23.46"
The 'tickformat' property is a string and must be specified as:
- A string
- A number that will be converted to a string | def tickformat(self):
"""
Sets the tick label formatting rule using d3 formatting mini-
languages which are very similar to those in Python. For
numbers, see: https://github.com/d3/d3-3.x-api-
reference/blob/master/Formatting.md#d3_format And for dates
see: https://github.com/d3/d3-3.x-api-
reference/blob/master/Time-Formatting.md#format We add one item
to d3's date formatter: "%{n}f" for fractional seconds with n
digits. For example, *2016-10-13 09:15:23.456* with tickformat
"%H~%M~%S.%2f" would display "09~15~23.46"
The 'tickformat' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
"""
return self["tickformat"] | [
"def",
"tickformat",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"tickformat\"",
"]"
] | [
1147,
4
] | [
1167,
33
] | python | en | ['en', 'error', 'th'] | False |
XAxis.tickformatstops | (self) |
The 'tickformatstops' property is a tuple of instances of
Tickformatstop that may be specified as:
- A list or tuple of instances of plotly.graph_objs.layout.scene.xaxis.Tickformatstop
- A list or tuple of dicts of string/value properties that
will be passed to the Tickformatstop constructor
Supported dict properties:
dtickrange
range [*min*, *max*], where "min", "max" -
dtick values which describe some zoom level, it
is possible to omit "min" or "max" value by
passing "null"
enabled
Determines whether or not this stop is used. If
`false`, this stop is ignored even within its
`dtickrange`.
name
When used in a template, named items are
created in the output figure in addition to any
items the figure already has in this array. You
can modify these items in the output figure by
making your own item with `templateitemname`
matching this `name` alongside your
modifications (including `visible: false` or
`enabled: false` to hide it). Has no effect
outside of a template.
templateitemname
Used to refer to a named item in this array in
the template. Named items from the template
will be created even without a matching item in
the input figure, but you can modify one by
making an item with `templateitemname` matching
its `name`, alongside your modifications
(including `visible: false` or `enabled: false`
to hide it). If there is no template or no
matching item, this item will be hidden unless
you explicitly show it with `visible: true`.
value
string - dtickformat for described zoom level,
the same as "tickformat"
Returns
-------
tuple[plotly.graph_objs.layout.scene.xaxis.Tickformatstop]
|
The 'tickformatstops' property is a tuple of instances of
Tickformatstop that may be specified as:
- A list or tuple of instances of plotly.graph_objs.layout.scene.xaxis.Tickformatstop
- A list or tuple of dicts of string/value properties that
will be passed to the Tickformatstop constructor
Supported dict properties:
dtickrange
range [*min*, *max*], where "min", "max" -
dtick values which describe some zoom level, it
is possible to omit "min" or "max" value by
passing "null"
enabled
Determines whether or not this stop is used. If
`false`, this stop is ignored even within its
`dtickrange`.
name
When used in a template, named items are
created in the output figure in addition to any
items the figure already has in this array. You
can modify these items in the output figure by
making your own item with `templateitemname`
matching this `name` alongside your
modifications (including `visible: false` or
`enabled: false` to hide it). Has no effect
outside of a template.
templateitemname
Used to refer to a named item in this array in
the template. Named items from the template
will be created even without a matching item in
the input figure, but you can modify one by
making an item with `templateitemname` matching
its `name`, alongside your modifications
(including `visible: false` or `enabled: false`
to hide it). If there is no template or no
matching item, this item will be hidden unless
you explicitly show it with `visible: true`.
value
string - dtickformat for described zoom level,
the same as "tickformat" | def tickformatstops(self):
"""
The 'tickformatstops' property is a tuple of instances of
Tickformatstop that may be specified as:
- A list or tuple of instances of plotly.graph_objs.layout.scene.xaxis.Tickformatstop
- A list or tuple of dicts of string/value properties that
will be passed to the Tickformatstop constructor
Supported dict properties:
dtickrange
range [*min*, *max*], where "min", "max" -
dtick values which describe some zoom level, it
is possible to omit "min" or "max" value by
passing "null"
enabled
Determines whether or not this stop is used. If
`false`, this stop is ignored even within its
`dtickrange`.
name
When used in a template, named items are
created in the output figure in addition to any
items the figure already has in this array. You
can modify these items in the output figure by
making your own item with `templateitemname`
matching this `name` alongside your
modifications (including `visible: false` or
`enabled: false` to hide it). Has no effect
outside of a template.
templateitemname
Used to refer to a named item in this array in
the template. Named items from the template
will be created even without a matching item in
the input figure, but you can modify one by
making an item with `templateitemname` matching
its `name`, alongside your modifications
(including `visible: false` or `enabled: false`
to hide it). If there is no template or no
matching item, this item will be hidden unless
you explicitly show it with `visible: true`.
value
string - dtickformat for described zoom level,
the same as "tickformat"
Returns
-------
tuple[plotly.graph_objs.layout.scene.xaxis.Tickformatstop]
"""
return self["tickformatstops"] | [
"def",
"tickformatstops",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"tickformatstops\"",
"]"
] | [
1176,
4
] | [
1224,
38
] | python | en | ['en', 'error', 'th'] | False |
XAxis.tickformatstopdefaults | (self) |
When used in a template (as
layout.template.layout.scene.xaxis.tickformatstopdefaults),
sets the default property values to use for elements of
layout.scene.xaxis.tickformatstops
The 'tickformatstopdefaults' property is an instance of Tickformatstop
that may be specified as:
- An instance of :class:`plotly.graph_objs.layout.scene.xaxis.Tickformatstop`
- A dict of string/value properties that will be passed
to the Tickformatstop constructor
Supported dict properties:
Returns
-------
plotly.graph_objs.layout.scene.xaxis.Tickformatstop
|
When used in a template (as
layout.template.layout.scene.xaxis.tickformatstopdefaults),
sets the default property values to use for elements of
layout.scene.xaxis.tickformatstops
The 'tickformatstopdefaults' property is an instance of Tickformatstop
that may be specified as:
- An instance of :class:`plotly.graph_objs.layout.scene.xaxis.Tickformatstop`
- A dict of string/value properties that will be passed
to the Tickformatstop constructor
Supported dict properties: | def tickformatstopdefaults(self):
"""
When used in a template (as
layout.template.layout.scene.xaxis.tickformatstopdefaults),
sets the default property values to use for elements of
layout.scene.xaxis.tickformatstops
The 'tickformatstopdefaults' property is an instance of Tickformatstop
that may be specified as:
- An instance of :class:`plotly.graph_objs.layout.scene.xaxis.Tickformatstop`
- A dict of string/value properties that will be passed
to the Tickformatstop constructor
Supported dict properties:
Returns
-------
plotly.graph_objs.layout.scene.xaxis.Tickformatstop
"""
return self["tickformatstopdefaults"] | [
"def",
"tickformatstopdefaults",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"tickformatstopdefaults\"",
"]"
] | [
1233,
4
] | [
1252,
45
] | python | en | ['en', 'error', 'th'] | False |
XAxis.ticklen | (self) |
Sets the tick length (in px).
The 'ticklen' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
|
Sets the tick length (in px).
The 'ticklen' property is a number and may be specified as:
- An int or float in the interval [0, inf] | def ticklen(self):
"""
Sets the tick length (in px).
The 'ticklen' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
"""
return self["ticklen"] | [
"def",
"ticklen",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"ticklen\"",
"]"
] | [
1261,
4
] | [
1272,
30
] | python | en | ['en', 'error', 'th'] | False |
XAxis.tickmode | (self) |
Sets the tick mode for this axis. If "auto", the number of
ticks is set via `nticks`. If "linear", the placement of the
ticks is determined by a starting position `tick0` and a tick
step `dtick` ("linear" is the default value if `tick0` and
`dtick` are provided). If "array", the placement of the ticks
is set via `tickvals` and the tick text is `ticktext`. ("array"
is the default value if `tickvals` is provided).
The 'tickmode' property is an enumeration that may be specified as:
- One of the following enumeration values:
['auto', 'linear', 'array']
Returns
-------
Any
|
Sets the tick mode for this axis. If "auto", the number of
ticks is set via `nticks`. If "linear", the placement of the
ticks is determined by a starting position `tick0` and a tick
step `dtick` ("linear" is the default value if `tick0` and
`dtick` are provided). If "array", the placement of the ticks
is set via `tickvals` and the tick text is `ticktext`. ("array"
is the default value if `tickvals` is provided).
The 'tickmode' property is an enumeration that may be specified as:
- One of the following enumeration values:
['auto', 'linear', 'array'] | def tickmode(self):
"""
Sets the tick mode for this axis. If "auto", the number of
ticks is set via `nticks`. If "linear", the placement of the
ticks is determined by a starting position `tick0` and a tick
step `dtick` ("linear" is the default value if `tick0` and
`dtick` are provided). If "array", the placement of the ticks
is set via `tickvals` and the tick text is `ticktext`. ("array"
is the default value if `tickvals` is provided).
The 'tickmode' property is an enumeration that may be specified as:
- One of the following enumeration values:
['auto', 'linear', 'array']
Returns
-------
Any
"""
return self["tickmode"] | [
"def",
"tickmode",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"tickmode\"",
"]"
] | [
1281,
4
] | [
1299,
31
] | python | en | ['en', 'error', 'th'] | False |
XAxis.tickprefix | (self) |
Sets a tick label prefix.
The 'tickprefix' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
|
Sets a tick label prefix.
The 'tickprefix' property is a string and must be specified as:
- A string
- A number that will be converted to a string | def tickprefix(self):
"""
Sets a tick label prefix.
The 'tickprefix' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
"""
return self["tickprefix"] | [
"def",
"tickprefix",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"tickprefix\"",
"]"
] | [
1308,
4
] | [
1320,
33
] | python | en | ['en', 'error', 'th'] | False |
XAxis.ticks | (self) |
Determines whether ticks are drawn or not. If "", this axis'
ticks are not drawn. If "outside" ("inside"), this axis' are
drawn outside (inside) the axis lines.
The 'ticks' property is an enumeration that may be specified as:
- One of the following enumeration values:
['outside', 'inside', '']
Returns
-------
Any
|
Determines whether ticks are drawn or not. If "", this axis'
ticks are not drawn. If "outside" ("inside"), this axis' are
drawn outside (inside) the axis lines.
The 'ticks' property is an enumeration that may be specified as:
- One of the following enumeration values:
['outside', 'inside', ''] | def ticks(self):
"""
Determines whether ticks are drawn or not. If "", this axis'
ticks are not drawn. If "outside" ("inside"), this axis' are
drawn outside (inside) the axis lines.
The 'ticks' property is an enumeration that may be specified as:
- One of the following enumeration values:
['outside', 'inside', '']
Returns
-------
Any
"""
return self["ticks"] | [
"def",
"ticks",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"ticks\"",
"]"
] | [
1329,
4
] | [
1343,
28
] | python | en | ['en', 'error', 'th'] | False |
XAxis.ticksuffix | (self) |
Sets a tick label suffix.
The 'ticksuffix' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
|
Sets a tick label suffix.
The 'ticksuffix' property is a string and must be specified as:
- A string
- A number that will be converted to a string | def ticksuffix(self):
"""
Sets a tick label suffix.
The 'ticksuffix' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
"""
return self["ticksuffix"] | [
"def",
"ticksuffix",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"ticksuffix\"",
"]"
] | [
1352,
4
] | [
1364,
33
] | python | en | ['en', 'error', 'th'] | False |
XAxis.ticktext | (self) |
Sets the text displayed at the ticks position via `tickvals`.
Only has an effect if `tickmode` is set to "array". Used with
`tickvals`.
The 'ticktext' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
|
Sets the text displayed at the ticks position via `tickvals`.
Only has an effect if `tickmode` is set to "array". Used with
`tickvals`.
The 'ticktext' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | def ticktext(self):
"""
Sets the text displayed at the ticks position via `tickvals`.
Only has an effect if `tickmode` is set to "array". Used with
`tickvals`.
The 'ticktext' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
"""
return self["ticktext"] | [
"def",
"ticktext",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"ticktext\"",
"]"
] | [
1373,
4
] | [
1386,
31
] | python | en | ['en', 'error', 'th'] | False |
XAxis.ticktextsrc | (self) |
Sets the source reference on Chart Studio Cloud for ticktext .
The 'ticktextsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for ticktext .
The 'ticktextsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def ticktextsrc(self):
"""
Sets the source reference on Chart Studio Cloud for ticktext .
The 'ticktextsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["ticktextsrc"] | [
"def",
"ticktextsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"ticktextsrc\"",
"]"
] | [
1395,
4
] | [
1406,
34
] | python | en | ['en', 'error', 'th'] | False |
XAxis.tickvals | (self) |
Sets the values at which ticks on this axis appear. Only has an
effect if `tickmode` is set to "array". Used with `ticktext`.
The 'tickvals' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
|
Sets the values at which ticks on this axis appear. Only has an
effect if `tickmode` is set to "array". Used with `ticktext`.
The 'tickvals' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | def tickvals(self):
"""
Sets the values at which ticks on this axis appear. Only has an
effect if `tickmode` is set to "array". Used with `ticktext`.
The 'tickvals' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
"""
return self["tickvals"] | [
"def",
"tickvals",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"tickvals\"",
"]"
] | [
1415,
4
] | [
1427,
31
] | python | en | ['en', 'error', 'th'] | False |
XAxis.tickvalssrc | (self) |
Sets the source reference on Chart Studio Cloud for tickvals .
The 'tickvalssrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for tickvals .
The 'tickvalssrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def tickvalssrc(self):
"""
Sets the source reference on Chart Studio Cloud for tickvals .
The 'tickvalssrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["tickvalssrc"] | [
"def",
"tickvalssrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"tickvalssrc\"",
"]"
] | [
1436,
4
] | [
1447,
34
] | python | en | ['en', 'error', 'th'] | False |
XAxis.tickwidth | (self) |
Sets the tick width (in px).
The 'tickwidth' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
|
Sets the tick width (in px).
The 'tickwidth' property is a number and may be specified as:
- An int or float in the interval [0, inf] | def tickwidth(self):
"""
Sets the tick width (in px).
The 'tickwidth' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
"""
return self["tickwidth"] | [
"def",
"tickwidth",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"tickwidth\"",
"]"
] | [
1456,
4
] | [
1467,
32
] | python | en | ['en', 'error', 'th'] | False |
XAxis.title | (self) |
The 'title' property is an instance of Title
that may be specified as:
- An instance of :class:`plotly.graph_objs.layout.scene.xaxis.Title`
- A dict of string/value properties that will be passed
to the Title constructor
Supported dict properties:
font
Sets this axis' title font. Note that the
title's font used to be customized by the now
deprecated `titlefont` attribute.
text
Sets the title of this axis. Note that before
the existence of `title.text`, the title's
contents used to be defined as the `title`
attribute itself. This behavior has been
deprecated.
Returns
-------
plotly.graph_objs.layout.scene.xaxis.Title
|
The 'title' property is an instance of Title
that may be specified as:
- An instance of :class:`plotly.graph_objs.layout.scene.xaxis.Title`
- A dict of string/value properties that will be passed
to the Title constructor
Supported dict properties:
font
Sets this axis' title font. Note that the
title's font used to be customized by the now
deprecated `titlefont` attribute.
text
Sets the title of this axis. Note that before
the existence of `title.text`, the title's
contents used to be defined as the `title`
attribute itself. This behavior has been
deprecated. | def title(self):
"""
The 'title' property is an instance of Title
that may be specified as:
- An instance of :class:`plotly.graph_objs.layout.scene.xaxis.Title`
- A dict of string/value properties that will be passed
to the Title constructor
Supported dict properties:
font
Sets this axis' title font. Note that the
title's font used to be customized by the now
deprecated `titlefont` attribute.
text
Sets the title of this axis. Note that before
the existence of `title.text`, the title's
contents used to be defined as the `title`
attribute itself. This behavior has been
deprecated.
Returns
-------
plotly.graph_objs.layout.scene.xaxis.Title
"""
return self["title"] | [
"def",
"title",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"title\"",
"]"
] | [
1476,
4
] | [
1501,
28
] | python | en | ['en', 'error', 'th'] | False |
XAxis.titlefont | (self) |
Deprecated: Please use layout.scene.xaxis.title.font instead.
Sets this axis' title font. Note that the title's font used to
be customized by the now deprecated `titlefont` attribute.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.layout.scene.xaxis.title.Font`
- A dict of string/value properties that will be passed
to the Font constructor
Supported dict properties:
color
family
HTML font family - the typeface that will be
applied by the web browser. The web browser
will only be able to apply a font if it is
available on the system which it operates.
Provide multiple font families, separated by
commas, to indicate the preference in which to
apply fonts if they aren't available on the
system. The Chart Studio Cloud (at
https://chart-studio.plotly.com or on-premise)
generates images on a server, where only a
select number of fonts are installed and
supported. These include "Arial", "Balto",
"Courier New", "Droid Sans",, "Droid Serif",
"Droid Sans Mono", "Gravitas One", "Old
Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
size
Returns
-------
|
Deprecated: Please use layout.scene.xaxis.title.font instead.
Sets this axis' title font. Note that the title's font used to
be customized by the now deprecated `titlefont` attribute.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.layout.scene.xaxis.title.Font`
- A dict of string/value properties that will be passed
to the Font constructor
Supported dict properties:
color
family
HTML font family - the typeface that will be
applied by the web browser. The web browser
will only be able to apply a font if it is
available on the system which it operates.
Provide multiple font families, separated by
commas, to indicate the preference in which to
apply fonts if they aren't available on the
system. The Chart Studio Cloud (at
https://chart-studio.plotly.com or on-premise)
generates images on a server, where only a
select number of fonts are installed and
supported. These include "Arial", "Balto",
"Courier New", "Droid Sans",, "Droid Serif",
"Droid Sans Mono", "Gravitas One", "Old
Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
size | def titlefont(self):
"""
Deprecated: Please use layout.scene.xaxis.title.font instead.
Sets this axis' title font. Note that the title's font used to
be customized by the now deprecated `titlefont` attribute.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.layout.scene.xaxis.title.Font`
- A dict of string/value properties that will be passed
to the Font constructor
Supported dict properties:
color
family
HTML font family - the typeface that will be
applied by the web browser. The web browser
will only be able to apply a font if it is
available on the system which it operates.
Provide multiple font families, separated by
commas, to indicate the preference in which to
apply fonts if they aren't available on the
system. The Chart Studio Cloud (at
https://chart-studio.plotly.com or on-premise)
generates images on a server, where only a
select number of fonts are installed and
supported. These include "Arial", "Balto",
"Courier New", "Droid Sans",, "Droid Serif",
"Droid Sans Mono", "Gravitas One", "Old
Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
size
Returns
-------
"""
return self["titlefont"] | [
"def",
"titlefont",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"titlefont\"",
"]"
] | [
1510,
4
] | [
1549,
32
] | python | en | ['en', 'error', 'th'] | False |
XAxis.type | (self) |
Sets the axis type. By default, plotly attempts to determined
the axis type by looking into the data of the traces that
referenced the axis in question.
The 'type' property is an enumeration that may be specified as:
- One of the following enumeration values:
['-', 'linear', 'log', 'date', 'category']
Returns
-------
Any
|
Sets the axis type. By default, plotly attempts to determined
the axis type by looking into the data of the traces that
referenced the axis in question.
The 'type' property is an enumeration that may be specified as:
- One of the following enumeration values:
['-', 'linear', 'log', 'date', 'category'] | def type(self):
"""
Sets the axis type. By default, plotly attempts to determined
the axis type by looking into the data of the traces that
referenced the axis in question.
The 'type' property is an enumeration that may be specified as:
- One of the following enumeration values:
['-', 'linear', 'log', 'date', 'category']
Returns
-------
Any
"""
return self["type"] | [
"def",
"type",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"type\"",
"]"
] | [
1558,
4
] | [
1572,
27
] | python | en | ['en', 'error', 'th'] | False |
XAxis.visible | (self) |
A single toggle to hide the axis while preserving interaction
like dragging. Default is true when a cheater plot is present
on the axis, otherwise false
The 'visible' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
A single toggle to hide the axis while preserving interaction
like dragging. Default is true when a cheater plot is present
on the axis, otherwise false
The 'visible' property must be specified as a bool
(either True, or False) | def visible(self):
"""
A single toggle to hide the axis while preserving interaction
like dragging. Default is true when a cheater plot is present
on the axis, otherwise false
The 'visible' property must be specified as a bool
(either True, or False)
Returns
-------
bool
"""
return self["visible"] | [
"def",
"visible",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"visible\"",
"]"
] | [
1581,
4
] | [
1594,
30
] | python | en | ['en', 'error', 'th'] | False |
XAxis.zeroline | (self) |
Determines whether or not a line is drawn at along the 0 value
of this axis. If True, the zero line is drawn on top of the
grid lines.
The 'zeroline' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
Determines whether or not a line is drawn at along the 0 value
of this axis. If True, the zero line is drawn on top of the
grid lines.
The 'zeroline' property must be specified as a bool
(either True, or False) | def zeroline(self):
"""
Determines whether or not a line is drawn at along the 0 value
of this axis. If True, the zero line is drawn on top of the
grid lines.
The 'zeroline' property must be specified as a bool
(either True, or False)
Returns
-------
bool
"""
return self["zeroline"] | [
"def",
"zeroline",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"zeroline\"",
"]"
] | [
1603,
4
] | [
1616,
31
] | python | en | ['en', 'error', 'th'] | False |
XAxis.zerolinecolor | (self) |
Sets the line color of the zero line.
The 'zerolinecolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
Returns
-------
str
|
Sets the line color of the zero line.
The 'zerolinecolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen | def zerolinecolor(self):
"""
Sets the line color of the zero line.
The 'zerolinecolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
Returns
-------
str
"""
return self["zerolinecolor"] | [
"def",
"zerolinecolor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"zerolinecolor\"",
"]"
] | [
1625,
4
] | [
1675,
36
] | python | en | ['en', 'error', 'th'] | False |
XAxis.zerolinewidth | (self) |
Sets the width (in px) of the zero line.
The 'zerolinewidth' property is a number and may be specified as:
- An int or float
Returns
-------
int|float
|
Sets the width (in px) of the zero line.
The 'zerolinewidth' property is a number and may be specified as:
- An int or float | def zerolinewidth(self):
"""
Sets the width (in px) of the zero line.
The 'zerolinewidth' property is a number and may be specified as:
- An int or float
Returns
-------
int|float
"""
return self["zerolinewidth"] | [
"def",
"zerolinewidth",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"zerolinewidth\"",
"]"
] | [
1684,
4
] | [
1695,
36
] | python | en | ['en', 'error', 'th'] | False |
XAxis.__init__ | (
self,
arg=None,
autorange=None,
backgroundcolor=None,
calendar=None,
categoryarray=None,
categoryarraysrc=None,
categoryorder=None,
color=None,
dtick=None,
exponentformat=None,
gridcolor=None,
gridwidth=None,
hoverformat=None,
linecolor=None,
linewidth=None,
mirror=None,
nticks=None,
range=None,
rangemode=None,
separatethousands=None,
showaxeslabels=None,
showbackground=None,
showexponent=None,
showgrid=None,
showline=None,
showspikes=None,
showticklabels=None,
showtickprefix=None,
showticksuffix=None,
spikecolor=None,
spikesides=None,
spikethickness=None,
tick0=None,
tickangle=None,
tickcolor=None,
tickfont=None,
tickformat=None,
tickformatstops=None,
tickformatstopdefaults=None,
ticklen=None,
tickmode=None,
tickprefix=None,
ticks=None,
ticksuffix=None,
ticktext=None,
ticktextsrc=None,
tickvals=None,
tickvalssrc=None,
tickwidth=None,
title=None,
titlefont=None,
type=None,
visible=None,
zeroline=None,
zerolinecolor=None,
zerolinewidth=None,
**kwargs
) |
Construct a new XAxis object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.layout.scene.XAxis`
autorange
Determines whether or not the range of this axis is
computed in relation to the input data. See `rangemode`
for more info. If `range` is provided, then `autorange`
is set to False.
backgroundcolor
Sets the background color of this axis' wall.
calendar
Sets the calendar system to use for `range` and `tick0`
if this is a date axis. This does not set the calendar
for interpreting data on this axis, that's specified in
the trace or via the global `layout.calendar`
categoryarray
Sets the order in which categories on this axis appear.
Only has an effect if `categoryorder` is set to
"array". Used with `categoryorder`.
categoryarraysrc
Sets the source reference on Chart Studio Cloud for
categoryarray .
categoryorder
Specifies the ordering logic for the case of
categorical variables. By default, plotly uses "trace",
which specifies the order that is present in the data
supplied. Set `categoryorder` to *category ascending*
or *category descending* if order should be determined
by the alphanumerical order of the category names. Set
`categoryorder` to "array" to derive the ordering from
the attribute `categoryarray`. If a category is not
found in the `categoryarray` array, the sorting
behavior for that attribute will be identical to the
"trace" mode. The unspecified categories will follow
the categories in `categoryarray`. Set `categoryorder`
to *total ascending* or *total descending* if order
should be determined by the numerical order of the
values. Similarly, the order can be determined by the
min, max, sum, mean or median of all the values.
color
Sets default for all colors associated with this axis
all at once: line, font, tick, and grid colors. Grid
color is lightened by blending this with the plot
background Individual pieces can override this.
dtick
Sets the step in-between ticks on this axis. Use with
`tick0`. Must be a positive number, or special strings
available to "log" and "date" axes. If the axis `type`
is "log", then ticks are set every 10^(n*dtick) where n
is the tick number. For example, to set a tick mark at
1, 10, 100, 1000, ... set dtick to 1. To set tick marks
at 1, 100, 10000, ... set dtick to 2. To set tick marks
at 1, 5, 25, 125, 625, 3125, ... set dtick to
log_10(5), or 0.69897000433. "log" has several special
values; "L<f>", where `f` is a positive number, gives
ticks linearly spaced in value (but not position). For
example `tick0` = 0.1, `dtick` = "L0.5" will put ticks
at 0.1, 0.6, 1.1, 1.6 etc. To show powers of 10 plus
small digits between, use "D1" (all digits) or "D2"
(only 2 and 5). `tick0` is ignored for "D1" and "D2".
If the axis `type` is "date", then you must convert the
time to milliseconds. For example, to set the interval
between ticks to one day, set `dtick` to 86400000.0.
"date" also has special values "M<n>" gives ticks
spaced by a number of months. `n` must be a positive
integer. To set ticks on the 15th of every third month,
set `tick0` to "2000-01-15" and `dtick` to "M3". To set
ticks every 4 years, set `dtick` to "M48"
exponentformat
Determines a formatting rule for the tick exponents.
For example, consider the number 1,000,000,000. If
"none", it appears as 1,000,000,000. If "e", 1e+9. If
"E", 1E+9. If "power", 1x10^9 (with 9 in a super
script). If "SI", 1G. If "B", 1B.
gridcolor
Sets the color of the grid lines.
gridwidth
Sets the width (in px) of the grid lines.
hoverformat
Sets the hover text formatting rule using d3 formatting
mini-languages which are very similar to those in
Python. For numbers, see:
https://github.com/d3/d3-3.x-api-
reference/blob/master/Formatting.md#d3_format And for
dates see: https://github.com/d3/d3-3.x-api-
reference/blob/master/Time-Formatting.md#format We add
one item to d3's date formatter: "%{n}f" for fractional
seconds with n digits. For example, *2016-10-13
09:15:23.456* with tickformat "%H~%M~%S.%2f" would
display "09~15~23.46"
linecolor
Sets the axis line color.
linewidth
Sets the width (in px) of the axis line.
mirror
Determines if the axis lines or/and ticks are mirrored
to the opposite side of the plotting area. If True, the
axis lines are mirrored. If "ticks", the axis lines and
ticks are mirrored. If False, mirroring is disable. If
"all", axis lines are mirrored on all shared-axes
subplots. If "allticks", axis lines and ticks are
mirrored on all shared-axes subplots.
nticks
Specifies the maximum number of ticks for the
particular axis. The actual number of ticks will be
chosen automatically to be less than or equal to
`nticks`. Has an effect only if `tickmode` is set to
"auto".
range
Sets the range of this axis. If the axis `type` is
"log", then you must take the log of your desired range
(e.g. to set the range from 1 to 100, set the range
from 0 to 2). If the axis `type` is "date", it should
be date strings, like date data, though Date objects
and unix milliseconds will be accepted and converted to
strings. If the axis `type` is "category", it should be
numbers, using the scale where each category is
assigned a serial number from zero in the order it
appears.
rangemode
If "normal", the range is computed in relation to the
extrema of the input data. If *tozero*`, the range
extends to 0, regardless of the input data If
"nonnegative", the range is non-negative, regardless of
the input data. Applies only to linear axes.
separatethousands
If "true", even 4-digit integers are separated
showaxeslabels
Sets whether or not this axis is labeled
showbackground
Sets whether or not this axis' wall has a background
color.
showexponent
If "all", all exponents are shown besides their
significands. If "first", only the exponent of the
first tick is shown. If "last", only the exponent of
the last tick is shown. If "none", no exponents appear.
showgrid
Determines whether or not grid lines are drawn. If
True, the grid lines are drawn at every tick mark.
showline
Determines whether or not a line bounding this axis is
drawn.
showspikes
Sets whether or not spikes starting from data points to
this axis' wall are shown on hover.
showticklabels
Determines whether or not the tick labels are drawn.
showtickprefix
If "all", all tick labels are displayed with a prefix.
If "first", only the first tick is displayed with a
prefix. If "last", only the last tick is displayed with
a suffix. If "none", tick prefixes are hidden.
showticksuffix
Same as `showtickprefix` but for tick suffixes.
spikecolor
Sets the color of the spikes.
spikesides
Sets whether or not spikes extending from the
projection data points to this axis' wall boundaries
are shown on hover.
spikethickness
Sets the thickness (in px) of the spikes.
tick0
Sets the placement of the first tick on this axis. Use
with `dtick`. If the axis `type` is "log", then you
must take the log of your starting tick (e.g. to set
the starting tick to 100, set the `tick0` to 2) except
when `dtick`=*L<f>* (see `dtick` for more info). If the
axis `type` is "date", it should be a date string, like
date data. If the axis `type` is "category", it should
be a number, using the scale where each category is
assigned a serial number from zero in the order it
appears.
tickangle
Sets the angle of the tick labels with respect to the
horizontal. For example, a `tickangle` of -90 draws the
tick labels vertically.
tickcolor
Sets the tick color.
tickfont
Sets the tick font.
tickformat
Sets the tick label formatting rule using d3 formatting
mini-languages which are very similar to those in
Python. For numbers, see:
https://github.com/d3/d3-3.x-api-
reference/blob/master/Formatting.md#d3_format And for
dates see: https://github.com/d3/d3-3.x-api-
reference/blob/master/Time-Formatting.md#format We add
one item to d3's date formatter: "%{n}f" for fractional
seconds with n digits. For example, *2016-10-13
09:15:23.456* with tickformat "%H~%M~%S.%2f" would
display "09~15~23.46"
tickformatstops
A tuple of :class:`plotly.graph_objects.layout.scene.xa
xis.Tickformatstop` instances or dicts with compatible
properties
tickformatstopdefaults
When used in a template (as layout.template.layout.scen
e.xaxis.tickformatstopdefaults), sets the default
property values to use for elements of
layout.scene.xaxis.tickformatstops
ticklen
Sets the tick length (in px).
tickmode
Sets the tick mode for this axis. If "auto", the number
of ticks is set via `nticks`. If "linear", the
placement of the ticks is determined by a starting
position `tick0` and a tick step `dtick` ("linear" is
the default value if `tick0` and `dtick` are provided).
If "array", the placement of the ticks is set via
`tickvals` and the tick text is `ticktext`. ("array" is
the default value if `tickvals` is provided).
tickprefix
Sets a tick label prefix.
ticks
Determines whether ticks are drawn or not. If "", this
axis' ticks are not drawn. If "outside" ("inside"),
this axis' are drawn outside (inside) the axis lines.
ticksuffix
Sets a tick label suffix.
ticktext
Sets the text displayed at the ticks position via
`tickvals`. Only has an effect if `tickmode` is set to
"array". Used with `tickvals`.
ticktextsrc
Sets the source reference on Chart Studio Cloud for
ticktext .
tickvals
Sets the values at which ticks on this axis appear.
Only has an effect if `tickmode` is set to "array".
Used with `ticktext`.
tickvalssrc
Sets the source reference on Chart Studio Cloud for
tickvals .
tickwidth
Sets the tick width (in px).
title
:class:`plotly.graph_objects.layout.scene.xaxis.Title`
instance or dict with compatible properties
titlefont
Deprecated: Please use layout.scene.xaxis.title.font
instead. Sets this axis' title font. Note that the
title's font used to be customized by the now
deprecated `titlefont` attribute.
type
Sets the axis type. By default, plotly attempts to
determined the axis type by looking into the data of
the traces that referenced the axis in question.
visible
A single toggle to hide the axis while preserving
interaction like dragging. Default is true when a
cheater plot is present on the axis, otherwise false
zeroline
Determines whether or not a line is drawn at along the
0 value of this axis. If True, the zero line is drawn
on top of the grid lines.
zerolinecolor
Sets the line color of the zero line.
zerolinewidth
Sets the width (in px) of the zero line.
Returns
-------
XAxis
|
Construct a new XAxis object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.layout.scene.XAxis`
autorange
Determines whether or not the range of this axis is
computed in relation to the input data. See `rangemode`
for more info. If `range` is provided, then `autorange`
is set to False.
backgroundcolor
Sets the background color of this axis' wall.
calendar
Sets the calendar system to use for `range` and `tick0`
if this is a date axis. This does not set the calendar
for interpreting data on this axis, that's specified in
the trace or via the global `layout.calendar`
categoryarray
Sets the order in which categories on this axis appear.
Only has an effect if `categoryorder` is set to
"array". Used with `categoryorder`.
categoryarraysrc
Sets the source reference on Chart Studio Cloud for
categoryarray .
categoryorder
Specifies the ordering logic for the case of
categorical variables. By default, plotly uses "trace",
which specifies the order that is present in the data
supplied. Set `categoryorder` to *category ascending*
or *category descending* if order should be determined
by the alphanumerical order of the category names. Set
`categoryorder` to "array" to derive the ordering from
the attribute `categoryarray`. If a category is not
found in the `categoryarray` array, the sorting
behavior for that attribute will be identical to the
"trace" mode. The unspecified categories will follow
the categories in `categoryarray`. Set `categoryorder`
to *total ascending* or *total descending* if order
should be determined by the numerical order of the
values. Similarly, the order can be determined by the
min, max, sum, mean or median of all the values.
color
Sets default for all colors associated with this axis
all at once: line, font, tick, and grid colors. Grid
color is lightened by blending this with the plot
background Individual pieces can override this.
dtick
Sets the step in-between ticks on this axis. Use with
`tick0`. Must be a positive number, or special strings
available to "log" and "date" axes. If the axis `type`
is "log", then ticks are set every 10^(n*dtick) where n
is the tick number. For example, to set a tick mark at
1, 10, 100, 1000, ... set dtick to 1. To set tick marks
at 1, 100, 10000, ... set dtick to 2. To set tick marks
at 1, 5, 25, 125, 625, 3125, ... set dtick to
log_10(5), or 0.69897000433. "log" has several special
values; "L<f>", where `f` is a positive number, gives
ticks linearly spaced in value (but not position). For
example `tick0` = 0.1, `dtick` = "L0.5" will put ticks
at 0.1, 0.6, 1.1, 1.6 etc. To show powers of 10 plus
small digits between, use "D1" (all digits) or "D2"
(only 2 and 5). `tick0` is ignored for "D1" and "D2".
If the axis `type` is "date", then you must convert the
time to milliseconds. For example, to set the interval
between ticks to one day, set `dtick` to 86400000.0.
"date" also has special values "M<n>" gives ticks
spaced by a number of months. `n` must be a positive
integer. To set ticks on the 15th of every third month,
set `tick0` to "2000-01-15" and `dtick` to "M3". To set
ticks every 4 years, set `dtick` to "M48"
exponentformat
Determines a formatting rule for the tick exponents.
For example, consider the number 1,000,000,000. If
"none", it appears as 1,000,000,000. If "e", 1e+9. If
"E", 1E+9. If "power", 1x10^9 (with 9 in a super
script). If "SI", 1G. If "B", 1B.
gridcolor
Sets the color of the grid lines.
gridwidth
Sets the width (in px) of the grid lines.
hoverformat
Sets the hover text formatting rule using d3 formatting
mini-languages which are very similar to those in
Python. For numbers, see:
https://github.com/d3/d3-3.x-api-
reference/blob/master/Formatting.md#d3_format And for
dates see: https://github.com/d3/d3-3.x-api-
reference/blob/master/Time-Formatting.md#format We add
one item to d3's date formatter: "%{n}f" for fractional
seconds with n digits. For example, *2016-10-13
09:15:23.456* with tickformat "%H~%M~%S.%2f" would
display "09~15~23.46"
linecolor
Sets the axis line color.
linewidth
Sets the width (in px) of the axis line.
mirror
Determines if the axis lines or/and ticks are mirrored
to the opposite side of the plotting area. If True, the
axis lines are mirrored. If "ticks", the axis lines and
ticks are mirrored. If False, mirroring is disable. If
"all", axis lines are mirrored on all shared-axes
subplots. If "allticks", axis lines and ticks are
mirrored on all shared-axes subplots.
nticks
Specifies the maximum number of ticks for the
particular axis. The actual number of ticks will be
chosen automatically to be less than or equal to
`nticks`. Has an effect only if `tickmode` is set to
"auto".
range
Sets the range of this axis. If the axis `type` is
"log", then you must take the log of your desired range
(e.g. to set the range from 1 to 100, set the range
from 0 to 2). If the axis `type` is "date", it should
be date strings, like date data, though Date objects
and unix milliseconds will be accepted and converted to
strings. If the axis `type` is "category", it should be
numbers, using the scale where each category is
assigned a serial number from zero in the order it
appears.
rangemode
If "normal", the range is computed in relation to the
extrema of the input data. If *tozero*`, the range
extends to 0, regardless of the input data If
"nonnegative", the range is non-negative, regardless of
the input data. Applies only to linear axes.
separatethousands
If "true", even 4-digit integers are separated
showaxeslabels
Sets whether or not this axis is labeled
showbackground
Sets whether or not this axis' wall has a background
color.
showexponent
If "all", all exponents are shown besides their
significands. If "first", only the exponent of the
first tick is shown. If "last", only the exponent of
the last tick is shown. If "none", no exponents appear.
showgrid
Determines whether or not grid lines are drawn. If
True, the grid lines are drawn at every tick mark.
showline
Determines whether or not a line bounding this axis is
drawn.
showspikes
Sets whether or not spikes starting from data points to
this axis' wall are shown on hover.
showticklabels
Determines whether or not the tick labels are drawn.
showtickprefix
If "all", all tick labels are displayed with a prefix.
If "first", only the first tick is displayed with a
prefix. If "last", only the last tick is displayed with
a suffix. If "none", tick prefixes are hidden.
showticksuffix
Same as `showtickprefix` but for tick suffixes.
spikecolor
Sets the color of the spikes.
spikesides
Sets whether or not spikes extending from the
projection data points to this axis' wall boundaries
are shown on hover.
spikethickness
Sets the thickness (in px) of the spikes.
tick0
Sets the placement of the first tick on this axis. Use
with `dtick`. If the axis `type` is "log", then you
must take the log of your starting tick (e.g. to set
the starting tick to 100, set the `tick0` to 2) except
when `dtick`=*L<f>* (see `dtick` for more info). If the
axis `type` is "date", it should be a date string, like
date data. If the axis `type` is "category", it should
be a number, using the scale where each category is
assigned a serial number from zero in the order it
appears.
tickangle
Sets the angle of the tick labels with respect to the
horizontal. For example, a `tickangle` of -90 draws the
tick labels vertically.
tickcolor
Sets the tick color.
tickfont
Sets the tick font.
tickformat
Sets the tick label formatting rule using d3 formatting
mini-languages which are very similar to those in
Python. For numbers, see:
https://github.com/d3/d3-3.x-api-
reference/blob/master/Formatting.md#d3_format And for
dates see: https://github.com/d3/d3-3.x-api-
reference/blob/master/Time-Formatting.md#format We add
one item to d3's date formatter: "%{n}f" for fractional
seconds with n digits. For example, *2016-10-13
09:15:23.456* with tickformat "%H~%M~%S.%2f" would
display "09~15~23.46"
tickformatstops
A tuple of :class:`plotly.graph_objects.layout.scene.xa
xis.Tickformatstop` instances or dicts with compatible
properties
tickformatstopdefaults
When used in a template (as layout.template.layout.scen
e.xaxis.tickformatstopdefaults), sets the default
property values to use for elements of
layout.scene.xaxis.tickformatstops
ticklen
Sets the tick length (in px).
tickmode
Sets the tick mode for this axis. If "auto", the number
of ticks is set via `nticks`. If "linear", the
placement of the ticks is determined by a starting
position `tick0` and a tick step `dtick` ("linear" is
the default value if `tick0` and `dtick` are provided).
If "array", the placement of the ticks is set via
`tickvals` and the tick text is `ticktext`. ("array" is
the default value if `tickvals` is provided).
tickprefix
Sets a tick label prefix.
ticks
Determines whether ticks are drawn or not. If "", this
axis' ticks are not drawn. If "outside" ("inside"),
this axis' are drawn outside (inside) the axis lines.
ticksuffix
Sets a tick label suffix.
ticktext
Sets the text displayed at the ticks position via
`tickvals`. Only has an effect if `tickmode` is set to
"array". Used with `tickvals`.
ticktextsrc
Sets the source reference on Chart Studio Cloud for
ticktext .
tickvals
Sets the values at which ticks on this axis appear.
Only has an effect if `tickmode` is set to "array".
Used with `ticktext`.
tickvalssrc
Sets the source reference on Chart Studio Cloud for
tickvals .
tickwidth
Sets the tick width (in px).
title
:class:`plotly.graph_objects.layout.scene.xaxis.Title`
instance or dict with compatible properties
titlefont
Deprecated: Please use layout.scene.xaxis.title.font
instead. Sets this axis' title font. Note that the
title's font used to be customized by the now
deprecated `titlefont` attribute.
type
Sets the axis type. By default, plotly attempts to
determined the axis type by looking into the data of
the traces that referenced the axis in question.
visible
A single toggle to hide the axis while preserving
interaction like dragging. Default is true when a
cheater plot is present on the axis, otherwise false
zeroline
Determines whether or not a line is drawn at along the
0 value of this axis. If True, the zero line is drawn
on top of the grid lines.
zerolinecolor
Sets the line color of the zero line.
zerolinewidth
Sets the width (in px) of the zero line. | def __init__(
self,
arg=None,
autorange=None,
backgroundcolor=None,
calendar=None,
categoryarray=None,
categoryarraysrc=None,
categoryorder=None,
color=None,
dtick=None,
exponentformat=None,
gridcolor=None,
gridwidth=None,
hoverformat=None,
linecolor=None,
linewidth=None,
mirror=None,
nticks=None,
range=None,
rangemode=None,
separatethousands=None,
showaxeslabels=None,
showbackground=None,
showexponent=None,
showgrid=None,
showline=None,
showspikes=None,
showticklabels=None,
showtickprefix=None,
showticksuffix=None,
spikecolor=None,
spikesides=None,
spikethickness=None,
tick0=None,
tickangle=None,
tickcolor=None,
tickfont=None,
tickformat=None,
tickformatstops=None,
tickformatstopdefaults=None,
ticklen=None,
tickmode=None,
tickprefix=None,
ticks=None,
ticksuffix=None,
ticktext=None,
ticktextsrc=None,
tickvals=None,
tickvalssrc=None,
tickwidth=None,
title=None,
titlefont=None,
type=None,
visible=None,
zeroline=None,
zerolinecolor=None,
zerolinewidth=None,
**kwargs
):
"""
Construct a new XAxis object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.layout.scene.XAxis`
autorange
Determines whether or not the range of this axis is
computed in relation to the input data. See `rangemode`
for more info. If `range` is provided, then `autorange`
is set to False.
backgroundcolor
Sets the background color of this axis' wall.
calendar
Sets the calendar system to use for `range` and `tick0`
if this is a date axis. This does not set the calendar
for interpreting data on this axis, that's specified in
the trace or via the global `layout.calendar`
categoryarray
Sets the order in which categories on this axis appear.
Only has an effect if `categoryorder` is set to
"array". Used with `categoryorder`.
categoryarraysrc
Sets the source reference on Chart Studio Cloud for
categoryarray .
categoryorder
Specifies the ordering logic for the case of
categorical variables. By default, plotly uses "trace",
which specifies the order that is present in the data
supplied. Set `categoryorder` to *category ascending*
or *category descending* if order should be determined
by the alphanumerical order of the category names. Set
`categoryorder` to "array" to derive the ordering from
the attribute `categoryarray`. If a category is not
found in the `categoryarray` array, the sorting
behavior for that attribute will be identical to the
"trace" mode. The unspecified categories will follow
the categories in `categoryarray`. Set `categoryorder`
to *total ascending* or *total descending* if order
should be determined by the numerical order of the
values. Similarly, the order can be determined by the
min, max, sum, mean or median of all the values.
color
Sets default for all colors associated with this axis
all at once: line, font, tick, and grid colors. Grid
color is lightened by blending this with the plot
background Individual pieces can override this.
dtick
Sets the step in-between ticks on this axis. Use with
`tick0`. Must be a positive number, or special strings
available to "log" and "date" axes. If the axis `type`
is "log", then ticks are set every 10^(n*dtick) where n
is the tick number. For example, to set a tick mark at
1, 10, 100, 1000, ... set dtick to 1. To set tick marks
at 1, 100, 10000, ... set dtick to 2. To set tick marks
at 1, 5, 25, 125, 625, 3125, ... set dtick to
log_10(5), or 0.69897000433. "log" has several special
values; "L<f>", where `f` is a positive number, gives
ticks linearly spaced in value (but not position). For
example `tick0` = 0.1, `dtick` = "L0.5" will put ticks
at 0.1, 0.6, 1.1, 1.6 etc. To show powers of 10 plus
small digits between, use "D1" (all digits) or "D2"
(only 2 and 5). `tick0` is ignored for "D1" and "D2".
If the axis `type` is "date", then you must convert the
time to milliseconds. For example, to set the interval
between ticks to one day, set `dtick` to 86400000.0.
"date" also has special values "M<n>" gives ticks
spaced by a number of months. `n` must be a positive
integer. To set ticks on the 15th of every third month,
set `tick0` to "2000-01-15" and `dtick` to "M3". To set
ticks every 4 years, set `dtick` to "M48"
exponentformat
Determines a formatting rule for the tick exponents.
For example, consider the number 1,000,000,000. If
"none", it appears as 1,000,000,000. If "e", 1e+9. If
"E", 1E+9. If "power", 1x10^9 (with 9 in a super
script). If "SI", 1G. If "B", 1B.
gridcolor
Sets the color of the grid lines.
gridwidth
Sets the width (in px) of the grid lines.
hoverformat
Sets the hover text formatting rule using d3 formatting
mini-languages which are very similar to those in
Python. For numbers, see:
https://github.com/d3/d3-3.x-api-
reference/blob/master/Formatting.md#d3_format And for
dates see: https://github.com/d3/d3-3.x-api-
reference/blob/master/Time-Formatting.md#format We add
one item to d3's date formatter: "%{n}f" for fractional
seconds with n digits. For example, *2016-10-13
09:15:23.456* with tickformat "%H~%M~%S.%2f" would
display "09~15~23.46"
linecolor
Sets the axis line color.
linewidth
Sets the width (in px) of the axis line.
mirror
Determines if the axis lines or/and ticks are mirrored
to the opposite side of the plotting area. If True, the
axis lines are mirrored. If "ticks", the axis lines and
ticks are mirrored. If False, mirroring is disable. If
"all", axis lines are mirrored on all shared-axes
subplots. If "allticks", axis lines and ticks are
mirrored on all shared-axes subplots.
nticks
Specifies the maximum number of ticks for the
particular axis. The actual number of ticks will be
chosen automatically to be less than or equal to
`nticks`. Has an effect only if `tickmode` is set to
"auto".
range
Sets the range of this axis. If the axis `type` is
"log", then you must take the log of your desired range
(e.g. to set the range from 1 to 100, set the range
from 0 to 2). If the axis `type` is "date", it should
be date strings, like date data, though Date objects
and unix milliseconds will be accepted and converted to
strings. If the axis `type` is "category", it should be
numbers, using the scale where each category is
assigned a serial number from zero in the order it
appears.
rangemode
If "normal", the range is computed in relation to the
extrema of the input data. If *tozero*`, the range
extends to 0, regardless of the input data If
"nonnegative", the range is non-negative, regardless of
the input data. Applies only to linear axes.
separatethousands
If "true", even 4-digit integers are separated
showaxeslabels
Sets whether or not this axis is labeled
showbackground
Sets whether or not this axis' wall has a background
color.
showexponent
If "all", all exponents are shown besides their
significands. If "first", only the exponent of the
first tick is shown. If "last", only the exponent of
the last tick is shown. If "none", no exponents appear.
showgrid
Determines whether or not grid lines are drawn. If
True, the grid lines are drawn at every tick mark.
showline
Determines whether or not a line bounding this axis is
drawn.
showspikes
Sets whether or not spikes starting from data points to
this axis' wall are shown on hover.
showticklabels
Determines whether or not the tick labels are drawn.
showtickprefix
If "all", all tick labels are displayed with a prefix.
If "first", only the first tick is displayed with a
prefix. If "last", only the last tick is displayed with
a suffix. If "none", tick prefixes are hidden.
showticksuffix
Same as `showtickprefix` but for tick suffixes.
spikecolor
Sets the color of the spikes.
spikesides
Sets whether or not spikes extending from the
projection data points to this axis' wall boundaries
are shown on hover.
spikethickness
Sets the thickness (in px) of the spikes.
tick0
Sets the placement of the first tick on this axis. Use
with `dtick`. If the axis `type` is "log", then you
must take the log of your starting tick (e.g. to set
the starting tick to 100, set the `tick0` to 2) except
when `dtick`=*L<f>* (see `dtick` for more info). If the
axis `type` is "date", it should be a date string, like
date data. If the axis `type` is "category", it should
be a number, using the scale where each category is
assigned a serial number from zero in the order it
appears.
tickangle
Sets the angle of the tick labels with respect to the
horizontal. For example, a `tickangle` of -90 draws the
tick labels vertically.
tickcolor
Sets the tick color.
tickfont
Sets the tick font.
tickformat
Sets the tick label formatting rule using d3 formatting
mini-languages which are very similar to those in
Python. For numbers, see:
https://github.com/d3/d3-3.x-api-
reference/blob/master/Formatting.md#d3_format And for
dates see: https://github.com/d3/d3-3.x-api-
reference/blob/master/Time-Formatting.md#format We add
one item to d3's date formatter: "%{n}f" for fractional
seconds with n digits. For example, *2016-10-13
09:15:23.456* with tickformat "%H~%M~%S.%2f" would
display "09~15~23.46"
tickformatstops
A tuple of :class:`plotly.graph_objects.layout.scene.xa
xis.Tickformatstop` instances or dicts with compatible
properties
tickformatstopdefaults
When used in a template (as layout.template.layout.scen
e.xaxis.tickformatstopdefaults), sets the default
property values to use for elements of
layout.scene.xaxis.tickformatstops
ticklen
Sets the tick length (in px).
tickmode
Sets the tick mode for this axis. If "auto", the number
of ticks is set via `nticks`. If "linear", the
placement of the ticks is determined by a starting
position `tick0` and a tick step `dtick` ("linear" is
the default value if `tick0` and `dtick` are provided).
If "array", the placement of the ticks is set via
`tickvals` and the tick text is `ticktext`. ("array" is
the default value if `tickvals` is provided).
tickprefix
Sets a tick label prefix.
ticks
Determines whether ticks are drawn or not. If "", this
axis' ticks are not drawn. If "outside" ("inside"),
this axis' are drawn outside (inside) the axis lines.
ticksuffix
Sets a tick label suffix.
ticktext
Sets the text displayed at the ticks position via
`tickvals`. Only has an effect if `tickmode` is set to
"array". Used with `tickvals`.
ticktextsrc
Sets the source reference on Chart Studio Cloud for
ticktext .
tickvals
Sets the values at which ticks on this axis appear.
Only has an effect if `tickmode` is set to "array".
Used with `ticktext`.
tickvalssrc
Sets the source reference on Chart Studio Cloud for
tickvals .
tickwidth
Sets the tick width (in px).
title
:class:`plotly.graph_objects.layout.scene.xaxis.Title`
instance or dict with compatible properties
titlefont
Deprecated: Please use layout.scene.xaxis.title.font
instead. Sets this axis' title font. Note that the
title's font used to be customized by the now
deprecated `titlefont` attribute.
type
Sets the axis type. By default, plotly attempts to
determined the axis type by looking into the data of
the traces that referenced the axis in question.
visible
A single toggle to hide the axis while preserving
interaction like dragging. Default is true when a
cheater plot is present on the axis, otherwise false
zeroline
Determines whether or not a line is drawn at along the
0 value of this axis. If True, the zero line is drawn
on top of the grid lines.
zerolinecolor
Sets the line color of the zero line.
zerolinewidth
Sets the width (in px) of the zero line.
Returns
-------
XAxis
"""
super(XAxis, self).__init__("xaxis")
if "_parent" in kwargs:
self._parent = kwargs["_parent"]
return
# Validate arg
# ------------
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.layout.scene.XAxis
constructor must be a dict or
an instance of :class:`plotly.graph_objs.layout.scene.XAxis`"""
)
# Handle skip_invalid
# -------------------
self._skip_invalid = kwargs.pop("skip_invalid", False)
self._validate = kwargs.pop("_validate", True)
# Populate data dict with properties
# ----------------------------------
_v = arg.pop("autorange", None)
_v = autorange if autorange is not None else _v
if _v is not None:
self["autorange"] = _v
_v = arg.pop("backgroundcolor", None)
_v = backgroundcolor if backgroundcolor is not None else _v
if _v is not None:
self["backgroundcolor"] = _v
_v = arg.pop("calendar", None)
_v = calendar if calendar is not None else _v
if _v is not None:
self["calendar"] = _v
_v = arg.pop("categoryarray", None)
_v = categoryarray if categoryarray is not None else _v
if _v is not None:
self["categoryarray"] = _v
_v = arg.pop("categoryarraysrc", None)
_v = categoryarraysrc if categoryarraysrc is not None else _v
if _v is not None:
self["categoryarraysrc"] = _v
_v = arg.pop("categoryorder", None)
_v = categoryorder if categoryorder is not None else _v
if _v is not None:
self["categoryorder"] = _v
_v = arg.pop("color", None)
_v = color if color is not None else _v
if _v is not None:
self["color"] = _v
_v = arg.pop("dtick", None)
_v = dtick if dtick is not None else _v
if _v is not None:
self["dtick"] = _v
_v = arg.pop("exponentformat", None)
_v = exponentformat if exponentformat is not None else _v
if _v is not None:
self["exponentformat"] = _v
_v = arg.pop("gridcolor", None)
_v = gridcolor if gridcolor is not None else _v
if _v is not None:
self["gridcolor"] = _v
_v = arg.pop("gridwidth", None)
_v = gridwidth if gridwidth is not None else _v
if _v is not None:
self["gridwidth"] = _v
_v = arg.pop("hoverformat", None)
_v = hoverformat if hoverformat is not None else _v
if _v is not None:
self["hoverformat"] = _v
_v = arg.pop("linecolor", None)
_v = linecolor if linecolor is not None else _v
if _v is not None:
self["linecolor"] = _v
_v = arg.pop("linewidth", None)
_v = linewidth if linewidth is not None else _v
if _v is not None:
self["linewidth"] = _v
_v = arg.pop("mirror", None)
_v = mirror if mirror is not None else _v
if _v is not None:
self["mirror"] = _v
_v = arg.pop("nticks", None)
_v = nticks if nticks is not None else _v
if _v is not None:
self["nticks"] = _v
_v = arg.pop("range", None)
_v = range if range is not None else _v
if _v is not None:
self["range"] = _v
_v = arg.pop("rangemode", None)
_v = rangemode if rangemode is not None else _v
if _v is not None:
self["rangemode"] = _v
_v = arg.pop("separatethousands", None)
_v = separatethousands if separatethousands is not None else _v
if _v is not None:
self["separatethousands"] = _v
_v = arg.pop("showaxeslabels", None)
_v = showaxeslabels if showaxeslabels is not None else _v
if _v is not None:
self["showaxeslabels"] = _v
_v = arg.pop("showbackground", None)
_v = showbackground if showbackground is not None else _v
if _v is not None:
self["showbackground"] = _v
_v = arg.pop("showexponent", None)
_v = showexponent if showexponent is not None else _v
if _v is not None:
self["showexponent"] = _v
_v = arg.pop("showgrid", None)
_v = showgrid if showgrid is not None else _v
if _v is not None:
self["showgrid"] = _v
_v = arg.pop("showline", None)
_v = showline if showline is not None else _v
if _v is not None:
self["showline"] = _v
_v = arg.pop("showspikes", None)
_v = showspikes if showspikes is not None else _v
if _v is not None:
self["showspikes"] = _v
_v = arg.pop("showticklabels", None)
_v = showticklabels if showticklabels is not None else _v
if _v is not None:
self["showticklabels"] = _v
_v = arg.pop("showtickprefix", None)
_v = showtickprefix if showtickprefix is not None else _v
if _v is not None:
self["showtickprefix"] = _v
_v = arg.pop("showticksuffix", None)
_v = showticksuffix if showticksuffix is not None else _v
if _v is not None:
self["showticksuffix"] = _v
_v = arg.pop("spikecolor", None)
_v = spikecolor if spikecolor is not None else _v
if _v is not None:
self["spikecolor"] = _v
_v = arg.pop("spikesides", None)
_v = spikesides if spikesides is not None else _v
if _v is not None:
self["spikesides"] = _v
_v = arg.pop("spikethickness", None)
_v = spikethickness if spikethickness is not None else _v
if _v is not None:
self["spikethickness"] = _v
_v = arg.pop("tick0", None)
_v = tick0 if tick0 is not None else _v
if _v is not None:
self["tick0"] = _v
_v = arg.pop("tickangle", None)
_v = tickangle if tickangle is not None else _v
if _v is not None:
self["tickangle"] = _v
_v = arg.pop("tickcolor", None)
_v = tickcolor if tickcolor is not None else _v
if _v is not None:
self["tickcolor"] = _v
_v = arg.pop("tickfont", None)
_v = tickfont if tickfont is not None else _v
if _v is not None:
self["tickfont"] = _v
_v = arg.pop("tickformat", None)
_v = tickformat if tickformat is not None else _v
if _v is not None:
self["tickformat"] = _v
_v = arg.pop("tickformatstops", None)
_v = tickformatstops if tickformatstops is not None else _v
if _v is not None:
self["tickformatstops"] = _v
_v = arg.pop("tickformatstopdefaults", None)
_v = tickformatstopdefaults if tickformatstopdefaults is not None else _v
if _v is not None:
self["tickformatstopdefaults"] = _v
_v = arg.pop("ticklen", None)
_v = ticklen if ticklen is not None else _v
if _v is not None:
self["ticklen"] = _v
_v = arg.pop("tickmode", None)
_v = tickmode if tickmode is not None else _v
if _v is not None:
self["tickmode"] = _v
_v = arg.pop("tickprefix", None)
_v = tickprefix if tickprefix is not None else _v
if _v is not None:
self["tickprefix"] = _v
_v = arg.pop("ticks", None)
_v = ticks if ticks is not None else _v
if _v is not None:
self["ticks"] = _v
_v = arg.pop("ticksuffix", None)
_v = ticksuffix if ticksuffix is not None else _v
if _v is not None:
self["ticksuffix"] = _v
_v = arg.pop("ticktext", None)
_v = ticktext if ticktext is not None else _v
if _v is not None:
self["ticktext"] = _v
_v = arg.pop("ticktextsrc", None)
_v = ticktextsrc if ticktextsrc is not None else _v
if _v is not None:
self["ticktextsrc"] = _v
_v = arg.pop("tickvals", None)
_v = tickvals if tickvals is not None else _v
if _v is not None:
self["tickvals"] = _v
_v = arg.pop("tickvalssrc", None)
_v = tickvalssrc if tickvalssrc is not None else _v
if _v is not None:
self["tickvalssrc"] = _v
_v = arg.pop("tickwidth", None)
_v = tickwidth if tickwidth is not None else _v
if _v is not None:
self["tickwidth"] = _v
_v = arg.pop("title", None)
_v = title if title is not None else _v
if _v is not None:
self["title"] = _v
_v = arg.pop("titlefont", None)
_v = titlefont if titlefont is not None else _v
if _v is not None:
self["titlefont"] = _v
_v = arg.pop("type", None)
_v = type if type is not None else _v
if _v is not None:
self["type"] = _v
_v = arg.pop("visible", None)
_v = visible if visible is not None else _v
if _v is not None:
self["visible"] = _v
_v = arg.pop("zeroline", None)
_v = zeroline if zeroline is not None else _v
if _v is not None:
self["zeroline"] = _v
_v = arg.pop("zerolinecolor", None)
_v = zerolinecolor if zerolinecolor is not None else _v
if _v is not None:
self["zerolinecolor"] = _v
_v = arg.pop("zerolinewidth", None)
_v = zerolinewidth if zerolinewidth is not None else _v
if _v is not None:
self["zerolinewidth"] = _v
# Process unknown kwargs
# ----------------------
self._process_kwargs(**dict(arg, **kwargs))
# Reset skip_invalid
# ------------------
self._skip_invalid = False | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"autorange",
"=",
"None",
",",
"backgroundcolor",
"=",
"None",
",",
"calendar",
"=",
"None",
",",
"categoryarray",
"=",
"None",
",",
"categoryarraysrc",
"=",
"None",
",",
"categoryorder",
"=",
"None",
",",
"color",
"=",
"None",
",",
"dtick",
"=",
"None",
",",
"exponentformat",
"=",
"None",
",",
"gridcolor",
"=",
"None",
",",
"gridwidth",
"=",
"None",
",",
"hoverformat",
"=",
"None",
",",
"linecolor",
"=",
"None",
",",
"linewidth",
"=",
"None",
",",
"mirror",
"=",
"None",
",",
"nticks",
"=",
"None",
",",
"range",
"=",
"None",
",",
"rangemode",
"=",
"None",
",",
"separatethousands",
"=",
"None",
",",
"showaxeslabels",
"=",
"None",
",",
"showbackground",
"=",
"None",
",",
"showexponent",
"=",
"None",
",",
"showgrid",
"=",
"None",
",",
"showline",
"=",
"None",
",",
"showspikes",
"=",
"None",
",",
"showticklabels",
"=",
"None",
",",
"showtickprefix",
"=",
"None",
",",
"showticksuffix",
"=",
"None",
",",
"spikecolor",
"=",
"None",
",",
"spikesides",
"=",
"None",
",",
"spikethickness",
"=",
"None",
",",
"tick0",
"=",
"None",
",",
"tickangle",
"=",
"None",
",",
"tickcolor",
"=",
"None",
",",
"tickfont",
"=",
"None",
",",
"tickformat",
"=",
"None",
",",
"tickformatstops",
"=",
"None",
",",
"tickformatstopdefaults",
"=",
"None",
",",
"ticklen",
"=",
"None",
",",
"tickmode",
"=",
"None",
",",
"tickprefix",
"=",
"None",
",",
"ticks",
"=",
"None",
",",
"ticksuffix",
"=",
"None",
",",
"ticktext",
"=",
"None",
",",
"ticktextsrc",
"=",
"None",
",",
"tickvals",
"=",
"None",
",",
"tickvalssrc",
"=",
"None",
",",
"tickwidth",
"=",
"None",
",",
"title",
"=",
"None",
",",
"titlefont",
"=",
"None",
",",
"type",
"=",
"None",
",",
"visible",
"=",
"None",
",",
"zeroline",
"=",
"None",
",",
"zerolinecolor",
"=",
"None",
",",
"zerolinewidth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"XAxis",
",",
"self",
")",
".",
"__init__",
"(",
"\"xaxis\"",
")",
"if",
"\"_parent\"",
"in",
"kwargs",
":",
"self",
".",
"_parent",
"=",
"kwargs",
"[",
"\"_parent\"",
"]",
"return",
"# Validate arg",
"# ------------",
"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",
"(",
"\"\"\"\\\nThe first argument to the plotly.graph_objs.layout.scene.XAxis \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.layout.scene.XAxis`\"\"\"",
")",
"# Handle skip_invalid",
"# -------------------",
"self",
".",
"_skip_invalid",
"=",
"kwargs",
".",
"pop",
"(",
"\"skip_invalid\"",
",",
"False",
")",
"self",
".",
"_validate",
"=",
"kwargs",
".",
"pop",
"(",
"\"_validate\"",
",",
"True",
")",
"# Populate data dict with properties",
"# ----------------------------------",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"autorange\"",
",",
"None",
")",
"_v",
"=",
"autorange",
"if",
"autorange",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"autorange\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"backgroundcolor\"",
",",
"None",
")",
"_v",
"=",
"backgroundcolor",
"if",
"backgroundcolor",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"backgroundcolor\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"calendar\"",
",",
"None",
")",
"_v",
"=",
"calendar",
"if",
"calendar",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"calendar\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"categoryarray\"",
",",
"None",
")",
"_v",
"=",
"categoryarray",
"if",
"categoryarray",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"categoryarray\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"categoryarraysrc\"",
",",
"None",
")",
"_v",
"=",
"categoryarraysrc",
"if",
"categoryarraysrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"categoryarraysrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"categoryorder\"",
",",
"None",
")",
"_v",
"=",
"categoryorder",
"if",
"categoryorder",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"categoryorder\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"color\"",
",",
"None",
")",
"_v",
"=",
"color",
"if",
"color",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"color\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"dtick\"",
",",
"None",
")",
"_v",
"=",
"dtick",
"if",
"dtick",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"dtick\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"exponentformat\"",
",",
"None",
")",
"_v",
"=",
"exponentformat",
"if",
"exponentformat",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"exponentformat\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"gridcolor\"",
",",
"None",
")",
"_v",
"=",
"gridcolor",
"if",
"gridcolor",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"gridcolor\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"gridwidth\"",
",",
"None",
")",
"_v",
"=",
"gridwidth",
"if",
"gridwidth",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"gridwidth\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"hoverformat\"",
",",
"None",
")",
"_v",
"=",
"hoverformat",
"if",
"hoverformat",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"hoverformat\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"linecolor\"",
",",
"None",
")",
"_v",
"=",
"linecolor",
"if",
"linecolor",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"linecolor\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"linewidth\"",
",",
"None",
")",
"_v",
"=",
"linewidth",
"if",
"linewidth",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"linewidth\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"mirror\"",
",",
"None",
")",
"_v",
"=",
"mirror",
"if",
"mirror",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"mirror\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"nticks\"",
",",
"None",
")",
"_v",
"=",
"nticks",
"if",
"nticks",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"nticks\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"range\"",
",",
"None",
")",
"_v",
"=",
"range",
"if",
"range",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"range\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"rangemode\"",
",",
"None",
")",
"_v",
"=",
"rangemode",
"if",
"rangemode",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"rangemode\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"separatethousands\"",
",",
"None",
")",
"_v",
"=",
"separatethousands",
"if",
"separatethousands",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"separatethousands\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"showaxeslabels\"",
",",
"None",
")",
"_v",
"=",
"showaxeslabels",
"if",
"showaxeslabels",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"showaxeslabels\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"showbackground\"",
",",
"None",
")",
"_v",
"=",
"showbackground",
"if",
"showbackground",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"showbackground\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"showexponent\"",
",",
"None",
")",
"_v",
"=",
"showexponent",
"if",
"showexponent",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"showexponent\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"showgrid\"",
",",
"None",
")",
"_v",
"=",
"showgrid",
"if",
"showgrid",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"showgrid\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"showline\"",
",",
"None",
")",
"_v",
"=",
"showline",
"if",
"showline",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"showline\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"showspikes\"",
",",
"None",
")",
"_v",
"=",
"showspikes",
"if",
"showspikes",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"showspikes\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"showticklabels\"",
",",
"None",
")",
"_v",
"=",
"showticklabels",
"if",
"showticklabels",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"showticklabels\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"showtickprefix\"",
",",
"None",
")",
"_v",
"=",
"showtickprefix",
"if",
"showtickprefix",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"showtickprefix\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"showticksuffix\"",
",",
"None",
")",
"_v",
"=",
"showticksuffix",
"if",
"showticksuffix",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"showticksuffix\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"spikecolor\"",
",",
"None",
")",
"_v",
"=",
"spikecolor",
"if",
"spikecolor",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"spikecolor\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"spikesides\"",
",",
"None",
")",
"_v",
"=",
"spikesides",
"if",
"spikesides",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"spikesides\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"spikethickness\"",
",",
"None",
")",
"_v",
"=",
"spikethickness",
"if",
"spikethickness",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"spikethickness\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tick0\"",
",",
"None",
")",
"_v",
"=",
"tick0",
"if",
"tick0",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tick0\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tickangle\"",
",",
"None",
")",
"_v",
"=",
"tickangle",
"if",
"tickangle",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tickangle\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tickcolor\"",
",",
"None",
")",
"_v",
"=",
"tickcolor",
"if",
"tickcolor",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tickcolor\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tickfont\"",
",",
"None",
")",
"_v",
"=",
"tickfont",
"if",
"tickfont",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tickfont\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tickformat\"",
",",
"None",
")",
"_v",
"=",
"tickformat",
"if",
"tickformat",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tickformat\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tickformatstops\"",
",",
"None",
")",
"_v",
"=",
"tickformatstops",
"if",
"tickformatstops",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tickformatstops\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tickformatstopdefaults\"",
",",
"None",
")",
"_v",
"=",
"tickformatstopdefaults",
"if",
"tickformatstopdefaults",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tickformatstopdefaults\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"ticklen\"",
",",
"None",
")",
"_v",
"=",
"ticklen",
"if",
"ticklen",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"ticklen\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tickmode\"",
",",
"None",
")",
"_v",
"=",
"tickmode",
"if",
"tickmode",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tickmode\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tickprefix\"",
",",
"None",
")",
"_v",
"=",
"tickprefix",
"if",
"tickprefix",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tickprefix\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"ticks\"",
",",
"None",
")",
"_v",
"=",
"ticks",
"if",
"ticks",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"ticks\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"ticksuffix\"",
",",
"None",
")",
"_v",
"=",
"ticksuffix",
"if",
"ticksuffix",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"ticksuffix\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"ticktext\"",
",",
"None",
")",
"_v",
"=",
"ticktext",
"if",
"ticktext",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"ticktext\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"ticktextsrc\"",
",",
"None",
")",
"_v",
"=",
"ticktextsrc",
"if",
"ticktextsrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"ticktextsrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tickvals\"",
",",
"None",
")",
"_v",
"=",
"tickvals",
"if",
"tickvals",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tickvals\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tickvalssrc\"",
",",
"None",
")",
"_v",
"=",
"tickvalssrc",
"if",
"tickvalssrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tickvalssrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tickwidth\"",
",",
"None",
")",
"_v",
"=",
"tickwidth",
"if",
"tickwidth",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tickwidth\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"title\"",
",",
"None",
")",
"_v",
"=",
"title",
"if",
"title",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"title\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"titlefont\"",
",",
"None",
")",
"_v",
"=",
"titlefont",
"if",
"titlefont",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"titlefont\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"type\"",
",",
"None",
")",
"_v",
"=",
"type",
"if",
"type",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"type\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"visible\"",
",",
"None",
")",
"_v",
"=",
"visible",
"if",
"visible",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"visible\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"zeroline\"",
",",
"None",
")",
"_v",
"=",
"zeroline",
"if",
"zeroline",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"zeroline\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"zerolinecolor\"",
",",
"None",
")",
"_v",
"=",
"zerolinecolor",
"if",
"zerolinecolor",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"zerolinecolor\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"zerolinewidth\"",
",",
"None",
")",
"_v",
"=",
"zerolinewidth",
"if",
"zerolinewidth",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"zerolinewidth\"",
"]",
"=",
"_v",
"# Process unknown kwargs",
"# ----------------------",
"self",
".",
"_process_kwargs",
"(",
"*",
"*",
"dict",
"(",
"arg",
",",
"*",
"*",
"kwargs",
")",
")",
"# Reset skip_invalid",
"# ------------------",
"self",
".",
"_skip_invalid",
"=",
"False"
] | [
1969,
4
] | [
2558,
34
] | python | en | ['en', 'error', 'th'] | False |
main | () | Benchmark between async and synchronous inference interfaces.
Sample runs for 20 demo images on K80 GPU, model - mask_rcnn_r50_fpn_1x:
async sync
7981.79 ms 9660.82 ms
8074.52 ms 9660.94 ms
7976.44 ms 9406.83 ms
Async variant takes about 0.83-0.85 of the time of the synchronous
interface.
| Benchmark between async and synchronous inference interfaces. | async def main():
"""Benchmark between async and synchronous inference interfaces.
Sample runs for 20 demo images on K80 GPU, model - mask_rcnn_r50_fpn_1x:
async sync
7981.79 ms 9660.82 ms
8074.52 ms 9660.94 ms
7976.44 ms 9406.83 ms
Async variant takes about 0.83-0.85 of the time of the synchronous
interface.
"""
project_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
config_file = os.path.join(project_dir,
'configs/mask_rcnn_r50_fpn_1x_coco.py')
checkpoint_file = os.path.join(
project_dir, 'checkpoints/mask_rcnn_r50_fpn_1x_20181010-069fa190.pth')
if not os.path.exists(checkpoint_file):
url = ('https://s3.ap-northeast-2.amazonaws.com/open-mmlab/mmdetection'
'/models/mask_rcnn_r50_fpn_1x_20181010-069fa190.pth')
print(f'Downloading {url} ...')
local_filename, _ = urllib.request.urlretrieve(url)
os.makedirs(os.path.dirname(checkpoint_file), exist_ok=True)
shutil.move(local_filename, checkpoint_file)
print(f'Saved as {checkpoint_file}')
else:
print(f'Using existing checkpoint {checkpoint_file}')
device = 'cuda:0'
model = init_detector(
config_file, checkpoint=checkpoint_file, device=device)
# queue is used for concurrent inference of multiple images
streamqueue = asyncio.Queue()
# queue size defines concurrency level
streamqueue_size = 4
for _ in range(streamqueue_size):
streamqueue.put_nowait(torch.cuda.Stream(device=device))
# test a single image and show the results
img = mmcv.imread(os.path.join(project_dir, 'demo/demo.jpg'))
# warmup
await async_inference_detector(model, img)
async def detect(img):
async with concurrent(streamqueue):
return await async_inference_detector(model, img)
num_of_images = 20
with profile_time('benchmark', 'async'):
tasks = [
asyncio.create_task(detect(img)) for _ in range(num_of_images)
]
async_results = await asyncio.gather(*tasks)
with torch.cuda.stream(torch.cuda.default_stream()):
with profile_time('benchmark', 'sync'):
sync_results = [
inference_detector(model, img) for _ in range(num_of_images)
]
result_dir = os.path.join(project_dir, 'demo')
show_result(
img,
async_results[0],
model.CLASSES,
score_thr=0.5,
show=False,
out_file=os.path.join(result_dir, 'result_async.jpg'))
show_result(
img,
sync_results[0],
model.CLASSES,
score_thr=0.5,
show=False,
out_file=os.path.join(result_dir, 'result_sync.jpg')) | [
"async",
"def",
"main",
"(",
")",
":",
"project_dir",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
")",
")",
"config_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"project_dir",
",",
"'configs/mask_rcnn_r50_fpn_1x_coco.py'",
")",
"checkpoint_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"project_dir",
",",
"'checkpoints/mask_rcnn_r50_fpn_1x_20181010-069fa190.pth'",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"checkpoint_file",
")",
":",
"url",
"=",
"(",
"'https://s3.ap-northeast-2.amazonaws.com/open-mmlab/mmdetection'",
"'/models/mask_rcnn_r50_fpn_1x_20181010-069fa190.pth'",
")",
"print",
"(",
"f'Downloading {url} ...'",
")",
"local_filename",
",",
"_",
"=",
"urllib",
".",
"request",
".",
"urlretrieve",
"(",
"url",
")",
"os",
".",
"makedirs",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"checkpoint_file",
")",
",",
"exist_ok",
"=",
"True",
")",
"shutil",
".",
"move",
"(",
"local_filename",
",",
"checkpoint_file",
")",
"print",
"(",
"f'Saved as {checkpoint_file}'",
")",
"else",
":",
"print",
"(",
"f'Using existing checkpoint {checkpoint_file}'",
")",
"device",
"=",
"'cuda:0'",
"model",
"=",
"init_detector",
"(",
"config_file",
",",
"checkpoint",
"=",
"checkpoint_file",
",",
"device",
"=",
"device",
")",
"# queue is used for concurrent inference of multiple images",
"streamqueue",
"=",
"asyncio",
".",
"Queue",
"(",
")",
"# queue size defines concurrency level",
"streamqueue_size",
"=",
"4",
"for",
"_",
"in",
"range",
"(",
"streamqueue_size",
")",
":",
"streamqueue",
".",
"put_nowait",
"(",
"torch",
".",
"cuda",
".",
"Stream",
"(",
"device",
"=",
"device",
")",
")",
"# test a single image and show the results",
"img",
"=",
"mmcv",
".",
"imread",
"(",
"os",
".",
"path",
".",
"join",
"(",
"project_dir",
",",
"'demo/demo.jpg'",
")",
")",
"# warmup",
"await",
"async_inference_detector",
"(",
"model",
",",
"img",
")",
"async",
"def",
"detect",
"(",
"img",
")",
":",
"async",
"with",
"concurrent",
"(",
"streamqueue",
")",
":",
"return",
"await",
"async_inference_detector",
"(",
"model",
",",
"img",
")",
"num_of_images",
"=",
"20",
"with",
"profile_time",
"(",
"'benchmark'",
",",
"'async'",
")",
":",
"tasks",
"=",
"[",
"asyncio",
".",
"create_task",
"(",
"detect",
"(",
"img",
")",
")",
"for",
"_",
"in",
"range",
"(",
"num_of_images",
")",
"]",
"async_results",
"=",
"await",
"asyncio",
".",
"gather",
"(",
"*",
"tasks",
")",
"with",
"torch",
".",
"cuda",
".",
"stream",
"(",
"torch",
".",
"cuda",
".",
"default_stream",
"(",
")",
")",
":",
"with",
"profile_time",
"(",
"'benchmark'",
",",
"'sync'",
")",
":",
"sync_results",
"=",
"[",
"inference_detector",
"(",
"model",
",",
"img",
")",
"for",
"_",
"in",
"range",
"(",
"num_of_images",
")",
"]",
"result_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"project_dir",
",",
"'demo'",
")",
"show_result",
"(",
"img",
",",
"async_results",
"[",
"0",
"]",
",",
"model",
".",
"CLASSES",
",",
"score_thr",
"=",
"0.5",
",",
"show",
"=",
"False",
",",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"result_dir",
",",
"'result_async.jpg'",
")",
")",
"show_result",
"(",
"img",
",",
"sync_results",
"[",
"0",
"]",
",",
"model",
".",
"CLASSES",
",",
"score_thr",
"=",
"0.5",
",",
"show",
"=",
"False",
",",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"result_dir",
",",
"'result_sync.jpg'",
")",
")"
] | [
14,
0
] | [
95,
61
] | python | en | ['en', 'en', 'en'] | True |
setup_args | () |
Set up args.
|
Set up args.
| def setup_args():
"""
Set up args.
"""
parser = ParlaiParser(False, False)
parser.add_parlai_data_path()
cc = parser.add_argument_group('Download Support Docs')
cc.add_argument(
'-nw',
'--slsize',
default=716,
type=int,
metavar='N',
help='number of wet files in a slice',
)
cc.add_argument(
'-ns',
'--slnum',
default=0,
type=int,
metavar='N',
help='commoncrawl slice number [0, ..., 71520 / args.slsize]',
)
cc.add_argument(
'-wf',
'--wet_urls',
default='pre_computed/wet.paths',
type=str,
help='path from data folder to file containing WET file URLs',
)
cc.add_argument(
'-sr_l',
'--subreddit_names',
default='["explainlikeimfive"]',
type=str,
help='subreddit names',
)
cc.add_argument(
'-nu',
'--n_urls',
default=100,
type=int,
metavar='N',
help='number of support documents to gather for each example',
)
cc.add_argument(
'-sfq',
'--save_freq',
default=50,
type=int,
metavar='N',
help='how often are results written to file',
)
cc.add_argument(
'-o',
'--output_dir',
default='eli5',
type=str,
help='where to save the output in data folder',
)
cc.add_argument(
'-u',
'--urls',
type=str,
help='path to a json file of URLs to gather (in a list format)',
)
cc.add_argument(
'-ids',
'--ccuids',
type=str,
help='path to a json file of Common Crawl IDs to gather (in a list format)',
)
return parser.parse_args() | [
"def",
"setup_args",
"(",
")",
":",
"parser",
"=",
"ParlaiParser",
"(",
"False",
",",
"False",
")",
"parser",
".",
"add_parlai_data_path",
"(",
")",
"cc",
"=",
"parser",
".",
"add_argument_group",
"(",
"'Download Support Docs'",
")",
"cc",
".",
"add_argument",
"(",
"'-nw'",
",",
"'--slsize'",
",",
"default",
"=",
"716",
",",
"type",
"=",
"int",
",",
"metavar",
"=",
"'N'",
",",
"help",
"=",
"'number of wet files in a slice'",
",",
")",
"cc",
".",
"add_argument",
"(",
"'-ns'",
",",
"'--slnum'",
",",
"default",
"=",
"0",
",",
"type",
"=",
"int",
",",
"metavar",
"=",
"'N'",
",",
"help",
"=",
"'commoncrawl slice number [0, ..., 71520 / args.slsize]'",
",",
")",
"cc",
".",
"add_argument",
"(",
"'-wf'",
",",
"'--wet_urls'",
",",
"default",
"=",
"'pre_computed/wet.paths'",
",",
"type",
"=",
"str",
",",
"help",
"=",
"'path from data folder to file containing WET file URLs'",
",",
")",
"cc",
".",
"add_argument",
"(",
"'-sr_l'",
",",
"'--subreddit_names'",
",",
"default",
"=",
"'[\"explainlikeimfive\"]'",
",",
"type",
"=",
"str",
",",
"help",
"=",
"'subreddit names'",
",",
")",
"cc",
".",
"add_argument",
"(",
"'-nu'",
",",
"'--n_urls'",
",",
"default",
"=",
"100",
",",
"type",
"=",
"int",
",",
"metavar",
"=",
"'N'",
",",
"help",
"=",
"'number of support documents to gather for each example'",
",",
")",
"cc",
".",
"add_argument",
"(",
"'-sfq'",
",",
"'--save_freq'",
",",
"default",
"=",
"50",
",",
"type",
"=",
"int",
",",
"metavar",
"=",
"'N'",
",",
"help",
"=",
"'how often are results written to file'",
",",
")",
"cc",
".",
"add_argument",
"(",
"'-o'",
",",
"'--output_dir'",
",",
"default",
"=",
"'eli5'",
",",
"type",
"=",
"str",
",",
"help",
"=",
"'where to save the output in data folder'",
",",
")",
"cc",
".",
"add_argument",
"(",
"'-u'",
",",
"'--urls'",
",",
"type",
"=",
"str",
",",
"help",
"=",
"'path to a json file of URLs to gather (in a list format)'",
",",
")",
"cc",
".",
"add_argument",
"(",
"'-ids'",
",",
"'--ccuids'",
",",
"type",
"=",
"str",
",",
"help",
"=",
"'path to a json file of Common Crawl IDs to gather (in a list format)'",
",",
")",
"return",
"parser",
".",
"parse_args",
"(",
")"
] | [
58,
0
] | [
130,
30
] | python | en | ['en', 'error', 'th'] | False |
Marker.color | (self) |
Sets the marker color of selected points.
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
Returns
-------
str
|
Sets the marker color of selected points.
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen | def color(self):
"""
Sets the marker color of selected points.
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
Returns
-------
str
"""
return self["color"] | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
15,
4
] | [
65,
28
] | python | en | ['en', 'error', 'th'] | False |
Marker.opacity | (self) |
Sets the marker opacity of selected points.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1]
Returns
-------
int|float
|
Sets the marker opacity of selected points.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1] | def opacity(self):
"""
Sets the marker opacity of selected points.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1]
Returns
-------
int|float
"""
return self["opacity"] | [
"def",
"opacity",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"opacity\"",
"]"
] | [
74,
4
] | [
85,
30
] | python | en | ['en', 'error', 'th'] | False |
Marker.size | (self) |
Sets the marker size of selected points.
The 'size' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
|
Sets the marker size of selected points.
The 'size' property is a number and may be specified as:
- An int or float in the interval [0, inf] | def size(self):
"""
Sets the marker size of selected points.
The 'size' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
"""
return self["size"] | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"size\"",
"]"
] | [
94,
4
] | [
105,
27
] | python | en | ['en', 'error', 'th'] | False |
Marker.__init__ | (self, arg=None, color=None, opacity=None, size=None, **kwargs) |
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.violin.selected.Marker`
color
Sets the marker color of selected points.
opacity
Sets the marker opacity of selected points.
size
Sets the marker size of selected points.
Returns
-------
Marker
|
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.violin.selected.Marker`
color
Sets the marker color of selected points.
opacity
Sets the marker opacity of selected points.
size
Sets the marker size of selected points. | def __init__(self, arg=None, color=None, opacity=None, size=None, **kwargs):
"""
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.violin.selected.Marker`
color
Sets the marker color of selected points.
opacity
Sets the marker opacity of selected points.
size
Sets the marker size of selected points.
Returns
-------
Marker
"""
super(Marker, self).__init__("marker")
if "_parent" in kwargs:
self._parent = kwargs["_parent"]
return
# Validate arg
# ------------
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.violin.selected.Marker
constructor must be a dict or
an instance of :class:`plotly.graph_objs.violin.selected.Marker`"""
)
# Handle skip_invalid
# -------------------
self._skip_invalid = kwargs.pop("skip_invalid", False)
self._validate = kwargs.pop("_validate", True)
# Populate data dict with properties
# ----------------------------------
_v = arg.pop("color", None)
_v = color if color is not None else _v
if _v is not None:
self["color"] = _v
_v = arg.pop("opacity", None)
_v = opacity if opacity is not None else _v
if _v is not None:
self["opacity"] = _v
_v = arg.pop("size", None)
_v = size if size is not None else _v
if _v is not None:
self["size"] = _v
# Process unknown kwargs
# ----------------------
self._process_kwargs(**dict(arg, **kwargs))
# Reset skip_invalid
# ------------------
self._skip_invalid = False | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"opacity",
"=",
"None",
",",
"size",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Marker",
",",
"self",
")",
".",
"__init__",
"(",
"\"marker\"",
")",
"if",
"\"_parent\"",
"in",
"kwargs",
":",
"self",
".",
"_parent",
"=",
"kwargs",
"[",
"\"_parent\"",
"]",
"return",
"# Validate arg",
"# ------------",
"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",
"(",
"\"\"\"\\\nThe first argument to the plotly.graph_objs.violin.selected.Marker \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.violin.selected.Marker`\"\"\"",
")",
"# Handle skip_invalid",
"# -------------------",
"self",
".",
"_skip_invalid",
"=",
"kwargs",
".",
"pop",
"(",
"\"skip_invalid\"",
",",
"False",
")",
"self",
".",
"_validate",
"=",
"kwargs",
".",
"pop",
"(",
"\"_validate\"",
",",
"True",
")",
"# Populate data dict with properties",
"# ----------------------------------",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"color\"",
",",
"None",
")",
"_v",
"=",
"color",
"if",
"color",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"color\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"opacity\"",
",",
"None",
")",
"_v",
"=",
"opacity",
"if",
"opacity",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"opacity\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"size\"",
",",
"None",
")",
"_v",
"=",
"size",
"if",
"size",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"size\"",
"]",
"=",
"_v",
"# Process unknown kwargs",
"# ----------------------",
"self",
".",
"_process_kwargs",
"(",
"*",
"*",
"dict",
"(",
"arg",
",",
"*",
"*",
"kwargs",
")",
")",
"# Reset skip_invalid",
"# ------------------",
"self",
".",
"_skip_invalid",
"=",
"False"
] | [
124,
4
] | [
193,
34
] | python | en | ['en', 'error', 'th'] | False |
Delta.decreasing | (self) |
The 'decreasing' property is an instance of Decreasing
that may be specified as:
- An instance of :class:`plotly.graph_objs.indicator.delta.Decreasing`
- A dict of string/value properties that will be passed
to the Decreasing constructor
Supported dict properties:
color
Sets the color for increasing value.
symbol
Sets the symbol to display for increasing value
Returns
-------
plotly.graph_objs.indicator.delta.Decreasing
|
The 'decreasing' property is an instance of Decreasing
that may be specified as:
- An instance of :class:`plotly.graph_objs.indicator.delta.Decreasing`
- A dict of string/value properties that will be passed
to the Decreasing constructor
Supported dict properties:
color
Sets the color for increasing value.
symbol
Sets the symbol to display for increasing value | def decreasing(self):
"""
The 'decreasing' property is an instance of Decreasing
that may be specified as:
- An instance of :class:`plotly.graph_objs.indicator.delta.Decreasing`
- A dict of string/value properties that will be passed
to the Decreasing constructor
Supported dict properties:
color
Sets the color for increasing value.
symbol
Sets the symbol to display for increasing value
Returns
-------
plotly.graph_objs.indicator.delta.Decreasing
"""
return self["decreasing"] | [
"def",
"decreasing",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"decreasing\"",
"]"
] | [
23,
4
] | [
42,
33
] | python | en | ['en', 'error', 'th'] | False |
Delta.font | (self) |
Set the font used to display the delta
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.indicator.delta.Font`
- A dict of string/value properties that will be passed
to the Font constructor
Supported dict properties:
color
family
HTML font family - the typeface that will be
applied by the web browser. The web browser
will only be able to apply a font if it is
available on the system which it operates.
Provide multiple font families, separated by
commas, to indicate the preference in which to
apply fonts if they aren't available on the
system. The Chart Studio Cloud (at
https://chart-studio.plotly.com or on-premise)
generates images on a server, where only a
select number of fonts are installed and
supported. These include "Arial", "Balto",
"Courier New", "Droid Sans",, "Droid Serif",
"Droid Sans Mono", "Gravitas One", "Old
Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
size
Returns
-------
plotly.graph_objs.indicator.delta.Font
|
Set the font used to display the delta
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.indicator.delta.Font`
- A dict of string/value properties that will be passed
to the Font constructor
Supported dict properties:
color
family
HTML font family - the typeface that will be
applied by the web browser. The web browser
will only be able to apply a font if it is
available on the system which it operates.
Provide multiple font families, separated by
commas, to indicate the preference in which to
apply fonts if they aren't available on the
system. The Chart Studio Cloud (at
https://chart-studio.plotly.com or on-premise)
generates images on a server, where only a
select number of fonts are installed and
supported. These include "Arial", "Balto",
"Courier New", "Droid Sans",, "Droid Serif",
"Droid Sans Mono", "Gravitas One", "Old
Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
size | def font(self):
"""
Set the font used to display the delta
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.indicator.delta.Font`
- A dict of string/value properties that will be passed
to the Font constructor
Supported dict properties:
color
family
HTML font family - the typeface that will be
applied by the web browser. The web browser
will only be able to apply a font if it is
available on the system which it operates.
Provide multiple font families, separated by
commas, to indicate the preference in which to
apply fonts if they aren't available on the
system. The Chart Studio Cloud (at
https://chart-studio.plotly.com or on-premise)
generates images on a server, where only a
select number of fonts are installed and
supported. These include "Arial", "Balto",
"Courier New", "Droid Sans",, "Droid Serif",
"Droid Sans Mono", "Gravitas One", "Old
Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
size
Returns
-------
plotly.graph_objs.indicator.delta.Font
"""
return self["font"] | [
"def",
"font",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"font\"",
"]"
] | [
51,
4
] | [
88,
27
] | python | en | ['en', 'error', 'th'] | False |
Delta.increasing | (self) |
The 'increasing' property is an instance of Increasing
that may be specified as:
- An instance of :class:`plotly.graph_objs.indicator.delta.Increasing`
- A dict of string/value properties that will be passed
to the Increasing constructor
Supported dict properties:
color
Sets the color for increasing value.
symbol
Sets the symbol to display for increasing value
Returns
-------
plotly.graph_objs.indicator.delta.Increasing
|
The 'increasing' property is an instance of Increasing
that may be specified as:
- An instance of :class:`plotly.graph_objs.indicator.delta.Increasing`
- A dict of string/value properties that will be passed
to the Increasing constructor
Supported dict properties:
color
Sets the color for increasing value.
symbol
Sets the symbol to display for increasing value | def increasing(self):
"""
The 'increasing' property is an instance of Increasing
that may be specified as:
- An instance of :class:`plotly.graph_objs.indicator.delta.Increasing`
- A dict of string/value properties that will be passed
to the Increasing constructor
Supported dict properties:
color
Sets the color for increasing value.
symbol
Sets the symbol to display for increasing value
Returns
-------
plotly.graph_objs.indicator.delta.Increasing
"""
return self["increasing"] | [
"def",
"increasing",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"increasing\"",
"]"
] | [
97,
4
] | [
116,
33
] | python | en | ['en', 'error', 'th'] | False |
Delta.position | (self) |
Sets the position of delta with respect to the number.
The 'position' property is an enumeration that may be specified as:
- One of the following enumeration values:
['top', 'bottom', 'left', 'right']
Returns
-------
Any
|
Sets the position of delta with respect to the number.
The 'position' property is an enumeration that may be specified as:
- One of the following enumeration values:
['top', 'bottom', 'left', 'right'] | def position(self):
"""
Sets the position of delta with respect to the number.
The 'position' property is an enumeration that may be specified as:
- One of the following enumeration values:
['top', 'bottom', 'left', 'right']
Returns
-------
Any
"""
return self["position"] | [
"def",
"position",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"position\"",
"]"
] | [
125,
4
] | [
137,
31
] | python | en | ['en', 'error', 'th'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.