Skip to content

Commit 6ff42d4

Browse files
authored
Merge pull request #345 from nschloe/tikzpicture-parameters
Tikzpicture parameters
2 parents 133154a + 22509d4 commit 6ff42d4

File tree

13 files changed

+47
-50
lines changed

13 files changed

+47
-50
lines changed

tikzplotlib/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
"""Script to convert Matplotlib generated figures into TikZ/PGFPlots figures.
22
"""
3-
from tikzplotlib.__about__ import (
3+
from .__about__ import (
44
__author__,
55
__copyright__,
66
__email__,
77
__license__,
88
__status__,
99
__version__,
1010
)
11-
from tikzplotlib.save import get_tikz_code, save
11+
from ._save import get_tikz_code, save
1212

1313
__all__ = [
1414
"__author__",

tikzplotlib/axes.py renamed to tikzplotlib/_axes.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
common_texification as mpl_common_texification,
55
)
66

7-
from . import color
7+
from . import _color
88

99

1010
def _common_texification(string):
@@ -129,14 +129,14 @@ def __init__(self, data, obj): # noqa: C901
129129
# axis line styles
130130
# Assume that the bottom edge color is the color of the entire box.
131131
axcol = obj.spines["bottom"].get_edgecolor()
132-
data, col, _ = color.mpl_color2xcolor(data, axcol)
132+
data, col, _ = _color.mpl_color2xcolor(data, axcol)
133133
if col != "black":
134134
self.axis_options.append("axis line style={{{}}}".format(col))
135135

136136
# background color
137137
bgcolor = obj.get_facecolor()
138138

139-
data, col, _ = color.mpl_color2xcolor(data, bgcolor)
139+
data, col, _ = _color.mpl_color2xcolor(data, bgcolor)
140140
if col != "white":
141141
self.axis_options.append("axis background/.style={{fill={}}}".format(col))
142142

@@ -228,7 +228,7 @@ def _ticks(self, data, obj):
228228
pass
229229
else:
230230
c0 = l0.get_color()
231-
data, xtickcolor, _ = color.mpl_color2xcolor(data, c0)
231+
data, xtickcolor, _ = _color.mpl_color2xcolor(data, c0)
232232
self.axis_options.append("xtick style={{color={}}}".format(xtickcolor))
233233

234234
try:
@@ -237,7 +237,7 @@ def _ticks(self, data, obj):
237237
pass
238238
else:
239239
c0 = l0.get_color()
240-
data, ytickcolor, _ = color.mpl_color2xcolor(data, c0)
240+
data, ytickcolor, _ = _color.mpl_color2xcolor(data, c0)
241241
self.axis_options.append("ytick style={{color={}}}".format(ytickcolor))
242242

243243
# Find tick direction
@@ -305,7 +305,7 @@ def _grid(self, obj, data):
305305
xlines = obj.get_xgridlines()
306306
if xlines:
307307
xgridcolor = xlines[0].get_color()
308-
data, col, _ = color.mpl_color2xcolor(data, xgridcolor)
308+
data, col, _ = _color.mpl_color2xcolor(data, xgridcolor)
309309
if col != "black":
310310
self.axis_options.append("x grid style={{{}}}".format(col))
311311

@@ -317,7 +317,7 @@ def _grid(self, obj, data):
317317
ylines = obj.get_ygridlines()
318318
if ylines:
319319
ygridcolor = ylines[0].get_color()
320-
data, col, _ = color.mpl_color2xcolor(data, ygridcolor)
320+
data, col, _ = _color.mpl_color2xcolor(data, ygridcolor)
321321
if col != "black":
322322
self.axis_options.append("y grid style={{{}}}".format(col))
323323

File renamed without changes.
File renamed without changes.

tikzplotlib/image.py renamed to tikzplotlib/_image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
import numpy
33
import PIL
44

5-
from . import files
5+
from . import _files
66

77

88
def draw_image(data, obj):
99
"""Returns the PGFPlots code for an image environment.
1010
"""
1111
content = []
1212

13-
filename, rel_filepath = files.new_filename(data, "img", ".png")
13+
filename, rel_filepath = _files.new_filename(data, "img", ".png")
1414

1515
# store the image as in a file
1616
img_array = obj.get_array()

tikzplotlib/legend.py renamed to tikzplotlib/_legend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import numpy
44

5-
from . import color as mycol
5+
from . import _color as mycol
66

77

88
def draw_legend(data, obj):

tikzplotlib/line2d.py renamed to tikzplotlib/_line2d.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
import numpy
44
from matplotlib.dates import num2date
55

6-
from . import color as mycol
7-
from . import files
8-
from . import path as mypath
9-
from .util import get_legend_text, has_legend, transform_to_data_coordinates
6+
from . import _color as mycol
7+
from . import _files
8+
from . import _path as mypath
109
from ._markers import _mpl_marker2pgfp_marker
10+
from ._util import get_legend_text, has_legend, transform_to_data_coordinates
1111

1212

1313
def draw_line2d(data, obj):
@@ -291,7 +291,7 @@ def _table(obj, data): # noqa: C901
291291
)
292292

293293
if data["externalize tables"]:
294-
filename, rel_filepath = files.new_filename(data, "table", ".tsv")
294+
filename, rel_filepath = _files.new_filename(data, "table", ".tsv")
295295
with open(filename, "w") as f:
296296
# No encoding handling required: plot_table is only ASCII
297297
f.write("".join(plot_table))

tikzplotlib/patch.py renamed to tikzplotlib/_patch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import matplotlib as mpl
22

3-
from . import path as mypath
3+
from . import _path as mypath
44

55

66
def draw_patch(data, obj):

tikzplotlib/path.py renamed to tikzplotlib/_path.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
import numpy
33
from matplotlib.markers import MarkerStyle
44

5-
from . import color
6-
from .axes import _mpl_cmap2pgf_cmap
7-
from .util import get_legend_text, has_legend
5+
from . import _color
6+
from ._axes import _mpl_cmap2pgf_cmap
87
from ._markers import _mpl_marker2pgfp_marker
8+
from ._util import get_legend_text, has_legend
99

1010

1111
def draw_path(data, path, draw_options=None, simplify=None):
@@ -239,13 +239,13 @@ def get_draw_options(data, obj, ec, fc, style, width):
239239
draw_options = []
240240

241241
if ec is not None:
242-
data, col, ec_rgba = color.mpl_color2xcolor(data, ec)
242+
data, col, ec_rgba = _color.mpl_color2xcolor(data, ec)
243243
if ec_rgba[3] != 0.0:
244244
# Don't draw if it's invisible anyways.
245245
draw_options.append("draw={}".format(col))
246246

247247
if fc is not None:
248-
data, col, fc_rgba = color.mpl_color2xcolor(data, fc)
248+
data, col, fc_rgba = _color.mpl_color2xcolor(data, fc)
249249
if fc_rgba[3] != 0.0:
250250
# Don't draw if it's invisible anyways.
251251
draw_options.append("fill={}".format(col))

tikzplotlib/quadmesh.py renamed to tikzplotlib/_quadmesh.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from PIL import Image
22

3-
from . import files
3+
from . import _files
44

55

66
def draw_quadmesh(data, obj):
@@ -10,7 +10,7 @@ def draw_quadmesh(data, obj):
1010
content = []
1111

1212
# Generate file name for current object
13-
filename, rel_filepath = files.new_filename(data, "img", ".png")
13+
filename, rel_filepath = _files.new_filename(data, "img", ".png")
1414

1515
# Get the dpi for rendering and store the original dpi of the figure
1616
dpi = data["dpi"]

0 commit comments

Comments
 (0)