Skip to content

Commit fc628e1

Browse files
Export polar frame properties in mplexporter
1 parent 018bd99 commit fc628e1

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

‎plotly/matplotlylib/mplexporter/utils.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,17 @@ def get_axes_properties(ax):
308308
"axes": [get_axis_properties(ax.xaxis), get_axis_properties(ax.yaxis)],
309309
}
310310

311+
if getattr(ax, "name", None) == "polar":
312+
frame = ax.spines.get("polar")
313+
if frame is not None:
314+
props["polar_frame"] = {
315+
"color": export_color(frame.get_edgecolor()),
316+
"linewidth": frame.get_linewidth(),
317+
"visible": frame.get_visible(),
318+
}
319+
else:
320+
props["polar_frame"] = None
321+
311322
for axname in ["x", "y"]:
312323
axis = getattr(ax, axname + "axis")
313324
domain = getattr(ax, "get_{0}lim".format(axname))()

‎plotly/matplotlylib/renderer.py‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def _open_polar_axes(self, ax, props):
136136
if len(radial_gridlines)
137137
else ("#b0b0b0", True)
138138
)
139-
frame = ax.spines.get("polar")
139+
frame = props.get("polar_frame")
140140
self.plotly_fig["layout"][self.current_polar_subplot] = go.layout.Polar(
141141
bgcolor=_export_color(props["axesbg"]),
142142
angularaxis=dict(
@@ -146,13 +146,9 @@ def _open_polar_axes(self, ax, props):
146146
ticktext=[t.get_text() for t in ax.xaxis.get_majorticklabels()],
147147
showgrid=angular_grid[1],
148148
gridcolor=_export_color(angular_grid[0]),
149-
showline=frame.get_visible() if frame is not None else True,
150-
linecolor=(
151-
_export_color(frame.get_edgecolor())
152-
if frame is not None
153-
else "black"
154-
),
155-
linewidth=frame.get_linewidth() if frame is not None else 1,
149+
showline=frame["visible"] if frame else True,
150+
linecolor=(_export_color(frame["color"]) if frame else "black"),
151+
linewidth=frame["linewidth"] if frame else 1,
156152
),
157153
radialaxis=dict(
158154
range=[float(v) for v in ax.get_ylim()],

0 commit comments

Comments
 (0)