Skip to content

Commit 3f3e8eb

Browse files
Merge pull request #1969 from plotly/range_theta
add range_theta kwarg
2 parents c31802f + 6ce081c commit 3f3e8eb

File tree

6 files changed

+55
-40
lines changed

6 files changed

+55
-40
lines changed

.circleci/config.yml

+34-39
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ jobs:
99
- checkout
1010
- run:
1111
name: Install black
12-
command: 'sudo pip install black'
12+
command: "sudo pip install black"
1313
- run:
1414
name: Check formatting with black
15-
command: 'black --check .'
15+
command: "black --check ."
1616

1717
# Core
1818
python-2.7-core:
@@ -25,10 +25,10 @@ jobs:
2525
- checkout
2626
- run:
2727
name: Install tox
28-
command: 'sudo pip install tox'
28+
command: "sudo pip install tox"
2929
- run:
3030
name: Test with tox
31-
command: 'cd packages/python/plotly; tox -e py27-core'
31+
command: "cd packages/python/plotly; tox -e py27-core"
3232
no_output_timeout: 20m
3333

3434
python-3.5-core:
@@ -41,10 +41,10 @@ jobs:
4141
- checkout
4242
- run:
4343
name: Install tox
44-
command: 'sudo pip install tox'
44+
command: "sudo pip install tox"
4545
- run:
4646
name: Test with tox
47-
command: 'cd packages/python/plotly; tox -e py35-core'
47+
command: "cd packages/python/plotly; tox -e py35-core"
4848
no_output_timeout: 20m
4949

5050
python-3.6-core:
@@ -57,10 +57,10 @@ jobs:
5757
- checkout
5858
- run:
5959
name: Install tox
60-
command: 'sudo pip install tox'
60+
command: "sudo pip install tox"
6161
- run:
6262
name: Test with tox
63-
command: 'cd packages/python/plotly; tox -e py36-core'
63+
command: "cd packages/python/plotly; tox -e py36-core"
6464
no_output_timeout: 20m
6565

6666
python-3.7-core:
@@ -73,10 +73,10 @@ jobs:
7373
- checkout
7474
- run:
7575
name: Install tox
76-
command: 'sudo pip install tox'
76+
command: "sudo pip install tox"
7777
- run:
7878
name: Test with tox
79-
command: 'cd packages/python/plotly; tox -e py37-core'
79+
command: "cd packages/python/plotly; tox -e py37-core"
8080
no_output_timeout: 20m
8181

8282
python-3.7-percy:
@@ -122,14 +122,14 @@ jobs:
122122
- checkout
123123
- run:
124124
name: Install tox
125-
command: 'sudo pip install tox'
125+
command: "sudo pip install tox"
126126
- run:
127127
name: Install npm dependencies
128128
command: cd packages/python/plotly/plotly/tests/test_optional/test_jupyter && npm install
129129
no_output_timeout: 20m
130130
- run:
131131
name: Test with tox
132-
command: 'cd packages/python/plotly; tox -e py27-optional'
132+
command: "cd packages/python/plotly; tox -e py27-optional"
133133
no_output_timeout: 20m
134134

135135
python-3.5-optional:
@@ -142,14 +142,14 @@ jobs:
142142
- checkout
143143
- run:
144144
name: Install tox
145-
command: 'sudo pip install tox'
145+
command: "sudo pip install tox"
146146
- run:
147147
name: Install npm dependencies
148148
command: cd packages/python/plotly/plotly/tests/test_optional/test_jupyter && npm install
149149
no_output_timeout: 20m
150150
- run:
151151
name: Test with tox
152-
command: 'cd packages/python/plotly; tox -e py35-optional'
152+
command: "cd packages/python/plotly; tox -e py35-optional"
153153
no_output_timeout: 20m
154154

155155
python-3.6-optional:
@@ -162,14 +162,14 @@ jobs:
162162
- checkout
163163
- run:
164164
name: Install tox
165-
command: 'sudo pip install tox'
165+
command: "sudo pip install tox"
166166
- run:
167167
name: Install npm dependencies
168168
command: cd packages/python/plotly/plotly/tests/test_optional/test_jupyter && npm install
169169
no_output_timeout: 20m
170170
- run:
171171
name: Test with tox
172-
command: 'cd packages/python/plotly; tox -e py36-optional'
172+
command: "cd packages/python/plotly; tox -e py36-optional"
173173
no_output_timeout: 20m
174174

