-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
foz
committed
Jul 6, 2021
1 parent
2d8fec0
commit 4d04563
Showing
21 changed files
with
4,753 additions
and
3,036 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: crossover | ||
name: crossover2 | ||
channels: | ||
- defaults | ||
dependencies: | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
|
||
|
||
import svgutils.transform as sg | ||
import base64 | ||
import sys | ||
|
||
def generate_figure(input_julia_path, input_data_path, output_path): | ||
fig0 = sg.SVGFigure( "210mm", "297mm") | ||
|
||
|
||
MPL_SCALE = 0.4*2 | ||
JL_SCALE = 0.08 | ||
|
||
def get_file(fn, scale=MPL_SCALE, pos=None): | ||
fig = sg.fromfile(fn) | ||
plot = fig.getroot() | ||
plot.scale_xy(scale, scale) | ||
if pos is not None: | ||
plot.moveto(*pos) | ||
return plot | ||
|
||
|
||
YS = 160*2 | ||
XS = 185*2 | ||
|
||
|
||
|
||
def make_row(data): | ||
panels = [] | ||
for i, (f, l, c) in enumerate(data): | ||
panels.append(get_file(f, pos=(i*XS, 0))) | ||
panels.append(sg.TextElement(i*XS-10, 0, l, size=20, weight="bold")) | ||
panels.append(sg.TextElement(i*XS+0.5*XS, 0, c, size=24, anchor="middle")) | ||
|
||
return sg.GroupElement(panels) | ||
|
||
|
||
def make_single(data, label=True, label_offset_x=-10): | ||
panels = [] | ||
if label: | ||
f, l = data | ||
panels.append(get_file(f, pos=(0, 0))) | ||
if l: | ||
panels.append(sg.TextElement(label_offset_x, 10, l, size=20, weight="bold")) | ||
else: | ||
f=data | ||
panels.append(get_file(f, pos=(0, 0))) | ||
return sg.GroupElement(panels) | ||
|
||
|
||
|
||
# load matpotlib-generated figures | ||
|
||
|
||
row = [ ( input_data_path+'/violin_number_length.svg', 'a', 'Experimental data'), | ||
( input_julia_path+'/new_end_nco_vs_length.svg', 'b', 'Simulation output') ] | ||
|
||
g = make_row(row) | ||
g.moveto(0,70) | ||
|
||
|
||
|
||
gpage = sg.GroupElement([g])#, gh]) | ||
gpage.moveto(30,30) | ||
|
||
|
||
fig0.append([gpage]) | ||
|
||
|
||
|
||
# save generated SVG files | ||
fig0.save(output_path+"/CO_length.svg") | ||
|
||
generate_figure(*sys.argv[1:]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.