From 995f8cfacda6585059bade68dc1fd49e0d72f886 Mon Sep 17 00:00:00 2001 From: "Nicolas P. Rougier" Date: Mon, 17 Oct 2016 09:34:18 +0200 Subject: [PATCH 1/6] Added markup MEP --- doc/devel/MEP/MEPxx.rst | 58 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 doc/devel/MEP/MEPxx.rst diff --git a/doc/devel/MEP/MEPxx.rst b/doc/devel/MEP/MEPxx.rst new file mode 100644 index 000000000000..25b8d54089f6 --- /dev/null +++ b/doc/devel/MEP/MEPxx.rst @@ -0,0 +1,58 @@ +========================= + MEPxx: Text light markup +========================= + +.. contents:: + :local: + + +Status +====== + +Discussion + + +Branches and Pull requests +========================== + +None at the moment, proof of concept only. + +Abstract +======== + +This MEP proposes to add lightweight markup to the text artist. + +Detailed description +==================== + +Using different size/color/family in a text annotation is difficult because the +`text` method accepts argument for size/color/family/weight/etc. that are used +for the whole text. But, if one wants, for example, to have different colors, +one has to look at the gallery where one such example is provided: +http://matplotlib.org/examples/text_labels_and_annotations/rainbow_text.html + +This example takes a list of strings as well as a list of colors which makes it +cumbersome to use. An alternative would be to use a restricted set of pango-like markup (see https://developer.gnome.org/pango/stable/PangoMarkupFormat.html) and to interpret this markup. + +Some markup examples:: + + Hello world!` + Hello world! + + +Implementation +============== + +One proof of concept is provided in markup_example.py but it only handles +horizontal direction. + + +Backward compatibility +====================== + +None at the moment since it is only a proof of concept + +Alternatives +============ + +None (to my knowledge) From 0159cb11c7f9ed685d3a9f5f307a572ed80bc704 Mon Sep 17 00:00:00 2001 From: "Nicolas P. Rougier" Date: Mon, 17 Oct 2016 09:40:50 +0200 Subject: [PATCH 2/6] Added link to code --- doc/devel/MEP/MEPxx.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/devel/MEP/MEPxx.rst b/doc/devel/MEP/MEPxx.rst index 25b8d54089f6..c7410763d397 100644 --- a/doc/devel/MEP/MEPxx.rst +++ b/doc/devel/MEP/MEPxx.rst @@ -43,8 +43,8 @@ Some markup examples:: Implementation ============== -One proof of concept is provided in markup_example.py but it only handles -horizontal direction. +One proof of concept is provided in `markup_example.py `_ but it currently only handles the horizontal direction. Backward compatibility From 5d9478afe1fe0e15c429d359e904d21a961dc7a6 Mon Sep 17 00:00:00 2001 From: "Nicolas P. Rougier" Date: Mon, 17 Oct 2016 09:44:24 +0200 Subject: [PATCH 3/6] Fix example link --- doc/devel/MEP/MEPxx.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/devel/MEP/MEPxx.rst b/doc/devel/MEP/MEPxx.rst index c7410763d397..53bebf90f1ab 100644 --- a/doc/devel/MEP/MEPxx.rst +++ b/doc/devel/MEP/MEPxx.rst @@ -43,8 +43,7 @@ Some markup examples:: Implementation ============== -One proof of concept is provided in `markup_example.py `_ but it currently only handles the horizontal direction. +A proof of concept is provided in `markup_example.py `_ but it currently only handles the horizontal direction. Backward compatibility From 9cb29a4d3d8620a158dbeb0032be510ef6ccb6be Mon Sep 17 00:00:00 2001 From: "Nicolas P. Rougier" Date: Mon, 17 Oct 2016 18:59:39 +0200 Subject: [PATCH 4/6] Updated MEP number --- doc/devel/MEP/{MEPxx.rst => MEP29.rst} | 2 +- doc/devel/MEP/index.rst | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) rename doc/devel/MEP/{MEPxx.rst => MEP29.rst} (98%) diff --git a/doc/devel/MEP/MEPxx.rst b/doc/devel/MEP/MEP29.rst similarity index 98% rename from doc/devel/MEP/MEPxx.rst rename to doc/devel/MEP/MEP29.rst index 53bebf90f1ab..3a1910750954 100644 --- a/doc/devel/MEP/MEPxx.rst +++ b/doc/devel/MEP/MEP29.rst @@ -1,5 +1,5 @@ ========================= - MEPxx: Text light markup + MEP29: Text light markup ========================= .. contents:: diff --git a/doc/devel/MEP/index.rst b/doc/devel/MEP/index.rst index f9f531d92800..9a8d55c7b72a 100644 --- a/doc/devel/MEP/index.rst +++ b/doc/devel/MEP/index.rst @@ -30,3 +30,5 @@ Matplotlib Enhancement Proposals MEP26 MEP27 MEP28 + MEP29 + From a4ccb375940fdeba188da3bf331fb749448c4445 Mon Sep 17 00:00:00 2001 From: "Nicolas P. Rougier" Date: Wed, 2 Nov 2016 14:58:03 +0100 Subject: [PATCH 5/6] Added suggestions from the MEP PR comments --- doc/devel/MEP/MEP29.rst | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/doc/devel/MEP/MEP29.rst b/doc/devel/MEP/MEP29.rst index 3a1910750954..51cbd0c10598 100644 --- a/doc/devel/MEP/MEP29.rst +++ b/doc/devel/MEP/MEP29.rst @@ -45,13 +45,38 @@ Implementation A proof of concept is provided in `markup_example.py `_ but it currently only handles the horizontal direction. +Improvements +------------ + + * This proof of concept uses regex to parse the text but it may be better + to use the html.parser from the standard library. + + * Computation of text fragment positions could benefit from the OffsetFrom + class. See for example item 5 in `Using Complex Coordinates with Annotations `_ + +Problems +-------- + + * One serious problem is how to deal with text having both latex and + html-like tags. For example, consider the follwing:: + + $Bold$ + + Recommendation would be to have mutual exclusion. + Backward compatibility ====================== None at the moment since it is only a proof of concept + Alternatives ============ -None (to my knowledge) +As proposed by @anntzer, this could be also implemented as improvements to +mathtext. For example:: + + r"$\text{Hello \textbf{world}}$" + r"$\text{Hello \textcolor{blue}{world}}$" + r"$\text{Hello \textsf{\small world}}$" From bd1e273e4cf8f762a7ffedb5cdbd09041d80c518 Mon Sep 17 00:00:00 2001 From: "Nicolas P. Rougier" Date: Wed, 2 Nov 2016 15:00:31 +0100 Subject: [PATCH 6/6] Typo --- doc/devel/MEP/MEP29.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/devel/MEP/MEP29.rst b/doc/devel/MEP/MEP29.rst index 51cbd0c10598..9315ddc939f3 100644 --- a/doc/devel/MEP/MEP29.rst +++ b/doc/devel/MEP/MEP29.rst @@ -48,21 +48,21 @@ A proof of concept is provided in `markup_example.py `_ +* Computation of text fragment positions could benefit from the OffsetFrom + class. See for example item 5 in `Using Complex Coordinates with Annotations `_ Problems -------- - * One serious problem is how to deal with text having both latex and - html-like tags. For example, consider the follwing:: +* One serious problem is how to deal with text having both latex and + html-like tags. For example, consider the follwing:: $Bold$ - Recommendation would be to have mutual exclusion. + Recommendation would be to have mutual exclusion. Backward compatibility pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy