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

Figure linewidth default in rcparams #6083

Closed
NGJROMO opened this issue Mar 1, 2016 · 15 comments
Closed

Figure linewidth default in rcparams #6083

NGJROMO opened this issue Mar 1, 2016 · 15 comments

Comments

@NGJROMO
Copy link

NGJROMO commented Mar 1, 2016

Hello,

I am using:
Matplotlib 1.5.1
Python 3.5
Windows 7 Professional 64-bit (6.1, Build 7601)

And I installed Python and Matplotlib newly through Anaconda.

I used to set my default plot settings with the following code:

import matplotlib as mpl
mpl.rcParams['savefig.bbox']='standard'
mpl.rcParams['axes.linewidth']=1
mpl.rcParams['axes.grid']=True
mpl.rcParams['grid.linestyle']='-'
mpl.rcParams['grid.linewidth']=1
mpl.rcParams["savefig.facecolor"]='white'
mpl.rcParams['savefig.edgecolor']='black'
mpl.rcParams['figure.edgecolor']='black'    
mpl.rcParams["figure.facecolor"]='white'
mpl.rcParams["axes.facecolor"]='white'
mpl.rcParams['axes.edgecolor']='black'

Which gave me a plot with a black grid, a white background and a black line around the plot. I initialized my figures with plt.figure():

norm2

After updating to Matplotlib 1.5.1 I run the same code, but the black box around the figure is gone:

norm1

I can manually fix the issue by initializing my figures with plt.figure(linewidth=1) (Which is how I produced above plots), but I would like to set the default figure linewidth in rcparams. To my knowledge this is currently not possible. e.g. an entry such as:

mpl.rcParams["figure.linewidth"]

would be perfect. It would be much appreciated if I could get some support on this topic.

I don't remember the exact version of Python and Matplotlib in which this used to work, is there a way to check my update history in Anaconda?

Kind regards,

Nick

@tacaswell tacaswell added this to the 1.5.2 (Critical bug fix release) milestone Mar 1, 2016
@tacaswell
Copy link
Member

Is the varying thickness of the box around the figure also a feature or a bug?

@NGJROMO
Copy link
Author

NGJROMO commented Mar 2, 2016

That looks like it can be solved by using:

plt.figure(linewidth=1.5)

instead of

plt.figure(linewidth=1)

To initialize the figure:

norm2

@tacaswell tacaswell modified the milestones: 2.1 (next point release), 1.5.2 (Critical bug fix release) May 16, 2016
@tacaswell tacaswell added the MEP: MEP25 serialization label May 16, 2016
@tacaswell
Copy link
Member

What was the last version of mpl that those rcparams worked with?

Hopefully this level of customization will be enabled by traitlets.

@NGJROMO
Copy link
Author

NGJROMO commented May 17, 2016

Let's see...

I initially downloaded matplotlib in august 2015 through the default anaconda installer and updated to 1.5.1 just before posting this issue (March 1st 2016).

I don't have a version timeline available but I suppose the version i downloaded in august 2015 would be 1.4.x ? Please verify

Kind regards,

Nick

@WeatherGod
Copy link
Member

Yes, most likely, it would have been version 1.4.2 if it was August 2015.

On Tue, May 17, 2016 at 2:24 AM, NGJROMO notifications@github.com wrote:

Let's see...

I initially downloaded matplotlib in august 2015 through the default
anaconda installer and updated to 1.5.1 just before posting this issue
(March 1st 2016).

I don't have a version timeline available but I suppose the version i
downloaded in august 2015 would be 1.4.x ? Please verify

Kind regards,

Nick


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#6083 (comment)

@tacaswell
Copy link
Member

Can you try down-grading mpl via anaconda (conda install matplotlib=1.4.2 etc) until you get the old behavior? This will greatly help us understand what caused this change and hence how to fix it.

@NGJROMO
Copy link
Author

NGJROMO commented May 30, 2016

Hi,

I can confirm that downgrading to 1.4.3 does not resolve my problem. Attempting a downgrade to 1.4.2 gives me the following:

