Skip to content

Commit 6f1b1bb

Browse files
committed
small fixes
1 parent 34db5dd commit 6f1b1bb

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

src/tikzplotlib/_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ def _handle_listed_color_map(cmap, data):
771771
reps = int(float(cmap.N) / len(cmap.colors) - 0.5) + 1
772772
repeated_cols = reps * cmap.colors
773773
colors = [
774-
"rgb({k}{unit})=({rgb[0]:{ff}},{rgb[1]:{ff}},{rgb[2]:{ff}})"
774+
f"rgb({k}{unit})=({rgb[0]:{ff}},{rgb[1]:{ff}},{rgb[2]:{ff}})"
775775
for k, rgb in enumerate(repeated_cols[: cmap.N])
776776
]
777777
colormap_string = "{{mymap}}{{[1{}]\n {}\n}}".format(unit, ";\n ".join(colors))

src/tikzplotlib/_hatches.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
r"""
2-
Map matplotlib hatches to tikz patterns
2+
Map matplotlib hatches to tikz patterns
33
4-
For matplotlib hatches, see:
5-
https://matplotlib.org/3.1.1/gallery/shapes_and_collections/hatch_demo.html
4+
For matplotlib hatches, see:
5+
https://matplotlib.org/3.1.1/gallery/shapes_and_collections/hatch_demo.html
66
7-
For patterns in tikzpgf:
8-
Ch 26 Pattern Lbrary in the manual
9-
Requires \usetikzlibrary{patterns}
7+
For patterns in tikzpgf:
8+
Ch 26 Pattern Lbrary in the manual
9+
Requires \usetikzlibrary{patterns}
1010
"""
1111

1212
# These methods exist, and might be relevant (in the future?):
@@ -93,7 +93,7 @@ def _mpl_hatch2pgfp_pattern(data, hatch, color_name, color_rgba):
9393
try:
9494
pgfplots_pattern = _MP_HATCH2PGF_PATTERN[hatch]
9595
except KeyError:
96-
warnings.warn("tikzplotlib: The hatch", hatch, "is ignored.")
96+
warnings.warn(f"tikzplotlib: The hatch {hatch} is ignored.")
9797
return data, []
9898

9999
data["tikz libs"].add("patterns")

src/tikzplotlib/_save.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -268,20 +268,16 @@ def _tex_comment(comment):
268268

269269
def _get_color_definitions(data):
270270
"""Returns the list of custom color definitions for the TikZ file."""
271-
definitions = []
272271
ff = data["float format"]
273-
for name, rgb in data["custom colors"].items():
274-
definitions.append(
275-
f"\\definecolor{{{name}}}{{rgb}}"
276-
f"{{{rgb[0]:{ff}},{rgb[1]:{ff}},{rgb[2]:{ff}}}}"
277-
)
278-
return definitions
272+
return [
273+
f"\\definecolor{{{name}}}{{rgb}}{{{rgb[0]:{ff}},{rgb[1]:{ff}},{rgb[2]:{ff}}}}"
274+
for name, rgb in data["custom colors"].items()
275+
]
279276

280277

281278
def _print_pgfplot_libs_message(data):
282279
"""Prints message to screen indicating the use of PGFPlots and its
283280
libraries."""
284-
285281
print(70 * "=")
286282
print("Please add the following lines to your LaTeX preamble:\n")
287283
print(data["flavor"].preamble(data))

0 commit comments

Comments
 (0)