Skip to content
Closed
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions lib/matplotlib/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

from matplotlib.backend_bases import RendererBase
from matplotlib.textpath import TextPath
from matplotlib.colors import colorConverter


def _process_text_args(override, fontdict=None, **kwargs):
Expand Down Expand Up @@ -749,8 +750,10 @@ def draw(self, renderer):
if textobj._bbox_patch:
textobj._draw_bbox(renderer, posx, posy)

color = textobj.get_color()
color = colorConverter.to_rgb(color)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be to_rgba?

prop = textobj._fontproperties
gc = renderer.new_gc()
gc.set_foreground(textobj.get_color())
gc.set_alpha(textobj.get_alpha())
gc.set_url(textobj._url)
textobj._set_gc_clip(gc)
Expand All @@ -771,19 +774,23 @@ def draw(self, renderer):
clean_line, ismath = textobj.is_math_text(line)

if textobj.get_path_effects():
from matplotlib.patheffects import PathEffectRenderer
textrenderer = PathEffectRenderer(
textobj.get_path_effects(), renderer)
path_effects = textobj.get_path_effects()
if textobj.get_usetex():
ismath = "TeX"
path, transform = renderer._get_text_path_transform(x, y, clean_line, prop, angle, ismath)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pep8 is choking on this line.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. I have modified the line to follow the PEP8 conventions.

-Michiel.


On Wed, 6/17/15, Thomas A Caswell notifications@github.com wrote:

Subject: Re: [matplotlib] Fix for issue4024 (#4532)
To: "matplotlib/matplotlib" matplotlib@noreply.github.com
Cc: "mdehoon" mjldehoon@yahoo.com
Date: Wednesday, June 17, 2015, 1:07 PM

In lib/matplotlib/text.py:

@@ -771,19 +774,23 @@ def
draw(self, renderer):
clean_line, ismath =
textobj.is_math_text(line)

             if textobj.get_path_effects():
  •                from matplotlib.patheffects import
    
    PathEffectRenderer

- textrenderer = PathEffectRenderer(

textobj.get_path_effects(), renderer)

  •                path_effects =
    
    textobj.get_path_effects()
  •                if textobj.get_usetex():
    
  •                    ismath = "TeX"
    
  •                path, transform =
    
    renderer._get_text_path_transform(x, y, clean_line, prop,
    angle, ismath)

pep8 is choking on this line.

—
Reply to this email directly or view
it on GitHub.

gc.set_linewidth(0.0)
for path_effect in path_effects:
path_effect.draw_path(renderer, gc, path, transform,
rgbFace=color)
else:
textrenderer = renderer

if textobj.get_usetex():
textrenderer.draw_tex(gc, x, y, clean_line,
textobj._fontproperties, angle,
gc.set_foreground(color)
if textobj.get_usetex():
renderer.draw_tex(gc, x, y, clean_line,
prop, angle,
mtext=mtext)
else:
textrenderer.draw_text(gc, x, y, clean_line,
textobj._fontproperties, angle,
else:
renderer.draw_text(gc, x, y, clean_line,
prop, angle,
ismath=ismath, mtext=mtext)

gc.restore()
Expand Down