Skip to content

Commit 2d11925

Browse files
committed
Minor
1 parent 9e49aff commit 2d11925

4 files changed

Lines changed: 41 additions & 8 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ There are two options to use the script:
3333

3434
NOTE: default values can be found in ```config/default.json```
3535

36+
* **--linewidth** _LINEWIDTH_
37+
Set linewidth for the graph
3638
* **--max-cost** _MAX-COST_
3739
Specify upper bound on cost axis.
3840
* **--min-cost** _MIN-COST_
@@ -49,6 +51,8 @@ NOTE: default values can be found in ```config/default.json```
4951
Do not plot non-optimal planner.
5052
* **--title-name** _TITLE-NAME_
5153
Set title name
54+
* **--no-title**
55+
Remove title name
5256
* **--legend-separate-file**
5357
Print legend as separate file.
5458
* **--legend-below-figure**

ompl_benchmark_plotter.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,21 @@ def run_benchmark_plotter(input_arguments):
2222
graph_group.add_argument('--min-cost', type=float, help='Specify lower bound on cost display.')
2323
graph_group.add_argument('--max-time', type=float, help='Specify upper bound on time display.')
2424
graph_group.add_argument('--min-time', type=float, help='Specify lower bound on time display.')
25+
graph_group.add_argument('--linewidth', type=float, help='Linewidth of the output.')
2526
graph_group.add_argument('--fontsize', type=float, help='Fontsize of title and descriptions.')
2627
graph_group.add_argument('--label-fontsize', type=float, help='Fontsize of tick labels.')
2728
graph_group.add_argument('--only-success-graph', action='store_const', const=True, help='Plot only the success graph.')
2829
graph_group.add_argument('--ignore-non-optimal-planner', action='store_const', const=True, help='Do not plot non-optimal planner.')
30+
graph_group.add_argument('--ignore-planner', action='store', type=str, nargs='+', help='Exclude planners from graph (accepts multiple planner names)')
2931
graph_group.add_argument('--legend-separate-file', action='store_const', const=True, help='Print legend as separate file.')
3032
graph_group.add_argument('--legend-below-figure', action='store_const',
3133
const=True, help='Print legend below graph.')
3234
graph_group.add_argument('--legend-none', action='store_const',
3335
const=True, help='Do not print legend.')
36+
graph_group.add_argument('--remove-ylabel', action='store_const',
37+
const=True, help='Do not print label on y-axis.')
3438
graph_group.add_argument('--title-name', action='store', type=str, help='Set title name.')
39+
graph_group.add_argument('--no-title', action='store_const', const=True, help='Do not set a title for this graph')
3540

3641
args = parser.parse_args(input_arguments)
3742
if args.quiet:

src/database_info.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,9 @@ def make_config(args):
401401
max_time = args.max_time if args.max_time else -1
402402
min_time = args.min_time if args.min_time else -1
403403
fontsize = args.fontsize if args.fontsize else -1
404+
linewidth = args.linewidth if args.linewidth else -1
405+
no_title = args.no_title if args.no_title else False
406+
remove_ylabel = args.remove_ylabel if args.remove_ylabel else False
404407
only_success_graph = args.only_success_graph if args.only_success_graph else False
405408
label_fontsize = args.label_fontsize if args.label_fontsize else -1
406409
plot_config = {
@@ -413,8 +416,12 @@ def make_config(args):
413416
'max_time': max_time,
414417
'min_time': min_time,
415418
'fontsize': fontsize,
419+
'no_title': no_title,
420+
'linewidth': linewidth,
421+
'remove_ylabel': remove_ylabel,
416422
'label_fontsize': label_fontsize,
417423
'ignore_non_optimal_planner': args.ignore_non_optimal_planner,
424+
'ignore_planner': args.ignore_planner,
418425
'legend_below_figure': args.legend_below_figure,
419426
'legend_separate_file': args.legend_separate_file,
420427
'legend_none': args.legend_none

src/database_to_graph.py

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ def get_json_from_database(cursor, data, config):
4343
if ignore_non_optimal_planner:
4444
planners = remove_non_optimal_planner(planners)
4545

46+
ignore_planner = config["ignore_planner"]
47+
if ignore_planner is not None:
48+
planners = [planner for planner in planners if planner[1] not in ignore_planner]
49+
print("New planner set: {}".format(planners))
50+
4651
for planner in planners:
4752
planner_id = planner[0]
4853
planner_name = planner[1]
@@ -171,8 +176,9 @@ def plot_success(ax, data):
171176
linewidth=data["info"]["linewidth"], label=get_label(planner))
172177

