[matplotlib-devel] SVG backend - edge alpha channel fix?

2010-06-04 Thread Bob
I'm using matplotlib v0.99.1.1 pyplot savefig() to generate svg files
using the matplotlib.use('SVG') backend. My networkx plot contains
semi-transparent edges which were not carrying over to the svg xml
correctly. The node transparencies were correct.
I was able to fix this problem by modifying
/matplotlib/backends/backend_svg.py ...


@@ -150 +149 @@
- gc.get_alpha(),
+ gc.get_rgb()[3],


While gc.get_rgb()[3] was able to return the correct alpha float
value, gc.get_alpha() was always returning 1.0.
Has anyone else seen this problem? Perhaps it's my use of
draw_networkx_edges() to style the edges.

Hope this helps,
Bob

--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] SVG backend - edge alpha channel fix?

2010-06-07 Thread Bob
Here is an example which generates both a png and svg file.
The png edge alpha levels are displayed correctly, while the svg edges
have an alpha value of 1.0
I tested this with a fresh build of matplotlib-1.0.svn r8391
Thanks for your help.

#!/usr/bin/python
import sys
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as N
import networkx as nx

def main():
   G = nx.Graph()
   G.add_nodes_from([0,1,2])
   G.add_edges_from([(0,1),(0,2),(1,2)])
   pos = nx.spring_layout(G)
   nx.draw_networkx_nodes(G, pos, node_size=1500,
node_color=['c','m','y'], alpha=0.3)
   nx.draw_networkx_edges(G, pos, width=45, edge_color=['r','g','b'], alpha=0.3)
   nx.draw_networkx_labels(G, pos)
   plt.savefig('test.png')
   plt.savefig('test.svg')
   return 0

if __name__ == "__main__":
sys.exit(main())

--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel