From: Andre W. <wo...@us...> - 2005-04-11 07:39:04
|
Hi, On 07.04.05, Simson L. Garfinkel wrote: > I'm having fun with my bar graph application. However, I'm having a > problem in that I have 250 bars on the graph, so I'm having some minor > issues. > > Here is my current code that is relevant: > > ============ > color_b = color.gray(.6) > bottom_bar = graph.style.bar([color_b,deco.stroked([color_b])]) > > color_t = color.rgb.red > top_bar = graph.style.bar([color_t,deco.stroked([color_t])]) > > datafile = graph.data.file("levels.dat", xname=0, y=2, stack=3) > > g.plot(datafile, > [bottom_bar, > graph.style.stackedbarpos("stack"), > top_bar]) > ============= > > Notice that I'm setting the stroked color to be the same color as the > bar. Otherwise the stroke obscures the bar color. Right, the attributes get merged by the attributes you provide. But you are also allowed to overwrite and even remove some of the default attributes. You overwrite it as you currently do (by specifying a different attribute, which is marked to be exclusive). But to remove the stroking, you can insert the deco.stroked.clear attribute! > What I would really like to do is to change the width of the stroke. I > can't really find anything in deco to allow me to control the width of > the stroke. I've look at the source code and find really figure out how > to take the strokestyle in style.py and put it into the graph.style.bar > function. Anybody know? You just need to set a linewith: graph.style.bar([color_t,deco.stroked([style.linewidth.thin, color_t])]) ... should work. > ============= > Finally, how do I turn off axes labeling? integral.py seems to have no > labels, but I can't figure out how to make those features work with the > bar graph. Well, in the integral example we have a continuous axis with a partitioner taking care of placing axis ticks. A bar axis does not have a paritioner at all, but it has "names" from the data. The bar axis basically just enumerates those names ... The most easiest way to remove the names would be to use the painter and set the nameattrs to None. This will skip painting of the names. HTH, André -- by _ _ _ Dr. André Wobst / \ \ / ) wo...@us..., http://www.wobsta.de/ / _ \ \/\/ / PyX - High quality PostScript figures with Python & TeX (_/ \_)_/\_/ visit http://pyx.sourceforge.net/ |