-
Notifications
You must be signed in to change notification settings - Fork 127
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
eggerdj
merged 18 commits into
qiskit-community:main
from
conradhaupt:vis_graphics_styles
Nov 22, 2022
Merged
Update plotter options and style paramters, and add visualization module to docs. #961
eggerdj
merged 18 commits into
qiskit-community:main
from
conradhaupt:vis_graphics_styles
Nov 22, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Previous commit failed GitHub CI tests because of a network error. This commit reruns those tests.
eggerdj
approved these changes
Nov 22, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
CurvePlotter
) to a plotter option (report_red_chi2_label
). This label was originally hardcoded, but is now an option with a default value.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 forCompositeCurveAnalysis
). Some users of Qiskit Experiments voiced their desire to remove the new-line to conserve space. ForCompositeCurveAnalysis
, the fit-report is not very readable without the extra new-line.symbol_size
anderrorbar_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 Matplotlibplot()
but notscatter()
.MplDrawer
handles this by squaringsymbol_size
when using it for Matplotlib'sscatter()
call. See this Stack Overflow discussion about how this size is computed in Matplotlib.MplDrawer
and the visualization module. This includes the follow changes to the default style (i.e., fromPlotStyle.default_style()
):legend_loc
: Fromcenter right
toNone
, 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
: From14
to12
, 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.