asreview / asreview-insights

Tools such as plots and metrics to analyze (simulated) reviews for ASReview LAB
https://www.asreview.ai
Apache License 2.0
28 stars 13 forks source link

Release v0.4.1 breaks legendas #25

Closed jteijema closed 2 years ago

jteijema commented 2 years ago

Using the following code with the API from version 0.4 gives no errors when creating a plot with a legenda:

with Plot.from_paths(files[:1]) as plot:
  inc_plot = plot.new("inclusion", result_format="number")
  inc_plot.set_grid()
  inc_plot.set_xlim(0, 4000)
  inc_plot.set_legend()
  inc_plot.add_random(add_text=False)

  all_files = all(plot.is_file.values())
  for key in list(plot.analyses):
      if all_files or not plot.is_file[key]:
          inc_plot.add_wss(
              key, 95, add_value=False, add_text=False)

  inc_plot.fig.set_size_inches(10, 5, forward=True)

  inc_plot.show()
  inc_plot.save("simulation_results.png")

image

Whereas running the same code with version 0.4.1: image

The error message isn't very informative.

..\Python\Python39\lib\site-packages\asreviewcontrib\visualization\plot_base.py:32: UserWarning: Legend does not support [<matplotlib.lines.Line2D object at 0x000001F563215400>] instances.
A proxy artist may be used instead.
See: https://matplotlib.org/users/legend_guide.html#creating-artists-specifically-for-adding-to-the-legend-aka-proxy-artists
  self.ax.legend(self.legend_plt, self.legend_name, loc=loc)
J535D165 commented 2 years ago

No idea what causes this: https://github.com/asreview/asreview-visualization/compare/v0.4...v0.4.1.

jteijema commented 2 years ago

Judging the difference it can only have been #20.

Rensvandeschoot commented 2 years ago

Solved in https://github.com/asreview/asreview-insights/pull/24