-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmake_pretty.py
More file actions
executable file
·92 lines (79 loc) · 2.65 KB
/
make_pretty.py
File metadata and controls
executable file
·92 lines (79 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 20 09:33:24 2020
@author: Sumeet Kumar
Plotting-relevant functions
"""
def set_font_settings(target):
tex_fonts = {}
if target=='AIAA_SciTech' or target=='VFS_Forum':
tex_fonts = {
# Use LaTeX to write all text
"text.usetex": True,
# "font.family": "Times New Roman",
"font.family": "cambria",
# Use 10pt font in plots, to match 10pt font in document
"axes.labelsize": 10,
"font.size": 10,
# Make the legend/label fonts a little smaller
"legend.fontsize": 9,
"legend.frameon":True,
"xtick.labelsize": 9,
"ytick.labelsize": 9
}
return tex_fonts
def set_size(target, custom_width=500, fraction=1.0):
"""Set figure dimensions to avoid scaling in LaTeX.
obtained this function from -
https://jwalton.info/Embed-Publication-Matplotlib-Latex/
Parameters
----------
custom_width: float
Explicit document textwidth or columnwidth in pts
fraction: float, optional
Fraction of the width in 'target' page which you wish the figure to
occupy
Returns
-------
fig_dim: tuple
Dimensions of figure in inches
"""
if target=='AIAA_SciTech':
width=469.75502
elif target=='VFS_Forum':
width=469.75502
else:
width=custom_width
# Width of figure (in pts)
fig_width_pt = width * fraction
# Convert from pt to inches
inches_per_pt = 1 / 72.27
# Golden ratio to set aesthetic figure height
# https://disq.us/p/2940ij3
golden_ratio = (5**.5 - 1) / 2
# Figure width in inches
fig_width_in = fig_width_pt * inches_per_pt
# Figure height in inches
fig_height_in = fig_width_in * golden_ratio
return (fig_width_in, fig_height_in)
def for_scatter():
markers = {'Dymore':"+",
'Dymore+VPM':"x",
'Expt':'o',
'RCAS':"*"}
color={'Dymore':'b',
'Dymore+VPM':'g',
'Expt':'r',
'CFD':'gray',
'RCAS':'lightcoral'}
markersize={'Dymore':6,
'Dymore+VPM':6,
'Expt':10,
'RCAS':6}
linestyle={'Dymore':'solid',
'Dymore+VPM':'dashed',
'Expt':'solid',
'RCAS':'dotted'}
generic_dict={'markers':markers,'color':color,'markersize':markersize,'linestyle':linestyle}
return generic_dict