You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Coordinate text wrapping in navigation toolbar #10375
The navigation toolbar at the bottom of a figure window contains a message box for displaying x and y coordinates. With the MacOSX backend, the available space appears to be fixed size and long text wraps and becomes unreadable even though the window width might be able to accommodate more text without wrapping.
Code for reproduction
frommatplotlibimportpyplotaspltfrommathimportpi, sinN=30x= [n/Nforninrange(5*N)]
y= [sin(i*pi) foriinx]
ax=plt.figure().add_subplot(1, 1, 1)
ax.format_coord=lambdax, y : 'the x-coordinate = '+format(x, '1.4f') +', '+ \
' and the y-coordinate = '+format(y, '1.4f')
plt.plot(x, y)
plt.show()
Actual outcome
Expected outcome
I don't know if the behavior was different in earlier versions. I do know that the behavior is more "sensible" in the TkAgg backend. I haven't tested other backends. In TkAgg the available space expands as the window width expands.
I suspect that this issue is (very understandably) viewed as a minor nuisance issue, and is therefore not likely to be addressed for a long time. I do not have the knowledge to propose an appropriate patch (rectangle width based on window width), but I do have a simple suggestion that would resolve the issue. I suggest changing the fixed rectangle width from 300 to 2500.
rect.size.width = 2500; (See matplotlib/src/_macosx.m: line 1714, branch: master)
In my limited testing, a width of 2500 is adequate for a window that spans the width of a 27" monitor. Better informed people may see problems with this approach that I don't, but I have tested it and am very satisfied with the results. It is an admittedly inelegant solution, but no more inelegant than the current fixed width of 300, and it improves functionality.
I would appreciate any feedback on this suggestion.
Did you rebuild matplotlib? Be sure to follow the instructions for installing from source for your platform. I'll note that, after my initial build, I needed to add the --upgrade option to get pip to rebuild and install matplotlib. See https://matplotlib.org/users/installing.html#installing-from-source
Activity
jtleighton commentedon Mar 4, 2018
I suspect that this issue is (very understandably) viewed as a minor nuisance issue, and is therefore not likely to be addressed for a long time. I do not have the knowledge to propose an appropriate patch (rectangle width based on window width), but I do have a simple suggestion that would resolve the issue. I suggest changing the fixed rectangle width from 300 to 2500.
rect.size.width = 2500;(See matplotlib/src/_macosx.m: line 1714, branch: master)In my limited testing, a width of 2500 is adequate for a window that spans the width of a 27" monitor. Better informed people may see problems with this approach that I don't, but I have tested it and am very satisfied with the results. It is an admittedly inelegant solution, but no more inelegant than the current fixed width of 300, and it improves functionality.
I would appreciate any feedback on this suggestion.
Vickershhh commentedon Mar 11, 2018
Hey, how did you change the number of width in _macosx file? I changed it to 1000 and run my code again. But nothing change.... @jtleighton
jtleighton commentedon Mar 11, 2018
Did you rebuild matplotlib? Be sure to follow the instructions for installing from source for your platform. I'll note that, after my initial build, I needed to add the --upgrade option to get pip to rebuild and install matplotlib. See https://matplotlib.org/users/installing.html#installing-from-source
timhoffm commentedon Jul 16, 2020
Is this still an issue on OSX?
jklymak commentedon Jul 16, 2020
Closed by #16710