Skip to content

Commit 3b393d7

Browse files
doc tweaks
1 parent 3452546 commit 3b393d7

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

doc/python/hover-text-and-formatting.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jupyter:
66
extension: .md
77
format_name: markdown
88
format_version: '1.2'
9-
jupytext_version: 1.3.0
9+
jupytext_version: 1.4.2
1010
kernelspec:
1111
display_name: Python 3
1212
language: python
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.7.3
23+
version: 3.7.7
2424
plotly:
2525
description: How to use hover text and formatting in Python with Plotly.
2626
display_as: file_settings

doc/python/imshow.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -298,15 +298,15 @@ examples on how to use plotly and datashader.
298298

299299
_introduced in plotly 4.7_
300300

301-
It can be useful to add shapes to an image trace, for highlighting an object, drawing bounding boxes as part of a machine learning training set, or identifying seeds for a segmentation algorithm.
301+
It can be useful to add shapes to an image trace, for highlighting an object, drawing bounding boxes as part of a machine learning training set, or identifying seeds for a segmentation algorithm.
302302

303303
In order to enable shape drawing, you need to
304304
- define a dragmode corresponding to a drawing tool (`'drawline'`,`'drawopenpath'`, `'drawclosedpath'`, `'drawcircle'`, or `'drawrect'`)
305305
- add modebar buttons corresponding to the drawing tools you wish to use.
306306

307307
The style of new shapes is specified by the `newshape` layout attribute. Shapes can be selected and modified after they have been drawn. More details and examples are given in the [tutorial on shapes](/python/shapes#drawing-shapes-on-cartesian-plots).
308308

309-
Drawing or modifying a shape triggers a `relayout` event, which [can be captured by a callback inside a Dash application](https://dash.plotly.com/interactive-graphing).
309+
Drawing or modifying a shape triggers a `relayout` event, which [can be captured by a callback inside a Dash application](https://dash.plotly.com/interactive-graphing).
310310

311311
```python
312312
import plotly.express as px
@@ -400,8 +400,5 @@ fig.show()
400400
```
401401

402402
#### Reference
403-
<<<<<<< HEAD
404-
See https://plotly.com/python/reference/#image for more information and chart attribute options!
405-
=======
403+
406404
See https://plotly.com/python/reference/image/ for more information and chart attribute options!
407-
>>>>>>> doc-prod

doc/python/time-series.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,14 @@ fig.show()
8787

8888
By default, the tick labels (and optional ticks) are associated with a specific grid-line, and represent an *instant* in time, for example, "midnight on February 1, 2018". Tick labels can be formatted using the `tickformat` attribute (which accepts the [d3 time-format formatting strings](https://github.com/d3/d3-time-format)) to display only the month and year, but they still represent an instant by default, so in the figure below, the text of the label "Feb 2018" spans part of the month of January and part of the month of February. The `dtick` attribute controls the spacing between gridlines, and the `"M1"` setting means "1 month". This attribute also accepts a number of milliseconds, which can be scaled up to days by multiplying by `24*60*60*1000`.
8989

90+
Note that by default, the formatting of values of X and Y values in the hover label matches that of the tick labels of the corresponding axes, so when customizing the tick labels to something broad like "month", it's usually necessary to [customize the hover label](/python/hover-text-and-formatting/) to something narrower like the acutal date, as below.
91+
9092
```python
9193
import plotly.express as px
92-
df = px.data.stocks(indexed=True)
93-
fig = px.line(df, title="custom tick labels")
94+
df = px.data.stocks()
95+
fig = px.line(df, x="date", y=df.columns,
96+
hover_data={"date": "|%B %d, %Y"},
97+
title='custom tick labels')
9498
fig.update_xaxes(
9599
dtick="M1",
96100
tickformat="%b %Y",
@@ -106,8 +110,10 @@ By setting the `ticklabelmode` attribute to `"period"` (the default is `"instant
106110

107111
```python
108112
import plotly.express as px
109-
df = px.data.stocks(indexed=True)
110-
fig = px.line(df, title='custom tick labels with ticklabelmode="period"')
113+
df = px.data.stocks()
114+
fig = px.line(df, x="date", y=df.columns,
115+
hover_data={"date": "|%B %d, %Y"},
116+
title='custom tick labels with ticklabelmode="period"')
111117
fig.update_xaxes(
112118
dtick="M1",
113119
tickformat="%b %Y",

0 commit comments

Comments
 (0)