Skip to content

Commit fe33fde

Browse files
committed
'draw=none' if ec is opacue. ommit 'fill opacity=0' as color isnt set
1 parent 92eab8c commit fe33fde

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

tikzplotlib/_path.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,14 @@ def get_draw_options(data, obj, ec, fc, ls, lw, hatch=None):
253253

254254
if ec is not None:
255255
data, ec_col, ec_rgba = _color.mpl_color2xcolor(data, ec)
256-
draw_options.append("draw={}".format(ec_col))
256+
if ec_rgba[3] > 0:
257+
draw_options.append("draw={}".format(ec_col))
258+
else:
259+
draw_options.append("draw=none")
257260

258261
if fc is not None:
259262
data, fc_col, fc_rgba = _color.mpl_color2xcolor(data, fc)
260-
if fc_rgba[3] != 0.0:
263+
if fc_rgba[3] > 0.0:
261264
# Don't draw if it's invisible anyways.
262265
draw_options.append("fill={}".format(fc_col))
263266

@@ -271,9 +274,9 @@ def get_draw_options(data, obj, ec, fc, ls, lw, hatch=None):
271274
):
272275
draw_options.append(("opacity=" + ff).format(ec[3]))
273276
else:
274-
if ec is not None and 0 < ec_rgba[3] != 1.0:
277+
if ec is not None and 0 < ec_rgba[3] < 1.0:
275278
draw_options.append(("draw opacity=" + ff).format(ec_rgba[3]))
276-
if fc is not None and 0 < fc_rgba[3] != 1.0:
279+
if fc is not None and 0 < fc_rgba[3] < 1.0:
277280
draw_options.append(("fill opacity=" + ff).format(fc_rgba[3]))
278281

279282
if lw is not None:
@@ -309,10 +312,6 @@ def get_draw_options(data, obj, ec, fc, ls, lw, hatch=None):
309312
finally:
310313
if h_rgba[3] > 0:
311314
data, pattern = _mpl_hatch2pgfp_pattern(data, hatch, h_col, h_rgba)
312-
if ec is not None and ec_rgba[3] == 0.0:
313-
# 'draw=none' must be specified for the border to be omitted
314-
# when a pattern is drawn using \draw.
315-
draw_options.append("draw={}".format(ec_col))
316315
draw_options += pattern
317316

318317
return data, draw_options

0 commit comments

Comments
 (0)