Skip to content

Add marker symbols example #2188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
42746dc
Merge branch 'doc-prod'
nicolaskruchten Jan 24, 2020
ff4df85
added some items in release process notes
emmanuelle Jan 24, 2020
2b06173
mention getting-started
emmanuelle Jan 24, 2020
7483fbb
changed order of imports for better error messages (#2132)
emmanuelle Jan 27, 2020
d14d842
Merge branch 'doc-prod'
nicolaskruchten Jan 29, 2020
d7fc1bc
tweaks to make flake8 happy
nicolaskruchten Jan 28, 2020
e9fa00d
g -> trace_data
nicolaskruchten Jan 28, 2020
ca87353
k -> attr_name
nicolaskruchten Jan 28, 2020
e7ced12
v -> attr_value
nicolaskruchten Jan 28, 2020
94303bc
v_label -> attr_label
nicolaskruchten Jan 28, 2020
95f78c2
result -> trace_patch
nicolaskruchten Jan 28, 2020
4bf740b
Merge pull request #2135 from plotly/cleanup
nicolaskruchten Jan 31, 2020
51fa1ee
Merge pull request #2128 from plotly/contributing
nicolaskruchten Feb 4, 2020
f7dc2be
Sunburst improvements (#2133)
emmanuelle Feb 4, 2020
9fb88c1
Merge doc prod2 (#2179)
emmanuelle Feb 11, 2020
00c3238
prevent creation of new px.default properties at run time
Feb 11, 2020
0eda9f8
prevent creation of new px.default properties at run time
Feb 11, 2020
633c2da
run black
Feb 11, 2020
bae0483
add test for permissive defaults
Feb 12, 2020
58aeb32
formatting
Feb 12, 2020
756f09b
formatting
Feb 12, 2020
bdda851
make sure new test is picked up by pytest
Feb 12, 2020
f4a005d
Merge pull request #2183 from plotly/px-permissive-defaults
Feb 12, 2020
ca903a4
add marker symbol example
Feb 12, 2020
061afb5
fix typo
Feb 12, 2020
fe369aa
be more explicit about basic/advanced shapes
Feb 13, 2020
1b32242
Merge branch 'master' into add-marker-symbols
Feb 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ This is the release process for releasing `plotly.py` version `X.Y.Z` with
`plotlywidget` version `A.B.C`.

Note: The `plotlywidget` instructions must be followed if any change
has been made in the `js/` directory source code, OR if the version of
has been made in the `packages/javascript` directory source code, OR if the version of
plotly.js has been updated. If neither of these is the case, there's no need
to increment the `plotlywidget` version or to publish a new version to npm.

Expand Down Expand Up @@ -253,7 +253,9 @@ Note that the conda installation instructions must include
"-c plotly/lable/test" rather than "-c plotly" in order to install the
release candidate version.

Commit Changelog and README updates.
Update the `doc/python/getting-started.md` file with the same version numbers.

Commit Changelog, README and getting-started updates.

### Bump to release candidate version
1) Manually update the plotlywidget version to `A.B.C-rc.1` in the files
Expand Down Expand Up @@ -297,17 +299,19 @@ And, you'll need the credentials file `~/.pypirc`. Request access from
(plotly_dev) $ twine upload dist/plotly-X.Y.Zrc1*
```

### Publish release candidate of `plotlywidget` to NPM
### Publish release candidate of `plotlywidget` and `jupyterlab-plotly` to NPM
Now, publish the release candidate of the `plotlywidget` NPM package.

```bash
cd ./js
cd ./packages/javascript/plotlywidget
npm publish --access public --tag next
```

The `--tag next` part ensures that users won't install this version unless
they explicitly ask for the version or for the version wtih the `next` tag.

Do the same in the `jupyterlab-plotly` directory.

### Publish release candidate to plotly anaconda channel
To publish package to the plotly anaconda channel you'll need to have the
anaconda or miniconda distribution installed, and you'll need to have the
Expand Down Expand Up @@ -361,7 +365,9 @@ release candidate suffix from the following version strings:

- `plotly/_widget_version.py`:
+ Update `__frontend_version__` to `^A.B.C` (Note the `^` prefix)
- `js/package.json`
- `packages/javascript/plotlywidget/package.json`
+ Update `"version"` to `A.B.C`
- `packages/javascript/jupyterlab-plotly/package.json`
+ Update `"version"` to `A.B.C`

Commit and push to the release branch.
Expand Down Expand Up @@ -431,6 +437,19 @@ Make "Release title" the same string as the tag.

Copy changelog section for this version as the "Describe this release"

### Upgrade doc requirements and API doc

Files to be updated:
- `doc/apidoc/conf.py` with new version number
- `doc/requirements.txt`
- `binder/requirements.txt`

### Synchronize master and doc-prod branches

doc-prod should already have been merged on a regular basis into master, but
start doing it first. Then merge master into doc-prod to deploy the doc related
to features in the release.

### Post announcement
Post a simple announcement to the Plotly Python forum, with links to the
README installation instructions and to the CHANGELOG.
Expand Down
115 changes: 112 additions & 3 deletions doc/python/marker-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ jupyter:
text_representation:
extension: .md
format_name: markdown
format_version: "1.1"
jupytext_version: 1.1.7
format_version: '1.2'
jupytext_version: 1.3.2
kernelspec:
display_name: Python 3
language: python
Expand All @@ -20,7 +20,7 @@ jupyter:
name: python
nbconvert_exporter: python
pygments_lexer: ipython3
version: 3.6.5
version: 3.7.0
plotly:
description: How to style markers in Python with Plotly.
display_as: file_settings
Expand Down Expand Up @@ -305,6 +305,115 @@ fig.show()

```

### Custom Marker Symbols

The `marker_symbol` attribute allows you to choose from a wide array of symbols to represent markers in your figures.

The basic symbols are: `circle`, `square`, `diamond`, `cross`, `x`, `triangle`, `pentagon`, `hexagram`, `star`, `diamond`, `hourglass`, `bowtie`, `asterisk`, `hash`, `y`, and `line`.

Each basic symbol is also represented by a number. Adding 100 to that number is equivalent to appending the suffix "-open" to a symbol name. Adding 200 is equivalent to appending "-dot" to a symbol name. Adding 300 is equivalent to appending "-open-dot" or "dot-open" to a symbol name.

In the following figures, hover over a symbol to see its name or number. Set the `marker_symbol` attribute equal to that name or number to change the marker symbol in your figure.

#### Basic Symbols

```python
import plotly.graph_objects as go
fig = go.Figure()
fig.update_layout(title="Basic Symbols")
fig.update_xaxes(showticklabels=False)
fig.update_yaxes(showticklabels=False)

for index in range(27):
fig.add_trace(go.Scatter(x=[(index % 30)], y=[index // 30],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use 6 here instead of 30 so that the symbols appear on several lines.

marker_symbol=index, marker_color='black',
marker_size=10, showlegend=False, hovertext=index))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're not tired of me nitpicking you could use a hovertemplate here to show just the index, not the coordinates.


fig.show()
```

#### Custom Symbols
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#### Custom Symbols
#### All Symbols


```python
import plotly.graph_objects as go
symbols = [0, 'circle', 100, 'circle-open', 200, 'circle-dot', 300,
'circle-open-dot', 1, 'square', 101, 'square-open', 201,
'square-dot', 301, 'square-open-dot', 2, 'diamond', 102,
'diamond-open', 202, 'diamond-dot', 302,
'diamond-open-dot', 3, 'cross', 103, 'cross-open', 203,
'cross-dot', 303, 'cross-open-dot', 4, 'x', 104, 'x-open',
204, 'x-dot', 304, 'x-open-dot', 5, 'triangle-up', 105,
'triangle-up-open', 205, 'triangle-up-dot', 305,
'triangle-up-open-dot', 6, 'triangle-down', 106,
'triangle-down-open', 206, 'triangle-down-dot', 306,
'triangle-down-open-dot', 7, 'triangle-left', 107,
'triangle-left-open', 207, 'triangle-left-dot', 307,
'triangle-left-open-dot', 8, 'triangle-right', 108,
'triangle-right-open', 208, 'triangle-right-dot', 308,
'triangle-right-open-dot', 9, 'triangle-ne', 109,
'triangle-ne-open', 209, 'triangle-ne-dot', 309,
'triangle-ne-open-dot', 10, 'triangle-se', 110,
'triangle-se-open', 210, 'triangle-se-dot', 310,
'triangle-se-open-dot', 11, 'triangle-sw', 111,
'triangle-sw-open', 211, 'triangle-sw-dot', 311,
'triangle-sw-open-dot', 12, 'triangle-nw', 112,
'triangle-nw-open', 212, 'triangle-nw-dot', 312,
'triangle-nw-open-dot', 13, 'pentagon', 113,
'pentagon-open', 213, 'pentagon-dot', 313,
'pentagon-open-dot', 14, 'hexagon', 114, 'hexagon-open',
214, 'hexagon-dot', 314, 'hexagon-open-dot', 15,
'hexagon2', 115, 'hexagon2-open', 215, 'hexagon2-dot',
315, 'hexagon2-open-dot', 16, 'octagon', 116,
'octagon-open', 216, 'octagon-dot', 316,
'octagon-open-dot', 17, 'star', 117, 'star-open', 217,
'star-dot', 317, 'star-open-dot', 18, 'hexagram', 118,
'hexagram-open', 218, 'hexagram-dot', 318,
'hexagram-open-dot', 19, 'star-triangle-up', 119,
'star-triangle-up-open', 219, 'star-triangle-up-dot', 319,
'star-triangle-up-open-dot', 20, 'star-triangle-down',
120, 'star-triangle-down-open', 220,
'star-triangle-down-dot', 320,
'star-triangle-down-open-dot', 21, 'star-square', 121,
'star-square-open', 221, 'star-square-dot', 321,
'star-square-open-dot', 22, 'star-diamond', 122,
'star-diamond-open', 222, 'star-diamond-dot', 322,
'star-diamond-open-dot', 23, 'diamond-tall', 123,
'diamond-tall-open', 223, 'diamond-tall-dot', 323,
'diamond-tall-open-dot', 24, 'diamond-wide', 124,
'diamond-wide-open', 224, 'diamond-wide-dot', 324,
'diamond-wide-open-dot', 25, 'hourglass', 125,
'hourglass-open', 26, 'bowtie', 126, 'bowtie-open', 27,
'circle-cross', 127, 'circle-cross-open', 28, 'circle-x',
128, 'circle-x-open', 29, 'square-cross', 129,
'square-cross-open', 30, 'square-x', 130, 'square-x-open',
31, 'diamond-cross', 131, 'diamond-cross-open', 32,
'diamond-x', 132, 'diamond-x-open', 33, 'cross-thin', 133,
'cross-thin-open', 34, 'x-thin', 134, 'x-thin-open', 35,
'asterisk', 135, 'asterisk-open', 36, 'hash', 136,
'hash-open', 236, 'hash-dot', 336, 'hash-open-dot', 37,
'y-up', 137, 'y-up-open', 38, 'y-down', 138,
'y-down-open', 39, 'y-left', 139, 'y-left-open', 40,
'y-right', 140, 'y-right-open', 41, 'line-ew', 141,
'line-ew-open', 42, 'line-ns', 142, 'line-ns-open', 43,
'line-ne', 143, 'line-ne-open', 44, 'line-nw', 144,
'line-nw-open']

fig = go.Figure()
fig.update_layout(title="Custom Marker Symbols")
fig.update_xaxes(showticklabels=False)
fig.update_yaxes(showticklabels=False)

for index, symbol in enumerate(symbols[::2]):
fig.add_trace(go.Scatter(x=[(index % 30)], y=[index // 30],
marker_symbol=symbol, marker_color='black',
marker_size=10, showlegend=False, hovertext=symbols[2*index + 1],
name=''))


fig.show()
```


### Reference

See https://plot.ly/python/reference/ for more information and chart attribute options!
2 changes: 1 addition & 1 deletion packages/python/plotly/plotly/express/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"""
from __future__ import absolute_import
from plotly import optional_imports
from ._imshow import imshow

pd = optional_imports.get_module("pandas")
if pd is None:
Expand All @@ -13,6 +12,7 @@
Plotly express requires pandas to be installed."""
)

from ._imshow import imshow
from ._chart_types import ( # noqa: F401
scatter,
scatter_3d,
Expand Down
Loading