Skip to content
This repository was archived by the owner on Nov 23, 2022. It is now read-only.

Commit 17c110f

Browse files
committed
Adjust figsize and marker size of plot
1 parent 85bceb2 commit 17c110f

10 files changed

+110
-70
lines changed

mise/ml/mlp_mul_ms.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ def plot_line(output_size, df_obs, df_sim, target, data_dir, png_dir, svg_dir):
783783
df_line.to_csv(csv_path)
784784

785785
# plot
786-
fig, ax = plt.subplots()
786+
fig, ax = plt.subplots(figsize=(8, 6))
787787

788788
ax.plot(dates, obs, color="tab:blue", alpha=0.7, label="obs")
789789
ax.plot(dates, sim, color="tab:orange", alpha=0.7, label="sim")
@@ -828,7 +828,7 @@ def plot_logs(train_logs, valid_logs, target,
828828
png_path = png_dir / ("log_train_" + col + ".png")
829829
svg_path = svg_dir / ("log_train_" + col + ".svg")
830830

831-
fig, ax = plt.subplots()
831+
fig, ax = plt.subplots(figsize=(8, 6))
832832
ax.plot(epochs, df_train_logs[col].to_numpy(), color="tab:blue")
833833

834834
# leg = plt.legend()
@@ -849,7 +849,7 @@ def plot_logs(train_logs, valid_logs, target,
849849
svg_path = svg_dir / ("log_valid_" + col + ".svg")
850850

851851
# plot
852-
fig, ax = plt.subplots()
852+
fig, ax = plt.subplots(figsize=(8, 6))
853853
ax.plot(epochs, df_valid_logs[col].to_numpy(), color="tab:blue")
854854

855855
# leg = plt.legend()
@@ -869,10 +869,13 @@ def plot_logs(train_logs, valid_logs, target,
869869
svg_path = svg_dir / ("log_train_valid_" + col + ".svg")
870870

871871
# plot
872-
fig, ax = plt.subplots()
872+
fig, ax = plt.subplots(figsize=(8, 6))
873873
ax.plot(epochs, df_train_logs[col].to_numpy(), color="tab:blue", label="train")
874874
ax.plot(epochs, df_valid_logs[col].to_numpy(), color="tab:orange", label="valid")
875875

876+
leg = plt.legend()
877+
ax.get_legend().remove()
878+
876879
ax.set_xlabel('epoch')
877880
ax.set_ylabel(col1)
878881
plt.savefig(png_path, dpi=600)
@@ -905,8 +908,9 @@ def plot_scatter(output_size, df_obs, df_sim, target, data_dir, png_dir, svg_dir
905908
df_scatter.to_csv(csv_path)
906909

907910
# plot
908-
fig, ax = plt.subplots()
909-
ax.scatter(obs, sim, color="tab:blue", alpha=0.8)
911+
fig, ax = plt.subplots(figsize=(10, 10))
912+
ax.scatter(obs, sim, color="tab:blue", alpha=0.8, s=(1.0,))
913+
ax.set_aspect(1.0)
910914

911915
ax.set_xlabel('target')
912916
ax.set_ylabel('predicted')
@@ -1026,7 +1030,7 @@ def plot_metrics(metric, output_size, df_obs, df_sim, data_dir, png_dir, svg_dir
10261030
df_metric.set_index('time', inplace=True)
10271031
df_metric.to_csv(csv_path)
10281032

1029-
fig, ax = plt.subplots()
1033+
fig, ax = plt.subplots(figsize=(8, 6))
10301034
ax.plot(times, metric_vals, color="tab:blue")
10311035

10321036
if title:

mise/ml/mlp_mul_ms_mccr.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ def plot_line(output_size, df_obs, df_sim, target, data_dir, png_dir, svg_dir):
793793
df_line.to_csv(csv_path)
794794

795795
# plot
796-
fig, ax = plt.subplots()
796+
fig, ax = plt.subplots(figsize=(8, 6))
797797

798798
ax.plot(dates, obs, color="tab:blue", alpha=0.7, label="obs")
799799
ax.plot(dates, sim, color="tab:orange", alpha=0.7, label="sim")
@@ -838,7 +838,7 @@ def plot_logs(train_logs, valid_logs, target,
838838
png_path = png_dir / ("log_train_" + col + ".png")
839839
svg_path = svg_dir / ("log_train_" + col + ".svg")
840840

841-
fig, ax = plt.subplots()
841+
fig, ax = plt.subplots(figsize=(8, 6))
842842
ax.plot(epochs, df_train_logs[col].to_numpy(), color="tab:blue")
843843

844844
# leg = plt.legend()
@@ -859,7 +859,7 @@ def plot_logs(train_logs, valid_logs, target,
859859
svg_path = svg_dir / ("log_valid_" + col + ".svg")
860860

861861
# plot
862-
fig, ax = plt.subplots()
862+
fig, ax = plt.subplots(figsize=(8, 6))
863863
ax.plot(epochs, df_valid_logs[col].to_numpy(), color="tab:blue")
864864

865865
# leg = plt.legend()
@@ -879,10 +879,13 @@ def plot_logs(train_logs, valid_logs, target,
879879
svg_path = svg_dir / ("log_train_valid_" + col + ".svg")
880880

881881
# plot
882-
fig, ax = plt.subplots()
882+
fig, ax = plt.subplots(figsize=(8, 6))
883883
ax.plot(epochs, df_train_logs[col].to_numpy(), color="tab:blue", label="train")
884884
ax.plot(epochs, df_valid_logs[col].to_numpy(), color="tab:orange", label="valid")
885885

886+
leg = plt.legend()
887+
ax.get_legend().remove()
888+
886889
ax.set_xlabel('epoch')
887890
ax.set_ylabel(col1)
888891
plt.savefig(png_path, dpi=600)
@@ -915,8 +918,9 @@ def plot_scatter(output_size, df_obs, df_sim, target, data_dir, png_dir, svg_dir
915918
df_scatter.to_csv(csv_path)
916919

917920
# plot
918-
fig, ax = plt.subplots()
919-
ax.scatter(obs, sim, color="tab:blue", alpha=0.8)
921+
fig, ax = plt.subplots(figsize=(10, 10))
922+
ax.scatter(obs, sim, color="tab:blue", alpha=0.8, s=(1.0,))
923+
ax.set_aspect(1.0)
920924

921925
ax.set_xlabel('target')
922926
ax.set_ylabel('predicted')
@@ -1036,7 +1040,7 @@ def plot_metrics(metric, output_size, df_obs, df_sim, data_dir, png_dir, svg_dir
10361040
df_metric.set_index('time', inplace=True)
10371041
df_metric.to_csv(csv_path)
10381042

1039-
fig, ax = plt.subplots()
1043+
fig, ax = plt.subplots(figsize=(8, 6))
10401044
ax.plot(times, metric_vals, color="tab:blue")
10411045

10421046
if title:

mise/ml/mlp_mul_transformer.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ def plot_line(output_size, df_obs, df_sim, target, data_dir, png_dir, svg_dir):
10131013
df_line.to_csv(csv_path)
10141014

10151015
# plot
1016-
fig, ax = plt.subplots()
1016+
fig, ax = plt.subplots(figsize=(8, 6))
10171017

10181018
ax.plot(dates, obs, color="tab:blue", alpha=0.7, label="obs")
10191019
ax.plot(dates, sim, color="tab:orange", alpha=0.7, label="sim")
@@ -1058,7 +1058,7 @@ def plot_logs(train_logs, valid_logs, target,
10581058
png_path = png_dir / ("log_train_" + col + ".png")
10591059
svg_path = svg_dir / ("log_train_" + col + ".svg")
10601060

1061-
fig, ax = plt.subplots()
1061+
fig, ax = plt.subplots(figsize=(8, 6))
10621062
ax.plot(epochs, df_train_logs[col].to_numpy(), color="tab:blue")
10631063

10641064
# leg = plt.legend()
@@ -1079,7 +1079,7 @@ def plot_logs(train_logs, valid_logs, target,
10791079
svg_path = svg_dir / ("log_valid_" + col + ".svg")
10801080

10811081
# plot
1082-
fig, ax = plt.subplots()
1082+
fig, ax = plt.subplots(figsize=(8, 6))
10831083
ax.plot(epochs, df_valid_logs[col].to_numpy(), color="tab:blue")
10841084

10851085
# leg = plt.legend()
@@ -1099,10 +1099,13 @@ def plot_logs(train_logs, valid_logs, target,
10991099
svg_path = svg_dir / ("log_train_valid_" + col + ".svg")
11001100

11011101
# plot
1102-
fig, ax = plt.subplots()
1102+
fig, ax = plt.subplots(figsize=(8, 6))
11031103
ax.plot(epochs, df_train_logs[col].to_numpy(), color="tab:blue", label="train")
11041104
ax.plot(epochs, df_valid_logs[col].to_numpy(), color="tab:orange", label="valid")
11051105

1106+
leg = plt.legend()
1107+
ax.get_legend().remove()
1108+
11061109
ax.set_xlabel('epoch')
11071110
ax.set_ylabel(col1)
11081111
plt.savefig(png_path, dpi=600)
@@ -1135,8 +1138,9 @@ def plot_scatter(output_size, df_obs, df_sim, target, data_dir, png_dir, svg_dir
11351138
df_scatter.to_csv(csv_path)
11361139

11371140
# plot
1138-
fig, ax = plt.subplots()
1139-
ax.scatter(obs, sim, color="tab:blue", alpha=0.8)
1141+
fig, ax = plt.subplots(figsize=(10, 10))
1142+
ax.scatter(obs, sim, color="tab:blue", alpha=0.8, s=(1.0,))
1143+
ax.set_aspect(1.0)
11401144

11411145
ax.set_xlabel('target')
11421146
ax.set_ylabel('predicted')
@@ -1256,7 +1260,7 @@ def plot_metrics(metric, output_size, df_obs, df_sim, data_dir, png_dir, svg_dir
12561260
df_metric.set_index('time', inplace=True)
12571261
df_metric.to_csv(csv_path)
12581262

1259-
fig, ax = plt.subplots()
1263+
fig, ax = plt.subplots(figsize=(8, 6))
12601264
ax.plot(times, metric_vals, color="tab:blue")
12611265

12621266
if title:

mise/ml/mlp_mul_transformer_mccr.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ def plot_line(output_size, df_obs, df_sim, target, data_dir, png_dir, svg_dir):
10121012
df_line.to_csv(csv_path)
10131013

10141014
# plot
1015-
fig, ax = plt.subplots()
1015+
fig, ax = plt.subplots(figsize=(8, 6))
10161016

10171017
ax.plot(dates, obs, color="tab:blue", alpha=0.7, label="obs")
10181018
ax.plot(dates, sim, color="tab:orange", alpha=0.7, label="sim")
@@ -1057,7 +1057,7 @@ def plot_logs(train_logs, valid_logs, target,
10571057
png_path = png_dir / ("log_train_" + col + ".png")
10581058
svg_path = svg_dir / ("log_train_" + col + ".svg")
10591059

1060-
fig, ax = plt.subplots()
1060+
fig, ax = plt.subplots(figsize=(8, 6))
10611061
ax.plot(epochs, df_train_logs[col].to_numpy(), color="tab:blue")
10621062

10631063
# leg = plt.legend()
@@ -1078,7 +1078,7 @@ def plot_logs(train_logs, valid_logs, target,
10781078
svg_path = svg_dir / ("log_valid_" + col + ".svg")
10791079

10801080
# plot
1081-
fig, ax = plt.subplots()
1081+
fig, ax = plt.subplots(figsize=(8, 6))
10821082
ax.plot(epochs, df_valid_logs[col].to_numpy(), color="tab:blue")
10831083

10841084
# leg = plt.legend()
@@ -1098,10 +1098,13 @@ def plot_logs(train_logs, valid_logs, target,
10981098
svg_path = svg_dir / ("log_train_valid_" + col + ".svg")
10991099

11001100
# plot
1101-
fig, ax = plt.subplots()
1101+
fig, ax = plt.subplots(figsize=(8, 6))
11021102
ax.plot(epochs, df_train_logs[col].to_numpy(), color="tab:blue", label="train")
11031103
ax.plot(epochs, df_valid_logs[col].to_numpy(), color="tab:orange", label="valid")
11041104

1105+
leg = plt.legend()
1106+
ax.get_legend().remove()
1107+
11051108
ax.set_xlabel('epoch')
11061109
ax.set_ylabel(col1)
11071110
plt.savefig(png_path, dpi=600)
@@ -1134,8 +1137,9 @@ def plot_scatter(output_size, df_obs, df_sim, target, data_dir, png_dir, svg_dir
11341137
df_scatter.to_csv(csv_path)
11351138

11361139
# plot
1137-
fig, ax = plt.subplots()
1138-
ax.scatter(obs, sim, color="tab:blue", alpha=0.8)
1140+
fig, ax = plt.subplots(figsize=(10, 10))
1141+
ax.scatter(obs, sim, color="tab:blue", alpha=0.8, s=(1.0,))
1142+
ax.set_aspect(1.0)
11391143

11401144
ax.set_xlabel('target')
11411145
ax.set_ylabel('predicted')
@@ -1255,7 +1259,7 @@ def plot_metrics(metric, output_size, df_obs, df_sim, data_dir, png_dir, svg_dir
12551259
df_metric.set_index('time', inplace=True)
12561260
df_metric.to_csv(csv_path)
12571261

1258-
fig, ax = plt.subplots()
1262+
fig, ax = plt.subplots(figsize=(8, 6))
12591263
ax.plot(times, metric_vals, color="tab:blue")
12601264

12611265
if title:

mise/ml/mlp_uni_ms.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ def plot_line(output_size, df_obs, df_sim, target, data_dir, png_dir, svg_dir):
734734
df_line.to_csv(csv_path)
735735

736736
# plot
737-
fig, ax = plt.subplots()
737+
fig, ax = plt.subplots(figsize=(8, 6))
738738

739739
ax.plot(dates, obs, color="tab:blue", alpha=0.7, label="obs")
740740
ax.plot(dates, sim, color="tab:orange", alpha=0.7, label="sim")
@@ -779,7 +779,7 @@ def plot_logs(train_logs, valid_logs, target,
779779
png_path = png_dir / ("log_train_" + col + ".png")
780780
svg_path = svg_dir / ("log_train_" + col + ".svg")
781781

782-
fig, ax = plt.subplots()
782+
fig, ax = plt.subplots(figsize=(8, 6))
783783
ax.plot(epochs, df_train_logs[col].to_numpy(), color="tab:blue")
784784

785785
# leg = plt.legend()
@@ -800,7 +800,7 @@ def plot_logs(train_logs, valid_logs, target,
800800
svg_path = svg_dir / ("log_valid_" + col + ".svg")
801801

802802
# plot
803-
fig, ax = plt.subplots()
803+
fig, ax = plt.subplots(figsize=(8, 6))
804804
ax.plot(epochs, df_valid_logs[col].to_numpy(), color="tab:blue")
805805

806806
# leg = plt.legend()
@@ -820,10 +820,13 @@ def plot_logs(train_logs, valid_logs, target,
820820
svg_path = svg_dir / ("log_train_valid_" + col + ".svg")
821821

822822
# plot
823-
fig, ax = plt.subplots()
823+
fig, ax = plt.subplots(figsize=(8, 6))
824824
ax.plot(epochs, df_train_logs[col].to_numpy(), color="tab:blue", label="train")
825825
ax.plot(epochs, df_valid_logs[col].to_numpy(), color="tab:orange", label="valid")
826826

827+
leg = plt.legend()
828+
ax.get_legend().remove()
829+
827830
ax.set_xlabel('epoch')
828831
ax.set_ylabel(col1)
829832
plt.savefig(png_path, dpi=600)
@@ -856,8 +859,9 @@ def plot_scatter(output_size, df_obs, df_sim, target, data_dir, png_dir, svg_dir
856859
df_scatter.to_csv(csv_path)
857860

858861
# plot
859-
fig, ax = plt.subplots()
860-
ax.scatter(obs, sim, color="tab:blue", alpha=0.8)
862+
fig, ax = plt.subplots(figsize=(10, 10))
863+
ax.scatter(obs, sim, color="tab:blue", alpha=0.8, s=(1.0,))
864+
ax.set_aspect(1.0)
861865

862866
ax.set_xlabel('target')
863867
ax.set_ylabel('predicted')
@@ -977,7 +981,7 @@ def plot_metrics(metric, output_size, df_obs, df_sim, data_dir, png_dir, svg_dir
977981
df_metric.set_index('time', inplace=True)
978982
df_metric.to_csv(csv_path)
979983

980-
fig, ax = plt.subplots()
984+
fig, ax = plt.subplots(figsize=(8, 6))
981985
ax.plot(times, metric_vals, color="tab:blue")
982986

983987
if title:

mise/ml/mlp_uni_ms_mccr.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ def plot_line(output_size, df_obs, df_sim, target, data_dir, png_dir, svg_dir):
742742
df_line.to_csv(csv_path)
743743

744744
# plot
745-
fig, ax = plt.subplots()
745+
fig, ax = plt.subplots(figsize=(8, 6))
746746

747747
ax.plot(dates, obs, color="tab:blue", alpha=0.7, label="obs")
748748
ax.plot(dates, sim, color="tab:orange", alpha=0.7, label="sim")
@@ -787,7 +787,7 @@ def plot_logs(train_logs, valid_logs, target,
787787
png_path = png_dir / ("log_train_" + col + ".png")
788788
svg_path = svg_dir / ("log_train_" + col + ".svg")
789789

790-
fig, ax = plt.subplots()
790+
fig, ax = plt.subplots(figsize=(8, 6))
791791
ax.plot(epochs, df_train_logs[col].to_numpy(), color="tab:blue")
792792

793793
# leg = plt.legend()
@@ -808,7 +808,7 @@ def plot_logs(train_logs, valid_logs, target,
808808
svg_path = svg_dir / ("log_valid_" + col + ".svg")
809809

810810
# plot
811-
fig, ax = plt.subplots()
811+
fig, ax = plt.subplots(figsize=(8, 6))
812812
ax.plot(epochs, df_valid_logs[col].to_numpy(), color="tab:blue")
813813

814814
# leg = plt.legend()
@@ -828,10 +828,13 @@ def plot_logs(train_logs, valid_logs, target,
828828
svg_path = svg_dir / ("log_train_valid_" + col + ".svg")
829829

830830
# plot
831-
fig, ax = plt.subplots()
831+
fig, ax = plt.subplots(figsize=(8, 6))
832832
ax.plot(epochs, df_train_logs[col].to_numpy(), color="tab:blue", label="train")
833833
ax.plot(epochs, df_valid_logs[col].to_numpy(), color="tab:orange", label="valid")
834834

835+
leg = plt.legend()
836+
ax.get_legend().remove()
837+
835838
ax.set_xlabel('epoch')
836839
ax.set_ylabel(col1)
837840
plt.savefig(png_path, dpi=600)
@@ -864,8 +867,9 @@ def plot_scatter(output_size, df_obs, df_sim, target, data_dir, png_dir, svg_dir
864867
df_scatter.to_csv(csv_path)
865868

866869
# plot
867-
fig, ax = plt.subplots()
868-
ax.scatter(obs, sim, color="tab:blue", alpha=0.8)
870+
fig, ax = plt.subplots(figsize=(10, 10))
871+
ax.scatter(obs, sim, color="tab:blue", alpha=0.8, s=(1.0,))
872+
ax.set_aspect(1.0)
869873

870874
ax.set_xlabel('target')
871875
ax.set_ylabel('predicted')
@@ -985,7 +989,7 @@ def plot_metrics(metric, output_size, df_obs, df_sim, data_dir, png_dir, svg_dir
985989
df_metric.set_index('time', inplace=True)
986990
df_metric.to_csv(csv_path)
987991

988-
fig, ax = plt.subplots()
992+
fig, ax = plt.subplots(figsize=(8, 6))
989993
ax.plot(times, metric_vals, color="tab:blue")
990994

991995
if title:

0 commit comments

Comments
 (0)