Skip to content

Commit

Permalink
update font size
Browse files Browse the repository at this point in the history
  • Loading branch information
Ipuch committed Jul 28, 2022
1 parent 6aae5ac commit 14ec30c
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 22 deletions.
12 changes: 10 additions & 2 deletions analyses/analyses_convergence.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
horizontal_spacing=0.15,
)

# update the font size of the subplot_titles
for i in fig['layout']['annotations']:
i['font'] = dict(size=22)

# select only the one who converged
df_results = df_results[df_results["status"] == 0]
df_results = df_results[df_results["n_shooting_tot"] >= 150]
Expand Down Expand Up @@ -160,13 +164,13 @@
plot_bgcolor="rgba(255,255,255,1)",
legend=dict(
title_font_family="Times New Roman",
font=dict(family="Times New Roman", color="black", size=15),
font=dict(family="Times New Roman", color="black", size=16),
orientation="h",
xanchor="center",
x=0.5,
),
font=dict(
size=17,
size=16,
family="Times New Roman",
),
xaxis=dict(color="black"),
Expand All @@ -182,21 +186,25 @@
row=1,
col=1,
tickformat="0.1r",
tickfont=dict(size=11),
)
fig.update_yaxes(
row=1,
col=2,
tickformat="0.1r",
tickfont=dict(size=11),
)
fig.update_yaxes(
row=2,
col=1,
tickformat="0.1r",
tickfont=dict(size=11),
)
fig.update_yaxes(
row=2,
col=2,
tickformat="0.1r",
tickfont=dict(size=11),
)

fig.show()
Expand Down
9 changes: 5 additions & 4 deletions analyses/analyses_convergence_time_cost.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@
plot_bgcolor="rgba(255,255,255,1)",
legend=dict(
title_font_family="Times New Roman",
font=dict(family="Times New Roman", color="black", size=10),
font=dict(family="Times New Roman", color="black", size=16),
xanchor="right",
yanchor="top",
x=1,
y=1.05,
),
font=dict(
size=12,
size=16,
family="Times New Roman",
),
xaxis=dict(color="black"),
Expand All @@ -113,12 +113,13 @@
fig.update_yaxes(
row=1,
col=1,
tickformat="0.1r",
tickformat="0.01r",
tickfont=dict(size=11),
)
fig.update_yaxes(
row=1,
col=2,
tickformat="0.1r",
tickfont=dict(size=11),
)

fig.show()
Expand Down
26 changes: 17 additions & 9 deletions analyses/analyses_plotly_all_q.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def plot_all_dof(fig: go.Figure, key: str, df_results: DataFrame, list_dof: list
row=idx_row,
col=idx_col,
)
fig.update_yaxes(tickfont=dict(size=11))

