forked from plotly/plotly.py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_layout.py
387 lines (383 loc) · 18.5 KB
/
_layout.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
import _plotly_utils.basevalidators
class LayoutValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name='layout', parent_name='', **kwargs):
super(LayoutValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
data_class_str=kwargs.pop('data_class_str', 'Layout'),
data_docs=kwargs.pop(
'data_docs', """
angularaxis
plotly.graph_objs.layout.AngularAxis instance
or dict with compatible properties
annotations
plotly.graph_objs.layout.Annotation instance or
dict with compatible properties
annotationdefaults
When used in a template (as
layout.template.layout.annotationdefaults),
sets the default property values to use for
elements of layout.annotations
autosize
Determines whether or not a layout width or
height that has been left undefined by the user
is initialized on each relayout. Note that,
regardless of this attribute, an undefined
layout width or height is always initialized on
the first call to plot.
bargap
Sets the gap (in plot fraction) between bars of
adjacent location coordinates.
bargroupgap
Sets the gap (in plot fraction) between bars of
the same location coordinate.
barmode
Determines how bars at the same location
coordinate are displayed on the graph. With
"stack", the bars are stacked on top of one
another With "relative", the bars are stacked
on top of one another, with negative values
below the axis, positive values above With
"group", the bars are plotted next to one
another centered around the shared location.
With "overlay", the bars are plotted over one
another, you might need to an "opacity" to see
multiple bars.
barnorm
Sets the normalization for bar traces on the
graph. With "fraction", the value of each bar
is divided by the sum of all values at that
location coordinate. "percent" is the same but
multiplied by 100 to show percentages.
boxgap
Sets the gap (in plot fraction) between boxes
of adjacent location coordinates. Has no effect
on traces that have "width" set.
boxgroupgap
Sets the gap (in plot fraction) between boxes
of the same location coordinate. Has no effect
on traces that have "width" set.
boxmode
Determines how boxes at the same location
coordinate are displayed on the graph. If
"group", the boxes are plotted next to one
another centered around the shared location. If
"overlay", the boxes are plotted over one
another, you might need to set "opacity" to see
them multiple boxes. Has no effect on traces
that have "width" set.
calendar
Sets the default calendar system to use for
interpreting and displaying dates throughout
the plot.
clickmode
Determines the mode of single click
interactions. "event" is the default value and
emits the `plotly_click` event. In addition
this mode emits the `plotly_selected` event in
drag modes "lasso" and "select", but with no
event data attached (kept for compatibility
reasons). The "select" flag enables selecting
single data points via click. This mode also
supports persistent selections, meaning that
pressing Shift while clicking, adds to /
subtracts from an existing selection. "select"
with `hovermode`: "x" can be confusing,
consider explicitly setting `hovermode`:
"closest" when using this feature. Selection
events are sent accordingly as long as "event"
flag is set as well. When the "event" flag is
missing, `plotly_click` and `plotly_selected`
events are not fired.
colorscale
plotly.graph_objs.layout.Colorscale instance or
dict with compatible properties
colorway
Sets the default trace colors.
datarevision
If provided, a changed value tells
`Plotly.react` that one or more data arrays has
changed. This way you can modify arrays in-
place rather than making a complete new copy
for an incremental change. If NOT provided,
`Plotly.react` assumes that data arrays are
being treated as immutable, thus any data array
with a different identity from its predecessor
contains new data.
direction
Legacy polar charts are deprecated! Please
switch to "polar" subplots. Sets the direction
corresponding to positive angles in legacy
polar charts.
dragmode
Determines the mode of drag interactions.
"select" and "lasso" apply only to scatter
traces with markers or text. "orbit" and
"turntable" apply only to 3D scenes.
editrevision
Controls persistence of user-driven changes in
`editable: true` configuration, other than
trace names and axis titles. Defaults to
`layout.uirevision`.
extendpiecolors
If `true`, the pie slice colors (whether given
by `piecolorway` or inherited from `colorway`)
will be extended to three times its original
length by first repeating every color 20%
lighter then each color 20% darker. This is
intended to reduce the likelihood of reusing
the same color when you have many slices, but
you can set `false` to disable. Colors provided
in the trace, using `marker.colors`, are never
extended.
font
Sets the global font. Note that fonts used in
traces and other layout components inherit from
the global font.
geo
plotly.graph_objs.layout.Geo instance or dict
with compatible properties
grid
plotly.graph_objs.layout.Grid instance or dict
with compatible properties
height
Sets the plot's height (in px).
hiddenlabels
hiddenlabelssrc
Sets the source reference on plot.ly for
hiddenlabels .
hidesources
Determines whether or not a text link citing
the data source is placed at the bottom-right
cored of the figure. Has only an effect only on
graphs that have been generated via forked
graphs from the plotly service (at
https://plot.ly or on-premise).
hoverdistance
Sets the default distance (in pixels) to look
for data to add hover labels (-1 means no
cutoff, 0 means no looking for data). This is
only a real distance for hovering on point-like
objects, like scatter points. For area-like
objects (bars, scatter fills, etc) hovering is
on inside the area and off outside, but these
objects will not supersede hover on point-like
objects in case of conflict.
hoverlabel
plotly.graph_objs.layout.Hoverlabel instance or
dict with compatible properties
hovermode
Determines the mode of hover interactions. If
`clickmode` includes the "select" flag,
`hovermode` defaults to "closest". If
`clickmode` lacks the "select" flag, it
defaults to "x" or "y" (depending on the
trace's `orientation` value) for plots based on
cartesian coordinates. For anything else the
default value is "closest".
images
plotly.graph_objs.layout.Image instance or dict
with compatible properties
imagedefaults
When used in a template (as
layout.template.layout.imagedefaults), sets the
default property values to use for elements of
layout.images
legend
plotly.graph_objs.layout.Legend instance or
dict with compatible properties
mapbox
plotly.graph_objs.layout.Mapbox instance or
dict with compatible properties
margin
plotly.graph_objs.layout.Margin instance or
dict with compatible properties
meta
Assigns extra meta information that can be used
in various `text` attributes. Attributes such
as the graph, axis and colorbar `title.text`,
annotation `text` `trace.name` in legend items,
`rangeselector`, `updatemenues` and `sliders`
`label` text all support `meta`. One can access
`meta` fields using template strings:
`%{meta[i]}` where `i` is the index of the
`meta` item in question.
metasrc
Sets the source reference on plot.ly for meta
.
modebar
plotly.graph_objs.layout.Modebar instance or
dict with compatible properties
orientation
Legacy polar charts are deprecated! Please
switch to "polar" subplots. Rotates the entire
polar by the given angle in legacy polar
charts.
paper_bgcolor
Sets the color of paper where the graph is
drawn.
piecolorway
Sets the default pie slice colors. Defaults to
the main `colorway` used for trace colors. If
you specify a new list here it can still be
extended with lighter and darker colors, see
`extendpiecolors`.
plot_bgcolor
Sets the color of plotting area in-between x
and y axes.
polar
plotly.graph_objs.layout.Polar instance or dict
with compatible properties
radialaxis
plotly.graph_objs.layout.RadialAxis instance or
dict with compatible properties
scene
plotly.graph_objs.layout.Scene instance or dict
with compatible properties
selectdirection
When "dragmode" is set to "select", this limits
the selection of the drag to horizontal,
vertical or diagonal. "h" only allows
horizontal selection, "v" only vertical, "d"
only diagonal and "any" sets no limit.
selectionrevision
Controls persistence of user-driven changes in
selected points from all traces.
separators
Sets the decimal and thousand separators. For
example, *. * puts a '.' before decimals and a
space between thousands. In English locales,
dflt is ".," but other locales may alter this
default.
shapes
plotly.graph_objs.layout.Shape instance or dict
with compatible properties
shapedefaults
When used in a template (as
layout.template.layout.shapedefaults), sets the
default property values to use for elements of
layout.shapes
showlegend
Determines whether or not a legend is drawn.
Default is `true` if there is a trace to show
and any of these: a) Two or more traces would
by default be shown in the legend. b) One pie
trace is shown in the legend. c) One trace is
explicitly given with `showlegend: true`.
sliders
plotly.graph_objs.layout.Slider instance or
dict with compatible properties
sliderdefaults
When used in a template (as
layout.template.layout.sliderdefaults), sets
the default property values to use for elements
of layout.sliders
spikedistance
Sets the default distance (in pixels) to look
for data to draw spikelines to (-1 means no
cutoff, 0 means no looking for data). As with
hoverdistance, distance does not apply to area-
like objects. In addition, some objects can be
hovered on but will not generate spikelines,
such as scatter fills.
template
Default attributes to be applied to the plot.
This should be a dict with format: `{'layout':
layoutTemplate, 'data': {trace_type:
[traceTemplate, ...], ...}}` where
`layoutTemplate` is a dict matching the
structure of `figure.layout` and
`traceTemplate` is a dict matching the
structure of the trace with type `trace_type`
(e.g. 'scatter'). Alternatively, this may be
specified as an instance of
plotly.graph_objs.layout.Template. Trace
templates are applied cyclically to traces of
each type. Container arrays (eg `annotations`)
have special handling: An object ending in
`defaults` (eg `annotationdefaults`) is applied
to each array item. But if an item has a
`templateitemname` key we look in the template
array for an item with matching `name` and
apply that instead. If no matching `name` is
found we mark the item invisible. Any named
template item not referenced is appended to the
end of the array, so this can be used to add a
watermark annotation or a logo image, for
example. To omit one of these items on the
plot, make an item with matching
`templateitemname` and `visible: false`.
ternary
plotly.graph_objs.layout.Ternary instance or
dict with compatible properties
title
plotly.graph_objs.layout.Title instance or dict
with compatible properties
titlefont
Deprecated: Please use layout.title.font
instead. Sets the title font. Note that the
title's font used to be customized by the now
deprecated `titlefont` attribute.
transition
Sets transition options used during
Plotly.react updates.
uirevision
Used to allow user interactions with the plot
to persist after `Plotly.react` calls that are
unaware of these interactions. If `uirevision`
is omitted, or if it is given and it changed
from the previous `Plotly.react` call, the
exact new figure is used. If `uirevision` is
truthy and did NOT change, any attribute that
has been affected by user interactions and did
not receive a different value in the new figure
will keep the interaction value.
`layout.uirevision` attribute serves as the
default for `uirevision` attributes in various
sub-containers. For finer control you can set
these sub-attributes directly. For example, if
your app separately controls the data on the x
and y axes you might set
`xaxis.uirevision=*time*` and
`yaxis.uirevision=*cost*`. Then if only the y
data is changed, you can update
`yaxis.uirevision=*quantity*` and the y axis
range will reset but the x axis range will
retain any user-driven zoom.
updatemenus
plotly.graph_objs.layout.Updatemenu instance or
dict with compatible properties
updatemenudefaults
When used in a template (as
layout.template.layout.updatemenudefaults),
sets the default property values to use for
elements of layout.updatemenus
violingap
Sets the gap (in plot fraction) between violins
of adjacent location coordinates. Has no effect
on traces that have "width" set.
violingroupgap
Sets the gap (in plot fraction) between violins
of the same location coordinate. Has no effect
on traces that have "width" set.
violinmode
Determines how violins at the same location
coordinate are displayed on the graph. If
"group", the violins are plotted next to one
another centered around the shared location. If
"overlay", the violins are plotted over one
another, you might need to set "opacity" to see
them multiple violins. Has no effect on traces
that have "width" set.
width
Sets the plot's width (in px).
xaxis
plotly.graph_objs.layout.XAxis instance or dict
with compatible properties
yaxis
plotly.graph_objs.layout.YAxis instance or dict
with compatible properties
"""
),
**kwargs
)