The following specifications were found to be in conflict:
  - conda -> conda-env
  - conda -> menuinst
  - conda -> pycosat
  - conda -> python 2.7*|3.3*|3.4*
  - conda -> pyyaml
  - conda -> requests
  - conda-env (target=conda-env-2.4.5-py35_0.tar.bz2) -> python 2.7*|3.3*|3.4*|3.5*
  - cycler (target=cycler-0.10.0-py35_0.tar.bz2) -> python 2.7*|3.4*|3.5*
  - cycler (target=cycler-0.10.0-py35_0.tar.bz2) -> six
  - matplotlib 1.4.2* -> numpy 1.9*
  - matplotlib 1.4.2* -> pyparsing 2.0.1
  - matplotlib 1.4.2* -> pyqt
  - matplotlib 1.4.2* -> python 2.6*|2.7*|3.3*|3.4*
  - matplotlib 1.4.2* -> pytz
  - menuinst (target=menuinst-1.3.2-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
  - mkl-service (target=mkl-service-1.1.2-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
  - nose (target=nose-1.3.7-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
  - numexpr (target=numexpr-2.5-np110py35_0.tar.bz2) -> numpy 1.10*|1.11*|1.6*|1.7*|1.8*|1.9*
  - numexpr (target=numexpr-2.5-np110py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
  - numpy (target=numpy-1.10.4-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*
  - pip (target=pip-8.1.1-py35_1.tar.bz2) -> python 2.7*|3.3*|3.4*
  - pycosat (target=pycosat-0.6.1-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
  - pyparsing (target=pyparsing-2.0.3-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*
  - pyqt (target=pyqt-4.11.4-py35_5.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*
  - pyqt (target=pyqt-4.11.4-py35_5.tar.bz2) -> qt >=4.8.6|>=4.8.7
  - pyqt (target=pyqt-4.11.4-py35_5.tar.bz2) -> sip >=4.16.4
  - python 3.5*
  - python-dateutil (target=python-dateutil-2.5.1-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
  - python-dateutil (target=python-dateutil-2.5.1-py35_0.tar.bz2) -> six
  - pytz (target=pytz-2016.2-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
  - pyyaml (target=pyyaml-3.11-py35_3.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*
  - qt (target=qt-4.8.7-vc14_7.tar.bz2) -> @vc10
  - qt (target=qt-4.8.7-vc14_7.tar.bz2) -> @vc14
  - qt (target=qt-4.8.7-vc14_7.tar.bz2) -> @vc9
  - requests (target=requests-2.9.1-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
  - scikit-learn (target=scikit-learn-0.17.1-np110py35_0.tar.bz2) -> numpy 1.10*|1.11*|1.6*|1.7*|1.8*
  - scikit-learn (target=scikit-learn-0.17.1-np110py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
  - scipy (target=scipy-0.17.0-np110py35_0.tar.bz2) -> numpy 1.10*|1.11*|1.6*|1.7*|1.8*|1.9*
  - scipy (target=scipy-0.17.0-np110py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
  - setuptools (target=setuptools-19.2-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
  - sip (target=sip-4.16.9-py35_2.tar.bz2) -> python 2.7*|3.4*|3.5*
  - six (target=six-1.10.0-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
  - tk (target=tk-8.5.18-vc14_0.tar.bz2) -> @vc10
  - tk (target=tk-8.5.18-vc14_0.tar.bz2) -> @vc14
  - tk (target=tk-8.5.18-vc14_0.tar.bz2) -> @vc9
  - wheel (target=wheel-0.29.0-py35_0.tar.bz2) -> python 2.7*|3.3*|3.4*|3.5*
Use "conda info <package>" to see the dependencies for each package.

I've also changed my rcparams code since I first made it, so I am not sure if I will be able to reproduce the problem with a 100% accuracy

@tacaswell
Copy link
Member

The easiest thing to do is just create a new enviroment with conda create -n testing matplotlib=1.4.2 instead of trying to down-grade inplace. Sorry gave bad advice before.

@NGJROMO
Copy link
Author

NGJROMO commented May 31, 2016

Hi,

I can confirm that creating this testing environment and running my code again does not give me black lines around my plots.

@tacaswell
Copy link
Member

Can you find a version of mpl where your code did work as expected?

@NGJROMO
Copy link
Author

NGJROMO commented May 31, 2016

I cannot, so I assume it's not matplotlib that causes the problem?

It is now two months ago since I posted this issue, and in the meantime I've upgraded from windows 8 to 10 and reinstalled anaconda again so I assume a lot of things have changed along with that.

@tacaswell
Copy link
Member

Without an example of when it worked it is hard for us to do much else to help. It seems you have found a suitable workaround so closing this due to not enough information.

If you can reproduce the old behavior please ping to have this re-opened!

@NGJROMO
Copy link
Author

NGJROMO commented Jun 1, 2016

Right, so could you please show me how to set my rcParams to produce a frame around my plots by default?

@tacaswell
Copy link
Member

I suggest sending an email to the matplotlib-user@python.org mailing list (you will need to subscribe to post un-moderated). We try to keep the issue tracking for bugs / feature requests and use the mailing list for this sort of user support.

@QuLogic QuLogic modified the milestones: unassigned, 2.1 (next point release) Jun 1, 2016
@NGJROMO
Copy link
Author

NGJROMO commented Jun 2, 2016

I'm not sure where to subscribe in order to mail to this address,

regardless I still think my request would classify as a feature request. As far as all I am asking is for a

mpl.rcParams["figure.linewidth"] (or similar)

entry to be added to the rcparams

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants