SourceForge logo
SourceForge logo
Menu

[matplotlib-devel] contour_demo problem

From: Steve C. <ste...@ya...> - 2005年02月22日 07:14:39
John,
When running coutour_demo.py with the Cairo backend I get:
 File "matplotlib/figure.py", line 338, in draw
 for a in self.axes: a.draw(renderer)
 File "matplotlib/axes.py", line 1307, in draw
 self.legend_.draw(renderer)
 File "matplotlib/legend.py", line 181, in draw
 h.draw(renderer)
 File "matplotlib/lines.py", line 266, in draw
 gc.set_foreground(self._color) # problem
 File "/matplotlib/backends/backend_cairo.py", line 421, in set_foreground
 self.ctx.set_rgb_color(*self._rgb)
TypeError: Context.set_rgb_color() takes exactly 3 arguments (4 given)
It looks to like the frontend (lines.py) is working with rgba colors
and passing the rgba color to the backend which is expecting rgb color.
colors.colorConverter.to_rgb(fg) is also a problem because for rgba input
it returns rgba not rgb.
One solution would be to change the last lines of colorConverter.to_rgb(fg)
from
 self.cache[arg] = color
 return color
to
	color = color[0:3]
 self.cache[arg] = color
 return color
To ensure that to_rgb() actually gives rgb and not rgba.
What do you think?
Steve

View entire thread

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /