Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _gen_grid(self, dx, dy, width=0.5):
xmax, ymax = 1000, 1000
x, y = 0, 0
lines = []
txt = []
while x < xmax:
lines.append(_transform.LineElement([(x, 0), (x, ymax)],
width=width))
txt.append(_transform.TextElement(x, dy/2, str(x), size=self.size))
x += dx
while y < ymax:
lines.append(_transform.LineElement([(0, y), (xmax, y)],
width=width))
txt.append(_transform.TextElement(0, y, str(y), size=self.size))
y += dy
return lines+txt
import sys
#create new SVG figure
fig = sg.SVGFigure("16cm", "6.5cm")
# load matpotlib-generated figures
fig1 = sg.fromfile('sigmoid_fit.svg')
fig2 = sg.fromfile('anscombe.svg')
# get the plot objects
plot1 = fig1.getroot()
plot2 = fig2.getroot()
plot2.moveto(280, 0, scale=0.5)
# add text labels
txt1 = sg.TextElement(25,20, "A", size=12, weight="bold")
txt2 = sg.TextElement(305,20, "B", size=12, weight="bold")
# append plots and labels to figure
fig.append([plot1, plot2])
fig.append([txt1, txt2])
# save generated SVG files
fig.save("fig_final.svg")
#create new SVG figure
fig = sg.SVGFigure("16cm", "6.5cm")
# load matpotlib-generated figures
fig1 = sg.fromfile('sigmoid_fit.svg')
fig2 = sg.fromfile('anscombe.svg')
# get the plot objects
plot1 = fig1.getroot()
plot2 = fig2.getroot()
plot2.moveto(280, 0, scale=0.5)
# add text labels
txt1 = sg.TextElement(25,20, "A", size=12, weight="bold")
txt2 = sg.TextElement(305,20, "B", size=12, weight="bold")
# append plots and labels to figure
fig.append([plot1, plot2])
fig.append([txt1, txt2])
# save generated SVG files
fig.save("fig_final.svg")
def _gen_grid(self, dx, dy, width=0.5):
xmax, ymax = 1000, 1000
x, y = 0, 0
lines = []
txt = []
while x < xmax:
lines.append(_transform.LineElement([(x, 0), (x, ymax)],
width=width))
txt.append(_transform.TextElement(x, dy/2, str(x), size=self.size))
x += dx
while y < ymax:
lines.append(_transform.LineElement([(0, y), (xmax, y)],
width=width))
txt.append(_transform.TextElement(0, y, str(y), size=self.size))
y += dy
return lines+txt
def __init__(self, text, x=None, y=None, **kwargs):
params = {'size': CONFIG['text.size'],
'weight': CONFIG['text.weight'],
'font': CONFIG['text.font']}
if x is None or y is None:
x, y = CONFIG['text.position']
params.update(kwargs)
element = _transform.TextElement(x, y, text, **params)
Element.__init__(self, element.root)