if row.dynamics_type == MillerDynamics.EXPLICIT:
first_e = 1
Expand All @@ -192,7 +193,7 @@ def plot_all_dof(fig: go.Figure, key: str, df_results: DataFrame, list_dof: list
plot_bgcolor="rgba(255,255,255,1)",
legend=dict(
title_font_family="Times New Roman",
font=dict(family="Times New Roman", color="black", size=15),
font=dict(family="Times New Roman", color="black", size=18),
orientation="h",
yanchor="bottom",
y=1.05,
Expand All @@ -201,7 +202,7 @@ def plot_all_dof(fig: go.Figure, key: str, df_results: DataFrame, list_dof: list
valign="top",
),
font=dict(
size=12,
size=19,
family="Times New Roman",
),
yaxis=dict(color="black"),
Expand All @@ -212,17 +213,21 @@ def plot_all_dof(fig: go.Figure, key: str, df_results: DataFrame, list_dof: list


fig = make_subplots(rows=rows, cols=cols, subplot_titles=list_dof_label, vertical_spacing=0.05, shared_xaxes=True)
# update the font size of the subplot_titles
for i in fig['layout']['annotations']:
i['font'] = dict(size=18)
fig = plot_all_dof(fig, "tau_integrated", df_results, list_dof, idx_rows, idx_cols)
fig.update_yaxes(row=1, col=1, title=r"$\boldsymbol{\tau} \; \text{(N)}$")
for i in range(2, rows + 1):
fig.update_yaxes(row=i, col=1, title=r"$\boldsymbol{\tau} \; \text{(Nm)}$")
for i in range(1, cols + 1):
fig.update_xaxes(row=rows, col=i, title=r"$\text{Time (s)}$")
fig.update_xaxes(row=rows, col=i, title=r"Time (s)")
fig.show()
fig.write_image(out_path_file + "/tau_integrated.png")

fig.write_image(out_path_file + "/tau_integrated.pdf")
fig.write_html(out_path_file + "/tau_integrated.html", include_mathjax="cdn")
fig.write_image(out_path_file + "/tau_integrated.eps")
fig.write_html(out_path_file + "/tau_integrated.html", include_mathjax="cdn")
fig.write_image(out_path_file + "/tau_integrated.png")

# zoom on x-axis between 0.7 and 0.75 for each subplot of the figure on the plotly object fig
for i in range(1, 3):
Expand All @@ -236,16 +241,19 @@ def plot_all_dof(fig: go.Figure, key: str, df_results: DataFrame, list_dof: list


fig = make_subplots(rows=rows, cols=cols, subplot_titles=list_dof_label, vertical_spacing=0.05, shared_xaxes=True)
# update the font size of the subplot_titles
for i in fig['layout']['annotations']:
i['font'] = dict(size=18)
fig = plot_all_dof(fig, "q_integrated", df_results, list_dof, idx_rows, idx_cols)
fig.update_yaxes(row=1, col=1, title=r"$\boldsymbol{q} \; \text{(m)}$")
fig.update_yaxes(row=1, col=1, title="q (m)")
for i in range(2, rows + 1):
fig.update_yaxes(row=i, col=1, title=r"$\boldsymbol{q}\; \text{(degree)}$")
fig.update_yaxes(row=i, col=1, title="q (degree)")
for i in range(1, cols + 1):
fig.update_xaxes(row=rows, col=i, title=r"$\text{Time (s)}$")
fig.update_xaxes(row=rows, col=i, title="Time (s)")
fig.show()
fig.write_image(out_path_file + "/q_integrated.png")
fig.write_image(out_path_file + "/q_integrated.pdf")
fig.write_image(out_path_file + "/q_integrated.eps")
fig.write_image(out_path_file + "/q_integrated.png")
fig.write_html(out_path_file + "/q_integrated.html", include_mathjax="cdn")

fig = make_subplots(rows=rows, cols=cols, subplot_titles=list_dof_label, vertical_spacing=0.05, shared_xaxes=True)
Expand Down
19 changes: 16 additions & 3 deletions analyses/analyses_plotly_detailed_cost.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
x=-0.15,
y=0.5,
text=r"$\mathcal{J}_1 + \mathcal{J}_2$",
font=dict(color="black", size=18),
font=dict(color="black", size=25),
textangle=270,
showarrow=False,
xref="paper",
Expand All @@ -94,16 +94,29 @@
plot_bgcolor="rgba(255,255,255,1)",
legend=dict(
title_font_family="Times New Roman",
font=dict(family="Times New Roman", color="black", size=11),
font=dict(family="Times New Roman", color="black", size=15),
),
font=dict(
size=12,
size=15,
family="Times New Roman",
),
yaxis=dict(color="black"),
template="simple_white",
boxgap=0.2,
)

fig.update_yaxes(
row=1,
col=1,
tickfont=dict(size=11),
)

fig.update_yaxes(
row=2,
col=1,
tickfont=dict(size=11),
)

fig.show()
fig.write_image(out_path_file + "/detailed_cost.png")
fig.write_image(out_path_file + "/detailed_cost.pdf")
Expand Down
12 changes: 10 additions & 2 deletions analyses/analyses_plotly_momentum.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
vertical_spacing=0.09,
)

# update the font size of the subplot_titles
for i in fig['layout']['annotations']:
i['font'] = dict(size=22)

# select only the one who converged
df_results = df_results[df_results["status"] == 0]

Expand Down Expand Up @@ -132,14 +136,14 @@ def my_traces(fig, dyn, grps, c, df, key, row, col, ylabel, title_str: str = Non
plot_bgcolor="rgba(255,255,255,1)",
legend=dict(
title_font_family="Times New Roman",
font=dict(family="Times New Roman", color="black", size=11),
font=dict(family="Times New Roman", color="black", size=16),
orientation="h",
xanchor="center",
x=0.5,
y=-0.05,
),
font=dict(
size=12,
size=16,
family="Times New Roman",
),
yaxis=dict(color="black"),
Expand All @@ -158,21 +162,25 @@ def my_traces(fig, dyn, grps, c, df, key, row, col, ylabel, title_str: str = Non
row=1,
col=1,
tickformat="0.1r",
tickfont=dict(size=11),
)
fig.update_yaxes(
row=1,
col=2,
tickformat="0.1r",
tickfont=dict(size=11),
)
fig.update_yaxes(
row=2,
col=1,
tickformat="0.1r",
tickfont=dict(size=11),
)
fig.update_yaxes(
row=2,
col=2,
tickformat="0.1r",
tickfont=dict(size=11),
)


Expand Down
7 changes: 5 additions & 2 deletions analyses/analyses_plotly_time_iter.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@
plot_bgcolor="rgba(255,255,255,1)",
legend=dict(
title_font_family="Times New Roman",
font=dict(family="Times New Roman", color="black", size=11),
font=dict(family="Times New Roman", color="black", size=15),
orientation="h",
xanchor="center",
x=0.5,
y=-0.05,
),
font=dict(
size=12,
size=15,
family="Times New Roman",
),
yaxis=dict(color="black"),
Expand All @@ -57,11 +57,14 @@
row=1,
col=1,
tickformat="0.1r",
tickfont=dict(size=11),
)

fig.update_yaxes(
row=1,
col=2,
tickformat="0.1r",
tickfont=dict(size=11),
)

fig.show()
Expand Down

0 comments on commit 14ec30c

Please sign in to comment.