Patch: more Pythonic rc handling

The standard RC parameters handling in Matplotlib has always troubled me. The
syntax rc('figure.subplot', top=0.9) is not very conveniet if one wants to
change a singe property. Direct rcParams['figure.subplot.top'] seems better
suited in this case.

However, as the dots are already used to indicate grouping in RC, it seems
very natural to use the syntax like:

rc.figure.subplot.top = 0.9

In my opinion this is very elegant, efficient and much Pythonic approach.

In the attachment I include a path to the current git main repo, which enables
this way of handling RC properties. I would appreciate very much if they were
reviewed and included in the next release of Matplotlib (the patch is not
particularly large).

Best regrds,
Maciek

0001-Added-extended-rc-handling-enabling-elegant-Pythonic.patch (4.75 KB)

···

--
Maciek Dems http://dems.art.pl/

Hi everyone,

We're part of the summer 2012 batch at Hackerschool (www.hackerschool.com) and we chose to spend this week contributing to matplotlib. We already submitted a handful of pull requests for bugs but we are looking for more to do.

Are there any open issues or features you would like us to work on?

- Amy, Vera, Beverly and Alan

Awesome!

Here is a quick list of all github issues tagged with “wishlist”:

https://github.com/matplotlib/matplotlib/issues?labels=wishlist&page=1&state=open

Thanks!
Ben Root

···

On Tue, Jul 10, 2012 at 4:15 PM, Amy Dyer <oxling@…149…> wrote:

Hi everyone,

We’re part of the summer 2012 batch at Hackerschool (www.hackerschool.com) and we chose to spend this week contributing to matplotlib. We already submitted a handful of pull requests for bugs but we are looking for more to do.

Are there any open issues or features you would like us to work on?

  • Amy, Vera, Beverly and Alan

I probably should at some point submit this as a wishlist item, but I thought I'd mention it here:

The other day, I was looking to make a ylabel with text of two different colors (I wanted to use the ylabel in a twinx rather than a legend to show that two of three plots on an axis used a particular scale). See also:

Unfortunately, I don't believe this solution is going to work in a xlabel or ylabel without finding the location of the ylabel and putting these concatenated text objects there.

It would be nice to have the label and title methods take a Text object (and a list of text objects -- each of whom could supply a piece of different colored text) in addition to a string.

A list of text objects would be automagically concatenated together. How to generalize alignment of multiple text objects? Haven't thought that far yet.

Either that or develop some additional color markup (and a parser) inside a string. Admittedly a bigger project -- though probably a better solution.

M

···

On 7/10/12 4:18 PM, Benjamin Root wrote:

On Tue, Jul 10, 2012 at 4:15 PM, Amy Dyer <oxling@...149... > <mailto:oxling@…149…>> wrote:

    Hi everyone,

    We're part of the summer 2012 batch at Hackerschool
    (www.hackerschool.com <http://www.hackerschool.com>) and we chose to
    spend this week contributing to matplotlib. We already submitted a
    handful of pull requests for bugs but we are looking for more to do.

    Are there any open issues or features you would like us to work on?

    - Amy, Vera, Beverly and Alan

Awesome!

Here is a quick list of all github issues tagged with "wishlist":

Issues · matplotlib/matplotlib · GitHub
<Issues · matplotlib/matplotlib · GitHub;

That is already a wishlist item. Feel free to comment on its discussion thread with your ideas.

Ben Root

···

On Tuesday, July 10, 2012, Mike Kaufman wrote:

On 7/10/12 4:18 PM, Benjamin Root wrote:

On Tue, Jul 10, 2012 at 4:15 PM, Amy Dyer <oxling@…55…149… > > > mailto:oxling@...149...> wrote:

Hi everyone,
We're part of the summer 2012 batch at Hackerschool
([www.hackerschool.com](http://www.hackerschool.com) <[http://www.hackerschool.com](http://www.hackerschool.com)>) and we chose to
spend this week contributing to matplotlib. We already submitted a
handful of pull requests for bugs but we are looking for more to do.
Are there any open issues or features you would like us to work on?
- Amy, Vera, Beverly and Alan

Awesome!

Here is a quick list of all github issues tagged with “wishlist”:

https://github.com/matplotlib/matplotlib/issues?labels=wishlist&page=1&state=open

<https://github.com/matplotlib/matplotlib/issues?labels=wishlist&page=1&state=open>

I probably should at some point submit this as a wishlist item, but I

thought I’d mention it here:

The other day, I was looking to make a ylabel with text of two different

colors (I wanted to use the ylabel in a twinx rather than a legend to

show that two of three plots on an axis used a particular scale). See also:

http://stackoverflow.com/questions/9169052/partial-coloring-of-text-in-matplotlib

Unfortunately, I don’t believe this solution is going to work in a

xlabel or ylabel without finding the location of the ylabel and putting

these concatenated text objects there.

It would be nice to have the label and title methods take a Text object

(and a list of text objects – each of whom could supply a piece of

different colored text) in addition to a string.

A list of text objects would be automagically concatenated together. How

to generalize alignment of multiple text objects? Haven’t thought that

far yet.

Either that or develop some additional color markup (and a parser)

inside a string. Admittedly a bigger project – though probably a better

solution.

M

Dnia wtorek, 10 lipca 2012 21:32:40 Maciek Dems pisze:

In the attachment I include a path to the current git main repo, which
enables this way of handling RC properties. I would appreciate very much if
they were reviewed and included in the next release of Matplotlib (the
patch is not particularly large).

I have posted the path to the github fork, as described in developer manual of
matplotlib. The most recent changes are here:

http://github.com/macdems/matplotlib/compare/master...better-rc

Best regards,
Maciek

···

--
Maciek Dems http://dems.art.pl/en/

For reference, I believe Ben's referring to #697 [1], for which I provided a
possible implementation, which has the automagic concatenation you seek.

1. https://github.com/matplotlib/matplotlib/issues/697

best,

···

On Tue, Jul 10, 2012 at 8:06 PM, Benjamin Root <ben.root@...553...> wrote:

On Tuesday, July 10, 2012, Mike Kaufman wrote:

It would be nice to have the label and title methods take a Text object
(and a list of text objects -- each of whom could supply a piece of
different colored text) in addition to a string.

A list of text objects would be automagically concatenated together. How
to generalize alignment of multiple text objects? Haven't thought that
far yet.

Either that or develop some additional color markup (and a parser)
inside a string. Admittedly a bigger project -- though probably a better
solution.

M

That is already a wishlist item. Feel free to comment on its discussion
thread with your ideas.

--
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7