forked from deephaven/deephaven-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmaps.py
More file actions
681 lines (639 loc) · 34.9 KB
/
Copy pathmaps.py
File metadata and controls
681 lines (639 loc) · 34.9 KB
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
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
from __future__ import annotations
from typing import Callable
import warnings
from plotly import express as px
from ._private_utils import process_args
from ..shared import default_callback
from ..deephaven_figure import DeephavenFigure
from ..types import PartitionableTableLike, TableLike
def scatter_geo(
table: PartitionableTableLike,
lat: str | None = None,
lon: str | None = None,
locations: str | None = None,
locationmode: str | None = None,
geojson: str | dict | None = None,
featureidkey: str = "id",
by: str | list[str] | None = None,
by_vars: str | list[str] = "color",
filter_by: str | list[str] | bool | None = None,
required_filter_by: str | list[str] | bool | None = None,
color: str | list[str] | None = None,
symbol: str | list[str] | None = None,
size: str | list[str] | None = None,
text: str | None = None,
hover_name: str | None = None,
labels: dict[str, str] | None = None,
color_discrete_sequence: list[str] | None = None,
color_discrete_map: str
| tuple[str, dict[str | tuple[str], str]]
| dict[str | tuple[str], str]
| None = None,
symbol_sequence: list[str] | None = None,
symbol_map: dict[str | tuple[str], str] | None = None,
size_sequence: list[int] | None = None,
size_map: str
| tuple[str, dict[str | tuple[str], str]]
| dict[str | tuple[str], str]
| None = None,
color_continuous_scale: list[str] | None = None,
range_color: list[float] | None = None,
color_continuous_midpoint: float | None = None,
opacity: float | None = None,
projection: str | None = None,
scope: str | None = None,
center: dict[str, float] | None = None,
fitbounds: bool | str = False,
basemap_visible: bool | None = None,
title: str | None = None,
template: str | None = None,
unsafe_update_figure: Callable = default_callback,
) -> DeephavenFigure:
"""
Create a scatter_geo plot
Args:
table: A table to pull data from.
lat: A column name to use for latitude values.
lon: A column name to use for longitude values.
locations: A column name to use for location values.
locationmode: A location mode to use.
One of ‘ISO-3’, ‘USA-states’, or ‘country names’.
These map locations to predefined geographic regions.
geojson: GeoJSON data to use for geographic regions.
featureidkey: The feature ID key to use for geographic regions.
by: A column or list of columns that contain values to plot the figure traces by.
All values or combination of values map to a unique design. The variable
by_vars specifies which design elements are used.
This is overriden if any specialized design variables such as color are specified
by_vars: A string or list of string that contain design elements to plot by.
Can contain size, color, and symbol.
If associated maps or sequences are specified, they are used to map by column values
to designs. Otherwise, default values are used.
filter_by: A column or list of columns that contain values to filter the chart by.
If a boolean is passed and the table is partitioned, all partition key columns used to
create the partitions are used.
If no filters are specified, all partitions are shown on the chart.
required_filter_by: A column or list of columns that contain values to filter the chart by.
Values set in input filters or linkers for the relevant columns determine the exact values to display.
If a boolean is passed and the table is partitioned, all partition key columns used to
create the partitions are used.
All required input filters or linkers must be set for the chart to display any data.
color: A column or list of columns that contain color values.
If only one column is passed, and it contains numeric values, the value
is used as a value on a continuous color scale. Otherwise, the value is
used for a plot by on color.
See color_discrete_map for additional behaviors.
symbol: A column or list of columns that contain symbol values.
The value is used for a plot by on symbol.
See color_discrete_map for additional behaviors.
size: A column or list of columns that contain size values.
If only one column is passed, and it contains numeric values, the value
is used as a size. Otherwise, the value is used for a plot by on size.
See size_map for additional behaviors.
text: A column that contains text annotations.
hover_name: A column that contains names to bold in the hover tooltip.
labels: A dictionary of labels mapping columns to new labels.
color_discrete_sequence: A list of colors to sequentially apply to
the series. The colors loop, so if there are more series than colors,
colors will be reused. This is overriden if "color" is specified.
color_discrete_map: If dict, the keys should be strings of the column values (or a tuple
of combinations of column values) which map to colors.
If "identity", the values are taken as literal colors.
If "by" or ("by", dict) where dict is as described above, the colors are forced to by
symbol_sequence: A list of symbols to sequentially apply to the
markers in the series. The symbols loop, so if there are more series than
symbols, symbols will be reused. This is overriden if "symbol" is specified.
symbol_map: If dict, the keys should be strings of the column values (or a tuple
of combinations of column values) which map to symbols.
size_sequence: A list of sizes to sequentially apply to the
markers in the series. The sizes loop, so if there are more series than
symbols, sizes will be reused. This is overriden if "size" is specified.
size_map: If dict, the keys should be strings of the column values (or a tuple
of combinations of column values) which map to sizes.
If "identity", the values are taken as literal sizes.
If "by" or ("by", dict) where dict is as described above, the sizes are forced to by
color_continuous_scale: A list of colors for a continuous scale
range_color: A list of two numbers that form the endpoints of the color axis
color_continuous_midpoint: A number that is the midpoint of the color axis
opacity: Opacity to apply to all markers. 0 is completely transparent
and 1 is completely opaque.
projection: The projection type to use.
Default depends on scope.
One of 'equirectangular', 'mercator', 'orthographic', 'natural earth',
'kavrayskiy7', 'miller', 'robinson', 'eckert4', 'azimuthal equal area',
'azimuthal equidistant', 'conic equal area', 'conic conformal',
'conic equidistant', 'gnomonic', 'stereographic', 'mollweide', 'hammer',
'transverse mercator', 'albers usa', 'winkel tripel', 'aitoff', or
'sinusoidal'
scope: The scope of the map.
Default of 'world', but forced to 'usa' if projection is 'albers usa'
One of 'world', 'usa', 'europe', 'asia', 'africa', 'north america', or
'south america'
center: A dictionary of center coordinates.
The keys should be 'lat' and 'lon' and the values should be floats
that represent the lat and lon of the center of the map.
fitbounds: One of False, 'locations', or 'geojson'
If 'locations' or 'geojson', the map will zoom to the extent of the
locations or geojson bounds respectively.
basemap_visible: If True, the basemap layer is visible.
title: The title of the chart
template: The template for the chart.
unsafe_update_figure: An update function that takes a plotly figure
as an argument and optionally returns a plotly figure. If a figure is
not returned, the plotly figure passed will be assumed to be the return
value. Used to add any custom changes to the underlying plotly figure.
Note that the existing data traces should not be removed. This may lead
to unexpected behavior if traces are modified in a way that break data
mappings.
Returns:
DeephavenFigure: A DeephavenFigure that contains the scatter_geo figure
"""
args = locals()
return process_args(args, {"scatter"}, px_func=px.scatter_geo)
def scatter_mapbox(*args, **kwargs) -> DeephavenFigure:
"""
c
"""
warnings.warn(
"scatter_mapbox is deprecated and will be removed in a future release. Use scatter_map instead.",
DeprecationWarning,
stacklevel=2,
)
if "style_mapbox" in kwargs:
kwargs["map_style"] = kwargs.pop("style_mapbox")
return scatter_map(*args, **kwargs)
def line_mapbox(*args, **kwargs) -> DeephavenFigure:
"""
Deprecated function. Use line_map instead.
"""
warnings.warn(
"line_mapbox is deprecated and will be removed in a future release. Use line_map instead.",
DeprecationWarning,
stacklevel=2,
)
if "style_mapbox" in kwargs:
kwargs["map_style"] = kwargs.pop("style_mapbox")
return line_map(*args, **kwargs)
def density_mapbox(*args, **kwargs) -> DeephavenFigure:
"""
Deprecated function. Use density_map instead.
"""
warnings.warn(
"density_mapbox is deprecated and will be removed in a future release. Use density_map instead.",
DeprecationWarning,
stacklevel=2,
)
if "style_mapbox" in kwargs:
kwargs["map_style"] = kwargs.pop("style_mapbox")
return density_map(*args, **kwargs)
def scatter_map(
table: PartitionableTableLike,
lat: str | None = None,
lon: str | None = None,
by: str | list[str] | None = None,
by_vars: str | list[str] = "color",
filter_by: str | list[str] | bool | None = None,
required_filter_by: str | list[str] | bool | None = None,
color: str | list[str] | None = None,
symbol: str | list[str] | None = None,
size: str | list[str] | None = None,
text: str | None = None,
hover_name: str | None = None,
labels: dict[str, str] | None = None,
color_discrete_sequence: list[str] | None = None,
color_discrete_map: str
| tuple[str, dict[str | tuple[str], str]]
| dict[str | tuple[str], str]
| None = None,
symbol_sequence: list[str] | None = None,
symbol_map: dict[str | tuple[str], str] | None = None,
size_sequence: list[int] | None = None,
size_map: str
| tuple[str, dict[str | tuple[str], str]]
| dict[str | tuple[str], str]
| None = None,
color_continuous_scale: list[str] | None = None,
range_color: list[float] | None = None,
color_continuous_midpoint: float | None = None,
opacity: float | None = None,
zoom: float | None = None,
center: dict[str, float] | None = None,
map_style: str = "open-street-map",
title: str | None = None,
template: str | None = None,
unsafe_update_figure: Callable = default_callback,
) -> DeephavenFigure:
"""
Create a scatter_map plot
Args:
table: A table to pull data from.
lat: A column name to use for latitude values.
lon: A column name to use for longitude values.
by: A column or list of columns that contain values to plot the figure traces by.
All values or combination of values map to a unique design. The variable
by_vars specifies which design elements are used.
This is overriden if any specialized design variables such as color are specified
by_vars: A string or list of string that contain design elements to plot by.
Can contain size, color, and symbol.
If associated maps or sequences are specified, they are used to map by column values
to designs. Otherwise, default values are used.
filter_by: A column or list of columns that contain values to filter the chart by.
If a boolean is passed and the table is partitioned, all partition key columns used to
create the partitions are used.
If no filters are specified, all partitions are shown on the chart.
required_filter_by: A column or list of columns that contain values to filter the chart by.
Values set in input filters or linkers for the relevant columns determine the exact values to display.
If a boolean is passed and the table is partitioned, all partition key columns used to
create the partitions are used.
All required input filters or linkers must be set for the chart to display any data.
color: A column or list of columns that contain color values.
If only one column is passed, and it contains numeric values, the value
is used as a value on a continuous color scale. Otherwise, the value is
used for a plot by on color.
See color_discrete_map for additional behaviors.
symbol: A column or list of columns that contain symbol values.
The value is used for a plot by on symbol.
See color_discrete_map for additional behaviors.
size: A column or list of columns that contain size values.
If only one column is passed, and it contains numeric values, the value
is used as a size. Otherwise, the value is used for a plot by on size.
See size_map for additional behaviors.
text: A column that contains text annotations.
hover_name: A column that contains names to bold in the hover tooltip.
labels: A dictionary of labels mapping columns to new labels.
color_discrete_sequence: A list of colors to sequentially apply to
the series. The colors loop, so if there are more series than colors,
colors will be reused.
color_discrete_map: If dict, the keys should be strings of the column values (or a tuple
of combinations of column values) which map to colors.
If "identity", the values are taken as literal colors.
If "by" or ("by", dict) where dict is as described above, the colors are forced to by
symbol_sequence: A list of symbols to sequentially apply to the
markers in the series. The symbols loop, so if there are more series than
symbols, symbols will be reused.
symbol_map: If dict, the keys should be strings of the column values (or a tuple
of combinations of column values) which map to symbols.
size_sequence: A list of sizes to sequentially apply to the
markers in the series. The sizes loop, so if there are more series than
symbols, sizes will be reused. This is overriden is "size" is specified.
size_map: If dict, the keys should be strings of the column values (or a tuple
of combinations of column values) which map to sizes.
If "identity", the values are taken as literal sizes.
If "by" or ("by", dict) where dict is as described above, the sizes are forced to by
color_continuous_scale: A list of colors for a continuous scale
range_color: A list of two numbers that form the endpoints of the color axis
color_continuous_midpoint: A number that is the midpoint of the color axis
opacity: Opacity to apply to all markers. 0 is completely transparent
and 1 is completely opaque.
zoom: The zoom level of the map.
center: A dictionary of center coordinates.
The keys should be 'lat' and 'lon' and the values should be floats
that represent the lat and lon of the center of the map.
map_style: The style of the map.
One of 'open-street-map', 'white-bg', 'carto-positron', 'carto-darkmatter',
and 'stamen-terrain', 'stamen-toner', 'stamen-watercolor'
title: The title of the chart
template: The template for the chart.
unsafe_update_figure: An update function that takes a plotly figure
as an argument and optionally returns a plotly figure. If a figure is
not returned, the plotly figure passed will be assumed to be the return
value. Used to add any custom changes to the underlying plotly figure.
Note that the existing data traces should not be removed. This may lead
to unexpected behavior if traces are modified in a way that break data
mappings.
Returns:
DeephavenFigure: A DeephavenFigure that contains the scatter_map figure
"""
args = locals()
return process_args(args, {"scatter"}, px_func=px.scatter_map)
def line_geo(
table: PartitionableTableLike,
lat: str | None = None,
lon: str | None = None,
locations: str | None = None,
locationmode: str | None = None,
geojson: str | dict | None = None,
featureidkey: str = "id",
by: str | list[str] | None = None,
by_vars: str | list[str] = "color",
filter_by: str | list[str] | bool | None = None,
required_filter_by: str | list[str] | bool | None = None,
color: str | list[str] | None = None,
symbol: str | list[str] | None = None,
size: str | list[str] | None = None,
width: str | list[str] | None = None,
line_dash: str | list[str] | None = None,
text: str | None = None,
hover_name: str | None = None,
labels: dict[str, str] | None = None,
color_discrete_sequence: list[str] | None = None,
color_discrete_map: dict[str | tuple[str], str] | None = None,
symbol_sequence: list[str] | None = None,
symbol_map: dict[str | tuple[str], str] | None = None,
size_sequence: list[float] | None = None,
size_map: dict[str | tuple[str], str] | None = None,
width_sequence: list[float] | None = None,
width_map: dict[str | tuple[str], str] | None = None,
line_dash_sequence: list[str] | None = None,
line_dash_map: dict[str | tuple[str], str] | None = None,
markers: bool = False,
projection: str | None = None,
scope: str | None = None,
center: dict[str, float] | None = None,
fitbounds: bool | str = False,
basemap_visible: bool | None = None,
title: str | None = None,
template: str | None = None,
unsafe_update_figure: Callable = default_callback,
) -> DeephavenFigure:
"""
Create a line_geo plot
Args:
table: A table to pull data from.
lat: A column name to use for latitude values.
lon: A column name to use for longitude values.
locations: A column name to use for location values.
locationmode: A location mode to use.
One of ‘ISO-3’, ‘USA-states’, or ‘country names’.
These map locations to predefined geographic regions.
geojson: GeoJSON data to use for geographic regions.
featureidkey: The feature ID key to use for geographic regions.
by: A column or list of columns that contain values to plot the figure traces by.
All values or combination of values map to a unique design. The variable
by_vars specifies which design elements are used.
This is overriden if any specialized design variables such as color are specified
by_vars: A string or list of string that contain design elements to plot by.
Can contain size, line_dash, width, color, and symbol.
If associated maps or sequences are specified, they are used to map by column values
to designs. Otherwise, default values are used.
filter_by: A column or list of columns that contain values to filter the chart by.
If a boolean is passed and the table is partitioned, all partition key columns used to
create the partitions are used.
If no filters are specified, all partitions are shown on the chart.
required_filter_by: A column or list of columns that contain values to filter the chart by.
Values set in input filters or linkers for the relevant columns determine the exact values to display.
If a boolean is passed and the table is partitioned, all partition key columns used to
create the partitions are used.
All required input filters or linkers must be set for the chart to display any data.
color: A column or list of columns that contain color values.
If only one column is passed, and it contains numeric values, the value
is used as a value on a continuous color scale. Otherwise, the value is
used for a plot by on color.
See color_discrete_map for additional behaviors.
symbol: A column or list of columns that contain symbol values.
The value is used for a plot by on symbol.
See color_discrete_map for additional behaviors.
size: A column or list of columns that contain size values.
If only one column is passed, and it contains numeric values, the value
is used as a size. Otherwise, the value is used for a plot by on size.
See size_map for additional behaviors.
width: A column or list of columns that contain width values.
If only one column is passed, and it contains numeric values, the value
is used as a width. Otherwise, the value is used for a plot by on width.
See width_map for additional behaviors.
line_dash: A column or list of columns that contain line_dash values.
If only one column is passed, and it contains numeric values, the value
is used as a line_dash. Otherwise, the value is used for a plot by on line_dash.
See line_dash_map for additional behaviors.
text: A column that contains text annotations.
hover_name: A column that contains names to bold in the hover tooltip.
labels: A dictionary of labels mapping columns to new labels.
color_discrete_sequence: A list of colors to sequentially apply to
the series. The colors loop, so if there are more series than colors,
colors will be reused. This is overriden if "color" is specified.
color_discrete_map: If dict, the keys should be strings of the column values (or a tuple
of combinations of column values) which map to colors.
symbol_sequence: A list of symbols to sequentially apply to the
markers in the series. The symbols loop, so if there are more series than
symbols, symbols will be reused. This is overriden if "symbol" is specified.
symbol_map: If dict, the keys should be strings of the column values (or a tuple
of combinations of column values) which map to symbols.
size_sequence: A list of sizes to sequentially apply to the
markers in the series. The sizes loop, so if there are more series than
sizes, sizes will be reused. This is overriden if "size" is specified.
size_map: If dict, the keys should be strings of the column values (or a tuple
of combinations of column values) which map to symbols.
width_sequence: A list of widths to sequentially apply to the
markers in the series. The widths loop, so if there are more series than
widths, widths will be reused. This is overriden if "width" is specified.
width_map: If dict, the keys should be strings of the column values (or a tuple
of combinations of column values) which map to symbols.
line_dash_sequence: A list of line_dashes to sequentially apply to the
markers in the series. The widths loop, so if there are more series than
widths, widths will be reused. This is overriden if "line_dash" is specified.
line_dash_map: If dict, the keys should be strings of the column values (or a tuple
of combinations of column values) which map to line_dash.
markers: If True, markers are shown.
projection: The projection type to use.
Default depends on scope.
One of 'equirectangular', 'mercator', 'orthographic', 'natural earth',
'kavrayskiy7', 'miller', 'robinson', 'eckert4', 'azimuthal equal area',
'azimuthal equidistant', 'conic equal area', 'conic conformal',
'conic equidistant', 'gnomonic', 'stereographic', 'mollweide', 'hammer',
'transverse mercator', 'albers usa', 'winkel tripel', 'aitoff', or
'sinusoidal'
scope: The scope of the map.
Default of 'world', but forced to 'usa' if projection is 'albers usa'
One of 'world', 'usa', 'europe', 'asia', 'africa', 'north america', or
'south america'
center: A dictionary of center coordinates.
The keys should be 'lat' and 'lon' and the values should be floats
that represent the lat and lon of the center of the map.
fitbounds: One of False, 'locations', or 'geojson'
If 'locations' or 'geojson', the map will zoom to the extent of the
locations or geojson bounds respectively.
basemap_visible: If True, the basemap layer is visible.
title: The title of the chart
template: The template for the chart.
unsafe_update_figure: An update function that takes a plotly figure
as an argument and optionally returns a plotly figure. If a figure is
not returned, the plotly figure passed will be assumed to be the return
value. Used to add any custom changes to the underlying plotly figure.
Note that the existing data traces should not be removed. This may lead
to unexpected behavior if traces are modified in a way that break data
mappings.
Returns:
DeephavenFigure: A DeephavenFigure that contains the line_geo figure
"""
args = locals()
return process_args(args, {"line"}, px_func=px.line_geo)
def line_map(
table: PartitionableTableLike,
lat: str | None = None,
lon: str | None = None,
by: str | list[str] | None = None,
by_vars: str | list[str] = "color",
filter_by: str | list[str] | bool | None = None,
required_filter_by: str | list[str] | bool | None = None,
color: str | list[str] | None = None,
text: str | None = None,
size: str | list[str] | None = None,
symbol: str | list[str] | None = None,
width: str | list[str] | None = None,
line_dash: str | None = None,
hover_name: str | None = None,
labels: dict[str, str] | None = None,
color_discrete_sequence: list[str] | None = None,
color_discrete_map: dict[str | tuple[str], str] | None = None,
line_dash_sequence: list[str] | None = None,
line_dash_map: dict[str | tuple[str], str] | None = None,
symbol_sequence: list[str] | None = None,
symbol_map: dict[str | tuple[str], str] | None = None,
size_sequence: list[int] | None = None,
size_map: dict[str | tuple[str], str] | None = None,
width_sequence: list[int] | None = None,
width_map: dict[str | tuple[str], str] | None = None,
zoom: float | None = None,
map_style: str = "open-street-map",
center: dict[str, float] | None = None,
title: str | None = None,
template: str | None = None,
unsafe_update_figure: Callable = default_callback,
) -> DeephavenFigure:
"""
Create a line_map plot
Args:
table: A table to pull data from.
lat: A column name to use for latitude values.
lon: A column name to use for longitude values.
by: A column or list of columns that contain values to plot the figure traces by.
All values or combination of values map to a unique design. The variable
by_vars specifies which design elements are used.
This is overriden if any specialized design variables such as color are specified
by_vars: A string or list of string that contain design elements to plot by.
Can contain size, line_dash, width, color, and symbol.
If associated maps or sequences are specified, they are used to map by column values
to designs. Otherwise, default values are used.
filter_by: A column or list of columns that contain values to filter the chart by.
If a boolean is passed and the table is partitioned, all partition key columns used to
create the partitions are used.
If no filters are specified, all partitions are shown on the chart.
required_filter_by: A column or list of columns that contain values to filter the chart by.
Values set in input filters or linkers for the relevant columns determine the exact values to display.
If a boolean is passed and the table is partitioned, all partition key columns used to
create the partitions are used.
All required input filters or linkers must be set for the chart to display any data.
color: A column or list of columns that contain color values.
If only one column is passed, and it contains numeric values, the value
is used as a value on a continuous color scale. Otherwise, the value is
used for a plot by on color.
See color_discrete_map for additional behaviors.
symbol: A column or list of columns that contain symbol values.
The value is used for a plot by on symbol.
See color_discrete_map for additional behaviors.
size: A column or list of columns that contain size values.
If only one column is passed, and it contains numeric values, the value
is used as a size. Otherwise, the value is used for a plot by on size.
See size_map for additional behaviors.
width: A column or list of columns that contain width values.
If only one column is passed, and it contains numeric values, the value
is used as a width. Otherwise, the value is used for a plot by on width.
See width_map for additional behaviors.
line_dash: A column or list of columns that contain line_dash values.
If only one column is passed, and it contains numeric values, the value
is used as a line_dash. Otherwise, the value is used for a plot by on line_dash.
See line_dash_map for additional behaviors.
text: A column that contains text annotations.
hover_name: A column that contains names to bold in the hover tooltip.
labels: A dictionary of labels mapping columns to new labels.
color_discrete_sequence: A list of colors to sequentially apply to
the series. The colors loop, so if there are more series than colors,
colors will be reused. This is overriden if "color" is specified.
color_discrete_map: If dict, the keys should be strings of the column values (or a tuple
of combinations of column values) which map to colors.
symbol_sequence: A list of symbols to sequentially apply to the
markers in the series. The symbols loop, so if there are more series than
symbols, symbols will be reused. This is overriden if "symbol" is specified.
symbol_map: If dict, the keys should be strings of the column values (or a tuple
of combinations of column values) which map to symbols.
size_sequence: A list of sizes to sequentially apply to the
markers in the series. The sizes loop, so if there are more series than
sizes, sizes will be reused. This is overriden if "size" is specified.
size_map: If dict, the keys should be strings of the column values (or a tuple
of combinations of column values) which map to symbols.
width_sequence: A list of widths to sequentially apply to the
markers in the series. The widths loop, so if there are more series than
widths, widths will be reused. This is overriden if "width" is specified.
width_map: If dict, the keys should be strings of the column values (or a tuple
of combinations of column values) which map to symbols.
line_dash_sequence: A list of line_dashes to sequentially apply to the
markers in the series. The widths loop, so if there are more series than
widths, widths will be reused. This is overriden if "line_dash" is specified.
line_dash_map: If dict, the keys should be strings of the column values (or a tuple
of combinations of column values) which map to line_dash.
zoom: The zoom level of the map.
center: A dictionary of center coordinates.
The keys should be 'lat' and 'lon' and the values should be floats
that represent the lat and lon of the center of the map.
map_style: The style of the map.
One of 'open-street-map', 'white-bg', 'carto-positron', 'carto-darkmatter',
and 'stamen-terrain', 'stamen-toner', 'stamen-watercolor'
title: The title of the chart
template: The template for the chart.
unsafe_update_figure: An update function that takes a plotly figure
as an argument and optionally returns a plotly figure. If a figure is
not returned, the plotly figure passed will be assumed to be the return
value. Used to add any custom changes to the underlying plotly figure.
Note that the existing data traces should not be removed. This may lead
to unexpected behavior if traces are modified in a way that break data
mappings.
Returns:
DeephavenFigure: A DeephavenFigure that contains the line_map figure
"""
args = locals()
return process_args(args, {"line"}, px_func=px.line_map)
def density_map(
table: TableLike,
lat: str | None = None,
lon: str | None = None,
z: str | None = None,
hover_name: str | None = None,
color_continuous_scale: list[str] | None = None,
range_color: list[float] | None = None,
color_continuous_midpoint: float | None = None,
labels: dict[str, str] | None = None,
radius: int = 30,
opacity: float | None = None,
zoom: float | None = None,
center: dict[str, float] | None = None,
map_style: str = "open-street-map",
title: str | None = None,
template: str | None = None,
unsafe_update_figure: Callable = default_callback,
) -> DeephavenFigure:
"""
Create a density_map plot
Args:
table: A table to pull data from.
lat: A column name to use for latitude values.
lon: A column name to use for longitude values.
z: A column name to use for z values.
hover_name: A column that contains names to bold in the hover tooltip.
labels: A dictionary of labels mapping columns to new labels.
color_continuous_scale: A list of colors for a continuous scale
range_color: A list of two numbers that form the endpoints of the color axis
color_continuous_midpoint: A number that is the midpoint of the color axis
radius: The radius of each point.
opacity: Opacity to apply to all markers. 0 is completely transparent
and 1 is completely opaque.
zoom: The zoom level of the map.
center: A dictionary of center coordinates.
The keys should be 'lat' and 'lon' and the values should be floats
that represent the lat and lon of the center of the map.
map_style: The style of the map.
One of 'open-street-map', 'white-bg', 'carto-positron', 'carto-darkmatter',
and 'stamen-terrain', 'stamen-toner', 'stamen-watercolor'
title: The title of the chart
template: The template for the chart.
unsafe_update_figure: An update function that takes a plotly figure
as an argument and optionally returns a plotly figure. If a figure is
not returned, the plotly figure passed will be assumed to be the return
value. Used to add any custom changes to the underlying plotly figure.
Note that the existing data traces should not be removed. This may lead
to unexpected behavior if traces are modified in a way that break data
mappings.
Returns:
DeephavenFigure: A DeephavenFigure that contains the density_map figure
"""
args = locals()
return process_args(args, set(), px_func=px.density_map)