Skip to content

Commit f27c9a9

Browse files
committed
added a work around for the axis scaling problems
1 parent cb0244b commit f27c9a9

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

mathics/builtin/graphics.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ class Graphics(Builtin):
417417
418418
In 'TeXForm', 'Graphics' produces Asymptote figures:
419419
>> Graphics[Circle[]] // TeXForm
420-
=
420+
=
421421
. \begin{asy}
422422
. size(5.8556cm, 5.8333cm);
423423
. add((175,175,175,0,0,175)*(new picture(){picture s=currentpicture,t=new picture;currentpicture=t;draw(ellipse((0,0),1,1), rgb(0, 0, 0)+linewidth(0.0038095));currentpicture=s;return t;})());
@@ -2650,6 +2650,19 @@ def get_line_width(self, face_element=True):
26502650
return 0
26512651
return edge_style.get_thickness()
26522652

2653+
def to_axis_style(self):
2654+
return AxisStyle(self)
2655+
2656+
2657+
class AxisStyle(Style):
2658+
def __init__(self, style):
2659+
super(AxisStyle, self).__init__(style.graphics, style.edge, style.face)
2660+
self.styles = style.styles
2661+
self.options = style.options
2662+
2663+
def get_line_width(self, face_element=True):
2664+
return 0.5
2665+
26532666

26542667
def _flatten(leaves):
26552668
for leaf in leaves:
@@ -3206,6 +3219,11 @@ def create_axes(self, elements, graphics_options, xmin, xmax, ymin, ymax):
32063219
ticks_style = [elements.create_style(s) for s in ticks_style]
32073220
axes_style = [elements.create_style(s) for s in axes_style]
32083221
label_style = elements.create_style(label_style)
3222+
3223+
ticks_style = [s.to_axis_style() for s in ticks_style]
3224+
axes_style = [s.to_axis_style() for s in axes_style]
3225+
label_style = label_style.to_axis_style()
3226+
32093227
ticks_style[0].extend(axes_style[0])
32103228
ticks_style[1].extend(axes_style[1])
32113229

0 commit comments

Comments
 (0)