175175
python-3.7-optional:
@@ -182,14 +182,14 @@ jobs:
182182
- checkout
183183
- run:
184184
name: Install tox
185-
command: 'sudo pip install tox'
185+
command: "sudo pip install tox"
186186
- run:
187187
name: Install npm dependencies
188188
command: cd packages/python/plotly/plotly/tests/test_optional/test_jupyter && npm install
189189
no_output_timeout: 20m
190190
- run:
191191
name: Test with tox
192-
command: 'cd packages/python/plotly; tox -e py37-optional'
192+
command: "cd packages/python/plotly; tox -e py37-optional"
193193
no_output_timeout: 20m
194194

195195
# Plot.ly
@@ -203,10 +203,10 @@ jobs:
203203
- checkout
204204
- run:
205205
name: Install tox
206-
command: 'sudo pip install tox'
206+
command: "sudo pip install tox"
207207
- run:
208208
name: Test with tox
209-
command: 'cd packages/python/chart-studio; tox -e py27-plot_ly'
209+
command: "cd packages/python/chart-studio; tox -e py27-plot_ly"
210210
no_output_timeout: 20m
211211

212212
python-3.5-plot_ly:
@@ -219,10 +219,10 @@ jobs:
219219
- checkout
220220
- run:
221221
name: Install tox
222-
command: 'sudo pip install tox'
222+
command: "sudo pip install tox"
223223
- run:
224224
name: Test with tox
225-
command: 'cd packages/python/chart-studio; tox -e py35-plot_ly'
225+
command: "cd packages/python/chart-studio; tox -e py35-plot_ly"
226226
no_output_timeout: 20m
227227

228228
python-3.7-plot_ly:
@@ -235,10 +235,10 @@ jobs:
235235
- checkout
236236
- run:
237237
name: Install tox
238-
command: 'sudo pip install tox'
238+
command: "sudo pip install tox"
239239
- run:
240240
name: Test with tox
241-
command: 'cd packages/python/chart-studio; tox -e py37-plot_ly'
241+
command: "cd packages/python/chart-studio; tox -e py37-plot_ly"
242242
no_output_timeout: 20m
243243

244244
python-2-7-orca:
@@ -269,7 +269,7 @@ jobs:
269269
pytest packages/python/plotly/plotly/tests/test_orca
270270
271271
- store_artifacts:
272-
path: plotly/tests/test_orca/images/linux/failed
272+
path: plotly/tests/test_orca/images/linux/failed
273273

274274
python-3-5-orca:
275275
docker:
@@ -299,7 +299,7 @@ jobs:
299299
pytest packages/python/plotly/plotly/tests/test_orca
300300
301301
- store_artifacts:
302-
path: plotly/tests/test_orca/images/linux/failed
302+
path: plotly/tests/test_orca/images/linux/failed
303303

304304
python-3-7-orca:
305305
docker:
@@ -325,12 +325,12 @@ jobs:
325325
command: |
326326
. /home/circleci/miniconda/etc/profile.d/conda.sh
327327
conda activate circle_optional
328-
pytest --doctest-modules --ignore packages/python/plotly/plotly/tests --ignore packages/python/plotly/plotly/matplotlylib/mplexporter/tests packages/python/plotly/plotly
328+
pytest --doctest-modules --ignore packages/python/plotly/plotly/tests --ignore packages/python/plotly/plotly/matplotlylib/mplexporter/tests packages/python/plotly/plotly
329329
pytest --disable-warnings packages/python/plotly/plotly/tests/test_core
330330
pytest packages/python/plotly/plotly/tests/test_orca
331331
332332
- store_artifacts:
333-
path: plotly/tests/test_orca/images/linux/failed
333+
path: plotly/tests/test_orca/images/linux/failed
334334

335335
plotlyjs_dev_build:
336336
docker:
@@ -343,13 +343,13 @@ jobs:
343343
- checkout
344344
- run:
345345
name: Install tox
346-
command: 'sudo pip install retrying tox black inflect'
346+
command: "sudo pip install retrying tox black inflect"
347347
- run:
348348
name: Update jupyterlab-plotly version
349-
command: 'cd packages/python/plotly; python setup.py updateplotlywidgetversion'
349+
command: "cd packages/python/plotly; python setup.py updateplotlywidgetversion"
350350
- run:
351351
name: Update plotly.js to dev
352-
command: 'cd packages/python/plotly; python setup.py updateplotlyjsdev'
352+
command: "cd packages/python/plotly; python setup.py updateplotlyjsdev"
353353
- run:
354354
name: Test with tox
355355
command: |
@@ -385,15 +385,13 @@ jobs:
385385
- store_artifacts:
386386
path: packages/python/plotly/dist
387387

