Skip to content

Commit 260e3a3

Browse files
committed
Merge branch 'axis_spanning_layout_object_xref_yref_bug' of https://github.com/zfoltz/plotly.py into axis_spanning_layout_object_xref_yref_bug
2 parents 8b2d4bf + 9f8c92d commit 260e3a3

File tree

16 files changed

+1286
-1007
lines changed

16 files changed

+1286
-1007
lines changed

.circleci/config.yml

Lines changed: 157 additions & 58 deletions
Large diffs are not rendered by default.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,6 @@ doc/check-or-enforce-order.py
5252
packages/javascript/jupyterlab-plotly/lib/
5353
packages/python/plotly/jupyterlab_plotly/labextension/
5454
packages/python/plotly/jupyterlab_plotly/nbextension/index.js*
55+
56+
test/percy/*.html
57+
test/percy/pandas2/*.html

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## [UNRELEASED]
6+
7+
### Fixed
8+
- Fixed another compatibility issue with Pandas 2.0, just affecting `px.*(line_close=True)` [[#4190](https://github.com/plotly/plotly.py/pull/4190)]
9+
510
## [5.14.1] - 2023-04-05
611

712
### Fixed

doc/python/static-image-export.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -109,42 +109,42 @@ If you are running this notebook live, click to [open the output directory](./im
109109

110110
plotly.py can output figures to several raster image formats including **PNG**, ...
111111

112-
```python
112+
~~~python
113113
fig.write_image("images/fig1.png")
114-
```
114+
~~~
115115

116116
**JPEG**, ...
117117

118-
```python
118+
~~~python
119119
fig.write_image("images/fig1.jpeg")
120-
```
120+
~~~
121121

122122
and **WebP**
123123

124-
```python
124+
~~~python
125125
fig.write_image("images/fig1.webp")
126-
```
126+
~~~
127127

128128
#### Vector Formats: SVG and PDF...
129129

130130

131131
plotly.py can also output figures in several vector formats including **SVG**, ...
132132

133-
```python
133+
~~~python
134134
fig.write_image("images/fig1.svg")
135-
```
135+
~~~
136136

137137
**PDF**, ...
138138

139-
```python
139+
~~~python
140140
fig.write_image("images/fig1.pdf")
141-
```
141+
~~~
142142

143143
and **EPS** (requires the poppler library)
144144

145-
```python
145+
~~~python
146146
fig.write_image("images/fig1.eps")
147-
```
147+
~~~
148148

149149
**Note:** It is important to note that any figures containing WebGL traces (i.e. of type `scattergl`, `heatmapgl`, `contourgl`, `scatter3d`, `surface`, `mesh3d`, `scatterpolargl`, `cone`, `streamtube`, `splom`, or `parcoords`) that are exported in a vector format will include encapsulated rasters, instead of vectors, for some parts of the image.
150150

@@ -199,14 +199,14 @@ Image(img_bytes)
199199
If `kaleido` is installed, it will automatically be used to perform image export. If it is not installed, plotly.py will attempt to use `orca` instead. The `engine` argument to the `to_image` and `write_image` functions can be used to override this default behavior.
200200

201201
Here is an example of specifying that orca should be used:
202-
```python
202+
~~~python
203203
fig.to_image(format="png", engine="orca")
204-
```
204+
~~~
205205

206206
And, here is an example of specifying that Kaleido should be used:
207-
```python
207+
~~~python
208208
fig.to_image(format="png", engine="kaleido")
209-
```
209+
~~~
210210

211211
<!-- #endregion -->
212212

packages/python/plotly/plotly/basedatatypes.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4067,12 +4067,10 @@ def _process_multiple_axis_spanning_shapes(
40674067
# however, in the case of a single plot, xref and yref MAY not be
40684068
# specified, IF they are not specified we specify them here so the following routines can work
40694069
# (they need to append " domain" to xref or yref). If they are specified, we leave them alone.
4070-
if self.layout[layout_obj][-1].xref == None:
4070+
if self.layout[layout_obj][-1].xref is None:
40714071
self.layout[layout_obj][-1].update(xref="x")
4072-
# self.layout[layout_obj][-1].update(xref="x")
4073-
if self.layout[layout_obj][-1].yref == None:
4072+
if self.layout[layout_obj][-1].yref is None:
40744073
self.layout[layout_obj][-1].update(yref="y")
4075-
# self.layout[layout_obj][-1].update(yref='y')
40764074
new_layout_objs = tuple(
40774075
filter(
40784076
lambda x: x is not None,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def make_trace_kwargs(args, trace_spec, trace_data, mapping_labels, sizeref):
268268
fit information to be used for trendlines
269269
"""
270270
if "line_close" in args and args["line_close"]:
271-
trace_data = trace_data.append(trace_data.iloc[0])
271+
trace_data = pd.concat([trace_data, trace_data.iloc[:1]])
272272
trace_patch = trace_spec.trace_patch.copy() or {}
273273
fit_results = None
274274
hover_header = ""

packages/python/plotly/plotly/matplotlylib/mplexporter/renderers/vega_renderer.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,18 @@ def open_axes(self, ax, props):
2323
dict(type="y", scale="y", ticks=10),
2424
]
2525
self.scales = [
26-
dict(name="x", domain=props["xlim"], type="linear", range="width",),
27-
dict(name="y", domain=props["ylim"], type="linear", range="height",),
26+
dict(
27+
name="x",
28+
domain=props["xlim"],
29+
type="linear",
30+
range="width",
31+
),
32+
dict(
33+
name="y",
34+
domain=props["ylim"],
35+
type="linear",
36+
range="height",
37+
),
2838
]
2939

3040
def draw_line(self, data, coordinates, style, label, mplobj=None):
@@ -103,7 +113,7 @@ def __init__(self, renderer):
103113

104114
def html(self):
105115
"""Build the HTML representation for IPython."""
106-
id = random.randint(0, 2 ** 16)
116+
id = random.randint(0, 2**16)
107117
html = '<div id="vis%d"></div>' % id
108118
html += "<script>\n"
109119
html += VEGA_TEMPLATE % (json.dumps(self.specification), id)

packages/python/plotly/plotly/matplotlylib/mplexporter/tests/test_basic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ def test_path():
146146

147147

148148
def test_Figure():
149-
""" if the fig is not associated with a canvas, FakeRenderer shall
150-
not fail. """
149+
"""if the fig is not associated with a canvas, FakeRenderer shall
150+
not fail."""
151151
fig = plt.Figure()
152152
ax = fig.add_subplot(111)
153153
ax.add_patch(plt.Circle((0, 0), 1))

0 commit comments

Comments
 (0)