Skip to content

Commit 2077b72

Browse files
author
Gorshanov Vadim
committed
Add the "axis equal" parameter
1 parent 5bb60d2 commit 2077b72

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/tikzplotlib/_axes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ def _set_axis_dimensions(self, data, aspect_num, xlim, ylim):
239239
else:
240240
# TODO keep an eye on https://tex.stackexchange.com/q/480058/13262
241241
pass
242+
if data["axis_equal"]:
243+
self.axis_options.append("axis equal")
242244

243245
def _ticks(self, data, obj):
244246
# get ticks

src/tikzplotlib/_save.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def get_tikz_code(
4141
table_row_sep: str = "\n",
4242
flavor: str = "latex",
4343
every_n_dot: int = 1,
44+
axis_equal: bool = False,
4445
):
4546
"""Main function. Here, the recursion into the image starts and the
4647
contents are picked up. The actual file gets written in this routine.
@@ -140,6 +141,9 @@ def get_tikz_code(
140141
:param every_n_dot: if path is encountered, only draw every Nth dot
141142
:type every_n_dot: int
142143
144+
:param axis_equal: if true, have equal axis ratio
145+
:type axis_equal: bool
146+
143147
:returns: None
144148
145149
The following optional attributes of matplotlib's objects are recognized
@@ -181,6 +185,7 @@ def get_tikz_code(
181185
data["add axis environment"] = add_axis_environment
182186
data["show_info"] = show_info
183187
data["every n dot"] = every_n_dot
188+
data["axis_equal"] = axis_equal
184189
# rectangle_legends is used to keep track of which rectangles have already
185190
# had \addlegendimage added. There should be only one \addlegenimage per
186191
# bar chart data series.

0 commit comments

Comments
 (0)