388-
389388
build-doc:
390389
resource_class: xlarge
391390
docker:
392391
# specify the version you desire here
393392
# use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers`
394393
- image: circleci/python:3.6.8-node
395394

396-
397395
working_directory: ~/project
398396

399397
steps:
@@ -419,12 +417,12 @@ jobs:
419417
npm install [email protected]
420418
npm install orca
421419
pip install -r requirements.txt
422-
if [ "${CIRCLE_BRANCH}" == "master" ]; then
420+
if [ "${CIRCLE_BRANCH}" != "doc-prod" ]; then
423421
pip uninstall -y plotly
424422
cd ../packages/python/plotly
425423
python3 setup.py install
426-
cd ../../../doc
427-
fi
424+
cd ../../../doc
425+
fi
428426
echo 'export PATH="/home/circleci/project/doc/node_modules/.bin:$PATH"' >> $BASH_ENV
429427
sudo apt-get install -y poppler-utils libxtst6 xvfb libgtk2.0-0 libgconf-2-4 libnss3 libasound2
430428
cd ..
@@ -484,12 +482,9 @@ jobs:
484482
485483
cd ../..
486484
487-
488485
- store_artifacts:
489486
path: doc/build
490487
destination: doc/build
491-
492-
493488

494489
workflows:
495490
version: 2

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ plotly/tests/test_orca/images/*/tmp
4343
/plotly-package/plotly/tests/test_core/test_offline/plotly.min.js
4444
temp-plot.html
4545
.vscode
46+
doc/python/.ipynb_checkpoints

doc/python/polar-chart.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.6.7
23+
version: 3.6.8
2424
plotly:
2525
description: How to make polar charts in Python with Plotly.
2626
display_as: scientific
@@ -75,6 +75,15 @@ fig.show()
7575
See also the [wind rose page](https://plot.ly/python/wind-rose-charts/) for more wind rose visualizations in polar coordinates.
7676

7777

78+
You can plot less than a whole circle with the `range_theta` argument, and also control the `start_angle` and `direction`:
79+
80+
```python
81+
import plotly.express as px
82+
fig = px.scatter_polar(r=range(0,90,10), theta=range(0,90,10),
83+
range_theta=[0,90], start_angle=0, direction="counterclockwise")
84+
fig.show()
85+
```
86+
7887
## Polar Scatter Plot with go.Scatterpolar
7988

8089
If Plotly Express does not provide a good starting point, you can use the more generic `go.Scatterpolar`. All the options are documented in the [reference page](https://plot.ly/python/reference/#scatterpolar).

packages/python/plotly/plotly/express/_chart_types.py

+3
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,7 @@ def scatter_polar(
734734
start_angle=90,
735735
size_max=None,
736736
range_r=None,
737+
range_theta=None,
737738
log_r=False,
738739
render_mode="auto",
739740
title=None,
@@ -776,6 +777,7 @@ def line_polar(
776777
line_shape=None,
777778
render_mode="auto",
778779
range_r=None,
780+
range_theta=None,
779781
log_r=False,
780782
title=None,
781783
template=None,
@@ -811,6 +813,7 @@ def bar_polar(
811813
direction="clockwise",
812814
start_angle=90,
813815
range_r=None,
816+
range_theta=None,
814817
log_r=False,
815818
title=None,
816819
template=None,

packages/python/plotly/plotly/express/_core.py

+3
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,9 @@ def configure_polar_axes(args, fig, orders):
534534
else:
535535
if args["range_r"]:
536536
radialaxis["range"] = args["range_r"]
537+
538+
if args["range_theta"]:
539+
layout["polar"]["sector"] = args["range_theta"]
537540
fig.update(layout=layout)
538541

539542

packages/python/plotly/plotly/express/_doc.py

+4
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,10 @@
303303
"list of two numbers",
304304
"If provided, overrides auto-scaling on the radial axis in polar coordinates.",
305305
],
306+
range_theta=[
307+
"list of two numbers",
308+
"If provided, overrides auto-scaling on the angular axis in polar coordinates.",
309+
],
306310
title=["str", "The figure title."],
307311
template=[
308312
"or dict or plotly.graph_objects.layout.Template instance",

0 commit comments

Comments
 (0)