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
I works on Windows 8.1 64bit. I use Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)] on win32 in environmet, created with conda.
Matplotlib version is 1.5.3
When I see files created with matplotlib I see that arrows on axis ends are normal in svg and pdf files but too small in png file.
I also noticed that these arrows are small when use show() too.
I tried this in jupyter notebook, that I installed via pip in virtual environment created with conda.
I think it is the same bug as in issue #6035 (the size of the arrow head depends on the DPI value) , so it should be fixed for mpl 2 (PR #6504), but I am not sure the fix was backported to the 1.5 branch.
If you have access to the latest beta version of mpl (2.0.4), you might want to give it a try.
@AndreWin Did you have the opportunity to check with the new RC1 of matplotlib 2.0? It seems to me that the problem of the DPI-dependent arrow head size is not present anymore.
However, during my own tests with RC1, the tick direction was not outward (but there is an easy fix for that) and the grid behavior was weird:
Here is a possible workaround:
# -*- coding: utf-8 -*-importmatplotlib.pyplotaspltfrommpl_toolkits.axes_grid.axislinesimportSubplotZerofig=plt.figure()
ax=SubplotZero(fig, 111)
_=fig.add_subplot(ax)
fordirectionin ["xzero", "yzero"]:
ax.axis[direction].set_visible(True)
ax.axis[direction].set_axisline_style("->")
# Set outward ticksax.axis[direction].major_ticks.set_tick_out(True)
ax.axis[direction].minor_ticks.set_tick_out(True)
fordirectionin ["top", "bottom", "left", "right"]:
ax.axis[direction].set_visible(False)
ax.axis["yzero"].set_axis_direction("left")
plt.plot([0,1], [0,1], c="blue", lw=2)
_=plt.title(u"График")
_=plt.xlabel(u"Ось x")
_=plt.ylabel(u"Ось y")
ax.minorticks_on()
# Workaround: as ax.grid(True) seems to be buggy, manually create a custom grid# 1- Set the desired lower bound for each axis (here 0.0)xlims= [0.0, ax.get_xlim()[1]]
ylims= [0.0, ax.get_ylim()[1]]
# 2- For each axis, get the (major) relevant tick locations# and draw a collection of linesgrid_style=dict(color='Black', lw=0.5, linestyles=':') # 1.5.3-like stylexticks= [valforvalinax.xaxis.get_ticklocs() ifxlims[0] <val<=xlims[1]]
ax.vlines(xticks, ymin=ylims[0], ymax=ylims[1], **grid_style)
yticks= [valforvalinax.yaxis.get_ticklocs() ifylims[0] <val<=ylims[1]]
ax.hlines(yticks, xmin=xlims[0], xmax=xlims[1], **grid_style)
forextin ['png', 'svg', 'pdf']:
plt.savefig("workaround_test_chart."+ext, dpi=300)
plt.show()
Hello, @afvincent. Sorry that didn't answer for a long time. I didn't find how to install beta version of maptlotlib in my environment created with conda.
Thank you very much for workarrond! :)
Best regards, Andrey.
I can reproduce the xlabel/ylabel issue, I suspect there is a bug in from mpl_toolkits.axes_grid.axislines import SubplotZero but I have not tracked it down. I can not reproduce this xlabel/ylabel issue with fig, ax = plt.subplots() source Axes objects.
As a side note, the default font supports Cyrillic out of the box in 2.0.
Activity
AndreWin commentedon Nov 20, 2016
I also noticed that these arrows are small when use
show()too.I tried this in jupyter notebook, that I installed via
pipin virtual environment created with conda.afvincent commentedon Nov 20, 2016
I think it is the same bug as in issue #6035 (the size of the arrow head depends on the DPI value) , so it should be fixed for mpl 2 (PR #6504), but I am not sure the fix was backported to the 1.5 branch.
If you have access to the latest beta version of mpl (2.0.4), you might want to give it a try.
AndreWin commentedon Nov 20, 2016
@afvincent, I will try beta soon and will give answer. Thanks.
afvincent commentedon Dec 9, 2016
@AndreWin Did you have the opportunity to check with the new RC1 of matplotlib 2.0? It seems to me that the problem of the DPI-dependent arrow head size is not present anymore.
However, during my own tests with RC1, the tick direction was not outward (but there is an easy fix for that) and the grid behavior was weird:

Here is a possible workaround:
AndreWin commentedon Dec 11, 2016
Hello, @afvincent. Sorry that didn't answer for a long time. I didn't find how to install beta version of maptlotlib in my environment created with conda.
Thank you very much for workarrond! :)
Best regards, Andrey.
tacaswell commentedon Dec 11, 2016
@AndreWin http://matplotlib.org/style_changes.html (link in the banner on the top of all matplotlib.org pages now).
AndreWin commentedon Dec 11, 2016
@tacaswell, many thanks :)
I'll try it now.
AndreWin commentedon Dec 11, 2016
End of arrows works now (version 2.0.0rc1). But I try to understand, why in my code
but I see "Ось x" on vertical axis... O_o
Full code is in my first message here.
Best regards, Andrey.
tacaswell commentedon Dec 11, 2016
I can reproduce the xlabel/ylabel issue, I suspect there is a bug in from mpl_toolkits.axes_grid.axislines import SubplotZero but I have not tracked it down. I can not reproduce this xlabel/ylabel issue with
fig, ax = plt.subplots()sourceAxesobjects.As a side note, the default font supports Cyrillic out of the box in 2.0.
QuLogic commentedon Dec 12, 2016
I'm not sure if this is expected when using
SubplotZero, but you can use:to get the correct labels.
AndreWin commentedon Dec 12, 2016
@tacaswell, when I replaced
to
I got error
TypeError: 'method' object is not subscriptableon lineFull code:
Really? Cool!!!! ^_^
AndreWin commentedon Dec 12, 2016
@QuLogic, your workaround works nice! Many thanks! :)
tacaswell commentedon Dec 12, 2016
Closing as fixed in 2.0, but created a new issue to track the
SubplotZeroaxis not being labeled correctly.See http://matplotlib.org/2.0.0rc1/users/dflt_style_changes.html#normal-text re the font.