-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New subplottool and various fixes #2112
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
Conversation
I think a critical functionality of the subplot tool must be to show the numeric values. This allows one to use the tool to find good values, and then use those values in a script. I don't know when this functionality was lost on the qt backend, but I hope you will restore it. This should be facilitated by the layout in your PR, which is closer to the original and generic mpl subplot tool--which is functionally quite good. |
Here it is. the button also update the the labels. |
Thank you--looks good! I haven't tested it or looked closely at the code. What did you use to generate the .ui file? The Travis failure looks completely unrelated. |
I used the command pyuic4 comes with PyQt4. (or pyqt4-dev-tools on debian based systems) . |
Right, that generates the .py file from the .ui file. Presumably you used Qt Designer to generate the .ui file. Does the PyQt4 tool write code that is immediately usable with pyside? We need to keep everything working with both pyqt4 and pyside. |
As you see in my last commit I removed the ui file. There's just the formsubplottool.py, no compilation at all. It seemed to me simpler this way, since there is no framework to handle ui files. Although it would be nice to have, since handwriting of forms in general is inexpedient. I tested it with pyqt4 and pyside. |
|
||
def funcleft(self, val): | ||
if val == self.sliderright.value(): | ||
val -= 1 | ||
self.targetfig.subplots_adjust(left=val/1000.) | ||
val /= 1000 |
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.
Be careful about integer division here.
Should the qt4agg fixes and the subplottool improvements be separated into two independent PRs s.t. reviewing them is easier ? |
win.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) | ||
|
||
win.show() | ||
image = os.path.join( matplotlib.rcParams['datapath'], |
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.
Despite this module not being pep8 compliant, let's try to have the new code as pep8 as possible.
There should be no spaces after and before (
and )
.
I meant "integer division" |
@rhoef Can you re-base this branch? |
Conflicts: lib/matplotlib/backends/backend_qt4.py lib/matplotlib/backends/qt4_editor/formsubplottool.py
Conflicts: lib/matplotlib/backends/backend_qt4.py
edit: |
item, ok = QtGui.QInputDialog.getItem(self, 'Customize', | ||
'Select axes:', titles, | ||
0, False) | ||
text = "_axes%d" % i |
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.
@rhoef why do you use a leading underscore here ?
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.
The figureeditor uses this kind of notation for lines, graphs with no label. I took it over from there.
What still needs to be done in order to get this PR merged ? |
Haven't looked over the PR, but you will definitely need to add an entry to the "whats_new.rst" file in the documentation. |
I tried to separate the subplottool specific changes from the figureoptions stuff. The subplottools code is now in #2594, the figureoptions PR still needs to be done. @rhoef can you create the figureoptions PR ? Here is the diff between this PR and #2594.
|
This PR changes the new-style signal/slot calls back to the old-style, which suffer from a bug in PySides (see #2382). 👎 on merging this until the signals/slots are fixed. |
This pull request summarises three commits:
subplottool customized
-) new subplottool, sliders are all vertially arranged, buttons for tight layout and reset (new files: a ui file to compile formsubplottool.py using pyrcc)
-) fix: subplottool is now modal dialog, was previously a QMainWindow, leaving the SPT open if one closed the plotwindow
function col2hex could not handle different color representations of mpl. Further the hexcodes in the dict COLORS did not correspond to the hexcodes for the default colors (quick workaround since default colors are defined somewhere else.)
I also change the labeling of untitled axes figureoptions dialog.
Use the subplots_demo.py (at4 backend) to overview the changes.