Skip to content

Commit

Permalink
Merge pull request #404 from senselessDev/text_alpha
Browse files Browse the repository at this point in the history
Support for opacity of text annotations
  • Loading branch information
nschloe committed May 20, 2020
2 parents d88bb1e + e379cde commit a53015b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion test/test_cleanfigure.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
import pytest
from matplotlib import pyplot as plt

import pytest
from tikzplotlib import clean_figure, get_tikz_code

RC_PARAMS = {"figure.figsize": [5, 5], "figure.dpi": 220, "pgf.rcfonts": False}
Expand Down
2 changes: 1 addition & 1 deletion test/test_rotated_labels.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import os
import tempfile

import pytest
from matplotlib import pyplot as plt

import pytest
import tikzplotlib


Expand Down
2 changes: 2 additions & 0 deletions tikzplotlib/_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ def _bbox(bbox, data, properties, scaling):
properties.append(f"line width={line_width:{ff}}pt")
inner_sep = bbox_style.pad * data["font size"]
properties.append(f"inner sep={inner_sep:{ff}}pt")
if bbox.get_alpha():
properties.append("fill opacity={}".format(bbox.get_alpha()))
# Rounded boxes
if isinstance(bbox_style, mpl.patches.BoxStyle.Round):
properties.append("rounded corners")
Expand Down
4 changes: 2 additions & 2 deletions tikzplotlib/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ def get_legend_text(obj):
if leg is None:
return None

keys = [l.get_label() for l in leg.legendHandles if l is not None]
values = [l.get_text() for l in leg.texts]
keys = [h.get_label() for h in leg.legendHandles if h is not None]
values = [t.get_text() for t in leg.texts]

label = obj.get_label()
d = dict(zip(keys, values))
Expand Down

0 comments on commit a53015b

Please sign in to comment.