; TeX output 1997.02.18:0955solh1DtGGcmr17Draqwing7thistogrambarsinsidetheLdKGXQ cmr12AT[-E;gXk`GGcmss17picture{enqvironment!", cmsy10ք]RainerScrh opf*vscrhoSepf@uni-mainz.de&37 1997/02/13.!Kt : cmbx9Abstractэoo cmr9ThisarticledescribAesanenhancemen9toftheL5Aacmr6A TuAEXow cmss9picture{environment btoTdra9whistogrambars.!čI!Nff cmbx121aLUserffinterfaceIK`y cmr10Thisisamacrocollectiontodrawhistogrambarsinsidea#m#R cmss10picture{environment.$"ߤN cmtt9\histogram IUseUUisasfollows:X$ cmmi10xٓRcmr70|s,y0)(x1,y1)...(x 0ercmmi7nq~,yn)XThe!coGordinatepairsspecifytheupperleftcornerofthehistogrambars,Si.e.Ithis$'willdrawahorizontallinefrom(xiTL;yi)$'to(xi+1 tO;yiTL),-thenaverticallinefromI(xi+1 tO;yiTL)to(xi+1;yi+1)if\noverticallineswasspGeci ed,pelsefrom(xi+1;y0|s)f\noverticallines\verticallinesItoUU(xi+1 tO;maxG(yiTL;yi+1)).XDefaultis\verticallines.^y0HshouldbGelessorequaltheminimumofalltheIyiT(i.e.qotherUUcaseshaveUUnotbGeentested).XLet'sUUstartwithanexample:qtogetthefollowingpicture:ꍍJ"\CV̎YO linew106'_ո΍-}Vfe.feefe؟feLΟfefe34fe8Pfeb81b 2bd3b3 4]JM`mlŸfdƎŸfdƎ9{'^5[v']10|lz%n^UBehandlerUU1}VR3 afe#لfdƎ.R3 afeaN#لfdƎR3 afe#لfdƎR3 afeڟՅefdƎ@nR3sfesfdƎ4R3sfe$fMfdƎR3fe,sfdƎRR3Rfe#لfdƎR3'jfe6fdƎLR3'jfe~MfdƎeR336feDNofdƎ؟R336feI NofdƎƞR336feПMfdƎwdR3feҪՅefdƎ(*R3sfe[\fdƎR3sfe "ԟfdƎ㉶R3"$fe蟳`fdƎ:|R3"$fem#لfdƎBR3RfetsfdƎR3Rfe:sfdƎLΟR336feNofdƎR336fe0ƟfdƎZR3'jfeጟfdƎ _ R3'jfe R#لfdƎR3feCMfdƎR3feޟ#لfdƎqrR3RfesfdƎ""8R3Rfe"Uj#لfdƎ'R3Rfe(0sfdƎ-ğR3Rfe-ԟfdƎ34R3fe3gԟfdƎ8PR3feIffffr @ -:q% cmsy6L|{Ycmr8ThisX lehasvÎersionnumb'ExXcommands:[X\setlength{\unitlength}{1mm} [X\begin{picture}(100,65)(-10,-15)[X\thicklines[X\put(0,-3){\vector(0,1){50}}[X\put(-3,0){\vector(1,0){90}}[X\thinlines[X\put(0,0){\line(0,-1){2}}[X\put(2,0){\line(0,-1){2}}[X\put(20,0){\line(0,-1){2}}[X\put(22,0){\line(0,-1){2}}[X\put(40,0){\line(0,-1){2}}[X\put(42,0){\line(0,-1){2}}[X\put(60,0){\line(0,-1){2}}[X\put(62,0){\line(0,-1){2}}[X\put(0,-1){\makebox(2,0)[t]{\small1}}[X\put(20,-1){\makebox(2,0)[t]{\small2}}[X\put(40,-1){\makebox(2,0)[t]{\small3}}[X\put(60,-1){\makebox(2,0)[t]{\small4}}[X\put(70,-1){\makebox(0,0)[t]{ml}}[X\put(0,10){\line(-1,0){2}}[X\put(0,20){\line(-1,0){2}}[X\put(-3,8){\makebox(0,4)[r]{5}}[X\put(-3,18){\makebox(0,4)[r]{10}}[X\put(-3,30){\makebox(0,4)[r]{n}}[X\put(15,-10){Behandler1}[X\histogram(0,0)(0,4)(2,4)(4,4)(6,0)(8,10)(10,8)(12,6)(14,4)&4(16,14)(18,8)(20,18)(22,18)(24,8)(26,0)(28,10)(30,2)&4(32,12)(34,4)(36,6)(38,6)(40,18)(42,10)(44,14)(46,4)&4(48,8)(50,4)(52,6)(54,4)(56,6)(58,2)(60,2)(62,0)[X\end{picture} ;I2aLImplementationLs1S cmsy9hpack9age#g i:3P\hist@x 3P\hist@y b\hist@ystartIHere'showitisimplemented:u rstwealloGcatethreecountersthatareneededlater Ion.\hist@x%and\hist@yarethexandyղcoGordinateofthe(': cmti10curr}'entSpoint,Z&i.e.ItheTDpGointthatservesasastartforthenextbGoxofthehistogram.ql\hist@ystartIholdsUUthey.coGordinateofthe rstpoint,i.e.qǵy0|s. Ls2S\newcount\hist@x Ls3S\newcount\hist@yLs4S\newcount\hist@ystart \noverticallines 6\verticallinesIW*eneedaswitchtodecideiftheverticallinesofthehistogrambGoxesaretobGe IdrawnUUfromyitoyi+1ɤorfromy0Ȳtomax(yiTL;yi+1 tO).qDefaultisthelatter.2soLs5S\newif\ifhist@vert Ls6Ls7S\let\verticallines\hist@verttrueLs8S\let\noverticallines\hist@vertfalseLs9I10S\hist@verttrue\histogramIThe?\histogramcommandtakesthestartingpGointasargumentandinitializes Ithecounters.\hist@x,\hist@yand\hist@ystartaresettox0|s,y0 66andy0|s,IrespGectively*.I11S\def\histogram(#1,#2){\hist@x#1\hist@y#2\hist@ystart\hist@yIThenUUthemacro\hist@nextisused.I12]\hist@next}\hist@nextI\hist@next loGoksatthenexttokentoseeifthereisanotheropenparentheses.X[If IthisUUisthecaseitcalls\hist@box,otherwise\hist@end.I13S\def\hist@next{\@ifnextchar({\hist@box}{\hist@end}}$\hist@boxIThemacro\hist@boxdoGesnearlyallthework.]8The rstthingtodoistosetthe ItempGorary counter\@tempcntatoxi+1' !", cmsy10bxiTL.RemembGerthat\hist@xisthexIcoGordinate5ofthelastpoint(i.e.hxiTL)whereasthemacros rstargumentisxi+1 tO.ISoUUwewriteI14S\def\hist@box(#1,#2){\@tempcnta-\hist@x I15ap\advance\@tempcnta#1IThenextstepiseasy:drawthehorizontalpartofthehistogrambGox.&uThelineIstartsUUat(xiTL;yi)UUandhaslength\@tempcnta\unitlength.I16ap\ifnum\@tempcnta>\z@ I17yw^\put(\hist@x,\hist@y){\line(1,0){\@tempcnta}}\elseI18yw^\put(\hist@x,\hist@y){\line(-1,0){-\@tempcnta}}\fiINowUUset\hist@xtoxi+1 tO:I19ap\hist@x#1IIfUU\verticallineswassetwe rstset\@tempcntatomax(yiTL;yi+1 tO):I20ap\ifhist@vert I21p2\ifnum\hist@y>#2\@tempcnta\hist@yI22yw^\else\@tempcnta#2\fiIthenweset\@tempcntbtothesamevqalueand\@tempcntatothelengthofthe IlineUUtodraw.I23p2\@tempcntb\@tempcntaI24p2\advance\@tempcnta-\hist@ystartIW*eUUdrawthelineI25p2\put(\hist@x,\@tempcntb){\line(0,-1){\@tempcnta}}%IwhichUU nishesthiscase.I26ap\elseIInItheothercase(i.e.mif\noverticallineswasset)wehavetodrawalinefrom IyitoUUyi+1 tO.qW*eset\@tempcntatoyi+1/8yiI27p2\@tempcnta-\hist@y I28p2\advance\@tempcnta#23ΠsoIandUUdrawtheline.I29p2\ifnum\@tempcnta>\z@ I30~0\put(\hist@x,\hist@y){\line(0,1){\@tempcnta}}\elseI31~0\put(\hist@x,\hist@y){\line(0,-1){-\@tempcnta}}\fiIThusUUendeththedrawing.I32ap\fiIFinally~weset\hist@ytoyi+1ݲandcall\hist@nexttoloGokforthenextcoordinate Ipair.I33ap\hist@y#2\hist@next}yhist@endIThereisonlyonethingweleftout:4whatifthereisnomoreopGenparenthesis?IThat'sUUtheeasypart:qdonothing.I34S\def\hist@end{}IF*rank8VMittelbachsuggestedthatthex{coGordinateshouldspecifythemidpointofIthehistogrambar,ՋnottheuppGerleftcorner.}However,Idon'tseehowthiswillIworkUUifthebarshavedi erentwidths.qWhatdoyouthinkabGoutit?XW*ell,UUthat'sall.qUseitandenjoy.4$B; (': cmti10$ cmmi10 0ercmmi7K`y cmr10ٓRcmr7O linew10(