-
-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Labels
questionFurther information is requestedFurther information is requested
Description
The example for the new multiple plots code is as follows:
import matplotlib.pyplot as plt
from asreview import open_state
from asreviewcontrib.insights.plot import plot_recall
fig, ax = plt.subplots()
with open_state("tests/asreview_files/sim_van_de_schoot_2017_1.asreview") as s1:
with open_state("tests/asreview_files/"
"sim_van_de_schoot_2017_logistic.asreview") as s2:
plot_recall(ax,
[s1, s2],
legend_values=["Naive Bayes", "Logistic"],
legend_kwargs={'loc': 'lower center'})
fig.savefig("docs/example_multiple_lines.png")
However, how would one do this dynamically? open_state() method is returning a '_GeneratorContextManager' object, which implies that it is intended to be used as a context manager with the with statement. However, I can't dynamically open a cascading with statement, and I can't store the state for later using:
for state_file in states:
state = open_state(state_file)
state_objs.append(state)
plot_recall(ax, state_objs, **plot_kwargs)
Any advise for this implementation? I think I cannot manually manage the lifetime of the state objects and they must be used within a with block, and thus I am forced to call plot_recall separately.
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested