Skip to content

Commit 5432c58

Browse files
authored
Merge branch 'doc-prod' into update-marker-docs
2 parents d42b6b3 + f6365c4 commit 5432c58

File tree

2 files changed

+42
-4
lines changed

2 files changed

+42
-4
lines changed

Diff for: .circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ jobs:
370370
- run:
371371
name: Create conda environment
372372
command: |
373-
conda create -n env --yes python=3.9 conda-build conda-verify
373+
conda create -n env --yes python=3.9 conda-build=3.28.4 conda-verify
374374
conda install -n env -c conda-forge jupyterlab=3 nodejs=16
375375
conda init bash
376376
mkdir output

Diff for: doc/python/text-and-annotations.md

+41-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ jupyter:
66
extension: .md
77
format_name: markdown
88
format_version: '1.3'
9-
jupytext_version: 1.14.1
9+
jupytext_version: 1.16.1
1010
kernelspec:
11-
display_name: Python 3
11+
display_name: Python 3 (ipykernel)
1212
language: python
1313
name: python3
1414
language_info:
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.8.8
23+
version: 3.10.11
2424
plotly:
2525
description: How to add text labels and annotations to plots in python.
2626
display_as: file_settings
@@ -207,6 +207,44 @@ fig.update_layout(showlegend=False)
207207
fig.show()
208208
```
209209

210+
#### Text Annotations with Log Axes
211+
212+
If the `x` or `y` positions of an annotation reference a log axis, you need to provide that position as a `log10` value when adding the annotation. In this example, the `yaxis` is a log axis so we pass the `log10` value of `1000` to the annotation's `y` position.
213+
214+
```python
215+
import plotly.graph_objects as go
216+
import math
217+
218+
dates = [
219+
"2024-01-01",
220+
"2024-01-02",
221+
"2024-01-03",
222+
"2024-01-04",
223+
"2024-01-05",
224+
"2024-01-06",
225+
]
226+
y_values = [1, 30, 70, 100, 1000, 10000000]
227+
228+
fig = go.Figure(
229+
data=[go.Scatter(x=dates, y=y_values, mode="lines+markers")],
230+
layout=go.Layout(
231+
yaxis=dict(
232+
type="log",
233+
)
234+
),
235+
)
236+
237+
fig.add_annotation(
238+
x="2024-01-05",
239+
y=math.log10(1000),
240+
text="Log axis annotation",
241+
showarrow=True,
242+
xanchor="right",
243+
)
244+
245+
fig.show()
246+
```
247+
210248
### 3D Annotations
211249

212250
```python

0 commit comments

Comments
 (0)