diff --git a/.circleci/config.yml b/.circleci/config.yml index 9fa39507cf..b51a92adea 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,10 +9,10 @@ jobs: - checkout - run: name: Install black - command: 'sudo pip install black' + command: "sudo pip install black" - run: name: Check formatting with black - command: 'black --check .' + command: "black --check ." # Core python-2.7-core: @@ -25,10 +25,10 @@ jobs: - checkout - run: name: Install tox - command: 'sudo pip install tox' + command: "sudo pip install tox" - run: name: Test with tox - command: 'cd packages/python/plotly; tox -e py27-core' + command: "cd packages/python/plotly; tox -e py27-core" no_output_timeout: 20m python-3.5-core: @@ -41,10 +41,10 @@ jobs: - checkout - run: name: Install tox - command: 'sudo pip install tox' + command: "sudo pip install tox" - run: name: Test with tox - command: 'cd packages/python/plotly; tox -e py35-core' + command: "cd packages/python/plotly; tox -e py35-core" no_output_timeout: 20m python-3.6-core: @@ -57,10 +57,10 @@ jobs: - checkout - run: name: Install tox - command: 'sudo pip install tox' + command: "sudo pip install tox" - run: name: Test with tox - command: 'cd packages/python/plotly; tox -e py36-core' + command: "cd packages/python/plotly; tox -e py36-core" no_output_timeout: 20m python-3.7-core: @@ -73,10 +73,10 @@ jobs: - checkout - run: name: Install tox - command: 'sudo pip install tox' + command: "sudo pip install tox" - run: name: Test with tox - command: 'cd packages/python/plotly; tox -e py37-core' + command: "cd packages/python/plotly; tox -e py37-core" no_output_timeout: 20m python-3.7-percy: @@ -122,14 +122,14 @@ jobs: - checkout - run: name: Install tox - command: 'sudo pip install tox' + command: "sudo pip install tox" - run: name: Install npm dependencies command: cd packages/python/plotly/plotly/tests/test_optional/test_jupyter && npm install no_output_timeout: 20m - run: name: Test with tox - command: 'cd packages/python/plotly; tox -e py27-optional' + command: "cd packages/python/plotly; tox -e py27-optional" no_output_timeout: 20m python-3.5-optional: @@ -142,14 +142,14 @@ jobs: - checkout - run: name: Install tox - command: 'sudo pip install tox' + command: "sudo pip install tox" - run: name: Install npm dependencies command: cd packages/python/plotly/plotly/tests/test_optional/test_jupyter && npm install no_output_timeout: 20m - run: name: Test with tox - command: 'cd packages/python/plotly; tox -e py35-optional' + command: "cd packages/python/plotly; tox -e py35-optional" no_output_timeout: 20m python-3.6-optional: @@ -162,14 +162,14 @@ jobs: - checkout - run: name: Install tox - command: 'sudo pip install tox' + command: "sudo pip install tox" - run: name: Install npm dependencies command: cd packages/python/plotly/plotly/tests/test_optional/test_jupyter && npm install no_output_timeout: 20m - run: name: Test with tox - command: 'cd packages/python/plotly; tox -e py36-optional' + command: "cd packages/python/plotly; tox -e py36-optional" no_output_timeout: 20m python-3.7-optional: @@ -182,14 +182,14 @@ jobs: - checkout - run: name: Install tox - command: 'sudo pip install tox' + command: "sudo pip install tox" - run: name: Install npm dependencies command: cd packages/python/plotly/plotly/tests/test_optional/test_jupyter && npm install no_output_timeout: 20m - run: name: Test with tox - command: 'cd packages/python/plotly; tox -e py37-optional' + command: "cd packages/python/plotly; tox -e py37-optional" no_output_timeout: 20m # Plot.ly @@ -203,10 +203,10 @@ jobs: - checkout - run: name: Install tox - command: 'sudo pip install tox' + command: "sudo pip install tox" - run: name: Test with tox - command: 'cd packages/python/chart-studio; tox -e py27-plot_ly' + command: "cd packages/python/chart-studio; tox -e py27-plot_ly" no_output_timeout: 20m python-3.5-plot_ly: @@ -219,10 +219,10 @@ jobs: - checkout - run: name: Install tox - command: 'sudo pip install tox' + command: "sudo pip install tox" - run: name: Test with tox - command: 'cd packages/python/chart-studio; tox -e py35-plot_ly' + command: "cd packages/python/chart-studio; tox -e py35-plot_ly" no_output_timeout: 20m python-3.7-plot_ly: @@ -235,10 +235,10 @@ jobs: - checkout - run: name: Install tox - command: 'sudo pip install tox' + command: "sudo pip install tox" - run: name: Test with tox - command: 'cd packages/python/chart-studio; tox -e py37-plot_ly' + command: "cd packages/python/chart-studio; tox -e py37-plot_ly" no_output_timeout: 20m python-2-7-orca: @@ -269,7 +269,7 @@ jobs: pytest packages/python/plotly/plotly/tests/test_orca - store_artifacts: - path: plotly/tests/test_orca/images/linux/failed + path: plotly/tests/test_orca/images/linux/failed python-3-5-orca: docker: @@ -299,7 +299,7 @@ jobs: pytest packages/python/plotly/plotly/tests/test_orca - store_artifacts: - path: plotly/tests/test_orca/images/linux/failed + path: plotly/tests/test_orca/images/linux/failed python-3-7-orca: docker: @@ -325,12 +325,12 @@ jobs: command: | . /home/circleci/miniconda/etc/profile.d/conda.sh conda activate circle_optional - pytest --doctest-modules --ignore packages/python/plotly/plotly/tests --ignore packages/python/plotly/plotly/matplotlylib/mplexporter/tests packages/python/plotly/plotly + pytest --doctest-modules --ignore packages/python/plotly/plotly/tests --ignore packages/python/plotly/plotly/matplotlylib/mplexporter/tests packages/python/plotly/plotly pytest --disable-warnings packages/python/plotly/plotly/tests/test_core pytest packages/python/plotly/plotly/tests/test_orca - store_artifacts: - path: plotly/tests/test_orca/images/linux/failed + path: plotly/tests/test_orca/images/linux/failed plotlyjs_dev_build: docker: @@ -343,13 +343,13 @@ jobs: - checkout - run: name: Install tox - command: 'sudo pip install retrying tox black inflect' + command: "sudo pip install retrying tox black inflect" - run: name: Update jupyterlab-plotly version - command: 'cd packages/python/plotly; python setup.py updateplotlywidgetversion' + command: "cd packages/python/plotly; python setup.py updateplotlywidgetversion" - run: name: Update plotly.js to dev - command: 'cd packages/python/plotly; python setup.py updateplotlyjsdev' + command: "cd packages/python/plotly; python setup.py updateplotlyjsdev" - run: name: Test with tox command: | @@ -385,7 +385,6 @@ jobs: - store_artifacts: path: packages/python/plotly/dist - build-doc: resource_class: xlarge docker: @@ -393,7 +392,6 @@ jobs: # use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers` - image: circleci/python:3.6.8-node - working_directory: ~/project steps: @@ -419,12 +417,12 @@ jobs: npm install electron@1.8.4 npm install orca pip install -r requirements.txt - if [ "${CIRCLE_BRANCH}" == "master" ]; then + if [ "${CIRCLE_BRANCH}" != "doc-prod" ]; then pip uninstall -y plotly cd ../packages/python/plotly python3 setup.py install - cd ../../../doc - fi + cd ../../../doc + fi echo 'export PATH="/home/circleci/project/doc/node_modules/.bin:$PATH"' >> $BASH_ENV sudo apt-get install -y poppler-utils libxtst6 xvfb libgtk2.0-0 libgconf-2-4 libnss3 libasound2 cd .. @@ -484,12 +482,9 @@ jobs: cd ../.. - - store_artifacts: path: doc/build destination: doc/build - - workflows: version: 2 diff --git a/.gitignore b/.gitignore index ddcf80c21f..7b9716095e 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,4 @@ plotly/tests/test_orca/images/*/tmp /plotly-package/plotly/tests/test_core/test_offline/plotly.min.js temp-plot.html .vscode +doc/python/.ipynb_checkpoints diff --git a/doc/python/polar-chart.md b/doc/python/polar-chart.md index 248c8b2bf3..08019307d8 100644 --- a/doc/python/polar-chart.md +++ b/doc/python/polar-chart.md @@ -20,7 +20,7 @@ jupyter: name: python nbconvert_exporter: python pygments_lexer: ipython3 - version: 3.6.7 + version: 3.6.8 plotly: description: How to make polar charts in Python with Plotly. display_as: scientific @@ -75,6 +75,15 @@ fig.show() See also the [wind rose page](https://plot.ly/python/wind-rose-charts/) for more wind rose visualizations in polar coordinates. +You can plot less than a whole circle with the `range_theta` argument, and also control the `start_angle` and `direction`: + +```python +import plotly.express as px +fig = px.scatter_polar(r=range(0,90,10), theta=range(0,90,10), + range_theta=[0,90], start_angle=0, direction="counterclockwise") +fig.show() +``` + ## Polar Scatter Plot with go.Scatterpolar 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). diff --git a/packages/python/plotly/plotly/express/_chart_types.py b/packages/python/plotly/plotly/express/_chart_types.py index e41c684967..9be0a02c03 100644 --- a/packages/python/plotly/plotly/express/_chart_types.py +++ b/packages/python/plotly/plotly/express/_chart_types.py @@ -734,6 +734,7 @@ def scatter_polar( start_angle=90, size_max=None, range_r=None, + range_theta=None, log_r=False, render_mode="auto", title=None, @@ -776,6 +777,7 @@ def line_polar( line_shape=None, render_mode="auto", range_r=None, + range_theta=None, log_r=False, title=None, template=None, @@ -811,6 +813,7 @@ def bar_polar( direction="clockwise", start_angle=90, range_r=None, + range_theta=None, log_r=False, title=None, template=None, diff --git a/packages/python/plotly/plotly/express/_core.py b/packages/python/plotly/plotly/express/_core.py index 849b874f00..21b52a5cb7 100644 --- a/packages/python/plotly/plotly/express/_core.py +++ b/packages/python/plotly/plotly/express/_core.py @@ -534,6 +534,9 @@ def configure_polar_axes(args, fig, orders): else: if args["range_r"]: radialaxis["range"] = args["range_r"] + + if args["range_theta"]: + layout["polar"]["sector"] = args["range_theta"] fig.update(layout=layout) diff --git a/packages/python/plotly/plotly/express/_doc.py b/packages/python/plotly/plotly/express/_doc.py index d30c1217d4..3ee3df4e5a 100644 --- a/packages/python/plotly/plotly/express/_doc.py +++ b/packages/python/plotly/plotly/express/_doc.py @@ -303,6 +303,10 @@ "list of two numbers", "If provided, overrides auto-scaling on the radial axis in polar coordinates.", ], + range_theta=[ + "list of two numbers", + "If provided, overrides auto-scaling on the angular axis in polar coordinates.", + ], title=["str", "The figure title."], template=[ "or dict or plotly.graph_objects.layout.Template instance",