documentation icon indicating copy to clipboard operation
documentation copied to clipboard

Conditioning colour definition

Open Szyli opened this issue 2 months ago • 2 comments

I have found that under the if statements subsection, at the end of the third example, the explained function of the circle's colour is not fully consistent.

A black circle indicates conditioning on 1, while a white circle indicates conditioning on 0.

This statement is correct if we use the bright theme of the draw function. For example:

circuit.draw(output="mpl", style='iqp')
Image

But if we were to use the dark one, due to the colours switching, the circle's are opposite to the above (and what the quote describes).

circuit.draw(output="mpl", style='iqp-dark')
Image

Note, the functionality of the code remains the same and it is only the figure that is being affected.

Select all that apply

  • [x] new content request
  • [ ] typo
  • [x] code bug
  • [ ] out-of-date content
  • [ ] broken link
  • [x] other

Describe the fix or the content request.

My proposal is to either include this detail in the guide or to fix the code such that it follows the above description for the colours.

For new content requests - if the request is accepted, do you want to write the content?

I only want to review the material when it's finished

Szyli avatar Oct 08 '25 16:10 Szyli

Thanks for flagging this!

abbycross avatar Oct 09 '25 14:10 abbycross

Happy to! I think the problem is rooting from the circuit visualization with matplotlib for conditions. In this function the following line generates the coloured circles in question.

fc = self._style["lc"] if override_fc or val_bit == "1" else self._style["bg"]

I also just noticed that the gate label within the condition also switches colour.

Szyli avatar Oct 09 '25 15:10 Szyli