Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update plotter options and style paramters, and add visualization module to docs. #961

Merged
merged 18 commits into from
Nov 22, 2022

Conversation

conradhaupt
Copy link
Contributor

@conradhaupt conradhaupt commented Oct 28, 2022

Summary

This PR expands on/updates plotters to add options for controlling some features and updating style parameters to better handle more use-cases. A secondary addition of this PR, which was missing from #902, is to ensure the visualization module is added to the documentation.

Details and comments

This PR has made the following changes to plotters and their styles

  1. Move reduce-chi squared label (in CurvePlotter) to a plotter option (report_red_chi2_label). This label was originally hardcoded, but is now an option with a default value.
  2. Reformat the CurvePlotter fit-report text so that there is a new-line gap between analysis results and the reduced-chi squared values only if more than one reduced-chi squared value is encountered (as is the case for CompositeCurveAnalysis). Some users of Qiskit Experiments voiced their desire to remove the new-line to conserve space. For CompositeCurveAnalysis, the fit-report is not very readable without the extra new-line.
  3. Add symbol_size and errorbar_capsize parameters to the default style, to control the marker and error-bar end-cap sizes respectively.
    • symbol_size is proportional to the area of the markers, which is the case for Matplotlib plot() but not scatter(). MplDrawer handles this by squaring symbol_size when using it for Matplotlib's scatter() call. See this Stack Overflow discussion about how this size is computed in Matplotlib.
  4. Updated the default style parameters to better reflect general use-cases of MplDrawer and the visualization module. This includes the follow changes to the default style (i.e., from PlotStyle.default_style()):
    • legend_loc: From center right to None, to use automatic legend placement by default.
    • textbox_rel_pos: From (0.6, 0.95) to (0.5, -0.25), to place the textbox below the axis and not overlap with axis graphics.
    • textbox_text_size: From 14 to 12, to minimize the space requirements of the textbox.

One additional change is the addition of visualization.rst to generate and include the module's documentation in the CI-generated documentation files.

Replace default legend_loc with None, to use automatic placement.
Add errorbar_capsize for controlling size of error-bar end caps.
Add symbol_size for controlling size of points/markers. This is
  proportional to the area of the points/markers, which is important
  when using Matplotlib scatter() and plot().
The new default textbox position is below the axis, horizontally
centred. The font-size has been reduced to 11, from 14, to generate
a more compact figure.
For some figures, -0.25 (previous) was too large. A value of -0.1
appears to be better.
@conradhaupt conradhaupt marked this pull request as draft November 3, 2022 11:02
Previous commit failed GitHub CI tests because of a network error.
This commit reruns those tests.
@conradhaupt conradhaupt marked this pull request as ready for review November 7, 2022 14:22
@coruscating coruscating added this to the Release 0.5 milestone Nov 16, 2022
Copy link
Contributor

@eggerdj eggerdj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@eggerdj eggerdj merged commit 1d8ab20 into qiskit-community:main Nov 22, 2022
@conradhaupt conradhaupt deleted the vis_graphics_styles branch November 22, 2022 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants