Skip to content

Commit 2a02318

Browse files
authored
Merge pull request #15478 from rmcdermo/master
Python: add plot_type to dataplot calls in plot_to_fig
2 parents 2f3479b + ddd62ee commit 2a02318

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

Utilities/Python/fdsplotlib.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,11 @@ def dataplot(config_filename,**kwargs):
406406
raw_keys = []
407407
key_labels = (raw_keys + [None] * len(col_names))[:len(col_names)]
408408

409+
# --- Sanitize plot type ---
410+
plot_type = str(pp.Plot_Type or '').strip().lower()
411+
if plot_type not in ['linear', 'loglog', 'semilogx', 'semilogy']:
412+
plot_type = 'linear'
413+
409414
for i, label in enumerate(col_names):
410415
if i==0:
411416
# plot the exp data
@@ -416,7 +421,8 @@ def dataplot(config_filename,**kwargs):
416421
marker_style=styles[i],
417422
x_min=pp.Min_Ind,x_max=pp.Max_Ind,
418423
y_min=pp.Min_Dep,y_max=pp.Max_Dep,
419-
legend_location=matlab_legend_to_matplotlib(pp.Key_Position)
424+
legend_location=matlab_legend_to_matplotlib(pp.Key_Position),
425+
plot_type=plot_type,
420426
)
421427
elif i>0:
422428
f = plot_to_fig(x_data=x_plot, y_data=y_plot[:, i],
@@ -427,7 +433,8 @@ def dataplot(config_filename,**kwargs):
427433
marker_style=styles[i],
428434
x_min=pp.Min_Ind,x_max=pp.Max_Ind,
429435
y_min=pp.Min_Dep,y_max=pp.Max_Dep,
430-
legend_location=matlab_legend_to_matplotlib(pp.Key_Position)
436+
legend_location=matlab_legend_to_matplotlib(pp.Key_Position),
437+
plot_type=plot_type,
431438
)
432439

433440
else:
@@ -460,7 +467,8 @@ def dataplot(config_filename,**kwargs):
460467
marker_style=pp.d1_Style,
461468
x_min=pp.Min_Ind,x_max=pp.Max_Ind,
462469
y_min=pp.Min_Dep,y_max=pp.Max_Dep,
463-
legend_location=matlab_legend_to_matplotlib(pp.Key_Position)
470+
legend_location=matlab_legend_to_matplotlib(pp.Key_Position),
471+
plot_type=plot_type,
464472
)
465473

466474
# --- Save measured (experimental) metric using MATLAB-equivalent logic ---
@@ -530,6 +538,7 @@ def dataplot(config_filename,**kwargs):
530538
x_min=pp.Min_Ind,x_max=pp.Max_Ind,
531539
y_min=pp.Min_Dep,y_max=pp.Max_Dep,
532540
legend_location=matlab_legend_to_matplotlib(pp.Key_Position),
541+
plot_type=plot_type,
533542
plot_title=pp.Plot_Title
534543
)
535544

@@ -1251,7 +1260,7 @@ def get_plot_style(style="fds"):
12511260
"Plot_Width": 5.0,
12521261
"Plot_Height": 3.4,
12531262
"Plot_X": 1.2,
1254-
"Plot_Y": 0.8,
1263+
"Plot_Y": 0.75,
12551264
"Scat_Plot_Width": 4.75,
12561265
"Scat_Plot_Height": 4.75,
12571266
"Scat_Plot_X": 1.00,

0 commit comments

Comments
 (0)