173178
ax.grid(True, which="both", ls='--')
174-
ylabel = data["info"]["ylabel_success"]
175-
ax.set_ylabel(ylabel, fontsize=fontsize)
179+
if not data["info"]["remove_ylabel"]:
180+
ylabel = data["info"]["ylabel_success"]
181+
ax.set_ylabel(ylabel, fontsize=fontsize)
176182

177183
def plot_optimization(ax, data, config):
178184

@@ -194,7 +200,6 @@ def plot_optimization(ax, data, config):
194200
planner_data = data["planners"]
195201
for planner in planner_data:
196202
planner_optimization_success = planner_data[planner]["optimization_success"]
197-
#color = get_color(data, planner)
198203
color = get_diverse_color(planner)
199204
if planner_optimization_success:
200205
planner_median = planner_data[planner]["median"]
@@ -213,7 +218,8 @@ def plot_optimization(ax, data, config):
213218
ylabel = data["info"]["ylabel_optimization"]
214219
xlabel = data["info"]["xlabel"]
215220
ax.set_xlabel(xlabel, fontsize=fontsize)
216-
ax.set_ylabel(ylabel, fontsize=fontsize)
221+
if not data["info"]["remove_ylabel"]:
222+
ax.set_ylabel(ylabel, fontsize=fontsize)
217223

218224
def json_to_graph(json_filepath, pdf_filepath, config):
219225
with open(json_filepath, 'r') as jsonfile:
@@ -234,10 +240,11 @@ def json_to_graph(json_filepath, pdf_filepath, config):
234240
label_fontsize = data["info"]["label_fontsize"]
235241
experiment_name = get_experiment_label(data["info"]["experiment"])
236242

237-
if 'title_name' in config:
238-
ax_success.set_title(config['title_name'], fontsize=fontsize)
239-
else:
240-
ax_success.set_title(experiment_name, fontsize=fontsize)
243+
if not config["no_title"]:
244+
if 'title_name' in config:
245+
ax_success.set_title(config['title_name'], fontsize=fontsize)
246+
else:
247+
ax_success.set_title(experiment_name, fontsize=fontsize)
241248

242249
legend_title_name = 'Planner'
243250
if not config["legend_none"]:
@@ -257,7 +264,11 @@ def json_to_graph(json_filepath, pdf_filepath, config):
257264
obj.set_linewidth(data["info"]["legend_linewidth"])
258265
plt.setp(legend.get_title(),fontsize=label_fontsize)
259266

267+
## Set ticks and label fontsizes
268+
tick_padding = 0.3 * label_fontsize
260269
ax_success.tick_params(labelsize=label_fontsize)
270+
ax_success.tick_params(axis='both', which='major', pad=tick_padding)
271+
261272
if not config["only_success_graph"]:
262273
ax_cost.tick_params(labelsize=label_fontsize)
263274

@@ -286,10 +297,16 @@ def plot_graph_from_databases(database_filepaths, config):
286297
data["info"]['min_cost'] = config['min_cost']
287298
if config['fontsize'] > 0:
288299
data["info"]['fontsize'] = config['fontsize']
300+
if config['linewidth'] > 0:
301+
data["info"]['linewidth'] = config['linewidth']
289302
if config['label_fontsize'] > 0:
290303
data["info"]['label_fontsize'] = config['label_fontsize']
291304
if config['verbosity'] > 0:
292305
data["info"]['verbosity'] = config['verbosity']
306+
if config['remove_ylabel']:
307+
data["info"]["remove_ylabel"] = True
308+
else:
309+
data["info"]["remove_ylabel"] = False
293310

294311
experiment_names = []
295312
experiment_times = []

0 commit comments

Comments
 (0)