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

Scrolling when text draw in Jupyter output #1403

Merged
merged 4 commits into from
Dec 4, 2018
Merged

Conversation

1ucian0
Copy link
Member

@1ucian0 1ucian0 commented Dec 3, 2018

This PR is an alternative solution to PR #1400.

When the circuit is draw in Jupyter, the output is wrapped in a <pre style="word-wrap: normal;white-space: pre;line-height: 15px;">, meaning that horizontal scrolling is allowed if needed. It looks like this:
2018-12-03 12 21 46

@nonhermitian
Copy link
Contributor

How about both this and #1400 with the option to select via wrap=True/False?

@1ucian0
Copy link
Member Author

1ucian0 commented Dec 3, 2018

I have no problem. I'm honestly fine with whatever you think is the best for the Jupyter users. Maybe this can be activated with scroll=True/False instead of wrap (it seems more descriptive about the result to me)?

@ajavadia
Copy link
Member

ajavadia commented Dec 3, 2018

The mpl also wraps around. It would be nice if that also had this option.

@1ucian0
Copy link
Member Author

1ucian0 commented Dec 3, 2018

Currently? I could not find any reference to wrap in qiskit/tools/visualization/_matplotlib.py...

@mtreinish
Copy link
Member

It's in there, it's called fold and it's a value in the style dict kwarg: https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/tools/visualization/_circuit_visualization.py#L163 It's a bit different though because it's a number of elements before folding/wrapping as opposed to the characters in the text output.

@mtreinish
Copy link
Member

Also, I agree with @nonhermitian I don't think this is an alternative to #1400 it feels complementary to setting a fixed default for jupyter.

@1ucian0
Copy link
Member Author

1ucian0 commented Dec 4, 2018

so.. fold is similar (opposite?) to line_length, right?

Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

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

I'm fine with this as is. It is opt-in now that #1400 merged if you want a horizontally scrolling text visualization in jupyter you have to set the line_length to a large number or -1. Otherwise we'll line wrap by default at 80chars in jupyter.

@1ucian0 1ucian0 merged commit 338f209 into Qiskit:master Dec 4, 2018
@1ucian0 1ucian0 deleted the scroll_pre branch December 7, 2018 21:40
lia-approves pushed a commit to edasgupta/qiskit-terra that referenced this pull request Jul 30, 2019
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.

4 participants