Skip to content

Cycler passed as string for rc #7219

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

Closed
JanisErdmanis opened this issue Oct 4, 2016 · 8 comments
Closed

Cycler passed as string for rc #7219

JanisErdmanis opened this issue Oct 4, 2016 · 8 comments
Labels
Difficulty: Medium https://matplotlib.org/devdocs/devel/contribute.html#good-first-issues status: inactive Marked by the “Stale” Github Action topic: rcparams

Comments

@JanisErdmanis
Copy link

JanisErdmanis commented Oct 4, 2016

Hello, I think I have found a bug with cycler when It is passed as a string for rc parameters. Here is example code I have

import pylab as plt

### WORKS
plt.rc("axes",prop_cycle=plt.cycler('linestyle', ['-', (0,(5,5))]) )
plt.plot([1,2])
plt.plot([1,4])
plt.show()

### ERROR

plt.rc("axes",prop_cycle="cycler('linestyle', ['-', (0,(5,5))])" )
plt.plot([1,2])
plt.plot([1,4])
plt.show()

When I run this code the first part works but the second part produces a long error - error.txt. I am using Ubuntu 16.04 and upgraded matplotlib to 1.5.3 with pip today.

@tacaswell tacaswell added this to the 2.0.1 (next bug fix release) milestone Oct 4, 2016
@tacaswell
Copy link
Member

I hope you encountered this by reading in a style file / putting this in matplotlibrc.

It looks like the validation/parsing on this is not good enough. This particular case is a bit tricky as the linestyle can be a list of strings so treating this as a list of strings seems reasonable.

@tacaswell tacaswell added the Difficulty: Medium https://matplotlib.org/devdocs/devel/contribute.html#good-first-issues label Oct 4, 2016
@WeatherGod
Copy link
Member

I wonder if the same problem would happen if the order of the linestyles
were reversed? Also, is this happening on master as well?

On Tue, Oct 4, 2016 at 7:26 PM, Thomas A Caswell notifications@github.com
wrote:

I hope you encountered this by reading in a style file / putting this in
matplotlibrc.

It looks like the validation/parsing on this is not good enough. This
particular case is a bit tricky as the linestyle can be a list of
strings so treating this as a list of strings seems reasonable.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#7219 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AARy-C-Y7lAz2EPP7Gcjnd_Bf8RFaKhGks5qwuCMgaJpZM4KOLNd
.

@anntzer
Copy link
Contributor

anntzer commented Oct 5, 2016

I'm going to take advantage of this issue to readvertise my suggestion of using a python source file for matplotlibrc (#7089 (comment))...

@WeatherGod
Copy link
Member

This doesn't have anything to do with rc files. This is passing arguments
to plt.rc().

On Wed, Oct 5, 2016 at 2:52 PM, Antony Lee notifications@github.com wrote:

I'm going to take advantage of this issue to readvertise my suggestion of
using a python source file for matplotlibrc (#7089 (comment)
#7089 (comment)
)...


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#7219 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AARy-FyIZj2AXJuTV8zG18c7Ba7qm8hbks5qw_H5gaJpZM4KOLNd
.

@WeatherGod
Copy link
Member

as a matter of fact, this is actually an argument against using python
source files for matplotlibrc's because we still need to support taking
string inputs into functions like plt.rc(), so we would need to keep our
parsing logic anyway, so there is very little gain.

On Wed, Oct 5, 2016 at 3:08 PM, Benjamin Root ben.v.root@gmail.com wrote:

This doesn't have anything to do with rc files. This is passing arguments
to plt.rc().

On Wed, Oct 5, 2016 at 2:52 PM, Antony Lee notifications@github.com
wrote:

I'm going to take advantage of this issue to readvertise my suggestion of
using a python source file for matplotlibrc (#7089 (comment)
#7089 (comment)
)...


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#7219 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AARy-FyIZj2AXJuTV8zG18c7Ba7qm8hbks5qw_H5gaJpZM4KOLNd
.

@anntzer
Copy link
Contributor

anntzer commented Oct 5, 2016

I thought that the whole reason for allowing string inputs in plt.rc was that the parsers are already there for handling matplotlibrc; if matplotlibrc is a python file then likewise plt.rc should likewise discard support for string inputs. Or, if we really want to keep support for this, we should just eval such inputs.

@QuLogic QuLogic modified the milestones: 2.0.1 (next bug fix release), 2.0.2 (next bug fix release) May 3, 2017
@tacaswell tacaswell modified the milestones: 2.1.1 (next bug fix release), 2.2 (next feature release) Oct 9, 2017
@github-actions
Copy link

This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

@github-actions github-actions bot added the status: inactive Marked by the “Stale” Github Action label Mar 31, 2023
@anntzer
Copy link
Contributor

anntzer commented Mar 31, 2023

This has actually been fixed as of master, afaict.

@anntzer anntzer closed this as completed Mar 31, 2023
@tacaswell tacaswell removed this from the future releases milestone Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty: Medium https://matplotlib.org/devdocs/devel/contribute.html#good-first-issues status: inactive Marked by the “Stale” Github Action topic: rcparams
Projects
None yet
Development

No branches or pull requests

5 participants