diff --git a/asreviewcontrib/makita/templates/doc_README.md.template b/asreviewcontrib/makita/templates/doc_README.md.template index afdb93e..cd74724 100644 --- a/asreviewcontrib/makita/templates/doc_README.md.template +++ b/asreviewcontrib/makita/templates/doc_README.md.template @@ -11,7 +11,7 @@ The template is described as: '{{ template_name_long }}'. This project depends on Python 3.7 or later (python.org/download), and [ASReview](https://asreview.nl/download/). Install the following dependencies to run the simulation and analysis in this project. ```sh -pip install asreview>=1.0 asreview-insights>=1.1.2 asreview-datatools +pip install asreview>=1.0 asreview-insights>=1.3 asreview-datatools ``` {% if not skip_wordclouds %} For generating wordclouds, install the following dependencies. diff --git a/asreviewcontrib/makita/templates/script_get_plot.py.template b/asreviewcontrib/makita/templates/script_get_plot.py.template index 004ab44..fc2a7c4 100644 --- a/asreviewcontrib/makita/templates/script_get_plot.py.template +++ b/asreviewcontrib/makita/templates/script_get_plot.py.template @@ -26,7 +26,8 @@ from asreview import open_state from asreviewcontrib.insights.plot import plot_recall -def _set_legend(ax, state, legend_option, label_to_line, state_file, hide_random): +def _set_legend(ax, state, legend_option, label_to_line, state_file, hide_random, + hide_optimal): metadata = state.settings_metadata label = None @@ -50,7 +51,8 @@ def _set_legend(ax, state, legend_option, label_to_line, state_file, hide_random raise ValueError(f"Invalid legend setting: '{legend_option}'") from err # noqa: E501 if label: - line_index = -2 if not hide_random else -1 + # plot_recall: series is plotted first, then random and optimal, so adjust index + line_index = -3 + hide_random + hide_optimal # add label to line if label not in label_to_line: ax.lines[line_index].set_label(label) @@ -60,7 +62,8 @@ def _set_legend(ax, state, legend_option, label_to_line, state_file, hide_random ax.lines[line_index].set_color(label_to_line[label].get_color()) ax.lines[line_index].set_label("_no_legend_") -def get_plot_from_states(states, filename, legend=None, hide_random=False): +def get_plot_from_states(states, filename, legend=None, hide_random=False, + hide_optimal=False): """Generate an ASReview plot from state files. Arguments @@ -80,9 +83,11 @@ def get_plot_from_states(states, filename, legend=None, hide_random=False): for state_file in states: with open_state(state_file) as state: - plot_recall(ax, state, show_random = not hide_random) + plot_recall(ax, state, show_random = not hide_random, + show_optimal = not hide_optimal) if legend: - _set_legend(ax, state, legend, label_to_line, state_file, hide_random) + _set_legend(ax, state, legend, label_to_line, state_file, + hide_random, hide_optimal) if legend: ax.legend(loc=4, prop={"size": 8}) @@ -106,6 +111,11 @@ if __name__ == "__main__": action="store_true", help="Hide the random line.", ) + parser.add_argument( + "--hide_optimal", + action="store_true", + help="Hide the optimal line.", + ) args = parser.parse_args() # load states @@ -116,4 +126,5 @@ if __name__ == "__main__": raise FileNotFoundError(f"No state files found in {args.s}") # generate plot and save results - get_plot_from_states(states, args.o, args.show_legend, args.hide_random) + get_plot_from_states(states, args.o, args.show_legend, args.hide_random, + args.hide_optimal)