FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
plotly.py/plotly/__init__.py at main · plotly/plotly.py · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
plotly
/
plotly.py
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
2.8k
Star
18.8k
Code
Issues
714
Pull requests
56
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
plotly.py
/
plotly
/
__init__.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
194 lines (161 loc) · 5.56 KB
Breadcrumbs
plotly.py
/
plotly
/
__init__.py
Copy path
File metadata and controls
194 lines (161 loc) · 5.56 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
"""
https://plot.ly/python/
Plotly's Python API allows users to programmatically access Plotly's
server resources.
This package is organized as follows:
Subpackages:
- plotly: all functionality that requires access to Plotly's servers
- graph_objs: objects for designing figures and visualizing data
- matplotlylib: tools to convert matplotlib figures
Modules:
- tools: some helpful tools that do not require access to Plotly's servers
- utils: functions that you probably won't need, but that subpackages use
- version: holds the current API version
- exceptions: defines our custom exception classes
"""
from
typing
import
TYPE_CHECKING
from
_plotly_utils
.
importers
import
relative_import
import
importlib
.
metadata
# This is the version of the plotly package
__version__
=
importlib
.
metadata
.
version
(
"plotly"
)
version
=
__version__
if
TYPE_CHECKING
:
from
plotly
import
(
graph_objs
,
tools
,
utils
,
offline
,
colors
,
io
,
data
,
)
from
plotly
.
version
import
__version__
__all__
=
[
"graph_objs"
,
"tools"
,
"utils"
,
"offline"
,
"colors"
,
"io"
,
"data"
,
"__version__"
,
]
# Set default template (for >= 3.7 this is done in plotly/io/__init__.py)
from
plotly
.
io
import
templates
templates
.
_default
=
"plotly"
else
:
__all__
,
__getattr__
,
__dir__
=
relative_import
(
__name__
,
[
".graph_objs"
,
".graph_objects"
,
".tools"
,
".utils"
,
".offline"
,
".colors"
,
".io"
,
".data"
,
],
[
".version.__version__"
],
)
def
plot
(
data_frame
,
kind
,
**
kwargs
):
"""
Pandas plotting backend function, not meant to be called directly.
To activate, set pandas.options.plotting.backend="plotly"
See https://github.com/pandas-dev/pandas/blob/master/pandas/plotting/__init__.py
"""
from
.
express
import
(
scatter
,
line
,
area
,
bar
,
box
,
histogram
,
violin
,
strip
,
funnel
,
density_contour
,
density_heatmap
,
imshow
,
)
if
kind
==
"scatter"
:
new_kwargs
=
{
k
:
kwargs
[
k
]
for
k
in
kwargs
if
k
not
in
[
"s"
,
"c"
]}
return
scatter
(
data_frame
,
**
new_kwargs
)
if
kind
==
"line"
:
return
line
(
data_frame
,
**
kwargs
)
if
kind
==
"area"
:
new_kwargs
=
{
k
:
kwargs
[
k
]
for
k
in
kwargs
if
k
not
in
[
"stacked"
]}
return
area
(
data_frame
,
**
new_kwargs
)
if
kind
==
"bar"
:
return
bar
(
data_frame
,
**
kwargs
)
if
kind
==
"barh"
:
return
bar
(
data_frame
,
orientation
=
"h"
,
**
kwargs
)
if
kind
==
"box"
:
new_kwargs
=
{
k
:
kwargs
[
k
]
for
k
in
kwargs
if
k
not
in
[
"by"
]}
return
box
(
data_frame
,
**
new_kwargs
)
if
kind
in
[
"hist"
,
"histogram"
]:
new_kwargs
=
{
k
:
kwargs
[
k
]
for
k
in
kwargs
if
k
not
in
[
"by"
,
"bins"
]}
return
histogram
(
data_frame
,
**
new_kwargs
)
if
kind
==
"violin"
:
return
violin
(
data_frame
,
**
kwargs
)
if
kind
==
"strip"
:
return
strip
(
data_frame
,
**
kwargs
)
if
kind
==
"funnel"
:
return
funnel
(
data_frame
,
**
kwargs
)
if
kind
==
"density_contour"
:
return
density_contour
(
data_frame
,
**
kwargs
)
if
kind
==
"density_heatmap"
:
return
density_heatmap
(
data_frame
,
**
kwargs
)
if
kind
==
"imshow"
:
return
imshow
(
data_frame
,
**
kwargs
)
if
kind
==
"heatmap"
:
raise
ValueError
(
"kind='heatmap' not supported plotting.backend='plotly'. "
"Please use kind='imshow' or kind='density_heatmap'."
)
raise
NotImplementedError
(
"kind='%s' not yet supported for plotting.backend='plotly'"
%
kind
)
def
boxplot_frame
(
data_frame
,
**
kwargs
):
"""
Pandas plotting backend function, not meant to be called directly.
To activate, set pandas.options.plotting.backend="plotly"
See https://github.com/pandas-dev/pandas/blob/master/pandas/plotting/__init__.py
"""
from
.
express
import
box
skip
=
[
"by"
,
"column"
,
"ax"
,
"fontsize"
,
"rot"
,
"grid"
,
"figsize"
,
"layout"
]
skip
+=
[
"return_type"
]
new_kwargs
=
{
k
:
kwargs
[
k
]
for
k
in
kwargs
if
k
not
in
skip
}
return
box
(
data_frame
,
**
new_kwargs
)
def
hist_frame
(
data_frame
,
**
kwargs
):
"""
Pandas plotting backend function, not meant to be called directly.
To activate, set pandas.options.plotting.backend="plotly"
See https://github.com/pandas-dev/pandas/blob/master/pandas/plotting/__init__.py
"""
from
.
express
import
histogram
skip
=
[
"column"
,
"by"
,
"grid"
,
"xlabelsize"
,
"xrot"
,
"ylabelsize"
,
"yrot"
]
skip
+=
[
"ax"
,
"sharex"
,
"sharey"
,
"figsize"
,
"layout"
,
"bins"
,
"legend"
]
new_kwargs
=
{
k
:
kwargs
[
k
]
for
k
in
kwargs
if
k
not
in
skip
}
return
histogram
(
data_frame
,
**
new_kwargs
)
def
hist_series
(
data_frame
,
**
kwargs
):
"""
Pandas plotting backend function, not meant to be called directly.
To activate, set pandas.options.plotting.backend="plotly"
See https://github.com/pandas-dev/pandas/blob/master/pandas/plotting/__init__.py
"""
from
.
express
import
histogram
skip
=
[
"by"
,
"grid"
,
"xlabelsize"
,
"xrot"
,
"ylabelsize"
,
"yrot"
,
"ax"
]
skip
+=
[
"figsize"
,
"bins"
,
"legend"
]
new_kwargs
=
{
k
:
kwargs
[
k
]
for
k
in
kwargs
if
k
not
in
skip
}
return
histogram
(
data_frame
,
**
new_kwargs
)
def
_jupyter_labextension_paths
():
"""Called by Jupyter Lab Server to detect if it is a valid labextension and
to install the extension.
"""
return
[
{
"src"
:
"labextension/static"
,
"dest"
:
"jupyterlab-plotly"
,
}
]
Back
|
FazBrowse Home
|
New Git URL