plotutils.texi 521 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223
  1. \input texinfo @c -*-texinfo-*-
  2. @c %**start of header
  3. @setfilename plotutils.info
  4. @settitle The Plotutils Package
  5. @c For double-sided printing, uncomment:
  6. @c @setchapternewpage odd
  7. @c %**end of header
  8. @dircategory GNU Plotting Utilities
  9. @direntry
  10. * Plotting utilities: (plotutils). GNU plotting utilities.
  11. * graph: (plotutils)graph Invocation. Plot datasets, possibly in real time.
  12. * plot: (plotutils)plot Invocation. Convert and display plot files.
  13. * pic2plot: (plotutils)pic2plot Invocation. Convert files in the pic language
  14. * tek2plot: (plotutils)tek2plot Invocation. Translate legacy Tektronix data.
  15. * plotfont: (plotutils)plotfont Invocation. Plot character maps of fonts.
  16. * spline: (plotutils)spline Invocation. Interpolate between points in datasets.
  17. * ode: (plotutils)ode Invocation. Integrate differential equations.
  18. * libplot: (plotutils)libplot. A library for 2-D vector graphics.
  19. * Appendices: (plotutils)Appendices. More info on the plotting utilities.
  20. @end direntry
  21. @iftex
  22. @hyphenation{Zapf-Ding-bats Hershey-Serif-Symbol Hershey-Sans-Symbol Web-CGM}
  23. @end iftex
  24. @ifinfo
  25. This file documents version 2.6 of the GNU plotting utilities package,
  26. including GNU libplot 4.4
  27. Copyright @copyright{} 1989, 1990, 1991, 1995, 1996, 1997, 1998, 1999, 2000, 2005, 2008, 2009 Free Software Foundation, Inc.
  28. Permission is granted to copy, distribute and/or modify this manual
  29. under the terms of the GNU Free Documentation License, Version 1.2 or
  30. any later version published by the Free Software Foundation; with no
  31. Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. A
  32. copy of the license is included in the appendix entitled ``The GNU Free
  33. Documentation License''.
  34. @end ifinfo
  35. @titlepage
  36. @title The GNU Plotting Utilities
  37. @subtitle Programs and functions for vector graphics and data plotting
  38. @subtitle Version 2.6
  39. @author Robert S. Maier
  40. @page
  41. @vskip 0pt plus 1filll
  42. Copyright @copyright{} 1989, 1990, 1991, 1995, 1996, 1997, 1998, 1999,
  43. 2000, 2005, 2008, 2009 Free Software Foundation, Inc.
  44. Permission is granted to copy, distribute and/or modify this manual
  45. under the terms of the GNU Free Documentation License, Version 1.2 or
  46. any later version published by the Free Software Foundation; with no
  47. Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. A
  48. copy of the license is included in the appendix entitled ``The GNU
  49. Free Documentation License''.
  50. @end titlepage
  51. @page
  52. @node Top, Plotutils Intro, (dir), (dir)
  53. @ifnottex
  54. This is the documentation for version 2.6 of the GNU plotting
  55. utilities package, including GNU libplot 4.4. The package consists of
  56. programs and functions for vector graphics and data plotting.
  57. @end ifnottex
  58. @menu
  59. * Plotutils Intro:: GNU plotting utilities
  60. * graph:: graph, a program for plotting datasets
  61. * plot:: plot, a plot format conversion program
  62. * pic2plot:: pic2plot, a translator for files in the pic language
  63. * tek2plot:: tek2plot, a translator for legacy Tektronix files
  64. * plotfont:: plotfont, a program for plotting font character maps
  65. * spline:: spline, an interpolation program
  66. * ode:: ode, a differential equation integrator
  67. * libplot:: A library for device-independent 2-D vector graphics
  68. * Appendices:: Additional Information
  69. @end menu
  70. @node Plotutils Intro, graph, Top, Top
  71. @chapter The GNU Plotting Utilities
  72. The GNU plotting utilities consist of eight command-line programs: the
  73. graphics programs @code{graph}, @code{plot}, @code{pic2plot},
  74. @code{tek2plot}, and @code{plotfont}, and the mathematical programs
  75. @code{spline}, @code{ode}, and @code{double}. Distributed with these
  76. programs is GNU @code{libplot}, the library on which the graphics
  77. programs are based. GNU @code{libplot} is a function library for
  78. device-independent two-dimensional vector graphics, including vector
  79. graphics animations under the @w{X Window} System. @w{It has} bindings
  80. for both C @w{and C++}.
  81. The graphics programs and GNU @code{libplot} can export vector graphics
  82. in the following formats.
  83. @table @asis
  84. @item X
  85. If this output option is selected, there is no output file. Output is
  86. directed to a popped-up window on an @w{X Window} System display.
  87. @item PNG
  88. This is ``portable network graphics'' format, which is increasingly
  89. popular on the Web. Unlike GIF format, it is unencumbered by patents.
  90. Files in PNG format may be viewed or edited with many applications,
  91. such as @code{display}, which is part of the free @code{ImageMagick}
  92. package.
  93. @item PNM
  94. This is ``portable anymap'' format. There are three types of portable
  95. anymap: PBM (portable bitmap, for monochrome images), PGM (portable
  96. graymap), and PPM (portable pixmap, for colored images). The output
  97. file will use whichever is most appropriate. Portable anymaps may be
  98. translated to other formats with the @code{netpbm} package, or viewed
  99. with @code{display}.
  100. @item GIF
  101. This is pseudo-GIF format rather than true GIF format. Unlike GIF
  102. format it does not use LZW compression, so it does not transgress the
  103. Unisys LZW patent. However, files in pseudo-GIF format may be viewed
  104. or edited with any application that accepts GIF format, @w{such as}
  105. @code{display}.
  106. @item SVG
  107. This is Scalable Vector Graphics format. SVG is an XML-based format
  108. for vector graphics on the Web. The @uref{http://www.w3.org, @w{W3
  109. Consortium}} has more information on SVG, which is being developed by
  110. its @uref{http://www.w3.org/Graphics, Graphics Activity}.
  111. @item AI
  112. This is the format used by Adobe Illustrator. Files in this format may
  113. be edited with Adobe Illustrator (@w{version 5}, and more recent
  114. versions), or other applications.
  115. @item PS
  116. This is @code{idraw}-editable Postscript format. Files in this format
  117. may be sent to a Postscript printer, imported into another document, or
  118. edited with the free @code{idraw} drawing editor. See @ref{idraw}.
  119. @item CGM
  120. This is Computer Graphics Metafile format, which may be imported into an
  121. application or displayed in any Web browser with a CGM plug-in. @w{By
  122. default}, a binary file in @w{version 3} CGM format that conforms to the
  123. WebCGM profile is produced. The @uref{http://www.cgmopen.org, CGM Open
  124. Consortium} has more information on WebCGM, which is a standard for
  125. Web-based vector graphics.
  126. @item Fig
  127. This is a vector graphics format that may be displayed or edited with
  128. the free @code{xfig} drawing editor. See @ref{xfig}.
  129. @item PCL 5
  130. This is a powerful version of Hewlett--Packard's Printer Control
  131. Language. Files in this format may be sent to a LaserJet printer or
  132. compatible device (note that most inkjets do not support @w{PCL 5}).
  133. @item HP-GL
  134. This is Hewlett--Packard's Graphics Language. By default, the modern
  135. variant HP-GL/2 is produced. Files in HP-GL or HP-GL/2 format may be
  136. imported into a document or sent to a plotter.
  137. @item ReGIS
  138. This is the graphics format understood by several DEC terminals (VT340,
  139. VT330, VT241, VT240) and emulators, including the DECwindows terminal
  140. emulator, @code{dxterm}.
  141. @item Tek
  142. This is the graphics format understood by Tektronix 4014 terminals and
  143. emulators, including the emulators built into the @code{xterm} terminal
  144. emulator program and the MS-DOS version of @code{kermit}.
  145. @item Metafile
  146. This is device-independent GNU graphics metafile format. The
  147. @code{plot} program can translate it to any of the preceding formats.
  148. @end table
  149. Of the command-line graphics programs, the best known is @code{graph},
  150. which is an application for plotting two-dimensional scientific data.
  151. It reads one or more data files containing datasets, and outputs a plot.
  152. The above output formats are supported. The corresponding commands are
  153. @code{graph @w{-T X}}, @code{graph -T png}, @code{graph -T pnm},
  154. @code{graph -T gif}, @code{graph -T svg}, @code{graph -T ai},
  155. @code{graph -T ps}, @code{graph -T cgm}, @code{graph -T fig},
  156. @code{graph -T pcl}, @code{graph -T hpgl}, @code{graph -T regis},
  157. @code{graph -T tek}, and @code{graph}. @code{graph} without a @samp{-T}
  158. option (referred to as `raw @code{graph}') produces output in GNU
  159. metafile format.
  160. @code{graph} can read datasets in both ASCII and binary format, and
  161. datasets in the `table' format produced by the plotting program
  162. @code{gnuplot}. It produces a plot with or without axes and labels.
  163. You may specify labels and ranges for the axes, and the size and
  164. position of the plot on the display. The labels may contain subscripts
  165. and subscripts, Greek letters, and other special symbols; there is also
  166. support for Cyrillic script (i.e., Russian) and Japanese. You may
  167. specify the type of marker symbol used for each dataset, and such
  168. parameters as the style and thickness of the line @w{(if any)} used to
  169. connect points in a dataset. The plotting of filled regions is
  170. supported, as is the drawing of error bars. @code{graph} provides full
  171. support for multiplotting. With a single invocation of @code{graph},
  172. you may produce a multiplot consisting of many plots, either side by
  173. side or inset. Each plot will have its own axes and data.
  174. @code{graph @w{-T X}}, @code{graph -T tek}, @code{graph -T regis}, and
  175. raw @code{graph} have a feature that most plotting programs do not have.
  176. They can accept input from a pipe, and plot data points to the output in
  177. real time. For this to occur, the user must specify ranges for both
  178. axes, so that @code{graph} does not need to wait until the end of the
  179. input before determining them.
  180. The @code{plot} program is a so-called plot filter. It can translate
  181. GNU graphics metafiles (produced @w{for example} by raw @code{graph})
  182. into any supported output format. The corresponding commands are
  183. @code{plot @w{-T X}}, @code{plot -T png}, @code{plot -T pnm}, @code{plot
  184. -T gif}, @code{plot -T svg}, @code{plot -T ai}, @code{plot -T ps},
  185. @code{plot -T cgm}, @code{plot -T fig}, @code{plot -T pcl}, @code{plot
  186. -T hpgl}, @code{plot -T regis}, @code{plot -T tek}, and @code{plot}.
  187. The @code{plot} program is useful if you wish to produce output in
  188. several different formats while invoking @code{graph} only once. @w{It
  189. is} also useful if you wish to translate files in the traditional
  190. `plot(5)' format produced by, e.g., the non-GNU versions of @code{graph}
  191. provided with some operating systems. GNU metafile format is compatible
  192. with plot(5) format.
  193. The @code{pic2plot} program can translate from the pic language to any
  194. supported output format. The pic language, which was invented at Bell
  195. Laboratories, is used for creating box-and-arrow diagrams of the kind
  196. frequently found in technical papers and textbooks. The corresponding
  197. commands are @code{pic2plot @w{-T X}}, @code{pic2plot -T png},
  198. @code{pic2plot -T pnm}, @code{pic2plot -T gif}, @code{pic2plot -T ai},
  199. @code{pic2plot -T ps}, @code{pic2plot -T cgm}, @code{pic2plot -T fig},
  200. @code{pic2plot -T pcl}, @code{pic2plot -T hpgl}, @code{pic2plot -T
  201. regis}, @code{pic2plot -T tek}, and @code{pic2plot}.
  202. The @code{tek2plot} program can translate from Tektronix format to any
  203. supported output format. The corresponding commands are @code{tek2plot
  204. @w{-T X}}, @code{tek2plot -T png}, @code{tek2plot -T pnm},
  205. @code{tek2plot -T gif}, @code{tek2plot -T svg}, @code{tek2plot -T ai},
  206. @code{tek2plot -T ps}, @code{tek2plot -T cgm}, @code{tek2plot -T fig},
  207. @code{tek2plot -T pcl}, @code{tek2plot -T hpgl}, @code{tek2plot -T
  208. regis}, and @code{tek2plot}. @code{tek2plot} is useful if you have an
  209. older application that produces drawings in Tektronix format.
  210. The @code{plotfont} program is a simple utility that displays a
  211. character map for any font that is available to @code{graph},
  212. @code{plot}, @code{pic2plot}, or @code{tek2plot}. The 35 standard
  213. Postscript fonts are available if the @samp{-T X}, @samp{-T ai},
  214. @samp{-T ps}, @samp{-T cgm}, or @samp{-T fig} options are used. The 45
  215. standard @w{PCL 5} fonts (i.e., ``LaserJet'' fonts) are available if the
  216. @samp{-T ai}, @samp{-T pcl} or @samp{-T hpgl} options are used. In the
  217. latter two cases (@samp{-T pcl} and @samp{-T hpgl}), @w{a number} of
  218. Hewlett--Packard vector fonts are available @w{as well}. @w{A set} of
  219. 22 Hershey vector fonts, including Cyrillic fonts and a Japanese font,
  220. is always available. When producing output for an @w{X Window System}
  221. display, any of the graphics programs can use scalable @w{X fonts}.
  222. Of the command-line mathematical programs, @code{spline} does spline
  223. interpolation of scalar or vector-valued data. It normally uses either
  224. cubic spline interpolation or exponential splines in tension, but like
  225. @code{graph} @w{it can} function as a real-time filter under some
  226. circumstances. Besides splining datasets, @w{it can} construct curves,
  227. either open or closed, through arbitrarily chosen points in
  228. @math{d}-dimensional space. @code{ode} provides the ability to
  229. integrate an ordinary differential equation or a system of ordinary
  230. differential equations, when provided with an explicit expression for
  231. each equation. It supplements the plotting program @code{gnuplot},
  232. which can plot functions but not integrate ordinary differential
  233. equations. The final command-line mathematical program, @code{double},
  234. is a filter for converting, scaling and cutting binary or ASCII data
  235. streams. @w{It is} still under development and is not yet documented.
  236. The GNU @code{libplot} function library, on which the command-line
  237. graphics programs are based, is discussed @w{at length} elsewhere in
  238. this documentation. @w{It gives} C @w{and C++} programs the ability to
  239. draw such objects as lines, open and closed polylines, arcs (both
  240. circular and elliptic), quadratic and cubic Bezier curves, circles and
  241. ellipses, points (i.e., pixels), marker symbols, and text strings. The
  242. filling of objects other than points, marker symbols, and text strings
  243. is supported (fill color, @w{as well} as pen color, can be set
  244. arbitrarily). Text strings can be drawn in any of a large number of
  245. fonts. The 35 standard Postscript fonts are supported by the @w{X
  246. Window} System, SVG, Illustrator, Postscript, CGM, and @code{xfig}
  247. drivers, and the 45 standard @w{PCL 5} fonts are supported by the SVG,
  248. Illustrator, @w{PCL 5} and HP-GL/2 drivers. The latter two also support
  249. a number of Hewlett--Packard vector fonts. All drivers, including the
  250. PNG, PNM, GIF, ReGIS, Tektronix and metafile drivers, support a set of
  251. 22 Hershey vector fonts.
  252. The support for drawing text strings is extensive. Text strings may
  253. include subscripts and superscripts, and may include characters chosen
  254. from more than one font in a typeface. Many non-alphanumeric characters
  255. may be included. The entire collection of over 1700 `Hershey glyphs'
  256. digitized by @w{Allen V.} Hershey at the U.S. Naval Surface Weapons
  257. Center, which includes many curious symbols, is built into GNU
  258. @code{libplot}. Text strings in the so-called EUC-JP encoding (the
  259. Extended Unix Code for Japanese) can be also be drawn. Such strings may
  260. include both syllabic Japanese characters (Hiragana and Katakana) and
  261. ideographic Japanese characters (Kanji). GNU @code{libplot} contains a
  262. library of 603 Kanji, including 596 of the 2965 frequently used
  263. @w{Level 1} Kanji.
  264. @node graph, plot, Plotutils Intro, Top
  265. @chapter The @code{graph} Application
  266. Each invocation of @code{graph} reads one or more datasets from files
  267. named on the command line or from standard input, and prepares a plot.
  268. There are many command-line options for adjusting the visual appearance
  269. of the plot.
  270. @iftex
  271. @xref{graph Invocation}, for documentation on all options.
  272. @end iftex
  273. The following sections explain how to use the most frequently used
  274. options, by giving examples.
  275. @menu
  276. * Simple Examples:: Simple examples using graph
  277. * Non-Square Plots:: Rotating and changing the aspect ratio of a plot
  278. * Multiple Datasets:: Preparing a plot from more than one dataset
  279. * Multiplotting:: Multiple plots on a single page
  280. * Data Formats:: Reading binary and other data formats
  281. * graph Invocation:: Command-line options
  282. @end menu
  283. @node Simple Examples, Non-Square Plots, graph, graph
  284. @section Simple examples using @code{graph}
  285. By default, @code{graph} reads ASCII data from the files specified on
  286. the command line, or from standard input if no files are specified. The
  287. data are pairs of numbers, interpreted as the @math{x} @w{and @math{y}}
  288. coordinates of data points. An example would be:
  289. @example
  290. 0.0 0.0
  291. 1.0 0.2
  292. 2.0 0.0
  293. 3.0 0.4
  294. 4.0 0.2
  295. 5.0 0.6
  296. @end example
  297. @noindent
  298. Data points do not need to be on different lines, nor do the @math{x}
  299. and @math{y} coordinates of a data point need to be on the same line.
  300. However, there should be no blank lines in the input if it is to be
  301. viewed as forming a single dataset.
  302. To plot such a dataset with @code{graph}, you could do
  303. @example
  304. graph -T ps datafile > plot.ps
  305. @end example
  306. @noindent
  307. or equivalently
  308. @example
  309. graph -T ps < datafile > plot.ps
  310. @end example
  311. @noindent
  312. Either of these would produce an encapsulated Postscript file
  313. @file{plot.ps}, which could be sent to a printer, displayed on a
  314. screen by the Postscript viewer @code{gv}, or edited with the free
  315. drawing editor @code{idraw}. The @samp{--page-size} option, or
  316. equivalently the @code{PAGESIZE} environment variable, specifies the
  317. size of the page on which the plot will be positioned. The default is
  318. "letter", i.e., 8.5@dmn{in} by 11@dmn{in}, but "a4" or other ISO or
  319. ANSI page sizes could equally well be specified. See @ref{Page and
  320. Viewport Sizes}.
  321. Similarly, you would do
  322. @example
  323. graph -T svg < datafile > plot.svg
  324. graph -T cgm < datafile > plot.cgm
  325. @end example
  326. @noindent
  327. to produce SVG and WebCGM files that could be displayed in a Web browser
  328. with SVG and WebCGM support, or
  329. @example
  330. graph -T fig < datafile > plot.fig
  331. @end example
  332. @noindent
  333. to produce a file @file{plot.fig} in Fig format that could be edited
  334. with the free @code{xfig} drawing editor, or
  335. @example
  336. graph -T ai < datafile > plot.ai
  337. @end example
  338. @noindent
  339. to produce a file @file{plot.ai} that could be edited with Adobe
  340. Illustrator. If you do
  341. @example
  342. graph -T hpgl < datafile > plot.plt
  343. @end example
  344. @noindent
  345. you will produce a file @file{plot.plt} in the Hewlett--Packard Graphics
  346. Language (HP-GL/2) that may be sent to a Hewlett--Packard plotter.
  347. Similarly, you would use @code{graph -T pcl} to produce a file in @w{PCL
  348. 5} format that may be printed on a LaserJet or other laser printer.
  349. You would use @code{graph @w{-T X}} to @w{pop up} a window on an @w{X
  350. Window} System display, and display the plot @w{in it}. For that, you
  351. would do
  352. @example
  353. graph -T X < datafile
  354. @end example
  355. @noindent
  356. If you use @code{graph @w{-T X}}, no output file will be produced: only
  357. a window. The window will vanish if you @w{type @samp{q}} or click your
  358. mouse @w{in it}.
  359. You may also use @code{graph -T png} to produce a PNG file, @code{graph
  360. -T pnm} to produce a PNM file (a ``portable anymap''), and @code{graph
  361. -T gif} to produce a pseudo-GIF file. If the free image display
  362. application @code{display} is available on your system, you could use any
  363. of the three commands
  364. @example
  365. graph -T png < datafile | display
  366. graph -T pnm < datafile | display
  367. graph -T gif < datafile | display
  368. @end example
  369. @noindent
  370. to view the output file.
  371. Another thing you can do is use @code{graph -T tek} to display a plot on
  372. a device that can emulate a Tektronix 4014 graphics terminal.
  373. @code{xterm}, the @w{X Window} System terminal emulator, can do this.
  374. Within an @code{xterm} window, you would type
  375. @example
  376. graph -T tek < datafile
  377. @end example
  378. @noindent
  379. @code{xterm} normally emulates a VT100 terminal, but when this command
  380. is issued from @w{within it}, @w{it will} @w{pop up} a second window
  381. (@w{a `Tektronix} window') and draw the plot @w{in it}. The Japanese
  382. terminal emulator @code{kterm} should be able to do the same, provided
  383. that it is correctly installed. Another piece of software that can
  384. emulate a Tektronix 4014 terminal is the MS-DOS version of @code{kermit}.
  385. In the same way, you would use @code{graph -T regis} to display a plot
  386. on any graphics terminal or emulator that supports ReGIS graphics.
  387. @code{dxterm}, the DECwindows terminal emulator, can do this. Several
  388. DEC terminals (in particular the VT340, VT330, VT241, and VT240
  389. terminals) also support ReGIS graphics.
  390. @code{graph} may behave differently depending on the environment in
  391. which it is invoked. We have already mentioned the @code{PAGESIZE}
  392. environment variable, which affects the operation of @code{graph -T
  393. svg}, @code{graph -T ai}, @code{graph -T ps}, @code{graph -T cgm},
  394. @code{graph -T fig}, @code{graph -T pcl}, and @code{graph -T hpgl}.
  395. Similarly, the @code{BITMAPSIZE} environment variable affects the
  396. operation of @code{graph @w{-T X}}, @code{graph -T png}, @code{graph -T
  397. pnm}, and @code{graph -T gif}. The @code{DISPLAY} environment variable
  398. affects the operation of @code{graph @w{-T X}}, and the @code{TERM}
  399. environment variable affects the operation of @code{graph -T tek}.
  400. There are also several environment variables that affect the operation
  401. of @code{graph -T pcl} and @code{graph -T hpgl}. For a complete
  402. discussion of the effects of the environment on @code{graph}, see
  403. @ref{graph Environment}. The following remarks apply irrespective of
  404. which output format is specified.
  405. By default, successive points in the dataset are joined by solid line
  406. segments, which form a polygonal line or polyline that we call simply a
  407. `line'. You may choose the style of line (the `linemode') with the
  408. @samp{-m} option:
  409. @example
  410. graph -T ps -m 2 < datafile > plot.ps
  411. @end example
  412. @noindent
  413. Here @samp{-m 2} indicates that linemode #2 should be used. @w{If the}
  414. dataset is rendered in monochrome, which is the default, the line can be
  415. drawn in one of five distinct styles. Linemodes #1 through #5 signify
  416. solid, dotted, dotdashed, shortdashed, and longdashed; thereafter the
  417. sequence repeats. @w{If the} @samp{-C} option is used, the dataset will
  418. be rendered in color. For colored datasets, the line can be drawn in
  419. one of 25 distinct styles. Linemodes #1 through #5 signify red, green,
  420. blue, magenta, and cyan; all are solid. Linemodes #6 through #10
  421. signify the same five colors, but dotted rather than solid. Linemodes
  422. #11 through #16 signify the same five colors, but dotdashed, and so
  423. forth. After linemode #25, the sequence repeats. Linemode #0,
  424. irrespective of whether the rendering is in monochrome or color, means
  425. that the line is not drawn.
  426. You may wish to @emph{fill} the polygon bounded by the line (i.e.,
  427. @w{shade it}, or fill it with a solid color). For this, you would use
  428. the @samp{-q} option. @w{For example},
  429. @example
  430. echo .1 .1 .1 .9 .9 .9 .9 .1 .1 .1 |
  431. graph -T ps -C -m 1 -q 0.3 > plot.ps
  432. @end example
  433. @noindent
  434. will plot a square region with vertices (0.1,0.1), (0.1,0.9), (0.9,0.9),
  435. and (0.9,0.1). The repetition of the first vertex (0.1,0.1) at the end
  436. of the sequence of vertices ensures that the square will be closed: all
  437. four segments of its boundary will be drawn. The square will be drawn
  438. in red, since the colored version of linemode #1 is requested. The
  439. interior of the square will be filled with red to an intensity @w{of
  440. 30%}, as the @samp{-q 0.3} option specifies. @w{If the} intensity
  441. @w{were 1.0}, the region would be filled with solid color, and if it
  442. @w{were 0.0}, the region would be filled with white. @w{If the}
  443. intensity were negative, the region would be unfilled, or transparent
  444. (the default).
  445. You may specify the thickness (`width') of the line, whether it is
  446. filled or not, by using the @samp{-W} option. @w{For example}, @samp{-W
  447. 0.01} specifies that the line should have a thickness equal to 0.01
  448. times the size of the graphics display. Also, you may put symbols at
  449. each data point along the line by doing, @w{for example},
  450. @example
  451. graph -T ps -S 3 0.1 < datafile > plot.ps
  452. @end example
  453. @noindent
  454. where the first argument 3 indicates which symbol to plot. The optional
  455. second argument 0.1 specifies the symbol size as a fraction of the size
  456. of the `plotting box': the square within which the plot is drawn.
  457. Symbol #1 is a dot, symbol #2 is a plus sign, symbol #3 is an asterisk,
  458. symbol #4 is a circle, symbol #5 is a cross, and so forth.
  459. (@xref{Marker Symbols}.) Symbols 1 through 31 are the same for all
  460. display types, and the color of a symbol will be the same as the color
  461. of the line it is plotted along.
  462. Actually, you would probably not want to plot symbols at each point in
  463. the dataset unless you turn off the line joining the points. For this
  464. purpose, the `negative linemode' concept is useful. @w{A line} whose
  465. linemode is negative is not visible; however, any symbols plotted along
  466. it will have the color associated with the corresponding positive
  467. linemode. So, @w{for example},
  468. @example
  469. graph -T ps -C -m -3 -S 4 < datafile > plot.ps
  470. @end example
  471. @noindent
  472. will plot a blue circle at each data point. The circles will not be
  473. joined by line segments. By adding the optional second argument to the
  474. @samp{-S} option, you may adjust the size of the circles.
  475. @code{graph} will automatically generate abscissa (@w{i.e., @math{x}})
  476. values for you if you use the @samp{-a} option. @w{If this} option is
  477. used, no abscissa values should be given in the data file. The data
  478. points will be taken to be regularly spaced along the abscissa. The two
  479. arguments following @samp{-a} on the command line will be taken as the
  480. sampling interval and the abscissa value of the first data point. @w{If
  481. they} are absent, they default to 1.0 and 0.0 respectively. For
  482. example, the command
  483. @example
  484. echo 0 1 0 | graph -T ps -a > plot.ps
  485. @end example
  486. @noindent
  487. produces exactly the same plot as
  488. @example
  489. echo 0 0 1 1 2 0 | graph -T ps > plot.ps
  490. @end example
  491. If the @samp{-I e} option is specified, @code{graph} will plot data with
  492. error bars. In this case the dataset should consist of triples
  493. (@math{x},@math{y},@i{error}), rather than pairs @math{(x,y)}. @w{A
  494. vertical} error bar of the appropriate length will be plotted at each
  495. data point. You would plot a symbol at each data point, along with the
  496. error bar, by using the @samp{-S} option in the usual way. The symbol
  497. will be the same for each point in the dataset. You may use the
  498. @samp{-a} option in conjunction with @samp{-I e}, if you wish. @w{If
  499. you} do, the dataset should contain no abscissa (@w{i.e., @math{x}})
  500. values.
  501. By default, the limits on the @math{x} and @math{y} axes, and the
  502. spacing between the labeled ticks on each axis, are computed
  503. automatically. You may wish to set them manually. You would accomplish
  504. this with the @samp{-x} and @samp{-y} options.
  505. @example
  506. echo 0 0 1 1 2 0 | graph -T ps -x -1 3 -y -1 2 > plot.ps
  507. @end example
  508. @noindent
  509. will produce a plot in which the @math{x} axis extends from @minus{}1
  510. @w{to 3}, and the @math{y} axis from @minus{}1 @w{to 2}. By default,
  511. @code{graph} tries to place about six numbered ticks on each axis. By
  512. including an optional third argument to @samp{-x} or @samp{-y}, you may
  513. manually set the spacing of the labeled ticks. @w{For example}, using
  514. @samp{-y -1 2 1} rather than @samp{-y -1 2} will produce a @w{@math{y}
  515. axis} with labeled ticks at @minus{}1, 0, 1, @w{and 2}, rather than at
  516. the locations that @code{graph} would choose by default, which would be
  517. @minus{}1, @minus{}0.5, 0, 0.5, 1, 1.5, @w{and 2}. @w{In general}, if a
  518. third argument is present then labeled ticks will be placed at each of
  519. its integer multiples.
  520. To make an axis logarithmic, you would use the @samp{-l} option. For
  521. example,
  522. @example
  523. echo 1 1 2 3 3 1 | graph -T ps -l x > plot.ps
  524. @end example
  525. @noindent
  526. will produce a plot in which the @math{x} axis is logarithmic, but the
  527. @math{y} axis is linear. To make both axes logarithmic, you would use
  528. @samp{-l x -l y}. By default, the upper and lower limits on a
  529. logarithmic axis are powers of ten, and there are tick marks at each
  530. power of ten and at its integer multiples. The tick marks at the powers
  531. of ten are labeled. @w{If the} axis spans more than five orders of
  532. magnitude, the tick marks at the integer multiples are omitted.
  533. If you have an unusually short logarithmic axis, you may need to
  534. increase the number of labeled ticks. To do this, you should specify a
  535. tick spacing manually. @w{For example}, @samp{-l x -x 1 9 2} would
  536. produce a plot in which the @w{@math{x} axis} is logarithmic and extends
  537. from 1 @w{to 9}. Labeled ticks would be located at each integer
  538. multiple @w{of 2}, i.e., at 2, 4, 6, @w{and 8}.
  539. You would label the @math{x} and @math{y} axes with the @samp{-X} and
  540. @samp{-Y} options, respectively. For example,
  541. @example
  542. echo 1 1 2 3 3 1 | graph -T ps -l x -X "A Logarithmic Axis" > plot.ps
  543. @end example
  544. @noindent
  545. will label the log axis in the preceding example. By default, the
  546. label for the @math{y} axis (@w{if any}) will be rotated 90 degrees,
  547. unless you use the @samp{-Q} option. (Some @w{X Window} System
  548. displays, both old and new, do not properly support rotated labels,
  549. and require the @samp{-Q} option.) You may specify a `top label', or
  550. title for the plot, by using the @samp{-L} option. Doing, @w{for
  551. example},
  552. @example
  553. echo 1 1 2 3 3 1 | graph -T ps -l x -L "A Simple Example" > plot.ps
  554. @end example
  555. @noindent
  556. will produce a plot with a title on top.
  557. The font size of the @math{x} axis and @math{y} axis labels may be
  558. specified with the @samp{-f} option, and the font size of the title with
  559. the @samp{--title-font-size} option. For example,
  560. @example
  561. echo 1 1 2 3 3 1 | graph -T ps -X "Abscissa" -f 0.1 > plot.ps
  562. @end example
  563. @noindent
  564. will produce a plot in which the font size of the @math{x} axis label,
  565. and each of the numerical tick labels, is very large (0.1 times the size
  566. of the plotting box, i.e., the square within which the plot is drawn).
  567. The font in which the labels specified with the @samp{-X}, @samp{-Y},
  568. and @samp{-L} options are drawn can be specified with the @samp{-F}
  569. option. For example, @samp{-F Times-Roman} will make the labels appear
  570. in Times-Roman instead of the default font (which is Helvetica, unless
  571. @samp{-T png}, @samp{-T pnm}, @samp{-T gif}, @samp{-T pcl}, @samp{-T
  572. hpgl}, @samp{-T regis}, or @samp{-T tek} is specified). Font names are
  573. case-insensitive, so @samp{-F times-roman} will work equally well. The
  574. available fonts include 35 Postscript fonts (for all variants of
  575. @code{graph} other than @code{graph -T png}, @code{graph -T pnm},
  576. @code{graph -T gif}, @code{graph -T pcl}, @code{graph -T hpgl},
  577. @code{graph -T regis}, and @code{graph -T tek}), 45 @w{PCL 5} fonts (for
  578. @code{graph -T svg}, @code{graph -T ai}, @code{graph -T pcl} and
  579. @code{graph -T hpgl}), a number of Hewlett--Packard vector fonts (for
  580. @code{graph -T pcl} and @code{graph -T hpgl}), and 22 Hershey vector
  581. fonts. The Hershey fonts include HersheyCyrillic, for Russian, and
  582. HersheyEUC, for Japanese. For a discussion of the available fonts, see
  583. @ref{Text Fonts}. The @code{plotfont} utility will produce a character
  584. map of any available font. @xref{plotfont}.
  585. The format of the labels drawn with the @samp{-X}, @samp{-Y}, and
  586. @samp{-L} options may be quite intricate. Subscripts, superscripts,
  587. square roots, and switching fonts within a typeface are all allowed.
  588. The above examples do not illustrate this, but for details, see
  589. @ref{Text String Format}.
  590. Each of the preceding examples produces a plot containing the default
  591. sort of grid (a square plotting box, with ticks and labels drawn along
  592. its lower edge and its left edge). There are actually several sorts of
  593. grid you may request. The @samp{@w{-g 0}}, @samp{@w{-g 1}}, @samp{@w{-g
  594. 2}}, and @samp{@w{-g 3}} options yield successively fancier grids. What
  595. they yield, respectively, is @w{no grid} @w{at all}, @w{a pair} of axes
  596. with ticks and labels, a square plotting box with ticks and labels, and
  597. a square plotting box with ticks, labels, and grid lines. As you can
  598. check, @samp{@w{-g 2}} is the default. There is also a @samp{@w{-g 4}}
  599. option, which yields a slightly different sort of grid: @w{a pair} of
  600. axes that cross at the origin. This last sort of grid is useful when
  601. the @math{x} @w{or @math{y}} coordinates of the data points you are
  602. plotting are both positive and negative.
  603. @node Non-Square Plots, Multiple Datasets, Simple Examples, graph
  604. @section Non-square, displaced, and rotated plots
  605. To alter the linear dimensions of the plotting box, and also to position
  606. it in a different part of the graphics display, you could do something
  607. like
  608. @example
  609. graph -T ps -h .3 -w .6 -r .1 -u .1 < datafile > plot.ps
  610. @end example
  611. @noindent
  612. Here the @samp{-h} and @samp{-w} options specify the height and width of
  613. the plotting box, and the @samp{-r} and @samp{-u} options indicate how
  614. far up and to the right the lower left corner of the plotting box should
  615. be positioned. All dimensions are expressed as fractions of the size of
  616. the graphics display. @w{By default}, the height and width of the
  617. plotting box equal 0.6, and the `upward shift' and the `rightward shift'
  618. @w{equal 0.2}. @w{So the} above example will produce a plot that is
  619. half as tall as usual. Compared to its usual position, the plot will be
  620. shifted slightly downward and to the left.
  621. Several command-line options specify sizes or dimensions as fractions of
  622. the size of the plotting box. For example, @samp{-S 3 .01} specifies
  623. that the marker symbols for the following dataset should be of @w{type
  624. #3}, and should have a font size equal @w{to 0.01}, i.e., 0.01 times the
  625. minimum dimension (height or width) of the plotting box. If the
  626. @samp{-h} or @samp{-w} options are employed to expand or contract the
  627. plot, such sizes or dimensions will scale in tandem. That is presumably
  628. the right thing @w{to do}.
  629. To rotate your plot by 90 degrees counterclockwise, you would add
  630. @samp{--rotation 90} to the @code{graph} command line. You would
  631. specify @samp{--rotation 180} to produce an upside-down plot. Any
  632. other angle may be specified, but angles other than 0, 90, 180, and
  633. 270 degrees are of interest primarily to postmodernists. The
  634. @samp{--rotation} option may be combined with the @samp{-h},
  635. @samp{-w}, @samp{-r}, and @samp{-u} options. If they appear together,
  636. the @samp{--rotation} option takes effect first. That is because
  637. @samp{--rotation} specifies the rotation angle of the graphics
  638. display, while the other options specify how the plotting box should
  639. be positioned within the graphics display. The two sorts of
  640. positioning are logically distinct.
  641. The graphics display (sometimes called the `viewport') is an
  642. abstraction. For @code{graph @w{-T X}}, it is a popped-up window on an
  643. @w{X display}. For @code{graph -T pnm} and @code{graph -T gif}, it is a
  644. square or rectangular bitmap. In these three cases, the size of the
  645. graphics display can be set by using the @samp{--bitmap-size} option, or
  646. by setting the @code{BITMAPSIZE} environment variable. For @code{graph
  647. -T tek}, the graphics display is a square region occupying the central
  648. part of a Tektronix display. (Tektronix displays are 4/3 times as wide
  649. as they are high.) For @code{graph -T regis}, it is a square region
  650. occupying the central part of a ReGIS display. For @code{graph -T ai},
  651. @code{graph -T ps}, @code{graph -T pcl}, and @code{graph -T fig}, @w{by
  652. default} it is a 8-inch square centered on an 8.5@dmn{in} by 11@dmn{in}
  653. page (@w{US letter} size). For @code{graph -T hpgl}, it is an 8-inch
  654. square, which by default is not centered. For @code{graph -T svg} and
  655. @code{graph -T cgm}, the default graphics display is an 8-inch square,
  656. though if the output file is placed on a Web page, it may be scaled
  657. arbitrarily.
  658. The page size, which determines the default display size used by
  659. @code{graph -T svg}, @code{graph -T ai}, @code{graph -T ps}, @code{graph
  660. -T cgm}, @code{graph -T fig}, @code{graph -T pcl}, and @code{graph -T
  661. hpgl}, can be set by using the @samp{--page-size} option, or by setting
  662. the environment variable @code{PAGESIZE}@. @w{For example}, setting the
  663. page size to "a4" would produce output for an A4-size page (21@dmn{cm}
  664. by 29.7@dmn{cm}), and would select a appropriate graphics display size.
  665. Either or both of the dimensions of the graphics display can be
  666. specified explicitly. For example, the page size could be specified as
  667. "letter,xsize=4in", or "a4,xsize=10cm,ysize=15cm". The dimensions of
  668. the graphics display are allowed to be negative (@w{a negative}
  669. dimension results in a reflection).
  670. The position of the display on the page, relative to its default
  671. position, may optionally be adjusted by specifying an offset vector.
  672. For example, the page size could be specified as "letter,yoffset=1.2in",
  673. or "a4,xoffset=@minus{}5mm,yoffset=2.0cm". @w{It is} also possible to
  674. position the graphics display precisely, by specifying the location of
  675. its lower left corner relative to the lower left corner of the page.
  676. For example, the page size could be specified as
  677. "letter,xorigin=2in,yorigin=3in", or "a4,xorigin=0.5cm,yorigin=0.5cm".
  678. The preceding options may be intermingled. However, @code{graph -T svg}
  679. and @code{graph -T cgm} ignore the "xoffset", "yoffset", "xorigin", and
  680. "yorigin" options, since SVG format and WebCGM format have no notion of
  681. the Web page on which the graphics display will ultimately be
  682. positioned. They interpret the "xsize" and "ysize" options as
  683. specifying a default size for the graphics display (@w{it is} merely a
  684. default, since the output file may be scaled arbitrarily when it is
  685. placed on a Web page).
  686. For more information on page and graphics display sizes, see @ref{Page
  687. and Viewport Sizes}.
  688. @node Multiple Datasets, Multiplotting, Non-Square Plots, graph
  689. @section Preparing a plot from more than one dataset
  690. It is frequently the case that several datasets need to be displayed on
  691. the same plot. @w{If so}, you may wish to distinguish the points in
  692. different datasets by joining them by lines of different types, or by
  693. using marker symbols of different types.
  694. A more complicated example would be the following. You may have a file
  695. containing a dataset that is the result of experimental observations,
  696. and a file containing closely spaced points that trace out a theoretical
  697. curve. The second file is a dataset in its own right. You would
  698. presumably plot it with line segments joining successive data points, so
  699. as to trace out the theoretical curve. But the first dataset, resulting
  700. from experiment, would be plotted without such line segments. @w{In
  701. fact}, a marker symbol would be plotted at each of its points.
  702. These examples, and others like them, led us to define a set of seven
  703. @emph{attributes} that define the way a dataset should be plotted.
  704. These attributes, which can be set by command-line options, are the
  705. following.
  706. @enumerate
  707. @item color/monochrome
  708. @item linemode
  709. @item linewidth
  710. @item symbol type
  711. @item symbol size
  712. @item symbol font name
  713. @item fill fraction
  714. @end enumerate
  715. @noindent
  716. Color/monochrome (a choice of one or the other) is the simplest. The
  717. choice is toggled with the @samp{-C} option. The `linemode' (i.e., line
  718. style) specifies how the line segments joining successive points should
  719. be drawn; it is specified with the @samp{-m} option. Linemode #0 means
  720. no linemode @w{at all}, @w{for example}. `Linewidth' means line
  721. thickness; @w{it is} specified with the @samp{-W} option. `Symbol type'
  722. and `symbol size', which are specified with the @samp{-S} option,
  723. specify the symbol plotted at each point of the dataset. `Symbol font
  724. name' refers to the font from which marker symbols #32 and above, which
  725. are taken to be characters rather than geometric symbols, are selected.
  726. @w{It is} set with the @samp{--symbol-font-name} option, and is relevant
  727. only if @samp{-S} is used to request such special marker symbols.
  728. Finally, the polygonal line joining the points in a dataset may be
  729. @emph{filled}, to create a filled or shaded polygon. The `fill
  730. fraction' is set with the @samp{-q} option. @w{A negative} fill
  731. fraction means no fill, or transparent; zero means white, and 1.0 means
  732. solid, or fully colored.
  733. The preceding seven attributes refer to the way in which datasets are
  734. plotted. Datasets may also differ from one another in the way in which
  735. they are read from files. The dataset(s) in a file may or may not
  736. contain error bars, @w{for example}. @w{If a} file contains data with
  737. error bars, the @samp{-I e} option should occur on the command line
  738. before the file name. (The @samp{-I} option specifies the input format
  739. for the following files.)
  740. The following illustrates how datasets in three different input files
  741. could be plotted simultaneously.
  742. @example
  743. graph -T ps -m 0 -S 3 file1 -C -m 3 file2 -C -W 0.02 file3 > output.ps
  744. @end example
  745. @noindent
  746. The dataset in @code{file1} will be plotted in linemode #0, so
  747. successive points will not be joined by lines. But symbol #3 (an
  748. asterisk) will be plotted at each point. The dataset in @code{file2}
  749. will be plotted in color, and linemode #3 will be used. In color
  750. plotting, linemode #3 is interpreted as a solid blue line. The second
  751. @samp{-C} on the command line turns off color for @code{file3}. The
  752. points in the third dataset will be joined by a black line with
  753. thickness 0.02, as a fraction of the size (i.e., minimum dimension) of
  754. the graphics display.
  755. The above command line could be made even more complicated by specifying
  756. additional options (e.g., @samp{-q} or @samp{-I}) before each file.
  757. @w{In fact} the command line could also include such standard options as
  758. @samp{-x} or @samp{-y}, which specify the range of each axis. Such
  759. options, which refer to the plot as a whole rather than to individual
  760. datasets, should appear before the first file name. @w{For example},
  761. you could do
  762. @example
  763. graph -T ps -x 0 1 0.5 -m 0 -S 3 file1 -C -m 3 file2 > output.ps
  764. @end example
  765. @noindent
  766. Note that it is possible to include the special file @w{name @samp{-}},
  767. which refers to standard input, on the command line. So you may pipe
  768. the output of another program into @code{graph}. You may even generate
  769. a plot @w{in part} from piped output, and @w{in part} from files.
  770. Each input file may include more than one dataset. If so, the command
  771. line options preceding a file on the command line will take effect for
  772. all datasets in that file. There are two exceptions to this. @w{By
  773. default}, the linemode is incremented (`bumped') from one dataset to the
  774. next. This feature is usually quite convenient. @w{For example}, if
  775. you do
  776. @example
  777. graph -T ps -m 3 file1 > output.ps
  778. @end example
  779. @noindent
  780. the first dataset in @code{file1} will appear in linemode #3, the second
  781. in linemode #4, etc. @w{In fact}, if you do
  782. @example
  783. graph -T ps file1 file2 @dots{} > output.ps
  784. @end example
  785. @noindent
  786. without specifying linemode explicitly, the successive datasets read
  787. from the files on the command line will appear in linemode #1, linemode
  788. #2,@: @dots{}. @w{If you} do not like this feature, you may turn it
  789. off, or in general @w{toggle it}, by using the @samp{-B} option.
  790. You may also control manually the linemode and symbol type used for the
  791. datasets within any file. You would do this by including directives in
  792. the file itself, rather than on the command line. For example, if the
  793. line
  794. @example
  795. #m=-5,S=10
  796. @end example
  797. @noindent
  798. appeared in an ASCII-format input file, it would be interpreted as a
  799. directive to switch to linemode #@minus{}5 and symbol type #10 for the
  800. following dataset. Future releases of @code{graph} may provide the
  801. ability to set each of the seven dataset attributes in this way.
  802. @node Multiplotting, Data Formats, Multiple Datasets, graph
  803. @section Multiplotting: placing multiple plots on a single page
  804. It is occasionally useful to display several plots at once on a single
  805. page, or on a single graphics display. We call such a composite plot a
  806. @emph{multiplot}. One common sort of multiplot is a small plot inset
  807. into a larger one. Another sort is two or more plots side by side.
  808. @code{graph} can draw multiplots consisting of an arbitrarily large
  809. number of plots. When multiplotting, @code{graph} draws each plot in
  810. its own `virtual display'. When an ordinary plot is drawn, the virtual
  811. display is the same as the physical display. But when a plot of a
  812. multiplot is drawn, the virtual display may be any smaller square
  813. region. The following two-plot example illustrates the idea.
  814. @example
  815. graph -T X datafile1 --reposition .35 .35 .3 datafile2
  816. @end example
  817. @noindent
  818. Here @code{datafile1} is plotted in the usual way. The
  819. @samp{--reposition} option, which serves as a separator between plots,
  820. specifies that the second plot will be drawn in a virtual display. For
  821. the purposes of the @samp{--reposition} option, the physical display is
  822. a square with lower left corner (0.0,0.0) and upper right corner
  823. (1.0,1.0). @w{In those} coordinates the virtual display will be a
  824. square of size 0.3, with lower left corner (0.35,0.35). @w{So the}
  825. second plot will be inset into the first.
  826. Just as the @samp{-w}, @samp{-h}, @samp{-r}, and @samp{-u} options may
  827. be used to set the size and position of a plotting box within the
  828. physical display, so they may be used to set the size and position of a
  829. plotting box within a virtual display. For example,
  830. @example
  831. graph -T X datafile1 --reposition .35 .35 .3 -w .4 -r .3 datafile2
  832. @end example
  833. @noindent
  834. will yield a two-plot multiplot in which the second plot is
  835. significantly different. Its plotting box will have a width only 0.4
  836. times the width of the virtual display. However, the plotting box will
  837. be centered within the virtual display, since the distance between the
  838. left edge of the plotting box and the left edge of the virtual display
  839. will be @w{0.3 times} the width of the virtual display.
  840. By convention, before each plot of a multiplot other than the first is
  841. drawn, a `blankout region' surrounding its plotting box is erased.
  842. (@w{That is}, @w{it is} filled with white, or whatever the background
  843. @w{color is}.) This erasure prevents the plots from overlapping and
  844. producing a messy result. @w{By default}, the blankout region is a
  845. rectangular region 30% larger in each dimension than the plotting box
  846. for the plot. That is appropriate if the plot is a small one that is
  847. inset into the first plot. @w{It may} not be appropriate, however,
  848. @w{if you} are preparing a multiplot in which several plots appear side
  849. by side. You may use the @samp{--blankout} option to adjust this
  850. parameter. @w{For example}, specifying @samp{--blankout 1.0} will make
  851. the blankout region for a plot coincide with its plotting box.
  852. Specifying @samp{--blankout 0.0} will prevent any blanking out from
  853. occurring. The blankout parameter may be set more than once, @w{so as}
  854. to differ from plot to plot.
  855. It should be emphasized that every plot in a multiplot is a plot in its
  856. own right. All the usual options (@samp{-m}, @samp{-S}, @samp{-x},
  857. @samp{-y}, etc.) can be applied to each plot separately. The options
  858. for a plot should occur on the @code{graph} command line immediately
  859. after the @samp{--reposition} option that applies to it. Each plot may
  860. be prepared from more than a single dataset, also. The names of the
  861. data files for each plot should occur on the command line before the
  862. following @samp{--reposition} option, @w{if any}.
  863. @node Data Formats, graph Invocation, Multiplotting, graph
  864. @section Reading binary and other data formats
  865. By default, @code{graph} reads datasets in ASCII format. But it can
  866. also read datasets in any of three binary formats (single precision
  867. floating point, double precision floating point, and integer).
  868. These three input formats are specified by the @samp{-I d}, @samp{-I f},
  869. and @samp{-I i} options, respectively.
  870. There are two advantages to using binary data: @w{1) @code{graph}} runs
  871. significantly faster because the computational overhead for converting
  872. data from ASCII to binary is eliminated, and @w{2) the} input files may
  873. be significantly smaller. @w{If you} have very large datasets, using
  874. binary format may reduce storage and runtime costs.
  875. For example, you may create a single precision binary dataset as output
  876. from a C language program:
  877. @example
  878. @group
  879. #include <stdio.h>
  880. void write_point (float x, float y)
  881. @{
  882. fwrite(&x, sizeof (float), 1, stdout);
  883. fwrite(&y, sizeof (float), 1, stdout);
  884. @}
  885. @end group
  886. @end example
  887. @noindent
  888. You may plot data written this way by doing:
  889. @example
  890. graph -T ps -I f < binary_datafile > plot.ps
  891. @end example
  892. @ifnottex
  893. @noindent
  894. The inclusion of multiple datasets within a single binary file is
  895. supported. If a binary file contains more than a single dataset,
  896. successive datasets should be separated by a single occurrence of the
  897. the largest possible number. For single precision datasets this is the
  898. quantity @code{FLT_MAX}, for double precision datasets it is the
  899. quantity @code{DBL_MAX}, and for integer datasets it is the quantity
  900. @code{INT_MAX}@. @w{On most} machines @code{FLT_MAX} is approximately
  901. 3.4x10^38, @code{DBL_MAX} is approximately 1.8x10^308, and
  902. @code{INT_MAX} is 2^32-1.
  903. @end ifnottex
  904. @tex
  905. @noindent
  906. The inclusion of multiple datasets within a single binary file is
  907. supported. If a binary file contains more than a single dataset,
  908. successive datasets should be separated by a single occurrence of the
  909. the largest possible number. For single precision datasets this is the
  910. quantity @code{FLT_MAX}, for double precision datasets it is the
  911. quantity @code{DBL_MAX}, and for integer datasets it is the quantity
  912. @code{INT_MAX}. @w{On most} machines @code{FLT_MAX} is approximately
  913. $3.4\times10^{38}$, @code{DBL_MAX} is approximately $1.8\times10^{308}$,
  914. and @code{INT_MAX} is $2^{31}-1$.
  915. @end tex
  916. If you are reading datasets from more than one file, it is not required
  917. that the files be in the same format. For example,
  918. @example
  919. graph -T ps -I f binary_datafile -I a ascii_datafile > plot.ps
  920. @end example
  921. @noindent
  922. will read @code{binary_datafile} in @samp{f} (binary single precision)
  923. format, and @code{datafile} in @samp{a} (normal ASCII) format.
  924. There is currently no support for reading and plotting binary data with
  925. error bars. If you have data with error bars, you should supply the data
  926. to @code{graph} in ASCII, and use the @samp{-I e} option.
  927. @code{graph} can also read data files in the ASCII `table' format
  928. produced by the @code{gnuplot} plotting program. For this, you should
  929. use the @samp{-I g} option. Such a data file may consist of more than
  930. one dataset.
  931. To sum up: there are six supported data formats, @samp{a} (normal
  932. ASCII), @samp{e} (ASCII with error bars), @samp{g} (the ASCII `table'
  933. format produced by @code{gnuplot}), @samp{f} (binary single precision),
  934. @samp{d} (binary double precision), and @samp{i} (binary integer).
  935. Input files may be in any of these six formats.
  936. @node graph Invocation, , Data Formats, graph
  937. @section @code{graph} command-line options
  938. The @code{graph} program reads one or more datasets from files named
  939. on the command line or from standard input, and prepares a plot. The
  940. output format is specified with the @samp{-T} option.
  941. By default, @code{graph} reads ASCII data from the files specified on
  942. the command line. The data are pairs of numbers, interpreted as the
  943. @math{x} @w{and @math{y}} coordinates of data points. If no files are
  944. specified, or the file @w{name @samp{-}} is specified, the standard
  945. input is read. An output file is written to standard output, unless the
  946. @samp{-T X} option is specified. @w{In that} case the graph is
  947. displayed in a popped-up window on an @w{X Window} System display, and
  948. there is no output file.
  949. There are many command-line options for adjusting the visual appearance
  950. of the plot. The relative order of file names and command-line options
  951. is important. Only the options that precede a file name on the command
  952. line take effect for that file.
  953. The following sections list the possible options. Each option that
  954. takes an argument is followed, in parentheses, by the type and default
  955. value of the argument. There are five sorts of option.
  956. @iftex
  957. @enumerate
  958. @item
  959. Options affecting an entire plot. (@xref{Plot Options}.)
  960. @item
  961. Options affecting the reading and drawing of individual datasets within a plot.
  962. (@xref{Dataset Options}.)
  963. @item
  964. Options for multiplotting (drawing several plots at once).
  965. (@xref{Multiplot Options}.)
  966. @item
  967. Options relevant only to raw @code{graph}, i.e., relevant only if no
  968. output format is specified with the @samp{-T} option. (@xref{Raw
  969. graph Options}.)
  970. @item
  971. Options requesting information (e.g., @samp{--help}).
  972. (@xref{Info Options}.)
  973. @end enumerate
  974. @end iftex
  975. @ifnottex
  976. The behavior of @code{graph} is also affected by a number of environment
  977. variables, so there is a section discussing them as well.
  978. @end ifnottex
  979. @menu
  980. * Plot Options:: Options affecting an entire plot
  981. * Dataset Options:: Options affecting the reading and plotting of datasets
  982. * Multiplot Options:: Options for drawing several plots at once
  983. * Raw graph Options:: Options relevant only to raw graph
  984. * Info Options:: Options requesting information (e.g., ---help)
  985. * graph Environment:: Environment variables
  986. @end menu
  987. @node Plot Options, Dataset Options, graph Invocation, graph Invocation
  988. @subsection Plot options
  989. The following options affect an entire plot. They should normally occur
  990. at most once, and should appear on the command line before the first
  991. file name. @w{If a} multiplot is being drawn, they may (with the
  992. exception of the @samp{-T} option) occur more than once. @w{If so}, the
  993. second and later occurrences should be placed on the command line
  994. immediately after each @samp{--reposition @var{x} @var{y}} option, which
  995. separates the plots in a multiplot.
  996. @table @samp
  997. @item -T @var{type}
  998. @itemx --output-format @var{type}
  999. (String, default "meta".) Select an output format of type @var{type},
  1000. which may be one of the strings "X", "png", "pnm", "gif", "svg", "ai",
  1001. "ps", "cgm", "fig", "pcl", "hpgl", "regis", "tek", and "meta". These
  1002. refer respectively to the @w{X Window System}, PNG format, portable
  1003. anymap (PBM/PGM/PPM) format, pseudo-GIF format, the XML-based Scalable
  1004. Vector Graphics format, the format used by Adobe Illustrator,
  1005. @code{idraw}-editable Postscript, the WebCGM format for Web-based
  1006. vector graphics, the format used by the @code{xfig} drawing editor,
  1007. the Hewlett--Packard @w{PCL 5} printer language, the Hewlett--Packard
  1008. Graphics Language (@w{by default}, HP-GL/2), the ReGIS (remote
  1009. graphics instruction set) format developed @w{by DEC}, Tektronix
  1010. format, and device-independent GNU graphics metafile format. The
  1011. option @samp{--display-type} is an obsolete alternative to
  1012. @samp{--output-format}.
  1013. @item -E @var{x|y}
  1014. @itemx --toggle-axis-end @var{x|y}
  1015. Set the position of the indicated axis to be on the other end of the
  1016. plotting box from what is currently the case. E.g., @samp{-E y} will
  1017. cause the @math{y} axis to appear on the right of the plot rather than
  1018. the left, which is the default. Similarly, @samp{-E x} will cause the
  1019. @w{@math{x} axis} to appear at the top of the plot rather than the
  1020. bottom. Note that if the @w{@math{x} axis} appears at the top, @w{no
  1021. plot} title will be drawn, since there will be no room.
  1022. @item -f @var{size}
  1023. @itemx --font-size @var{size}
  1024. (Float, default 0.0525.) Set the size of the font used for the axis and
  1025. tick labels to be @var{size}. The size is specified as a fraction of
  1026. the minimum dimension (width or height) of the plotting box.
  1027. @item -F @var{font_name}
  1028. @itemx --font-name @var{font_name}
  1029. (String, default "Helvetica" except for @code{graph -T pcl}, for which
  1030. "Univers" is the default, and @code{graph -T png}, @code{graph -T pnm},
  1031. @code{graph -T gif}, @code{graph -T hpgl}, @code{graph -T regis},
  1032. @code{graph -T tek}, and raw @code{graph}, for all of which
  1033. "HersheySerif" is the default.) Set the font used for the axis and tick
  1034. labels, and for the plot title @w{(if any)}, to be @var{font_name}. The
  1035. choice of font for the plot title may be overridden with the
  1036. @samp{--title-font-name} option (see below). Font names are
  1037. case-insensitive. @w{If the} specified font is not available, the
  1038. default font will be used. Which fonts are available depends on which
  1039. @samp{-T} option is used. For a list of all fonts, see @ref{Text
  1040. Fonts}. The @code{plotfont} utility will produce a character map of any
  1041. available font. @xref{plotfont}.
  1042. @item -g @var{grid_style}
  1043. @itemx --grid-style @var{grid_style}
  1044. (Integer in the range 0@dots{}4, default 2.) Set the grid style for the
  1045. plot to be @var{grid_style}. Grid styles 0 @w{through 3} are
  1046. progressively more fancy, but @w{style 4} is a somewhat different style.
  1047. @enumerate 0
  1048. @item no axes, tick marks or labels.
  1049. @item a pair of axes, with tick marks and labels.
  1050. @item a pair of axes, box around plot, with tick marks and labels.
  1051. @item a pair of axes, box around plot, with tick marks and labels; also grid lines.
  1052. @item axes intersect at the origin, with tick marks and labels.
  1053. @item box around plot, with tick marks and labels.
  1054. @end enumerate
  1055. @item -h @var{height}
  1056. @itemx --height-of-plot @var{height}
  1057. (Float, default 0.6.) Set the fractional height of the plot with
  1058. respect to the height of the display (or virtual display, in the case of
  1059. a multiplot) to be @var{height}. @w{A value} of 1.0 will produce a
  1060. plotting box that fills the entire available area. Since labels and
  1061. tick marks may be placed outside the plotting box, values considerably
  1062. less than 1.0 are normally chosen.
  1063. @item -H
  1064. @itemx --toggle-frame-on-top
  1065. Toggle whether or not a copy of the plot frame should be drawn on top of
  1066. the plot, @w{as well} as @w{beneath it}. This option is useful when the
  1067. plotted dataset(s) project slightly beyond the frame, which can happen
  1068. if a large line thickness or symbol size is specified.
  1069. @item -k @var{length}
  1070. @itemx --tick-size @var{length}
  1071. (Float, default .02.) Set the length of the tick marks on each axis to
  1072. be @var{length}. @w{A value} of 1.0 produces tick marks whose length is
  1073. equal to the minimum dimension (width or height) of the plotting box.
  1074. @w{A negative} @var{length} yields tick marks that extend outside the
  1075. box, rather than inside.
  1076. @item -K @var{clip_mode}
  1077. @itemx --clip-mode @var{clip_mode}
  1078. (Integer, default 1.) Set the clip mode for the plot to
  1079. @var{clip_mode}. The clip mode is relevant only if data points are
  1080. being joined by a line, and the line is not being filled to create a
  1081. filled region (since filled regions are clipped in a fixed way).
  1082. There are three clip modes: 0, 1, @w{and 2}. They have the same meaning
  1083. as in the @code{gnuplot} plotting program. Clip @w{mode 0} means that a
  1084. line segment joining two data points will be plotted only if neither
  1085. point is outside the plotting box. Clip @w{mode 1} means that it will
  1086. be plotted if no more than one of the two points is outside, and clip
  1087. @w{mode 2} means that it will be plotted even if both are outside.
  1088. @w{In all} three clip modes the line segment will be clipped to the
  1089. plotting box.
  1090. @item -l @var{x|y}
  1091. @itemx --toggle-log-axis @var{x|y}
  1092. Set the specified axis to be a log axis rather than a linear axis, or
  1093. vice versa. By default, both axes are linear axes.
  1094. @item -L @var{top_label}
  1095. @itemx --top-label @var{top_label}
  1096. (String, default empty.) Place the text string @var{top_label} above
  1097. the plot, as its `top label', i.e., title. The string may include
  1098. escape sequences (@pxref{Text String Format}). The
  1099. @samp{--title-font-size} option may be used to specify the size of the
  1100. font. The font is normally the same as the font used for labeling axes
  1101. and ticks, as selected by the @samp{-F} option. But this can be
  1102. overridden with the @samp{--title-font-name} option.
  1103. @item -N @var{x|y}
  1104. @itemx --toggle-no-ticks @var{x|y}
  1105. Toggle the presence of ticks and tick labels on the specified axis.
  1106. This applies to the grid styles that normally include ticks and tick
  1107. labels, i.e., grid styles 1, 2, 3, @w{and 4}.
  1108. @item -Q
  1109. @itemx --toggle-rotate-y-label
  1110. Position the label on the @math{y} axis (which is set with the
  1111. @samp{-Y} option) horizontally instead of vertically, or vice versa.
  1112. By default, the label is rotated, so that it is parallel to the
  1113. @w{@math{y} axis}. But some output devices (e.g., old @w{X Window}
  1114. System displays, and buggy new ones) cannot handle rotated fonts. So
  1115. if you specify @samp{-T X}, you may also @w{need @samp{-Q}}.
  1116. @item -r @var{right}
  1117. @itemx --right-shift @var{right}
  1118. (Float, default 0.2.) Move the plot to the right by a fractional amount
  1119. @var{right} with respect to the width of the display (or virtual
  1120. display, in the case of a multiplot). This produces a margin on the
  1121. left side of the plotting box. @w{A value} of 0.5 will produce a margin
  1122. half the width of the available area. Note that the tick marks and
  1123. labels are drawn in the margin.
  1124. @item -R @var{x|y}
  1125. @itemx --toggle-round-to-next-tick @var{x|y}
  1126. Toggle whether or not the upper and lower limits of the specified axis
  1127. should be expanded, so that they both become integer multiples of the
  1128. spacing between labeled tick marks.
  1129. This option is meaningful whenever the user specifies either or both of
  1130. the limits, by using the @samp{-x} or @samp{-y} option. @w{If the} user
  1131. leaves both limits unspecified, they will always be chosen to satisfy
  1132. the `integer multiple' constraint.
  1133. @item -s
  1134. @itemx --save-screen
  1135. Save the screen. This option requests that @code{graph} not erase the
  1136. output device before it begins to plot.
  1137. This option is relevant only to @code{graph -T tek} and raw
  1138. @code{graph}. Tektronix displays and emulators are persistent, in the
  1139. sense that previously drawn graphics remain visible. So by repeatedly
  1140. using @code{graph -T tek -s}, you can @w{build up} a multiplot.
  1141. @item -t
  1142. @itemx --toggle-transpose-axes
  1143. Transpose the abscissa and ordinate. This causes the axes to be
  1144. interchanged, and the options that apply to each axis to be applied to
  1145. the opposite axis. That is, data points are read in as @math{(y, x)}
  1146. pairs, and such options as @samp{-x} and @samp{-X} apply to the
  1147. @w{@math{y} axis} rather than the @w{@math{x} axis}. @w{If the}
  1148. @samp{-I e} option is in force, so that the data points are read with
  1149. error bars, the orientation of the error bars will be switched between
  1150. vertical and horizontal.
  1151. @item -u @var{up}
  1152. @itemx --upward-shift @var{up}
  1153. (Float, default 0.2.) Move the plot up by a fractional amount @var{up}
  1154. with respect to the height of the display (or virtual display, in the
  1155. case of a multiplot). This produces a margin below the plotting box.
  1156. @w{A value} of 0.5 will produce a margin half the height of the
  1157. available area. Note that the tick marks and labels are drawn in the
  1158. margin.
  1159. @item -w @var{width}
  1160. @itemx --width-of-plot @var{width}
  1161. (Float, default 0.6.) Set the fractional width of the plot with respect
  1162. to the width of the display (or virtual display, in the case of a
  1163. multiplot) to be @var{width}. @w{A value} of 1.0 will produce a
  1164. plotting box that fills the entire available area. Since labels and
  1165. tick marks may be placed outside the plotting box, values considerably
  1166. less than 1.0 are normally chosen.
  1167. @item -x [@var{lower_limit} [@var{upper_limit} [@var{spacing}]]]
  1168. @itemx --x-limits [@var{lower_limit} [@var{upper_limit} [@var{spacing}]]]
  1169. (Floats.) The arguments @var{lower_limit} and @var{upper_limit} specify
  1170. the limits of the @w{@math{x} axis}, and the optional argument
  1171. @var{spacing} specifies the spacing of labeled ticks along the axis.
  1172. @w{If any} of the three arguments is missing or is supplied @w{as
  1173. @samp{-}} (i.e., as a single hyphen), @w{it is} computed from the data.
  1174. Both arguments @var{lower_limit} and @var{upper_limit} must be present
  1175. if @code{graph} is to act as a real-time filter.
  1176. By default, the supplied limit(s) are strictly respected. However, the
  1177. @samp{-R x} option may be used to request that they be rounded to the
  1178. nearest integer multiple of the spacing between labeled ticks. The
  1179. lower limit will be rounded downward, and the upper limit upward.
  1180. @item -X @var{x_label}
  1181. @itemx --x-label @var{x_label}
  1182. (String, default empty.) Set the label for the @math{x} axis to be the text
  1183. string @var{x_label}. The string may include escape sequences
  1184. (@pxref{Text String Format}). The @samp{-F} and @samp{-f} options may
  1185. be used to specify the name of the font and the size of the font.
  1186. @item -y [@var{lower_limit} [@var{upper_limit} [@var{spacing}]]]
  1187. @itemx --y-limits [@var{lower_limit} [@var{upper_limit} [@var{spacing}]]]
  1188. (Floats.) The arguments specify the limits of the @math{y} axis, and
  1189. the spacing of labeled ticks along it, as for the @w{@math{x} axis} (see
  1190. above). Both arguments @var{lower_limit} and @var{upper_limit} must be
  1191. present if @code{graph} is to act as a real-time filter.
  1192. By default, the supplied limit(s) are strictly respected. However, the
  1193. @samp{-R y} option may be used to request that they be rounded to the
  1194. nearest multiple of the tick spacing. The lower limit will be rounded
  1195. downward, and the upper limit upward.
  1196. @item -Y @var{y_label}
  1197. @itemx --y-label @var{y_label}
  1198. (String, default empty.) Set the label for the @math{y} axis to be
  1199. the text string @var{y_label}. The string may include escape
  1200. sequences (@pxref{Text String Format}). The label will be rotated by
  1201. 90 degrees so that it is parallel to the axis, unless the @samp{-Q}
  1202. option is used. (Some @w{X Window} System displays, both old and new,
  1203. do not properly support rotated labels, so that if you specify
  1204. @samp{-T X}, you may also need @samp{-Q}.) The @samp{-F} and
  1205. @samp{-f} options can be used to specify the name of the font and the
  1206. size of the font.
  1207. @item --bg-color @var{name}
  1208. (String, default "white".) Set the color used for the plot background
  1209. to be @var{name}. This is relevant only to @code{graph @w{-T X}},
  1210. @code{graph -T png}, @code{graph -T pnm}, @code{graph -T gif},
  1211. @code{graph -T cgm}, @code{graph -T regis}, and @code{graph -T meta}.
  1212. @w{An unrecognized} name sets the color to the default. For information
  1213. on what names are recognized, see @ref{Color Names}. The environment
  1214. variable @code{BG_COLOR} can equally well be used to specify the
  1215. background color.
  1216. If the @samp{-T png} or @samp{-T gif} option is used, a transparent PNG
  1217. file or a transparent pseudo-GIF, respectively, may be produced by
  1218. setting the @code{TRANSPARENT_COLOR} environment variable to the name of
  1219. the background color. @xref{graph Environment}. @w{If the} @samp{-T
  1220. svg} or @samp{-T cgm} option is used, an output file without a
  1221. background may be produced by setting the background color to "none".
  1222. @item --bitmap-size @var{bitmap_size}
  1223. (String, default "570x570".) Set the size of the graphics display in
  1224. which the plot will be drawn, in terms of pixels, to be
  1225. @var{bitmap_size}. This is relevant only to @code{graph @w{-T X}},
  1226. @code{graph -T png}, @code{graph -T pnm}, and @code{graph -T gif}, for
  1227. all of which the size can be expressed in terms of pixels. The
  1228. environment variable @code{BITMAPSIZE} may equally well be used to
  1229. specify the size.
  1230. The graphics display used by @code{graph -T X} is a popped-up @w{X
  1231. window}. Command-line positioning of this window on an @w{X Window}
  1232. System display is supported. For example, if @var{bitmap_size} is
  1233. "570x570+0+0" then the window will be @w{popped up} in the upper left
  1234. corner.
  1235. If you choose a rectangular (non-square) window size, the fonts in the
  1236. plot will be scaled anisotropically, i.e., by different factors in the
  1237. horizontal and vertical direction. Any font that cannot easily be
  1238. anisotropically scaled will be replaced by a default scalable font,
  1239. such as the Hershey vector font "HersheySerif".
  1240. For backward compatibility, @code{graph -T X} allows the user to set the
  1241. window size and position by setting the @w{X resource}
  1242. @code{Xplot.geometry}, instead of @samp{--bitmap-size} or
  1243. @code{BITMAPSIZE}@.
  1244. @item --emulate-color @var{option}
  1245. (String, default "no".) If @var{option} is "yes", replace each color in
  1246. the output by an appropriate shade of gray. This is seldom useful,
  1247. except when using @samp{graph -T pcl} to prepare output for a @w{PCL 5}
  1248. device. (Many monochrome @w{PCL 5} devices, such as monochrome
  1249. LaserJets, do a poor job of emulating color on their own. They usually
  1250. map HP-GL/2's seven standard pen colors, including even yellow, to
  1251. black.) You may equally well request color emulation by setting the
  1252. environment variable @code{EMULATE_COLOR} to "yes".
  1253. @item --frame-color @var{name}
  1254. (String, default "black".) Set the color used for drawing the plot
  1255. frame, and for drawing monochrome datasets @w{(if any)} to be
  1256. @var{name}. @w{An unrecognized} name sets the color to the default.
  1257. For information on what names are recognized, see @ref{Color Names}.
  1258. @item --frame-line-width @var{frame_line_width}
  1259. (Float, default @minus{}1.0.) Set the thickness of lines in the plot
  1260. frame, as a fraction of the size (i.e., minimum dimension) of the
  1261. graphics display, to @var{frame_line_width}. @w{A negative} value means
  1262. that the default value for the line thickness provided by the GNU
  1263. @code{libplot} graphics library should be used. This is usually 1/850
  1264. times the size of the display, although if @samp{-T X}, @samp{-T png},
  1265. @samp{-T pnm}, or @samp{-T gif} is specified, it is zero. By
  1266. convention, a zero-thickness line is the thinnest line that can be
  1267. drawn. This is the case in all output formats. Note, however, that the
  1268. drawing editors @code{idraw} and @code{xfig} treat zero-thickness lines
  1269. as invisible.
  1270. @code{graph -T tek} and @code{graph -T regis} do not support drawing
  1271. lines with other than a default thickness, and @code{graph -T hpgl} does
  1272. not support @w{doing so} if the environment variable @code{HPGL_VERSION}
  1273. is set to a value less @w{than "2"} (the default).
  1274. @item --max-line-length @var{max_line_length}
  1275. (Integer, default 500.) Set the maximum number of points that a
  1276. polygonal line drawn through any dataset may contain, before it is
  1277. flushed to the output device, to equal @var{max_line_length}. @w{If
  1278. this} flushing occurs, the polygonal line will be split into two or more
  1279. sub-lines, though the splitting should not be noticeable. Splitting
  1280. will not take place if the @samp{-q} option, which requests filling, is
  1281. used.
  1282. The reason for splitting long polygonal lines is that some display
  1283. devices (e.g., old Postscript printers and HP-GL pen plotters) have
  1284. limited buffer sizes. The environment variable @code{MAX_LINE_LENGTH}
  1285. can also be used to specify the maximum line length. This option has no
  1286. effect on @code{graph -T tek} or raw @code{graph}, since they draw
  1287. polylines in real time and have no buffer limitations.
  1288. @item --page-size @var{pagesize}
  1289. (String, default "letter".) Set the size of the page on which the plot
  1290. will be positioned. This is relevant only to @code{graph -T svg},
  1291. @code{graph -T ai}, @code{graph -T ps}, @code{graph -T cgm}, @code{graph
  1292. -T fig}, @code{graph -T pcl}, and @code{graph -T hpgl}. "letter" means
  1293. an 8.5@dmn{in} by 11@dmn{in} page. Any ISO page size in the range
  1294. "a0"@dots{}"a4" or ANSI page size in the range "a"@dots{}"e" may be
  1295. specified ("letter" is an alias @w{for "a"} and "tabloid" is an alias
  1296. @w{for "b"}). "legal", "ledger", @w{and "b5"} are recognized page sizes
  1297. also. The environment variable @code{PAGESIZE} can equally well be used
  1298. to specify the page size.
  1299. For @code{graph -T ai}, @code{graph -T ps}, @code{graph -T pcl}, and
  1300. @code{graph -T fig}, the graphics display (or `viewport') within which
  1301. the plot is drawn will be, by default, a square region centered on the
  1302. specified page. For @code{graph -T hpgl}, it will be a square region of
  1303. the same size, but may be positioned differently. Either or both of the
  1304. dimensions of the graphics display can be specified explicitly. For
  1305. example, @var{pagesize} could be specified as "letter,xsize=4in", or
  1306. "a4,xsize=10cm,ysize=15cm". The dimensions are allowed to be negative
  1307. (@w{a negative} dimension results in a reflection).
  1308. The position of the graphics display, relative to its default
  1309. position, may optionally be adjusted by specifying an offset vector.
  1310. For example, @var{pagesize} could be specified as
  1311. "letter,yoffset=1.2in", or "a4,xoffset=@minus{}5mm,yoffset=2.0cm".
  1312. @w{It is} also possible to position the graphics display precisely, by
  1313. specifying the location of its lower left corner relative to the lower
  1314. left corner of the page. For example, @var{pagesize} could be
  1315. specified as "letter,xorigin=2in,yorigin=3in", or
  1316. "a4,xorigin=0.5cm,yorigin=0.5cm". The preceding options may be
  1317. intermingled.
  1318. @code{graph -T svg} and @code{graph -T cgm} ignore the "xoffset",
  1319. "yoffset", "xorigin", and "yorigin" options, since SVG format and
  1320. WebCGM format have no notion of the Web page on which the graphics
  1321. display will ultimately be positioned. However, they do respect the
  1322. "xsize" and "ysize" options. For more on page sizes, see @ref{Page
  1323. and Viewport Sizes}.
  1324. @item --pen-colors @var{colors}
  1325. (String, default "1=red:2=green:3=blue:4=magenta:5=cyan".) Set the
  1326. colors of the pens used for drawing plots, as numbered, to be
  1327. @var{colors}. The format should be self-explanatory. @w{An
  1328. unrecognized} name sets the corresponding color to the default. For
  1329. information on what names are recognized, see @ref{Color Names}.
  1330. @item --rotation @var{angle}
  1331. (Integer, default 0.) Set the rotation angle of the graphics display
  1332. to be @var{angle} degrees. The rotation is counterclockwise. The
  1333. environment variable @code{ROTATION} can equally well be used to
  1334. specify the rotation angle.
  1335. This option is used for switching between portrait and landscape
  1336. orientations, which have rotation angles @w{0 and} 90 degrees
  1337. respectively. Postmodernists may also find it useful.
  1338. @item --title-font-name @var{font_name}
  1339. (String, default "Helvetica" except for @code{graph -T pcl}, for which
  1340. "Univers" is the default, and @code{graph -T png}, @code{graph -T pnm},
  1341. @code{graph -T gif}, @code{graph -T hpgl}, @code{graph -T regis}, and
  1342. @code{graph -T tek}, for all of which "HersheySerif" is the default.)
  1343. Set the font used for the plot title to be @var{font_name}. Normally
  1344. the font used for the plot title is the same as that used for labeling
  1345. the axes and the ticks along the axes, as specified by the @samp{-F}
  1346. option. But the @samp{--title-font-name} option can be used to override
  1347. this. Font names are case-insensitive. @w{If the} specified font is
  1348. not available, the default font will be used. Which fonts are available
  1349. depends on which @samp{-T} option is used. For a list of all fonts, see
  1350. @ref{Text Fonts}. The @code{plotfont} utility will produce a character
  1351. map of any available font. @xref{plotfont}.
  1352. @item --title-font-size @var{size}
  1353. (Float, default 0.07.) Set the size of the font used for the top label
  1354. (`title'), as specified by the @samp{-L} option, to be @var{size}. The
  1355. size is specified as a fraction of the minimum dimension (width or
  1356. height) of the plotting box.
  1357. @end table
  1358. @node Dataset Options, Multiplot Options, Plot Options, graph Invocation
  1359. @subsection Dataset options
  1360. The following options affect the way in which individual datasets are
  1361. read from files, and drawn as part of a plot. They should appear on the
  1362. command line before the file containing the datasets whose reading or
  1363. rendering they will affect. They may appear more than once on a command
  1364. line, if more than one file is to be read.
  1365. The following three options affect the way in which datasets are read
  1366. from files.
  1367. @table @samp
  1368. @item -I @var{data-format}
  1369. @itemx --input-format @var{data-format}
  1370. This specifies which format the subsequent input file(s) are in.
  1371. @table @samp
  1372. @item a
  1373. ASCII format. Each input file is a sequence of floating point numbers,
  1374. interpreted as the @math{x} @w{and @math{y}} coordinates of the
  1375. successive data points in a dataset. The @math{x} @w{and @math{y}}
  1376. coordinates of a point need not appear on the same line, and points need
  1377. not appear on different lines. But if a blank line occurs (i.e., two
  1378. newlines in succession are seen), @w{it is} interpreted as the end of a
  1379. dataset, and the beginning of the next.
  1380. @item e
  1381. ASCII format, including error bars. Similar to @samp{a} format, except
  1382. that triples (@math{x},@math{y},@i{error}) appear instead of pairs
  1383. @math{(x,y)}.
  1384. @item g
  1385. The ASCII `table' format produced by the @code{gnuplot} plotting program.
  1386. @item f
  1387. @ifnottex
  1388. Single precision binary format. Each input file is a sequence of single
  1389. precision floating point numbers, interpreted as forming pairs
  1390. (@math{x},@math{y}). Successive datasets are separated by a single
  1391. occurrence of the quantity @code{FLT_MAX}, which is the largest possible
  1392. single precision floating point number. @w{On most} machines this is
  1393. approximately 3.4x10^38.
  1394. @end ifnottex
  1395. @tex
  1396. Single precision binary format. Each input file is a sequence of single
  1397. precision floating point numbers, interpreted as forming pairs
  1398. (@math{x},@math{y}). Successive datasets are separated by a single
  1399. occurrence of the quantity @code{FLT_MAX}, which is the largest possible
  1400. single precision floating point number. @w{On most} machines this is
  1401. approximately $3.4\times10^{38}$.
  1402. @end tex
  1403. @item d
  1404. @ifnottex
  1405. Double precision binary format. Each input file is a sequence of double
  1406. precision floating point numbers, interpreted as forming pairs
  1407. (@math{x},@math{y}). Successive datasets are separated by a single
  1408. occurrence of the quantity @code{DBL_MAX}, which is the largest possible
  1409. double precision floating point number. @w{On most} machines this is
  1410. approximately 1.8x10^308.
  1411. @end ifnottex
  1412. @tex
  1413. Double precision binary format. Each input file is a sequence of double
  1414. precision floating point numbers, interpreted as forming pairs
  1415. (@math{x},@math{y}). Successive datasets are separated by a single
  1416. occurrence of the quantity @code{DBL_MAX}, which is the largest possible
  1417. double precision floating point number. @w{On most} machines this is
  1418. approximately $1.8\times10^{308}$.
  1419. @end tex
  1420. @item i
  1421. @ifnottex
  1422. Integer binary format. Each input file is a sequence of integers,
  1423. interpreted as forming pairs (@math{x},@math{y}). Successive datasets
  1424. are separated by a single occurrence of the quantity @code{INT_MAX},
  1425. which is the largest possible integer. @w{On most} machines this is
  1426. 2^31-1.
  1427. @end ifnottex
  1428. @tex
  1429. Integer binary format. Each input file is a sequence of integers,
  1430. interpreted as forming pairs (@math{x},@math{y}). Successive datasets
  1431. are separated by a single occurrence of the quantity @code{INT_MAX},
  1432. which is the largest possible integer. @w{On most} machines this is
  1433. $2^{31}-1$.
  1434. @end tex
  1435. @end table
  1436. @item -a [@var{step_size} [@var{lower_limit}]]
  1437. @itemx --auto-abscissa [@var{step_size} [@var{lower_limit}]]
  1438. (Floats, defaults 1.0 and 0.0.) Automatically generate abscissa
  1439. (@math{x}) values. Irrespective of data format (@samp{a}, @samp{e},
  1440. @samp{f}, @samp{d}, @w{or @samp{i}}), this option specifies that the
  1441. abscissa (@math{x}) values are missing from the input file: the
  1442. dataset(s) to be read contain only ordinate (@math{y}) values. The
  1443. increment from each @w{@math{x} value} to the next will be
  1444. @var{step_size}, and the first @w{@math{x} value} will be
  1445. @var{lower_limit}. @w{To return} to reading abscissa values from the
  1446. input, i.e., for subsequent input files, you would use @samp{-a 0},
  1447. which disables automatic generation of the abscissa values and returns
  1448. @var{step_size} and @var{lower_limit} to their default values.
  1449. @item -B
  1450. @itemx --toggle-auto-bump
  1451. By default, the linemode (set with @samp{-m}, see below) is `bumped'
  1452. (incremented by unity) at the beginning of each new dataset. This
  1453. option toggles auto-bumping: @w{it turns} it off if it was on, and on if
  1454. it was off.
  1455. @end table
  1456. The following options affect the way in which individual datasets are
  1457. drawn as part of a plot. These options set the six `attributes' (symbol
  1458. type, symbol font, linemode, line thickness, fill fraction, and
  1459. color/monochrome) that each dataset has.
  1460. @table @samp
  1461. @item -m @var{line_mode}
  1462. @itemx --line-mode @var{line_mode}
  1463. (Integer, default 1.) @var{line_mode} specifies the mode (i.e., style)
  1464. of the lines drawn between successive points in a dataset. By
  1465. convention, linemode #0 means no line @w{at all} (data points are
  1466. disconnected). @w{If the} dataset is being rendered in monochrome, the
  1467. interpretation of @var{line_mode} is as follows.
  1468. @enumerate
  1469. @item solid
  1470. @item dotted
  1471. @item dotdashed
  1472. @item shortdashed
  1473. @item longdashed
  1474. @end enumerate
  1475. Thereafter (i.e., for @var{line_mode} greater than 5) the sequence of
  1476. five linemodes repeats. So besides linemode #0, there are a total of
  1477. five distinct monochrome linemodes. @w{If the} dataset is being
  1478. rendered in color (as may be requested with the @samp{-C} option), the
  1479. interpretation of linemodes #1 through #5 is instead
  1480. @enumerate
  1481. @item red, solid
  1482. @item green, solid
  1483. @item blue, solid
  1484. @item magenta, solid
  1485. @item cyan, solid
  1486. @end enumerate
  1487. Linemodes #6 through #10 use the same five colors, but are dotted;
  1488. linemodes #11 through #15 are dotdashed; linemodes #16 through #20 are
  1489. shortdashed; and linemodes #21 through #25 are longdashed. So besides
  1490. linemode #0, there are a total of 25 distinct colored linemodes. @w{A
  1491. negative} linemode indicates that no line should be drawn, but that the
  1492. marker symbol, @w{if any} (see below), should be in the color of the
  1493. corresponding positive linemode.
  1494. @item -S [@var{symbol_number} [@var{symbol_size}]]
  1495. @itemx --symbol [@var{symbol_number} [@var{symbol_size}]]
  1496. (Integer and float, defaults 0 and 0.03.) Draw a marker symbol at each
  1497. data point. @var{symbol_number} specifies the symbol type, and
  1498. @var{symbol_size} specifies the font size of the symbol, as a fraction
  1499. of the minimum dimension (width or height) of the plotting box. @w{If
  1500. the} dataset is being rendered in color, the symbol will have the color
  1501. of the line that is being drawn to connect the data points.
  1502. If you use the @samp{-S} option, you would usually also use the
  1503. @samp{-m} option, to request that the symbols be drawn without any line
  1504. connecting them. By specifying a negative argument @w{to @samp{-m}}
  1505. (@w{a `negative} linemode'), you may obtain colored symbols.
  1506. The following table lists the first few symbols (by convention,
  1507. @w{symbol #0} means @w{no symbol} @w{at all}).
  1508. @enumerate
  1509. @item dot
  1510. @tex
  1511. ($\thinspace\cdot\thinspace$)
  1512. @end tex
  1513. @item plus (@math{+})
  1514. @item asterisk (@math{*})
  1515. @item circle
  1516. @tex
  1517. ($\circ$)
  1518. @end tex
  1519. @item cross
  1520. @tex
  1521. ($\times$)
  1522. @end tex
  1523. @end enumerate
  1524. Marker symbols 0@dots{}31 are furnished by the GNU @code{libplot}
  1525. graphics library. @xref{Marker Symbols}. Symbol numbers greater than
  1526. or equal @w{to 32} are interpreted as characters in a symbol font, which
  1527. can be set with the @samp{--symbol-font-name} option (see below).
  1528. @item -W @var{line_width}
  1529. @itemx --line-width @var{line_width}
  1530. (Float, default @minus{}1.0.) Set the thickness of the lines used to
  1531. join successive points in a dataset, as a fraction of the size (i.e.,
  1532. minimum dimension) of the graphics display, to @var{line_width}. @w{A
  1533. negative} value means that the default value for the line thickness
  1534. provided by the GNU @code{libplot} graphics library should be used.
  1535. This is usually 1/850 times the size of the display, although if
  1536. @samp{-T X}, @samp{-T png}, @samp{-T pnm}, or @samp{-T gif} is
  1537. specified, it is zero. By convention, a zero-thickness line is the
  1538. thinnest line that can be drawn. This is the case in all output
  1539. formats. Note, however, that the drawing editors @code{idraw} and
  1540. @code{xfig} treat zero-thickness lines as invisible.
  1541. @code{graph -T tek} and @code{graph -T regis} do not support drawing
  1542. lines with other than a default thickness, and @code{graph -T hpgl} does
  1543. not support @w{doing so} if the environment variable @code{HPGL_VERSION}
  1544. is set to a value less @w{than "2"} (the default).
  1545. @item -q @var{fill_fraction}
  1546. @itemx --fill-fraction @var{fill_fraction}
  1547. (Float, default @minus{}1.0.) If successive points in a dataset are
  1548. joined by line segments, set the shading intensity for the polygon
  1549. formed by the line segments to be @var{fill_fraction}. @w{A solid}
  1550. polygon (i.e., one filled with the `pen color' used for drawing the line
  1551. segments) is obtained by choosing @var{fill_fraction}=1.0. The interior
  1552. of the polygon will be white if @var{fill_fraction}=0.0. The polygon
  1553. will be unfilled (transparent) if @var{fill_fraction} is negative.
  1554. @w{If the} polygon intersects itself, the `even-odd fill rule' will
  1555. normally be used to determine which points are inside rather than
  1556. outside, i.e., to determine which portions of the polygon should be
  1557. shaded. The even-odd fill rule is explained in the @cite{Postscript
  1558. Language Reference Manual}.
  1559. The @samp{-q} option has no effect on @code{graph -T tek}, and it is
  1560. only partly effective in @code{graph -T hpgl} if the environment
  1561. variable @code{HPGL_VERSION} is set to a value less @w{than "2"} (the
  1562. default).
  1563. @item -C
  1564. @itemx --toggle-use-color
  1565. Toggle between color and monochrome rendering of datasets. The
  1566. interpretation of linemode depends on whether the rendering is being
  1567. performed in color or monochrome; see the @samp{-m} option above.
  1568. @item --symbol-font-name @var{symbol_font_name}
  1569. (String, default "ZapfDingbats" unless @samp{-T png}, @samp{-T pnm},
  1570. @samp{-T gif}, @samp{-T pcl}, @samp{-T hpgl}, @samp{-T regis}, or
  1571. @code{@w{-T tek}} is specified, in which case it is "HersheySerif".)
  1572. Set the symbol font, from which marker symbols numbered 32 and higher
  1573. are selected, to be @var{symbol_font_name}. Font names are
  1574. case-insensitive. @w{If the} specified font is not available, the
  1575. default font will be used. Which fonts are available depends on which
  1576. @samp{-T} option is used. For example, if the @samp{-T pcl} or @samp{-T
  1577. hpgl} option is used then normally the Wingdings font, which is an
  1578. alternative source of symbols, becomes available. For a list of all
  1579. fonts, see @ref{Text Fonts}. The @code{plotfont} utility will produce a
  1580. character map of any available font. @xref{plotfont}.
  1581. @end table
  1582. @node Multiplot Options, Raw graph Options, Dataset Options, graph Invocation
  1583. @subsection Multiplot options
  1584. The following options are used for multiplotting (placing more than a
  1585. single plots on a display, or a page). The @samp{--reposition}
  1586. directive serves as a separator, on the command line, between the
  1587. options and file names that apply to successive plots.
  1588. @table @samp
  1589. @item --reposition @var{x} @var{y} @var{size}
  1590. (Floats, defaults 0.0, 0.0, 1.0) Set the `virtual display' within which
  1591. the next plot will be drawn to be a square of size @var{size}, with
  1592. lower left corner (@var{x},@var{y}). Normalized coordinates are used
  1593. here: (0,0) means the lower left corner of the physical display and
  1594. (1,1) means the upper right corner of the physical display. The size of
  1595. the plot within the virtual display may be adjusted with the @samp{-h}
  1596. and @samp{-w} options, and its position within the virtual display with
  1597. the @samp{-u} and @samp{-w} options. After a @samp{--reposition}
  1598. directive, the arguments of those four options will be interpreted in
  1599. terms of the virtual display, not the physical display.
  1600. @item --blankout @var{blankout_fraction}
  1601. (Float, default 1.3.) Before each additional plot of a multiplot is
  1602. drawn, the region of the display that the plot will occupy is cleared.
  1603. If @var{blankout_fraction}=1.3, @w{a region} @w{30% larger} in each
  1604. dimension is cleared. If, for example, @var{blankout_fraction}=1.0, the
  1605. region covered by the plot's plotting box, and @w{no more}, is cleared.
  1606. The default value, 1.3, is appropriate for inset plots. @w{1.0 would}
  1607. be appropriate for side by side plots.
  1608. @code{graph -T tek} cannot clear regions, and @code{graph -T hpgl}
  1609. cannot clear them if the environment variables @code{HPGL_VERSION} and
  1610. @code{HPGL_OPAQUE_MODE} are set to non-default values (i.e., values
  1611. other than @w{"2" and "yes"}, respectively).
  1612. @end table
  1613. @node Raw graph Options, Info Options, Multiplot Options, graph Invocation
  1614. @subsection Raw @code{graph} options
  1615. The following option is relevant only to raw @code{graph}, i.e., is
  1616. relevant only if no output format is specified with the @samp{-T}
  1617. option. In this case @code{graph} outputs a graphics metafile, which
  1618. may be translated to other formats by invoking @code{plot}. This
  1619. option should appear on the command line before any file names, since
  1620. it affects the output of the plot (or multiplot) as a whole.
  1621. @table @samp
  1622. @item -O
  1623. @itemx --portable-output
  1624. Output the portable (human-readable) version of GNU metafile format,
  1625. rather than a binary version (the default). This can also be requested
  1626. by setting the environment variable @code{META_PORTABLE} to "yes".
  1627. @end table
  1628. @node Info Options, graph Environment, Raw graph Options, graph Invocation
  1629. @subsection Informational options
  1630. The following options request information.
  1631. @table @samp
  1632. @item --help
  1633. Print a list of command-line options, and then exit.
  1634. @item --help-fonts
  1635. Print a table of available fonts, and then exit. The table will
  1636. depend on which output format is specified with the @samp{-T} option.
  1637. @code{graph @w{-T X}}, @code{graph -T svg}, @code{graph -T ai},
  1638. @code{graph -T ps}, @code{graph -T cgm}, and @code{graph -T fig} each
  1639. support the 35 standard Postscript fonts. @code{graph -T svg},
  1640. @code{graph -T ai}, @code{graph -T pcl}, and @code{graph -T hpgl}
  1641. support the 45 standard @w{PCL 5} fonts, and @code{graph -T pcl} and
  1642. @code{graph -T hpgl} support a number of Hewlett--Packard vector
  1643. fonts. All of the preceding, together with @code{graph -T png},
  1644. @code{graph -T pnm}, @code{graph -T gif}, @code{graph -T regis}, and
  1645. @code{graph -T tek}, support a set of 22 Hershey vector fonts. Raw
  1646. @code{graph} @w{in principle} supports any of these fonts, since its
  1647. output must be translated to other formats with @code{plot}. The
  1648. @code{plotfont} utility will produce a character map of any available
  1649. font. @xref{plotfont}.
  1650. @item --list-fonts
  1651. Like @samp{--help-fonts}, but lists the fonts in a single column to
  1652. facilitate piping to other programs. @w{If no} output format is
  1653. specified with the @samp{-T} option, the full set of supported fonts
  1654. is listed.
  1655. @item --version
  1656. Print the version number of @code{graph} and the plotting utilities
  1657. package, and exit.
  1658. @end table
  1659. @node graph Environment, , Info Options, graph Invocation
  1660. @section Environment variables
  1661. The behavior of @code{graph} is affected by several environment
  1662. variables. We have already mentioned the environment variables
  1663. @code{BITMAPSIZE}, @code{PAGESIZE}, @code{BG_COLOR},
  1664. @code{EMULATE_COLOR}, @code{MAX_LINE_LENGTH}, and @code{ROTATION}@.
  1665. They serve as backups for the several options @samp{--bitmap-size},
  1666. @samp{--page-size}, @samp{--bg-color}, @samp{--emulate-color},
  1667. @samp{--max-line-length}, and @samp{--rotation}. The remaining
  1668. environment variables are specific to individual output formats.
  1669. @code{graph @w{-T X}}, which pops up a window on an @w{X Window} System
  1670. display and draws graphics @w{in it}, checks the @code{DISPLAY}
  1671. environment variable. The value of this variable determines the display
  1672. on which the window will be @w{popped up}.
  1673. @code{graph -T png} and @code{graph -T gif}, which produce output in PNG
  1674. and pseudo-GIF format respectively, are affected by two environment
  1675. variables. If the value of the @code{INTERLACE} variable is "yes", the
  1676. output file will be interlaced. Also, if the value of the
  1677. @code{TRANSPARENT_COLOR} environment variable is the name of a color
  1678. that appears in the output file, that color will be treated as
  1679. transparent by most applications. For information on what color names
  1680. are recognized, see @ref{Color Names}.
  1681. @code{graph -T pnm}, which produces output in Portable Anymap
  1682. (PBM/PGM/PPM) format, is affected by the @code{PNM_PORTABLE} environment
  1683. variable. If its value is "yes", the output file will be in the
  1684. portable (human readable) version of PBM, PGM, or PPM format, rather
  1685. than the default (binary) version.
  1686. @code{graph -T cgm}, which produces CGM files that comply with the
  1687. WebCGM profile for Web-based vector graphics, is affected by two
  1688. environment variables. By default, a @w{version 3} CGM file is
  1689. generated. Many older CGM interpreters and viewers, such as the ones
  1690. built into Microsoft Office and other commercial software, only support
  1691. @w{version 1} CGM files. The @code{CGM_MAX_VERSION} environment
  1692. variable may be set to "1", "2", "3", @w{or "4"} (the default) to
  1693. specify an maximum value for the version number. The
  1694. @code{CGM_ENCODING} variable may also be set, to specify the type of
  1695. encoding used in the CGM file. Supported values are "clear_text" (i.e.,
  1696. human readable) and "binary" (the default). The WebCGM profile requires
  1697. that the binary encoding be used.
  1698. @code{graph -T pcl}, which produces @w{PCL 5} output for
  1699. Hewlett--Packard printers, is affected by the environment variable
  1700. @code{PCL_ASSIGN_COLORS}@. It should be set to "yes" when producing
  1701. @w{PCL 5} output for a color printer or other color device. This will
  1702. ensure accurate color reproduction by giving the output device complete
  1703. freedom in assigning colors, internally, to its ``logical pens''. If it
  1704. is "no" then the device will use a fixed set of colored pens, and will
  1705. emulate other colors by shading. The default is "no" because monochrome
  1706. @w{PCL 5} devices, which are more common than colored ones, must use
  1707. shading to emulate color.
  1708. @code{graph -T hpgl}, which produces Hewlett--Packard Graphics Language
  1709. output, is also affected by several environment variables. The most
  1710. important is @code{HPGL_VERSION}, which may be set to "1", "1.5", @w{or
  1711. "2"} (the default). @w{"1" means} that the output should be generic
  1712. HP-GL, @w{"1.5" means} that the output should be suitable for the
  1713. HP7550A graphics plotter and the HP758x, HP7595A and HP7596A drafting
  1714. plotters (HP-GL with some HP-GL/2 extensions), and @w{"2" means} that
  1715. the output should be modern HP-GL/2. @w{If the} version is "1" @w{or
  1716. "1.5"} then the only available fonts will be vector fonts, and all lines
  1717. will be drawn with a default thickness (the @samp{-W} option will not
  1718. work). Additionally, if the version @w{is "1"} then the filling of
  1719. arbitrary curves with solid color will not be supported (the @samp{-q}
  1720. option may be used to fill circles and rectangles aligned with the
  1721. coordinate axes, though).
  1722. The position of the @code{graph -T hpgl} graphics display on the page
  1723. can be rotated @w{90 degrees} counterclockwise by setting the
  1724. @code{HPGL_ROTATE} environment variable to "yes". This is not the same
  1725. as the rotation obtained with the @samp{--rotation} option, since it
  1726. both rotates the graphics display and repositions its lower left corner
  1727. toward another corner of the page. Besides "no" and "yes", recognized
  1728. values for the @code{HPGL_ROTATE} variable are "0", "90", "180", @w{and
  1729. "270"}. @w{"no" and} "yes" are equivalent to @w{"0" and "90"},
  1730. respectively. "180" and "270" are supported only if @code{HPGL_VERSION}
  1731. @w{is "2"} (the default).
  1732. @emph{Opaque} filling and the drawing of visible white lines are
  1733. supported only if @code{HPGL_VERSION} is "2" (the default) and the
  1734. environment variable @code{HPGL_OPAQUE_MODE} is "yes" (the default).
  1735. @w{If the} value is "no" then opaque filling will not be used, and white
  1736. lines (@w{if any}), which are normally drawn with @w{pen #0}, will not
  1737. be drawn. This feature is to accommodate older HP-GL/2 devices.
  1738. HP-GL/2 pen plotters, @w{for example}, do not support opacity or the use
  1739. of @w{pen #0} to draw visible white lines. Some older HP-GL/2 devices
  1740. reportedly malfunction if asked to draw opaque objects.
  1741. @w{By default}, @code{graph -T hpgl} will draw with a fixed set of pens.
  1742. Which pens are present may be specified by setting the @code{HPGL_PENS}
  1743. environment variable. If @code{HPGL_VERSION} @w{is "1"}, the default
  1744. value of @code{HPGL_PENS} is "1=black"; if @code{HPGL_VERSION} is
  1745. "1.5" @w{or "2"}, the default value of @code{HPGL_PENS} is
  1746. "1=black:2=red:3=green:4=yellow:5=blue:6=magenta:7=cyan". The format
  1747. should be self-explanatory. By setting @code{HPGL_PENS}, you may
  1748. specify a color for any pen in the range #1@dots{}#31. For information
  1749. on what color names are recognized, see @ref{Color Names}. @w{Pen #1}
  1750. must always be present, though it need not be black. Any pen in
  1751. the range #2@dots{}#31 may be omitted.
  1752. If @code{HPGL_VERSION} is "2" then @code{graph -T hpgl} will also be
  1753. affected by the environment variable @code{HPGL_ASSIGN_COLORS}@. @w{If
  1754. the} value of this variable is "yes", then @code{graph -T hpgl} will not
  1755. be restricted to the palette specified in @code{HPGL_PENS}: @w{it will}
  1756. assign colors to ``logical pens'' in the range #1@dots{}#31, @w{as
  1757. needed}. The default value is "no" because other than color LaserJet
  1758. printers and DesignJet plotters, not many HP-GL/2 devices allow the
  1759. assignment of colors to logical pens. In particular, HP-GL/2 pen
  1760. plotters do not.
  1761. @code{graph -T tek}, which produces output for a Tektronix terminal or
  1762. emulator, checks the @code{TERM} environment variable. @w{If the} value
  1763. of @code{TERM} is a string beginning with "xterm", "nxterm", or "kterm",
  1764. @w{it is} taken as a sign that @code{graph} is running in an @w{X
  1765. Window} System VT100 terminal emulator: @w{an @code{xterm}},
  1766. @code{nxterm}, or @code{kterm}. Before drawing graphics, @code{graph -T
  1767. tek} will emit an escape sequence that causes the terminal emulator's
  1768. auxiliary Tektronix window, which is normally hidden, to @w{pop up}.
  1769. After the graphics are drawn, an escape sequence that returns control to
  1770. the original VT100 window will be emitted. The Tektronix window will
  1771. remain on the screen.
  1772. If the value of @code{TERM} is a string beginning with "kermit",
  1773. "ansi.sys", or "nansi.sys", @w{it is} taken as a sign that @code{graph}
  1774. is running in the VT100 terminal emulator provided by the MS-DOS version
  1775. of @code{kermit}. Before drawing graphics, @code{graph -T tek} will
  1776. emit an escape sequence that switches the terminal emulator to Tektronix
  1777. mode. Also, some of the Tektronix control codes emitted by @code{graph
  1778. -T tek} will be @code{kermit}-specific. There will be a limited amount
  1779. of color support, which is not normally the case (the 16 @code{ansi.sys}
  1780. colors will be supported). After drawing graphics, @code{graph -T tek}
  1781. will emit an escape sequence that returns the emulator to VT100 mode.
  1782. The key sequence `@w{ALT minus}' can be employed manually within
  1783. @code{kermit} to switch between the two modes.
  1784. @node plot, pic2plot, graph, Top
  1785. @chapter The @code{plot} Program
  1786. @menu
  1787. * plot Examples:: How to use a plot filter
  1788. * plot Invocation:: Command-line options
  1789. * plot Environment:: Environment variables
  1790. @end menu
  1791. @node plot Examples, plot Invocation, plot, plot
  1792. @section How to use @code{plot}
  1793. The GNU plot filter @code{plot} displays GNU graphics metafiles or
  1794. translates them to other formats. @w{It will} take input from files
  1795. specified on the command line or from standard input. The @samp{-T}
  1796. option is used to specify the desired output format. Supported output
  1797. formats include "X", "png", "pnm", "gif", "svg", "ai", "ps", "cgm",
  1798. "fig", "pcl", "hpgl", "regis", "tek", and "meta" (the default).
  1799. The metafile format is a device-independent format for storage of vector
  1800. graphics. By default, it is a binary rather than a human-readable
  1801. format (@pxref{Metafiles}). Each of the @code{graph}, @code{pic2plot},
  1802. @code{tek2plot}, and @code{plotfont} utilities will write a graphics
  1803. metafile to standard output if no @samp{-T} option is specified on its
  1804. command line. The GNU @code{libplot} graphics library may also be used
  1805. to produce metafiles. Metafiles may contain arbitrarily many pages of
  1806. graphics, but each metafile produced by @code{graph} contains only a
  1807. single page.
  1808. @code{plot}, like the metafile format itself, is useful if you wish to
  1809. preserve a vector graphics file, and display or edit it with more than
  1810. one drawing editor. The following example shows how you may do this.
  1811. To produce a plot of data arranged as alternating @math{x} and @math{y}
  1812. coordinates in an ASCII file, you may use @code{graph} as follows:
  1813. @example
  1814. graph < datafile > test.meta
  1815. @end example
  1816. @noindent
  1817. The file @file{test.meta} will be a single-page graphics metafile.
  1818. Similarly, to create in metafile format a plot consisting of a simple
  1819. figure, you may do:
  1820. @example
  1821. echo 0 0 1 1 2 0 | spline | graph > test.meta
  1822. @end example
  1823. @noindent
  1824. To display any such plot on an @w{X Window} System display, you
  1825. would do
  1826. @example
  1827. plot -T X test.meta
  1828. @end example
  1829. @noindent
  1830. or
  1831. @example
  1832. plot -T X < test.meta
  1833. @end example
  1834. @noindent
  1835. To print the plot on a Postscript printer, you would do something
  1836. like
  1837. @example
  1838. plot -T ps < test.meta | lpr
  1839. @end example
  1840. @noindent
  1841. To edit it with the free @code{idraw} drawing editor, you would do
  1842. @example
  1843. @group
  1844. plot -T ps < test.meta > test.ps
  1845. idraw test.ps
  1846. @end group
  1847. @end example
  1848. @noindent
  1849. To produce a PNG file, you would do
  1850. @example
  1851. plot -T png < test.meta > test.png
  1852. @end example
  1853. @noindent
  1854. To produce a ``portable anymap'' (a file in PBM, PGM, or PPM format,
  1855. whichever is most appropriate) you would do
  1856. @example
  1857. plot -T pnm < test.meta > test.pnm
  1858. @end example
  1859. @noindent
  1860. and to produce a pseudo-GIF file, you would do
  1861. @example
  1862. plot -T gif < test.meta > test.gif
  1863. @end example
  1864. @noindent
  1865. Similarly, to produce versions of the plot in SVG format and WebCGM
  1866. format that can be displayed in a Web browser with SVG and WebCGM
  1867. support, you would do
  1868. @example
  1869. plot -T svg < test.meta > test.svg
  1870. plot -T cgm < test.meta > test.cgm
  1871. @end example
  1872. @noindent
  1873. To produce a version of the plot that can be viewed and edited with
  1874. Adobe Illustrator, you would do
  1875. @example
  1876. plot -T ai < test.meta > test.ai
  1877. @end example
  1878. @noindent
  1879. and to produce a version that can be viewed and edited with the free
  1880. @code{xfig} drawing editor, you would do
  1881. @example
  1882. @group
  1883. plot -T fig < test.meta > test.fig
  1884. xfig test.fig
  1885. @end group
  1886. @end example
  1887. @noindent
  1888. Other formats may be obtained by using @code{plot -T pcl}, @code{plot -T
  1889. hpgl}, @code{plot -T regis}, and @code{plot -T tek}.
  1890. @code{plot} may behave differently depending on the environment in which
  1891. it is invoked. In particular, @code{plot -T svg}, @code{plot -T ai},
  1892. @code{plot -T ps}, @code{plot -T cgm}, @code{plot -T fig}, @code{plot -T
  1893. pcl}, and @code{plot -T hpgl} are affected by the environment variable
  1894. @code{PAGESIZE}@. @code{plot @w{-T X}}, @code{plot -T png}, @code{plot
  1895. -T pnm}, and @code{plot -T gif} are affected by the environment variable
  1896. @code{BITMAPSIZE}@. The @code{DISPLAY} environment variable affects the
  1897. operation of @code{plot @w{-T X}}, and the @code{TERM} environment
  1898. variable affects the operation of @code{plot -T tek}. There are also
  1899. several environment variables that affect the operation of @code{plot -T
  1900. pcl} and @code{plot -T hpgl}. For a complete discussion of the effects
  1901. of the environment on @code{plot}, see @ref{plot Environment}.
  1902. @node plot Invocation, plot Environment, plot Examples, plot
  1903. @section @code{plot} command-line options
  1904. The plot filter @code{plot} translates GNU graphics metafiles to other
  1905. formats. The @samp{-T} option is used to specify the output format.
  1906. Files in metafile format are produced by GNU @code{graph},
  1907. @code{pic2plot}, @code{tek2plot}, @code{plotfont}, and other
  1908. applications that use the GNU @code{libplot} graphics library. For
  1909. technical details on the metafile format, see @ref{Metafiles}.
  1910. Input file names may be specified anywhere on the command line. That
  1911. is, the relative order of file names and command-line options does not
  1912. matter. If no files are specified, or the file @w{name @samp{-}} is
  1913. specified, the standard input is read. An output file is written to
  1914. standard output, unless the @samp{-T X} option is specified. @w{In
  1915. that} case the output is displayed in a window or windows on an @w{X
  1916. Window} System display, and there is no output file.
  1917. The full set of command-line options is listed below. There are four
  1918. sorts of option:
  1919. @enumerate
  1920. @item
  1921. Options setting the values of drawing parameters.
  1922. @item
  1923. Options relevant only to raw @code{plot}, i.e., relevant only if no
  1924. output format is specified with the @samp{-T} option.
  1925. @item
  1926. Options specifying the type of metafile format the input is in (for
  1927. backward compatibility only).
  1928. @item
  1929. Options requesting information (e.g., @samp{--help}).
  1930. @end enumerate
  1931. @noindent
  1932. Each option that takes an argument is followed, in parentheses, by the
  1933. type and default value of the argument.
  1934. The following options set the values of drawing parameters.
  1935. @table @samp
  1936. @item -T @var{type}
  1937. @itemx --output-format @var{type}
  1938. (String, default "meta".) Select an output format of type @var{type},
  1939. which may be one of the strings "X", "png", "pnm", "gif", "svg", "ai",
  1940. "ps", "cgm", "fig", "pcl", "hpgl", "regis", "tek", and "meta". These
  1941. refer respectively to the @w{X Window System}, PNG format, portable
  1942. anymap (PBM/PGM/PPM) format, pseudo-GIF format, the XML-based Scalable
  1943. Vector Graphics format, the format used by Adobe Illustrator,
  1944. @code{idraw}-editable Postscript, the WebCGM format for Web-based
  1945. vector graphics, the format used by the @code{xfig} drawing editor,
  1946. the Hewlett--Packard @w{PCL 5} printer language, the Hewlett--Packard
  1947. Graphics Language (@w{by default}, HP-GL/2), the ReGIS (remote
  1948. graphics instruction set) format developed @w{by DEC}, Tektronix
  1949. format, and device-independent GNU graphics metafile format. The
  1950. option @samp{--display-type} is an obsolete alternative to
  1951. @samp{--output-format}.
  1952. @item -p @var{n}
  1953. @itemx --page-number @var{n}
  1954. (Positive integer.) Display only page number @var{n}, within the
  1955. metafile or sequence of metafiles that is being translated.
  1956. Metafiles may consist of one or more pages, numbered beginning @w{with
  1957. 1}. Also, each page may contain multiple `frames'. @code{plot @w{-T
  1958. X}}, @code{plot -T regis}, or @code{plot -T tek}, which plot in real
  1959. time, will separate successive frames by screen erasures. @code{plot -T
  1960. png}, @code{plot -T pnm}, @code{plot -T gif}, @code{plot -T svg},
  1961. @code{plot -T ai}, @code{plot -T ps}, @code{plot -T cgm}, @code{plot -T
  1962. fig}, @code{plot -T pcl}, @code{plot -T hpgl}, which do not plot in real
  1963. time, will display only the last frame of any multi-frame page.
  1964. The default behavior, if @samp{-p} is not used, is to display all pages.
  1965. For example, @code{plot @w{-T X}} displays each page in its own @w{X
  1966. window}. @w{If the} @samp{-T png} option, the @samp{-T pnm} option, the
  1967. @samp{-T gif} option, the @samp{-T svg} option, the @samp{-T ai} option,
  1968. or the @samp{-T fig} option is used, the default behavior is to display
  1969. only the first page, since files in PNG, PNM, pseudo-GIF, SVG, AI, or
  1970. Fig format may contain only a single page of graphics.
  1971. Most metafiles produced by the GNU plotting utilities (e.g., by raw
  1972. @code{graph}) contain only a single page, consisting of two frames: an
  1973. empty one to clear the display, and a second one containing graphics.
  1974. @item -s
  1975. @itemx --merge-pages
  1976. Merge all displayed pages into a single page, and also merge all
  1977. `frames' within each displayed page.
  1978. This option is useful when merging together single-page plots from
  1979. different sources. For example, it can be used to merge together plots
  1980. obtained from separate invocations of @code{graph}. This is an
  1981. alternative form of multiplotting (@pxref{Multiplotting}).
  1982. @item --bitmap-size @var{bitmap_size}
  1983. (String, default "570x570".) Set the size of the graphics display in
  1984. which the plot will be drawn, in terms of pixels, to be
  1985. @var{bitmap_size}. This is relevant only to @code{plot @w{-T X}},
  1986. @code{plot -T png}, @code{plot -T pnm}, and @code{plot -T gif}, for all
  1987. of which the size can be expressed in terms of pixels. The environment
  1988. variable @code{BITMAPSIZE} may equally well be used to specify the size.
  1989. The graphics display used by @code{plot -T X} is a popped-up @w{X
  1990. window}. Command-line positioning of this window on an @w{X Window}
  1991. System display is supported. For example, if @var{bitmap_size} is
  1992. "570x570+0+0" then the window will be @w{popped up} in the upper left
  1993. corner.
  1994. If you choose a rectangular (non-square) window size, the fonts in the
  1995. plot will be scaled anisotropically, i.e., by different factors in the
  1996. horizontal and vertical direction. Any font that cannot be
  1997. anisotropically scaled will be replaced by a default scalable font,
  1998. such as the Hershey vector font "HersheySerif".
  1999. For backward compatibility, @code{plot -T X} allows the user to set the
  2000. window size and position by setting the @w{X resource}
  2001. @code{Xplot.geometry}, instead of @samp{--bitmap-size} or
  2002. @code{BITMAPSIZE}@.
  2003. @item --emulate-color @var{option}
  2004. (String, default "no".) If @var{option} is "yes", replace each color in
  2005. the output by an appropriate shade of gray. This is seldom useful,
  2006. except when using @samp{plot -T pcl} to prepare output for a @w{PCL 5}
  2007. device. (Many monochrome @w{PCL 5} devices, such as monochrome
  2008. LaserJets, do a poor job of emulating color on their own. They usually
  2009. map HP-GL/2's seven standard pen colors, including even yellow, to
  2010. black.) You may equally well request color emulation by setting the
  2011. environment variable @code{EMULATE_COLOR} to "yes".
  2012. @item --max-line-length @var{max_line_length}
  2013. (Integer, default 500.) Set the maximum number of points that a
  2014. polygonal line may contain, before it is flushed to the output device,
  2015. to equal @var{max_line_length}. If this flushing occurs, the polygonal
  2016. line will be split into two or more sub-lines, though the splitting
  2017. should not be noticeable. Splitting will not take place if the line is
  2018. the boundary of a filled polygon.
  2019. The reason for splitting long polygonal lines is that some display
  2020. devices (e.g., old Postscript printers and HP-GL pen plotters) have
  2021. limited buffer sizes. The environment variable @code{MAX_LINE_LENGTH}
  2022. can also be used to specify the maximum line length. This option has no
  2023. effect on @code{plot -T tek} or raw @code{plot}, since they draw
  2024. polylines in real time and have no buffer limitations.
  2025. @item --page-size @var{pagesize}
  2026. (String, default "letter".) Set the size of the page on which the plot
  2027. will be positioned. This is relevant only to @code{plot -T svg},
  2028. @code{plot -T ai}, @code{plot -T ps}, @code{plot -T cgm}, @code{plot -T
  2029. fig}, @code{plot -T pcl}, and @code{plot -T hpgl}. "letter" means an
  2030. 8.5@dmn{in} by 11@dmn{in} page. Any ISO page size in the range
  2031. "a0"@dots{}"a4" or ANSI page size in the range "a"@dots{}"e" may be
  2032. specified ("letter" is an alias @w{for "a"} and "tabloid" is an alias
  2033. @w{for "b"}). "legal", "ledger", @w{and "b5"} are recognized page sizes
  2034. also. The environment variable @code{PAGESIZE} can equally well be used
  2035. to specify the page size.
  2036. For @code{plot -T ai}, @code{plot -T ps}, @code{plot -T pcl}, and
  2037. @code{plot -T fig}, the graphics display (or `viewport') within which
  2038. the plot is drawn will be, by default, a square region centered on the
  2039. specified page. For @code{plot -T hpgl}, it will be a square region of
  2040. the same size, but may be positioned differently. Either or both of the
  2041. dimensions of the graphics display can be specified explicitly. For
  2042. example, @var{pagesize} could be specified as "letter,xsize=4in", or
  2043. "a4,xsize=10cm,ysize=15cm". The dimensions are allowed to be negative
  2044. (@w{a negative} dimension results in a reflection).
  2045. The position of the graphics display, relative to its default
  2046. position, may optionally be adjusted by specifying an offset vector.
  2047. For example, @var{pagesize} could be specified as
  2048. "letter,yoffset=1.2in", or "a4,xoffset=@minus{}5mm,yoffset=2.0cm".
  2049. @w{It is} also possible to position the graphics display precisely, by
  2050. specifying the location of its lower left corner relative to the lower
  2051. left corner of the page. For example, @var{pagesize} could be
  2052. specified as "letter,xorigin=2in,yorigin=3in", or
  2053. "a4,xorigin=0.5cm,yorigin=0.5cm". The preceding options may be
  2054. intermingled.
  2055. @code{plot -T svg} and @code{plot -T cgm} ignore the "xoffset",
  2056. "yoffset", "xorigin", and "yorigin" options, since SVG format and
  2057. WebCGM format have no notion of the Web page on which the graphics
  2058. display will ultimately be positioned. However, they do respect the
  2059. "xsize" and "ysize" options. For more on page sizes, see @ref{Page
  2060. and Viewport Sizes}.
  2061. @end table
  2062. The following options set the initial values of additional drawing
  2063. parameters. Any of these may be overridden by a directive in the
  2064. metafile itself. @w{In fact}, these options are useful only when
  2065. plotting old metafiles in the pre-GNU `plot(5)' format, which did not
  2066. include such directives.
  2067. @table @samp
  2068. @item --bg-color @var{name}
  2069. (String, default "white".) Set the color used for the plot background
  2070. to be @var{name}. This is relevant only to @code{plot @w{-T X}},
  2071. @code{plot -T png}, @code{plot -T pnm}, @code{plot -T gif}, @code{plot
  2072. -T cgm}, @code{plot -T regis}, and @code{plot -Tmeta}. @w{An
  2073. unrecognized} name sets the color to the default. For information on
  2074. what names are recognized, see @ref{Color Names}. The environment
  2075. variable @code{BG_COLOR} can equally well be used to specify the
  2076. background color.
  2077. If the @samp{-T png} or @samp{-T gif} option is used, a transparent PNG
  2078. file or a transparent pseudo-GIF, respectively, may be produced by
  2079. setting the @code{TRANSPARENT_COLOR} environment variable to the name of
  2080. the background color. @xref{plot Environment}. @w{If the} @samp{-T
  2081. svg} or @samp{-T cgm} option is used, an output file without a
  2082. background may be produced by setting the background color to "none".
  2083. @item -f @var{font_size}
  2084. @itemx --font-size @var{font_size}
  2085. (Float, initial value device-dependent.) Set the initial size of the
  2086. font used for rendering text, as a fraction of the width of the graphics
  2087. display, to @var{font_size}.
  2088. @item -F @var{font_name}
  2089. @itemx --font-name @var{font_name}
  2090. (String, default "Helvetica" except for @code{plot -T pcl}, for which
  2091. "Univers" is the default, and @code{plot -T png}, @code{plot -T pnm},
  2092. @code{plot -T gif}, @code{plot -T hpgl}, @code{plot -T regis},
  2093. @code{plot -T tek}, and raw @code{plot}, for all of which "HersheySerif"
  2094. is the default.) Set the font initially used for text (i.e., for
  2095. `labels') to @var{font_name}. Font names are case-insensitive. @w{If
  2096. the} specified font is not available, the default font will be used.
  2097. Which fonts are available depends on which @samp{-T} option is used.
  2098. For a list of all fonts, see @ref{Text Fonts}. The @code{plotfont}
  2099. utility will produce a character map of any available font.
  2100. @xref{plotfont}.
  2101. @item -W @var{line_width}
  2102. @itemx --line-width @var{line_width}
  2103. (Float, default @minus{}1.0.) Set the thickness of lines, as a fraction
  2104. of the size (i.e., minimum dimension) of the graphics display, to
  2105. @var{line_width}. @w{A negative} value means that the default value
  2106. provided by the GNU @code{libplot} graphics library should be used.
  2107. This is usually 1/850 times the size of the display, although if
  2108. @samp{-T X}, @samp{-T png}, @samp{-T pnm}, or @samp{-T gif} is
  2109. specified, it is zero. By convention, a zero-thickness line is the
  2110. thinnest line that can be drawn. This is the case in all output
  2111. formats. Note, however, that the drawing editors @code{idraw} and
  2112. @code{xfig} treat zero-thickness lines as invisible.
  2113. @code{plot -T tek} and @code{plot -T regis} do not support drawing lines
  2114. with other than a default thickness, and @code{plot -T hpgl} does not
  2115. support @w{doing so} if the environment variable @code{HPGL_VERSION} is
  2116. set to a value less @w{than "2"} (the default).
  2117. @item --pen-color @var{name}
  2118. (String, default "black".) Set the pen color to be @var{name}. An
  2119. unrecognized name sets the pen color to the default. For information on
  2120. what color names are recognized, see @ref{Color Names}.
  2121. @end table
  2122. The following option is relevant only to raw @code{plot}, i.e., relevant
  2123. only if no output type is specified with the @samp{-T} option. In this
  2124. case @code{plot} outputs a graphics metafile, which may be translated to
  2125. other formats by a second invocation of @code{plot}.
  2126. @table @samp
  2127. @item -O
  2128. @itemx --portable-output
  2129. Output the portable (human-readable) version of GNU metafile format,
  2130. rather than a binary version (the default). This can also be requested
  2131. by setting the environment variable @code{META_PORTABLE} to "yes".
  2132. @end table
  2133. @code{plot} will automatically determine which type of GNU metafile
  2134. format the input @w{is in}. There are two types: binary (the default)
  2135. and portable (human-readable). The binary format is machine-dependent.
  2136. @xref{Metafiles}.
  2137. For compatibility with older plotting software, the reading of input
  2138. files in the pre-GNU `plot(5)' format is also supported. This is
  2139. normally a binary format, with each integer in the metafile represented
  2140. as a pair of bytes. The order of the two bytes is machine dependent.
  2141. You may specify that input file(s) are in plot(5) format rather than
  2142. ordinary GNU metafile format by using either the @samp{-h} option
  2143. (``high byte first'') or the @samp{-l} option (``low byte first''),
  2144. whichever is appropriate. Some non-GNU systems support an ASCII
  2145. (human-readable) variant of plot(5) format. You may specify that the
  2146. input is in this format by using the @samp{-A} option. Irrespective of
  2147. the variant, a file in plot(5) format includes only one page of
  2148. graphics.
  2149. @table @samp
  2150. @item -h
  2151. @itemx --high-byte-first-input
  2152. Input file(s) are assumed to be in traditional `plot(5)' metafile
  2153. format, with the high-order byte of each integer occurring first. This
  2154. variant is uncommon.
  2155. @item -l
  2156. @itemx --low-byte-first-input
  2157. Input file(s) are assumed to be in traditional `plot(5)' metafile
  2158. format, with the low-order byte of each integer occurring first. This
  2159. variant is the most common.
  2160. @item -A
  2161. @itemx --ascii-input
  2162. Input file(s) are assumed to be in the ASCII variant of traditional
  2163. `plot(5)' metafile format. This variant is rare: on some older systems,
  2164. it is produced by a program called @code{plottoa}.
  2165. @end table
  2166. The following options request information.
  2167. @table @samp
  2168. @item --help
  2169. Print a list of command-line options, and then exit.
  2170. @item --help-fonts
  2171. Print a table of available fonts, and then exit. The table will depend
  2172. on which output format is specified with the @samp{-T}
  2173. option. @code{plot @w{-T X}}, @code{plot -T svg}, @code{plot -T ai},
  2174. @code{plot -T ps}, @code{plot -T cgm}, and @code{plot -T fig} each
  2175. support the 35 standard Postscript fonts. @code{plot -T svg},
  2176. @code{plot -T ai}, @code{plot -T pcl}, and @code{plot -T hpgl} support
  2177. the 45 standard @w{PCL 5} fonts, and @code{plot -T pcl} and @code{plot
  2178. -T hpgl} support a number of Hewlett--Packard vector fonts. All of the
  2179. preceding, together with @code{plot -T png}, @code{plot -T pnm},
  2180. @code{plot -T gif}, @code{plot -T regis}, and @code{plot -T tek},
  2181. support a set of 22 Hershey vector fonts. Raw @code{plot} @w{in
  2182. principle} supports any of these fonts, since its output must be
  2183. translated to other formats with @code{plot}. The @code{plotfont}
  2184. utility will produce a character map of any available font.
  2185. @xref{plotfont}.
  2186. @item --list-fonts
  2187. Like @samp{--help-fonts}, but lists the fonts in a single column to
  2188. facilitate piping to other programs. @w{If no} output format is
  2189. specified with the @samp{-T} option, the full set of supported fonts
  2190. is listed.
  2191. @item --version
  2192. Print the version number of @code{plot} and the plotting utilities
  2193. package, and exit.
  2194. @end table
  2195. @node plot Environment, , plot Invocation, plot
  2196. @section Environment variables
  2197. The behavior of @code{plot} is affected by several environment
  2198. variables. We have already mentioned the environment variables
  2199. @code{BITMAPSIZE}, @code{PAGESIZE}, @code{BG_COLOR},
  2200. @code{EMULATE_COLOR}, @code{MAX_LINE_LENGTH}, and @code{ROTATION}@.
  2201. They serve as backups for the several options @samp{--bitmap-size},
  2202. @samp{--page-size}, @samp{--bg-color}, @samp{--emulate-color},
  2203. @samp{--max-line-length}, and @samp{--rotation}. The remaining
  2204. environment variables are specific to individual output formats.
  2205. @code{plot @w{-T X}}, which pops up a window on an @w{X Window} System
  2206. display and draws graphics @w{in it}, checks the @code{DISPLAY}
  2207. environment variable. The value of this variable determines the display
  2208. on which the window will be @w{popped up}.
  2209. @code{plot -T png} and @code{plot -T gif}, which produce output in PNG
  2210. format and pseudo-GIF format respectively, are affected by two
  2211. environment variables. If the value of the @code{INTERLACE} variable is
  2212. "yes", the output file will be interlaced. Also, if the value of the
  2213. @code{TRANSPARENT_COLOR} environment variable is the name of a color
  2214. that appears in the output file, that color will be treated as
  2215. transparent by most applications. For information on what color names
  2216. are recognized, see @ref{Color Names}.
  2217. @code{plot -T pnm}, which produces output in Portable Anymap
  2218. (PBM/PGM/PPM) format, is affected by the @code{PNM_PORTABLE} environment
  2219. variable. If its value is "yes", the output file will be in the
  2220. portable (human readable) version of PBM, PGM, or PPM format, rather
  2221. than the default (binary) version.
  2222. @code{plot -T cgm}, which produces CGM files that comply with the WebCGM
  2223. profile for Web-based vector graphics, is affected by two environment
  2224. variables. By default, a @w{version 3} CGM file is generated. Many
  2225. older CGM interpreters and viewers, such as the ones built into
  2226. Microsoft Office and other commercial software, only support @w{version
  2227. 1} CGM files. The @code{CGM_MAX_VERSION} environment variable may be
  2228. set to "1", "2", "3", @w{or "4"} (the default) to specify a maximum
  2229. value for the version number. The @code{CGM_ENCODING} variable may also
  2230. be set, to specify the type of encoding used in the CGM file. Supported
  2231. values are "clear_text" (i.e., human readable) and "binary" (the
  2232. default). The WebCGM profile requires that the binary encoding be used.
  2233. @code{plot -T pcl}, which produces @w{PCL 5} output for Hewlett--Packard
  2234. printers, is affected by the environment variable
  2235. @code{PCL_ASSIGN_COLORS}@. It should be set to "yes" when producing
  2236. @w{PCL 5} output for a color printer or other color device. This will
  2237. ensure accurate color reproduction by giving the output device complete
  2238. freedom in assigning colors, internally, to its ``logical pens''. If it
  2239. is "no" then the device will use a fixed set of colored pens, and will
  2240. emulate other colors by shading. The default is "no" because monochrome
  2241. @w{PCL 5} devices, which are more common than colored ones, must use
  2242. shading to emulate color.
  2243. @code{plot -T hpgl}, which produces Hewlett--Packard Graphics Language
  2244. output, is also affected by several environment variables. The most
  2245. important is @code{HPGL_VERSION}, which may be set to "1", "1.5", @w{or
  2246. "2"} (the default). @w{"1" means} that the output should be generic
  2247. HP-GL, @w{"1.5" means} that the output should be suitable for the
  2248. HP7550A graphics plotter and the HP758x, HP7595A and HP7596A drafting
  2249. plotters (HP-GL with some HP-GL/2 extensions), and @w{"2" means} that
  2250. the output should be modern HP-GL/2. @w{If the} version is "1" @w{or
  2251. "1.5"} then the only available fonts will be vector fonts, and all lines
  2252. will be drawn with a default thickness (the @samp{-W} option will not
  2253. work). Additionally, if the version @w{is "1"} then the filling of
  2254. arbitrary curves with solid color will not be supported (circles and
  2255. rectangles aligned with the coordinate axes may be filled, though).
  2256. The position of the @code{plot -T hpgl} graphics display on the page can
  2257. be rotated @w{90 degrees} counterclockwise by setting the
  2258. @code{HPGL_ROTATE} environment variable to "yes". This is not the same
  2259. as the rotation obtained with the @samp{--rotation} option, since it
  2260. both rotates the graphics display and repositions its lower left corner
  2261. toward another corner of the page. Besides "no" and "yes", recognized
  2262. values for the @code{HPGL_ROTATE} variable are "0", "90", "180", @w{and
  2263. "270"}. @w{"no" and} "yes" are equivalent to @w{"0" and "90"},
  2264. respectively. "180" and "270" are supported only if @code{HPGL_VERSION}
  2265. @w{is "2"} (the default).
  2266. @emph{Opaque} filling and the drawing of visible white lines are
  2267. supported only if @code{HPGL_VERSION} is "2" (the default) and the
  2268. environment variable @code{HPGL_OPAQUE_MODE} is "yes" (the default).
  2269. @w{If the} value is "no" then opaque filling will not be used, and white
  2270. lines (@w{if any}), which are normally drawn with @w{pen #0}, will not
  2271. be drawn. This feature is to accommodate older HP-GL/2 devices.
  2272. HP-GL/2 pen plotters, @w{for example}, do not support opacity or the use
  2273. of @w{pen #0} to draw visible white lines. Some older HP-GL/2 devices
  2274. reportedly malfunction if asked to draw opaque objects.
  2275. @w{By default}, @code{plot -T hpgl} will draw with a fixed set of pens.
  2276. Which pens are present may be specified by setting the @code{HPGL_PENS}
  2277. environment variable. If @code{HPGL_VERSION} @w{is "1"}, the default
  2278. value of @code{HPGL_PENS} is "1=black"; if @code{HPGL_VERSION} is
  2279. "1.5" @w{or "2"}, the default value of @code{HPGL_PENS} is
  2280. "1=black:2=red:3=green:4=yellow:5=blue:6=magenta:7=cyan". The format
  2281. should be self-explanatory. By setting @code{HPGL_PENS}, you may
  2282. specify a color for any pen in the range #1@dots{}#31. For information
  2283. on what color names are recognized, see @ref{Color Names}. @w{Pen #1}
  2284. must always be present, though it need not be black. Any pen in
  2285. the range #2@dots{}#31 may be omitted.
  2286. If @code{HPGL_VERSION} is "2" then @code{plot -T hpgl} will also be
  2287. affected by the environment variable @code{HPGL_ASSIGN_COLORS}@. @w{If
  2288. the} value of this variable is "yes", then @code{plot -T hpgl} will not
  2289. be restricted to the palette specified in @code{HPGL_PENS}: @w{it will}
  2290. assign colors to ``logical pens'' in the range #1@dots{}#31, @w{as
  2291. needed}. The default value is "no" because other than color LaserJet
  2292. printers and DesignJet plotters, not many HP-GL/2 devices allow the
  2293. assignment of colors to logical pens. In particular, HP-GL/2 pen
  2294. plotters do not.
  2295. @code{plot -T tek}, which produces output for a Tektronix terminal or
  2296. emulator, checks the @code{TERM} environment variable. @w{If the} value
  2297. of @code{TERM} is a string beginning with "xterm", "nxterm", or "kterm",
  2298. @w{it is} taken as a sign that @code{plot} is running in an @w{X Window}
  2299. System VT100 terminal emulator: @w{an @code{xterm}}, @code{nxterm}, or
  2300. @code{kterm}. Before drawing graphics, @code{plot -T tek} will emit an
  2301. escape sequence that causes the terminal emulator's auxiliary Tektronix
  2302. window, which is normally hidden, to @w{pop up}. After the graphics are
  2303. drawn, an escape sequence that returns control to the original VT100
  2304. window will be emitted. The Tektronix window will remain on the screen.
  2305. If the value of @code{TERM} is a string beginning with "kermit",
  2306. "ansi.sys", or "nansi.sys", @w{it is} taken as a sign that @code{plot}
  2307. is running in the VT100 terminal emulator provided by the MS-DOS version
  2308. of @code{kermit}. Before drawing graphics, @code{plot -T tek} will emit
  2309. an escape sequence that switches the terminal emulator to Tektronix
  2310. mode. Also, some of the Tektronix control codes emitted by @code{plot
  2311. -T tek} will be @code{kermit}-specific. There will be a limited amount
  2312. of color support, which is not normally the case (the 16 @code{ansi.sys}
  2313. colors will be supported). After drawing graphics, @code{plot -T tek}
  2314. will emit an escape sequence that returns the emulator to VT100 mode.
  2315. The key sequence `@w{ALT minus}' can be employed manually within
  2316. @code{kermit} to switch between the two modes.
  2317. @node pic2plot, tek2plot, plot, Top
  2318. @chapter The @code{pic2plot} Program
  2319. @menu
  2320. * pic2plot Introduction:: What pic2plot is used for
  2321. * pic2plot Invocation:: Command-line options
  2322. * pic2plot Environment:: Environment variables
  2323. @end menu
  2324. @node pic2plot Introduction, pic2plot Invocation, pic2plot, pic2plot
  2325. @section What @code{pic2plot} is used for
  2326. The @code{pic2plot} program takes one or more files in the pic language,
  2327. and either displays the figures that they contain on an @w{X Window}
  2328. System display, or produces an output file containing the figures. Many
  2329. graphics file formats are supported.
  2330. The pic language is a `little language' that was developed at Bell
  2331. Laboratories for creating box-and-arrow diagrams of the kind frequently
  2332. found in technical papers and textbooks. @w{A directory} containing
  2333. documentation on the pic language is distributed along with the plotting
  2334. utilities. @w{On most} systems it is installed as
  2335. @file{/usr/share/pic2plot} or @file{/usr/local/share/pic2plot}. The
  2336. directory includes Brian Kernighan's original technical report on the
  2337. language, @w{Eric S.} Raymond's tutorial on the GNU implementation, and
  2338. some sample pic macros contributed by the late @w{W. Richard} Stevens.
  2339. The pic language was originally designed to work with the @code{troff}
  2340. document formatter. In that context it is read by a translator called
  2341. @code{pic}, or its GNU counterpart @code{gpic}. Since extensive
  2342. documentation on @code{pic} and @code{gpic} is available, this section
  2343. simply gives an example of an input file, and mentions some extra
  2344. features supported by @code{pic2plot}.
  2345. A pic file contains one or more figures, each of the box-and-arrow type.
  2346. Each figure is begun by a line reading @t{.PS}, and ended by a line
  2347. reading @t{.PE}@. Lines that are not contained in a
  2348. @t{.PS}@dots{}@t{.PE} pair are ignored. @w{Each figure} is built from
  2349. geometrical objects, such as rectangular boxes, circles, ellipses,
  2350. quarter circles (``arcs''), polygonal lines, and splines. Arcs,
  2351. polygonal lines, and spline may be equipped with arrowheads. Any object
  2352. may be labeled with one or more lines of text.
  2353. Objects are usually positioned not by specifying their positions in
  2354. absolute coordinates, but rather by specifying their positions relative
  2355. to other, previously drawn objects. The following figure is an example.
  2356. @example
  2357. .PS
  2358. box "START"; arrow; circle dashed filled; arrow
  2359. circle diam 2 thickness 3 "This is a" "big, thick" "circle" dashed; up
  2360. arrow from top of last circle; ellipse "loopback" dashed
  2361. arrow dotted from left of last ellipse to top of last box
  2362. arc cw radius 1/2 from top of last ellipse; arrow
  2363. box "END"
  2364. .PE
  2365. @end example
  2366. @noindent
  2367. If you put this example in a file and run @samp{pic2plot -T X} on the
  2368. file, a window containing the figure will be @w{popped up} on your @w{X
  2369. display}. Similarly, if you run @samp{pic2plot -T ps} on the file, a
  2370. Postscript file containing the figure will be written to standard
  2371. output. The Postscript file may be edited with the @code{idraw} drawing
  2372. editor. Other graphics formats such as PNG format, PNM format,
  2373. pseudo-GIF format, SVG format, WebCGM format, or Fig format (which is
  2374. editable with the @code{xfig} drawing editor) may be obtained similarly.
  2375. You would use the options @samp{-T png}, @samp{-T pnm}, @samp{-T gif},
  2376. @code{samp -T svg}, @samp{-T cgm}, and @samp{-T fig}, respectively.
  2377. The above example illustrates some of the features of the pic language.
  2378. By default, successive objects are drawn so as to touch each other. The
  2379. drawing proceeds in a certain direction, which at startup is
  2380. left-to-right. The @samp{up} command changes this direction to
  2381. bottom-to-top, so that the next object (the arrow extending from the top
  2382. of the big circle) will point upward rather than to the right.
  2383. Objects have sizes and other attributes, which may be set globally, or
  2384. specified on a per-object basis. For example, the diameter of a circle
  2385. may be specified, or the radius of an arc. @w{An arc} may be oriented
  2386. clockwise rather than counterclockwise by specifying the @samp{cw}
  2387. attribute. The line style of most objects may be altered by specifying
  2388. the @samp{dashed} or @samp{dotted} attribute. Also, any object may be
  2389. labeled, by specifying one or more text strings as attributes. @w{A
  2390. text} string may contain escape sequences that shift the font, append
  2391. subscripts or superscripts, or include non-ASCII characters and
  2392. mathematical symbols. @xref{Text String Format}.
  2393. Most sizes and positions are expressed in terms of `virtual inches'.
  2394. The use of virtual inches is peculiar to @code{pic2plot}. The graphics
  2395. display used by @code{pic2plot}, i.e., its drawing region, is defined to
  2396. be a square, @w{8 virtual} inches wide and @w{8 virtual} inches high.
  2397. If the page size for the output file is the "letter" size, which is the
  2398. default for Postscript output, virtual inches will the same as real
  2399. inches. But a different page size may be specified; for example, by
  2400. using the @samp{--page-size a4} option. @w{If so}, a virtual inch will
  2401. simply equal one-eighth of the width of the graphics display. @w{On A4}
  2402. paper, the graphics display is a square of size 19.81@dmn{}cm.
  2403. By default, each figure is centered in the graphics display. You may
  2404. turn off centering, so that you can use absolute coordinates, by using
  2405. the @samp{-n} option. For example, a figure consisting only of the
  2406. object @samp{arrow from (8,8) to (4,4)} will be positioned in the
  2407. absence of centering so that the head of the arrow is at the center of
  2408. the display. Its tail will be at the upper right corner.
  2409. The thickness of lines is not specified in terms of virtual inches. For
  2410. compatibility with @code{gpic}, it is specified in terms of virtual
  2411. points. The example above, which specifies the @samp{thickness}
  2412. attribute of one of the objects, illustrates this. There are @w{72
  2413. virtual} points per virtual inch.
  2414. If there is more than one figure to be displayed, they will appear in
  2415. different @w{X windows}, or on successive pages of the output file.
  2416. Some output formats (@w{such as} PNG, PNM, pseudo-GIF, SVG, Illustrator,
  2417. and Fig) support only a single page of graphics. @w{If any} of those
  2418. output formats is chosen, only the first figure will appear in the
  2419. output file. Currently, @code{pic2plot} cannot produce animated
  2420. pseudo-GIFs.
  2421. The preceding survey does not do justice to the pic language, which is
  2422. actually a full-featured programming language, with support for
  2423. variables, looping constructs, etc. Its advanced features make the
  2424. drawing of large, repetitive diagrams quite easy.
  2425. @node pic2plot Invocation, pic2plot Environment, pic2plot Introduction, pic2plot
  2426. @section @code{pic2plot} command-line options
  2427. The @code{pic2plot} program translates files in the pic language,
  2428. which is used for creating box-and-arrow diagrams of the kind
  2429. frequently found in technical papers and textbooks, to other graphics
  2430. formats. The output format is specified with the @samp{-T} option.
  2431. The possible output formats are the same formats that are supported by
  2432. the GNU @code{graph} and @code{plot} programs.
  2433. Input file names may be specified anywhere on the command line. That
  2434. is, the relative order of file names and command-line options does not
  2435. matter. If no files are specified, or the file @w{name @samp{-}} is
  2436. specified, the standard input is read. An output file is written to
  2437. standard output, unless the @samp{-T X} option is specified. @w{In
  2438. that} case the output is displayed in one or more windows on an @w{X
  2439. Window} System display, and there is no output file.
  2440. The full set of command-line options is listed below. There are three
  2441. sorts of option:
  2442. @enumerate
  2443. @item
  2444. General options.
  2445. @item
  2446. Options relevant only to raw @code{pic2plot}, i.e., relevant only if no
  2447. output format is specified with the @samp{-T} option.
  2448. @item
  2449. Options requesting information (e.g., @samp{--help}).
  2450. @end enumerate
  2451. @noindent
  2452. Each option that takes an argument is followed, in parentheses, by the
  2453. type and default value of the argument.
  2454. The following are general options.
  2455. @table @samp
  2456. @item -T @var{type}
  2457. @itemx --output-format @var{type}
  2458. (String, default "meta".) Select an output format of type @var{type},
  2459. which may be one of the strings "X", "png", "pnm", "gif", "svg", "ai",
  2460. "ps", "cgm", "fig", "pcl", "hpgl", "regis", "tek", and "meta". These
  2461. refer respectively to the @w{X Window System}, PNG format, portable
  2462. anymap (PBM/PGM/PPM) format, pseudo-GIF format, the XML-based Scalable
  2463. Vector Graphics format, the format used by Adobe Illustrator,
  2464. @code{idraw}-editable Postscript, the WebCGM format for Web-based
  2465. vector graphics, the format used by the @code{xfig} drawing editor,
  2466. the Hewlett--Packard @w{PCL 5} printer language, the Hewlett--Packard
  2467. Graphics Language (@w{by default}, HP-GL/2), the ReGIS (remote
  2468. graphics instruction set) format developed @w{by DEC}, Tektronix
  2469. format, and device-independent GNU graphics metafile format. The
  2470. option @samp{--display-type} is an obsolete alternative to
  2471. @samp{--output-format}.
  2472. @item -d
  2473. @itemx --precision-dashing
  2474. Draw dashed and dotted lines carefully, i.e., draw each dash and dot as
  2475. a separately positioned object. The default is to use the support for
  2476. dashed and dotted lines provided by the underlying graphics library, GNU
  2477. @code{libplot}.
  2478. This option may produce slightly better-looking dashed and dotted lines.
  2479. However, it will come at a price: if an editable output file is produced
  2480. (@w{i.e., an} output file in Illustrator, Postscript or Fig format),
  2481. @w{it will} be difficulty to modify its dashed and dotted lines with a
  2482. drawing editor.
  2483. @item -f @var{font_size}
  2484. @itemx --font-size @var{font_size}
  2485. (Float, default 0.0175.) Set the size of the font used for rendering
  2486. text, as a fraction of the width of the graphics display, to
  2487. @var{font_size}.
  2488. @item -F @var{font_name}
  2489. @itemx --font-name @var{font_name}
  2490. (String, default "Helvetica" except for @code{pic2plot -T pcl}, for
  2491. which "Univers" is the default, and @code{pic2plot -T png},
  2492. @code{pic2plot -T pnm}, @code{pic2plot -T gif}, @code{pic2plot -T hpgl},
  2493. @code{pic2plot -T regis}, @code{pic2plot -T tek}, and raw
  2494. @code{pic2plot}, for all of which "HersheySerif" is the default.) Set
  2495. the font used for text to @var{font_name}. Font names are
  2496. case-insensitive. @w{If the} specified font is not available, the
  2497. default font will be used. Which fonts are available depends on which
  2498. @samp{-T} option is used. For a list of all fonts, see @ref{Text
  2499. Fonts}. The @code{plotfont} utility will produce a character map of any
  2500. available font. @xref{plotfont}.
  2501. @item -n
  2502. @itemx --no-centering
  2503. Turn off the automatic centering of each figure. If this option is
  2504. specified, the position of the objects in each figure may be specified
  2505. in terms of absolute coordinates. E.g., @samp{line from (0,0) to (4,4)}
  2506. will draw a line segment from the lower left corner to the center of the
  2507. graphics display, since the display width and display height are defined
  2508. to equal @w{8 virtual} inches.
  2509. @item -W @var{line_width}
  2510. @itemx --line-width @var{line_width}
  2511. (Float, default @minus{}1.0.) Set the default thickness of lines, as a
  2512. fraction of the size (i.e., minimum dimension) of the graphics display,
  2513. to @var{line_width}. @w{A negative} value means that the default value
  2514. provided by the GNU @code{libplot} graphics library should be used.
  2515. This is usually 1/850 times the size of the display, although if
  2516. @samp{-T X}, @samp{-T png}, @samp{-T pnm}, or @samp{-T gif} is
  2517. specified, it is zero. By convention, a zero-thickness line is the
  2518. thinnest line that can be drawn. This is the case in all output
  2519. formats. Note, however, that the drawing editors @code{idraw} and
  2520. @code{xfig} treat zero-thickness lines as invisible.
  2521. @code{pic2plot -T hpgl} does not support drawing lines with other than a
  2522. default thickness if the environment variable @code{HPGL_VERSION} is set
  2523. to a value less @w{than "2"} (the default).
  2524. @item --bg-color @var{name}
  2525. (String, default "white".) Set the color used for the background to be
  2526. @var{name}. This is relevant only to @code{pic2plot @w{-T X}},
  2527. @code{pic2plot -T png}, @code{pic2plot -T pnm}, @code{pic2plot -T gif},
  2528. @code{pic2plot -T cgm}, @code{pic2plot -T regis}, and @code{pic2plot -T
  2529. meta}. @w{An unrecognized} name sets the color to the default. For
  2530. information on what names are recognized, see @ref{Color Names}. The
  2531. environment variable @code{BG_COLOR} can equally well be used to specify
  2532. the background color.
  2533. If the @samp{-T png} or @samp{-T gif} option is used, a transparent PNG
  2534. file or a transparent pseudo-GIF, respectively, may be produced by
  2535. setting the @code{TRANSPARENT_COLOR} environment variable to the name of
  2536. the background color. @xref{pic2plot Environment}. @w{If the} @samp{-T
  2537. svg} or @samp{-T cgm} option is used, an output file without a
  2538. background may be produced by setting the background color to "none".
  2539. @item --bitmap-size @var{bitmap_size}
  2540. (String, default "570x570".) Set the size of the graphics display in
  2541. which the plot will be drawn, in terms of pixels, to be
  2542. @var{bitmap_size}. This is relevant only to @code{pic2plot @w{-T X}},
  2543. @code{pic2plot -T png}, @code{pic2plot -T pnm}, and @code{pic2plot -T
  2544. gif}, for all of which the size can be expressed in terms of pixels.
  2545. The environment variable @code{BITMAPSIZE} may equally well be used to
  2546. specify the size.
  2547. The graphics display used by @code{pic2plot -T X} is a popped-up @w{X
  2548. window}. Command-line positioning of this window on an @w{X Window}
  2549. System display is supported. For example, if @var{bitmap_size} is
  2550. "570x570+0+0" then the window will be @w{popped up} in the upper left
  2551. corner.
  2552. If you choose a rectangular (non-square) window size, the fonts in the
  2553. plot will be scaled anisotropically, i.e., by different factors in the
  2554. horizontal and vertical direction. Any font that cannot be
  2555. anisotropically scaled will be replaced by a default scalable font,
  2556. such as the Hershey vector font "HersheySerif".
  2557. For backward compatibility, @code{pic2plot -T X} allows the user to set
  2558. the window size and position by setting the @w{X resource}
  2559. @code{Xplot.geometry}, instead of @samp{--bitmap-size} or
  2560. @code{BITMAPSIZE}@.
  2561. @item --emulate-color @var{option}
  2562. (String, default "no".) If @var{option} is "yes", replace each color in
  2563. the output by an appropriate shade of gray. This is seldom useful,
  2564. except when using @samp{pic2plot -T pcl} to prepare output for a @w{PCL
  2565. 5} device. (Many monochrome @w{PCL 5} devices, such as monochrome
  2566. LaserJets, do a poor job of emulating color on their own. They usually
  2567. map HP-GL/2's seven standard pen colors, including even yellow, to
  2568. black.) You may equally well request color emulation by setting the
  2569. environment variable @code{EMULATE_COLOR} to "yes".
  2570. @item --max-line-length @var{max_line_length}
  2571. (Integer, default 500.) Set the maximum number of points that a
  2572. polygonal line may contain, before it is flushed to the output device,
  2573. to equal @var{max_line_length}. If this flushing occurs, the polygonal
  2574. line will be split into two or more sub-lines, though the splitting
  2575. should not be noticeable.
  2576. The reason for splitting long polygonal lines is that some display
  2577. devices (e.g., old Postscript printers and HP-GL pen plotters) have
  2578. limited buffer sizes. The environment variable @code{MAX_LINE_LENGTH}
  2579. can also be used to specify the maximum line length. This option has no
  2580. effect on raw @code{pic2plot}, since it draws polylines in real time and
  2581. has no buffer limitations.
  2582. @item --page-size @var{pagesize}
  2583. (String, default "letter".) Set the size of the page on which the plot
  2584. will be positioned. This is relevant only to @code{pic2plot -T svg},
  2585. @code{pic2plot -T ai}, @code{pic2plot -T ps}, @code{pic2plot -T cgm},
  2586. @code{pic2plot -T fig}, @code{pic2plot -T pcl}, and @code{pic2plot
  2587. @w{-T} hpgl}. "letter" means an 8.5@dmn{in} by 11@dmn{in} page. Any
  2588. ISO page size in the range "a0"@dots{}"a4" or ANSI page size in the
  2589. range "a"@dots{}"e" may be specified ("letter" is an alias @w{for "a"}
  2590. and "tabloid" is an alias @w{for "b"}). "legal", "ledger", @w{and "b5"}
  2591. are recognized page sizes also. The environment variable
  2592. @code{PAGESIZE} can equally well be used to specify the page size.
  2593. For @code{pic2plot -T ai}, @code{pic2plot -T ps}, @code{pic2plot -T
  2594. pcl}, and @code{pic2plot -T fig}, the graphics display (or `viewport')
  2595. within which the plot is drawn will be, by default, a square region
  2596. centered on the specified page. For @code{pic2plot -T hpgl}, it will be
  2597. a square region of the same size, but may be positioned differently.
  2598. Either or both of the dimensions of the graphics display can be
  2599. specified explicitly. For example, @var{pagesize} could be specified as
  2600. "letter,xsize=4in", or "a4,xsize=10cm,ysize=15cm". The dimensions are
  2601. allowed to be negative (@w{a negative} dimension results in a
  2602. reflection).
  2603. The position of the graphics display, relative to its default
  2604. position, may optionally be adjusted by specifying an offset vector.
  2605. For example, @var{pagesize} could be specified as
  2606. "letter,yoffset=1.2in", or "a4,xoffset=@minus{}5mm,yoffset=2.0cm".
  2607. @w{It is} also possible to position the graphics display precisely, by
  2608. specifying the location of its lower left corner relative to the lower
  2609. left corner of the page. For example, @var{pagesize} could be
  2610. specified as "letter,xorigin=2in,yorigin=3in", or
  2611. "a4,xorigin=0.5cm,yorigin=0.5cm". The preceding options may be
  2612. intermingled.
  2613. @code{pic2plot -T svg} and @code{pic2plot -T cgm} ignore the
  2614. "xoffset", "yoffset", "xorigin", and "yorigin" options, since SVG
  2615. format and WebCGM format have no notion of the Web page on which the
  2616. graphics display will ultimately be positioned. However, they do
  2617. respect the "xsize" and "ysize" options. For more on page sizes, see
  2618. @ref{Page and Viewport Sizes}.
  2619. @item --pen-color @var{name}
  2620. (String, default "black".) Set the pen color to be @var{name}. An
  2621. unrecognized name sets the pen color to the default. For information on
  2622. what color names are recognized, see @ref{Color Names}.
  2623. @item --rotation @var{angle}
  2624. (Float, default 0.0.) Set the rotation angle of the graphics display
  2625. to be @var{angle} degrees. The rotation is counterclockwise. The
  2626. environment variable @code{ROTATION} can equally well be used to
  2627. specify the rotation angle.
  2628. This option is used for switching between portrait and landscape
  2629. orientations, which have rotation angles @w{0 and} 90 degrees
  2630. respectively. Postmodernists may also find it useful.
  2631. @end table
  2632. The following option is relevant only to raw @code{pic2plot}, i.e.,
  2633. relevant only if no output format is specified with the
  2634. @samp{-T} option. In this case @code{pic2plot} outputs a graphics
  2635. metafile, which may be translated to other formats by invoking
  2636. @code{plot}.
  2637. @table @samp
  2638. @item -O
  2639. @itemx --portable-output
  2640. Output the portable (human-readable) version of GNU metafile format,
  2641. rather than a binary version (the default). This can also be requested
  2642. by setting the environment variable @code{META_PORTABLE} to "yes".
  2643. @end table
  2644. The following options request information.
  2645. @table @samp
  2646. @item --help
  2647. Print a list of command-line options, and then exit.
  2648. @item --help-fonts
  2649. Print a table of available fonts, and then exit. The table will depend
  2650. on which output format is specified with the @samp{-T}
  2651. option. @code{pic2plot @w{-T X}}, @code{pic2plot -T svg},
  2652. @code{pic2plot -T ai}, @code{pic2plot -T ps}, @code{pic2plot -T cgm},
  2653. and @code{pic2plot -T fig} each support the 35 standard Postscript
  2654. fonts. @code{pic2plot -T svg}, @code{pic2plot -T ai}, @code{pic2plot -T
  2655. pcl}, and @code{pic2plot -T hpgl} support the 45 standard @w{PCL 5}
  2656. fonts, and @code{pic2plot -T pcl} and @code{pic2plot -T hpgl} support a
  2657. number of Hewlett--Packard vector fonts. All of the preceding, together
  2658. with @code{pic2plot -T png}, @code{pic2plot -T pnm}, @code{pic2plot -T
  2659. gif}, @code{pic2plot -T regis}, and @code{pic2plot -T tek}, support a
  2660. set of 22 Hershey vector fonts. Raw @code{pic2plot} @w{in principle}
  2661. supports any of these fonts, since its output must be translated to
  2662. other formats with @code{plot}. The @code{plotfont} utility will
  2663. produce a character map of any available font. @xref{plotfont}.
  2664. @item --list-fonts
  2665. Like @samp{--help-fonts}, but lists the fonts in a single column to
  2666. facilitate piping to other programs. @w{If no} output
  2667. format is specified with the @samp{-T} option, the full set of supported
  2668. fonts is listed.
  2669. @item --version
  2670. Print the version number of @code{pic2plot} and the plotting utilities
  2671. package, and exit.
  2672. @end table
  2673. @node pic2plot Environment, , pic2plot Invocation, pic2plot
  2674. @section Environment variables
  2675. The behavior of @code{pic2plot} is affected by several environment
  2676. variables. We have already mentioned the environment variables
  2677. @code{BITMAPSIZE}, @code{PAGESIZE}, @code{BG_COLOR},
  2678. @code{EMULATE_COLOR}, @code{MAX_LINE_LENGTH}, and @code{ROTATION}@.
  2679. They serve as backups for the several options @samp{--bitmap-size},
  2680. @samp{--page-size}, @samp{--bg-color}, @samp{--emulate-color},
  2681. @samp{--max-line-length}, and @samp{--rotation}. The remaining
  2682. environment variables are specific to individual output formats.
  2683. @code{pic2plot @w{-T X}}, which pops up a window on an @w{X Window}
  2684. System display for each figure, checks the @code{DISPLAY} environment
  2685. variable. The value of this variable determines the display on which
  2686. the windows will be @w{popped up}.
  2687. @code{pic2plot -T png} and @code{pic2plot -T gif}, which produce output
  2688. in PNG format and pseudo-GIF format respectively, are affected by two
  2689. environment variables. If the value of the @code{INTERLACE} variable is
  2690. "yes", the output file will be interlaced. Also, if the value of the
  2691. @code{TRANSPARENT_COLOR} environment variable is the name of a color
  2692. that appears in the output file, that color will be treated as
  2693. transparent by most applications. For information on what color names
  2694. are recognized, see @ref{Color Names}.
  2695. @code{pic2plot -T pnm}, which produces output in Portable Anymap
  2696. (PBM/PGM/PPM) format, is affected by the @code{PNM_PORTABLE} environment
  2697. variable. If its value is "yes", the output file will be in the
  2698. portable (human readable) version of PBM, PGM, or PPM format, rather
  2699. than the default (binary) version.
  2700. @code{pic2plot -T cgm}, which produces CGM files that comply with the
  2701. WebCGM profile for Web-based vector graphics, is affected by two
  2702. environment variables. By default, a @w{version 3} CGM file is
  2703. generated. Many older CGM interpreters and viewers, such as the ones
  2704. built into Microsoft Office and other commercial software, only support
  2705. @w{version 1} CGM files. The @code{CGM_MAX_VERSION} environment
  2706. variable may be set to "1", "2", "3", @w{or "4"} (the default) to
  2707. specify a maximum value for the version number. The @code{CGM_ENCODING}
  2708. variable may also be set, to specify the type of encoding used in the
  2709. CGM file. Supported values are "clear_text" (i.e., human readable) and
  2710. "binary" (the default). The WebCGM profile requires that the binary
  2711. encoding be used.
  2712. @code{pic2plot -T pcl}, which produces @w{PCL 5} output for
  2713. Hewlett--Packard printers, is affected by the environment variable
  2714. @code{PCL_ASSIGN_COLORS}@. It should be set to "yes" when producing
  2715. @w{PCL 5} output for a color printer or other color device. This will
  2716. ensure accurate color reproduction by giving the output device complete
  2717. freedom in assigning colors, internally, to its ``logical pens''. If it
  2718. is "no" then the device will use a fixed set of colored pens, and will
  2719. emulate other colors by shading. The default is "no" because monochrome
  2720. @w{PCL 5} devices, which are more common than colored ones, must use
  2721. shading to emulate color.
  2722. @code{pic2plot -T hpgl}, which produces Hewlett--Packard Graphics
  2723. Language output, is also affected by several environment variables. The
  2724. most important is @code{HPGL_VERSION}, which may be set to "1", "1.5",
  2725. @w{or "2"} (the default). @w{"1" means} that the output should be
  2726. generic HP-GL, @w{"1.5" means} that the output should be suitable for
  2727. the HP7550A graphics plotter and the HP758x, HP7595A and HP7596A
  2728. drafting plotters (HP-GL with some HP-GL/2 extensions), and @w{"2"
  2729. means} that the output should be modern HP-GL/2. @w{If the} version is
  2730. "1" @w{or "1.5"} then the only available fonts will be vector fonts, and
  2731. all lines will be drawn with a default thickness (the @samp{-W} option
  2732. will not work). Additionally, if the version @w{is "1"} then the
  2733. filling of arbitrary curves with solid color will not be supported
  2734. (circles and rectangles aligned with the coordinate axes may be filled,
  2735. though).
  2736. The position of the @code{pic2plot -T hpgl} graphics display on the page
  2737. can be rotated @w{90 degrees} counterclockwise by setting the
  2738. @code{HPGL_ROTATE} environment variable to "yes". This is not the same
  2739. as the rotation obtained with the @samp{--rotation} option, since it
  2740. both rotates the graphics display and repositions its lower left corner
  2741. toward another corner of the page. Besides "no" and "yes", recognized
  2742. values for the @code{HPGL_ROTATE} variable are "0", "90", "180", @w{and
  2743. "270"}. @w{"no" and} "yes" are equivalent to @w{"0" and "90"},
  2744. respectively. "180" and "270" are supported only if @code{HPGL_VERSION}
  2745. @w{is "2"} (the default).
  2746. @emph{Opaque} filling and the drawing of visible white lines are
  2747. supported only if @code{HPGL_VERSION} is "2" (the default) and the
  2748. environment variable @code{HPGL_OPAQUE_MODE} is "yes" (the default).
  2749. @w{If the} value is "no" then opaque filling will not be used, and white
  2750. lines (@w{if any}), which are normally drawn with @w{pen #0}, will not
  2751. be drawn. This feature is to accommodate older HP-GL/2 devices.
  2752. HP-GL/2 pen plotters, @w{for example}, do not support opacity or the use
  2753. of @w{pen #0} to draw visible white lines. Some older HP-GL/2 devices
  2754. reportedly malfunction if asked to draw opaque objects.
  2755. @w{By default}, @code{pic2plot -T hpgl} will draw with a fixed set of
  2756. pens. Which pens are present may be specified by setting the
  2757. @code{HPGL_PENS} environment variable. If @code{HPGL_VERSION} @w{is
  2758. "1"}, the default value of @code{HPGL_PENS} is "1=black"; if
  2759. @code{HPGL_VERSION} is "1.5" @w{or "2"}, the default value of
  2760. @code{HPGL_PENS} is
  2761. "1=black:2=red:3=green:4=yellow:5=blue:6=magenta:7=cyan". The format
  2762. should be self-explanatory. By setting @code{HPGL_PENS}, you may
  2763. specify a color for any pen in the range #1@dots{}#31. For information
  2764. on what color names are recognized, see @ref{Color Names}. @w{Pen #1}
  2765. must always be present, though it need not be black. Any pen in
  2766. the range #2@dots{}#31 may be omitted.
  2767. If @code{HPGL_VERSION} is "2" then @code{pic2plot -T hpgl} will also be
  2768. affected by the environment variable @code{HPGL_ASSIGN_COLORS}@. @w{If
  2769. the} value of this variable is "yes", then @code{plot -T hpgl} will not
  2770. be restricted to the palette specified in @code{HPGL_PENS}: @w{it will}
  2771. assign colors to ``logical pens'' in the range #1@dots{}#31, @w{as
  2772. needed}. The default value is "no" because other than color LaserJet
  2773. printers and DesignJet plotters, not many HP-GL/2 devices allow the
  2774. assignment of colors to logical pens. In particular, HP-GL/2 pen
  2775. plotters do not.
  2776. @code{pic2plot -T tek}, which produces output for a Tektronix terminal
  2777. or emulator, checks the @code{TERM} environment variable. @w{If the}
  2778. value of @code{TERM} is a string beginning with "xterm", "nxterm", or
  2779. "kterm", @w{it is} taken as a sign that @code{pic2plot} is running in an
  2780. @w{X Window} System VT100 terminal emulator: @w{an @code{xterm}},
  2781. @code{nxterm}, or @code{kterm}. Before drawing graphics, @code{pic2plot
  2782. -T tek} will emit an escape sequence that causes the terminal emulator's
  2783. auxiliary Tektronix window, which is normally hidden, to @w{pop up}.
  2784. After the graphics are drawn, an escape sequence that returns control to
  2785. the original VT100 window will be emitted. The Tektronix window will
  2786. remain on the screen.
  2787. If the value of @code{TERM} is a string beginning with "kermit",
  2788. "ansi.sys", or "nansi.sys", @w{it is} taken as a sign that
  2789. @code{pic2plot} is running in the VT100 terminal emulator provided by
  2790. the MS-DOS version of @code{kermit}. Before drawing graphics,
  2791. @code{pic2plot -T tek} will emit an escape sequence that switches the
  2792. terminal emulator to Tektronix mode. Also, some of the Tektronix
  2793. control codes emitted by @code{pic2plot -T tek} will be
  2794. @code{kermit}-specific. There will be a limited amount of color
  2795. support, which is not normally the case (the 16 @code{ansi.sys} colors
  2796. will be supported). After drawing graphics, @code{pic2plot -T tek} will
  2797. emit an escape sequence that returns the emulator to VT100 mode. The
  2798. key sequence `@w{ALT minus}' can be employed manually within
  2799. @code{kermit} to switch between the two modes.
  2800. @node tek2plot, plotfont, pic2plot, Top
  2801. @chapter The @code{tek2plot} Program
  2802. @menu
  2803. * tek2plot Introduction:: What tek2plot is used for
  2804. * tek2plot Invocation:: Command-line options
  2805. * tek2plot Environment:: Environment variables
  2806. @end menu
  2807. @node tek2plot Introduction, tek2plot Invocation, tek2plot, tek2plot
  2808. @section What @code{tek2plot} is used for
  2809. GNU @code{tek2plot} is a command-line Tektronix translator. It
  2810. displays Tektronix graphics files, or translates them to other
  2811. formats. The @samp{-T} option is used to specify the output format.
  2812. Supported output formats include "X", "png", "pnm", "gif", "svg",
  2813. "ai", "ps", "cgm", "fig", "pcl", "hpgl", "regis", "tek", and "meta"
  2814. (the default). These are the same formats that are supported by the
  2815. GNU @code{graph}, @code{plot}, and @code{pic2plot} programs.
  2816. @code{tek2plot} will take input from a file specified on the command
  2817. line or from standard input, just as the plot filter @code{plot} does.
  2818. Tektronix graphics files are produced by many older applications, such
  2819. as @uref{http://tdc-www.cfa.harvard.edu/software/skymap, SKYMAP}, a
  2820. powerful astronomical display program. @w{A directory} containing
  2821. sample Tektronix graphics files, which you may experiment with, is
  2822. distributed along with the GNU plotting utilities. @w{On most}
  2823. systems it is installed as @file{/usr/share/tek2plot} or
  2824. @file{/usr/local/share/tek2plot}.
  2825. Tektronix graphics format is defined as a noninteractive version of the
  2826. graphics format understood by Tektronix 4010/4014 terminals, as
  2827. documented in the @cite{4014 Service Manual}, Tektronix Inc., 1974
  2828. (Tektronix Part #070-1648-00). @code{tek2plot} does not support
  2829. interactive features such as graphics input mode (``GIN mode'') or
  2830. status enquiry. However, it does support a few additional features
  2831. provided by popular Tektronix emulators, such as the color extensions
  2832. supported by the Tektronix emulator contained in the MS-DOS version of
  2833. @code{kermit}.
  2834. @node tek2plot Invocation, tek2plot Environment, tek2plot Introduction, tek2plot
  2835. @section @code{tek2plot} command-line options
  2836. The @code{tek2plot} program translates the Tektronix graphics files
  2837. produced by many older applications to other formats. The output
  2838. format is specified with the @samp{-T} option. The possible output
  2839. formats are the same formats that are supported by the GNU
  2840. @code{graph}, @code{plot}, and @code{pic2plot} programs.
  2841. Input file names may be specified anywhere on the command line. That
  2842. is, the relative order of file names and command-line options does not
  2843. matter. If no files are specified, or the file @w{name @samp{-}} is
  2844. specified, the standard input is read. An output file is written to
  2845. standard output, unless the @samp{-T X} option is specified. @w{In
  2846. that} case the output is displayed in one or more windows on an @w{X
  2847. Window} System display, and there is no output file.
  2848. The full set of command-line options is listed below. There are three
  2849. sorts of option:
  2850. @enumerate
  2851. @item
  2852. General options.
  2853. @item
  2854. Options relevant only to raw @code{tek2plot}, i.e., relevant only if no
  2855. output format is specified with the @samp{-T} option.
  2856. @item
  2857. Options requesting information (e.g., @samp{--help}).
  2858. @end enumerate
  2859. @noindent
  2860. Each option that takes an argument is followed, in parentheses, by the
  2861. type and default value of the argument.
  2862. The following are general options.
  2863. @table @samp
  2864. @item -T @var{type}
  2865. @itemx --output-format @var{type}
  2866. (String, default "meta".) Select an output format of type @var{type},
  2867. which may be one of the strings "X", "png", "pnm", "gif", "svg", "ai",
  2868. "ps", "cgm", "fig", "pcl", "hpgl", "regis", "tek", and "meta". These
  2869. refer respectively to the @w{X Window System}, PNG format, portable
  2870. anymap (PBM/PGM/PPM) format, pseudo-GIF format, the XML-based Scalable
  2871. Vector Graphics format, the format used by Adobe Illustrator,
  2872. @code{idraw}-editable Postscript, the WebCGM format for Web-based
  2873. vector graphics, the format used by the @code{xfig} drawing editor,
  2874. the Hewlett--Packard @w{PCL 5} printer language, the Hewlett--Packard
  2875. Graphics Language (@w{by default}, HP-GL/2), the ReGIS (remote
  2876. graphics instruction set) format developed @w{by DEC}, Tektronix
  2877. format, and device-independent GNU graphics metafile format.
  2878. @item -p @var{n}
  2879. @itemx --page-number @var{n}
  2880. (Nonnegative integer.) Display only page number @var{n}, within the
  2881. Tektronix file or sequence of Tektronix files that is being translated.
  2882. Tektronix files may consist of one or more pages, numbered beginning
  2883. with zero.
  2884. The default behavior, if the @samp{-p} option is not used, is to display
  2885. all nonempty pages in succession. For example, @code{tek2plot @w{-T X}}
  2886. displays each page in its own @w{X window}. @w{If the} @samp{-T png}
  2887. option, the @samp{-T pnm} option, the @samp{-T gif} option, the @samp{-T
  2888. svg} option, the @samp{-T ai} option, or the @samp{-T fig} option is
  2889. used, the default behavior is to display only the first page, since
  2890. files in PNG, PNM, pseudo-GIF, SVG, AI, or Fig format may contain only a
  2891. single page of graphics.
  2892. Most Tektronix files consist of either one page (page #0) or
  2893. two pages (@w{an empty} @w{page #0}, and @w{page #1}). Tektronix files
  2894. produced by the GNU plotting utilities (e.g., by @code{graph -T tek})
  2895. are normally of the latter sort.
  2896. @item -F @var{font_name}
  2897. @itemx --font-name @var{font_name}
  2898. (String, default "Courier" except for @code{tek2plot -T png},
  2899. @code{tek2plot -T pnm}, @code{tek2plot -T gif}, @code{tek2plot -T hpgl},
  2900. @code{tek2plot -T regis}, and raw @code{tek2plot}, for all of which
  2901. "HersheySerif" is the default.) Set the font used for text to
  2902. @var{font_name}. Font names are case-insensitive. @w{If a} font
  2903. outside the Courier family is chosen, the @samp{--position-chars} option
  2904. (see below) should probably be used. For a list of all fonts, see
  2905. @ref{Text Fonts}. @w{If the} specified font is not available, the
  2906. default font will be used.
  2907. If you intend to print a @w{PCL 5} file prepared with @code{tek2plot -T
  2908. pcl} on a LaserJet III, you should specify a font other than Courier.
  2909. That is because the LaserJet III, which was Hewlett--Packard's first
  2910. @w{PCL 5} printer, did not come with a scalable Courier typeface. The
  2911. only @w{PCL 5} fonts it supported were the eight fonts in the CGTimes
  2912. and Univers families. See @ref{Text Fonts}.
  2913. @item -W @var{line_width}
  2914. @itemx --line-width @var{line_width}
  2915. (Float, default @minus{}1.0.) Set the thickness of lines, as a fraction
  2916. of the size (i.e., minimum dimension) of the graphics display, to
  2917. @var{line_width}. @w{A negative} value means that the default value
  2918. provided by the GNU @code{libplot} graphics library should be used.
  2919. This is usually 1/850 times the size of the display, although if
  2920. @samp{-T X}, @samp{-T png}, @samp{-T pnm}, or @samp{-T gif} is
  2921. specified, it is zero. By convention, a zero-thickness line is the
  2922. thinnest line that can be drawn. This is the case in all output
  2923. formats. Note, however, that the drawing editors @code{idraw} and
  2924. @code{xfig} treat zero-thickness lines as invisible.
  2925. @code{tek2plot -T regis} does not support drawing lines with other than
  2926. a default thickness, and @code{tek2plot -T hpgl} does not support doing
  2927. so if the environment variable @code{HPGL_VERSION} is set to a value
  2928. less @w{than "2"} (the default).
  2929. @item --bg-color @var{name}
  2930. (String, default "white".) Set the color used for the background to be
  2931. @var{name}. This is relevant only to @code{tek2plot @w{-T X}},
  2932. @code{tek2plot -T png}, @code{tek2plot -T pnm}, @code{tek2plot -T gif},
  2933. @code{tek2plot -T cgm}, @code{tek2plot -T regis}, and @code{tek2plot -T
  2934. meta}. @w{An unrecognized} name sets the color to the default. For
  2935. information on what names are recognized, see @ref{Color Names}. The
  2936. environment variable @code{BG_COLOR} can equally well be used to specify
  2937. the background color.
  2938. If the @samp{-T png} or @samp{-T gif} option is used, a transparent PNG
  2939. file or a transparent pseudo-GIF, respectively, may be produced by
  2940. setting the @code{TRANSPARENT_COLOR} environment variable to the name of
  2941. the background color. @xref{tek2plot Environment}. @w{If the} @samp{-T
  2942. svg} or @samp{-T cgm} option is used, an output file without a
  2943. background may be produced by setting the background color to "none".
  2944. @item --bitmap-size @var{bitmap_size}
  2945. (String, default "570x570".) Set the size of the graphics display in
  2946. which the plot will be drawn, in terms of pixels, to be
  2947. @var{bitmap_size}. This is relevant only to @code{tek2plot @w{-T X}},
  2948. @code{tek2plot -T png}, @code{tek2plot -T pnm}, and @code{tek2plot -T
  2949. gif}, for all of which the size can be expressed in terms of pixels.
  2950. The environment variable @code{BITMAPSIZE} may equally well be used to
  2951. specify the size.
  2952. The graphics display used by @code{tek2plot -T X} is a popped-up @w{X
  2953. window}. Command-line positioning of this window on an @w{X Window}
  2954. System display is supported. For example, if @var{bitmap_size} is
  2955. "570x570+0+0" then the window will be @w{popped up} in the upper left
  2956. corner.
  2957. If you choose a rectangular (non-square) window size, the fonts in the
  2958. plot will be scaled anisotropically, i.e., by different factors in the
  2959. horizontal and vertical direction. Any font that cannot be
  2960. anisotropically scaled will be replaced by a default scalable font,
  2961. such as the Hershey vector font "HersheySerif".
  2962. For backward compatibility, @code{tek2plot -T X} allows the user to set
  2963. the window size and position by setting the @w{X resource}
  2964. @code{Xplot.geometry}, instead of @samp{--bitmap-size} or
  2965. @code{BITMAPSIZE}@.
  2966. @item --emulate-color @var{option}
  2967. (String, default "no".) If @var{option} is "yes", replace each color in
  2968. the output by an appropriate shade of gray. This is seldom useful,
  2969. except when using @samp{tek2plot -T pcl} to prepare output for a @w{PCL
  2970. 5} device. (Many monochrome @w{PCL 5} devices, such as monochrome
  2971. LaserJets, do a poor job of emulating color on their own. They usually
  2972. map HP-GL/2's seven standard pen colors, including even yellow, to
  2973. black.) You may equally well request color emulation by setting the
  2974. environment variable @code{EMULATE_COLOR} to "yes".
  2975. @item --max-line-length @var{max_line_length}
  2976. (Integer, default 500.) Set the maximum number of points that a
  2977. polygonal line may contain, before it is flushed to the output device,
  2978. to equal @var{max_line_length}. If this flushing occurs, the polygonal
  2979. line will be split into two or more sub-lines, though the splitting
  2980. should not be noticeable.
  2981. The reason for splitting long polygonal lines is that some display
  2982. devices (e.g., old Postscript printers and HP-GL pen plotters) have
  2983. limited buffer sizes. The environment variable @code{MAX_LINE_LENGTH}
  2984. can also be used to specify the maximum line length. This option has no
  2985. effect on raw @code{tek2plot}, since it draws polylines in real time and
  2986. has no buffer limitations.
  2987. @item --page-size @var{pagesize}
  2988. (String, default "letter".) Set the size of the page on which the plot
  2989. will be positioned. This is relevant only to @code{tek2plot -T svg},
  2990. @code{tek2plot -T ai}, @code{tek2plot -T ps}, @code{tek2plot -T cgm},
  2991. @code{tek2plot -T fig}, @code{tek2plot -T pcl}, and @code{tek2plot
  2992. @w{-T} hpgl}. "letter" means an 8.5@dmn{in} by 11@dmn{in} page. Any
  2993. ISO page size in the range "a0"@dots{}"a4" or ANSI page size in the
  2994. range "a"@dots{}"e" may be specified ("letter" is an alias @w{for "a"}
  2995. and "tabloid" is an alias @w{for "b"}). "legal", "ledger", @w{and "b5"}
  2996. are recognized page sizes also. The environment variable
  2997. @code{PAGESIZE} can equally well be used to specify the page size.
  2998. For @code{tek2plot -T ai}, @code{tek2plot -T ps}, @code{tek2plot -T
  2999. pcl}, and @code{tek2plot -T fig}, the graphics display (or `viewport')
  3000. within which the plot is drawn will be, by default, a square region
  3001. centered on the specified page. For @code{tek2plot -T hpgl}, it will be
  3002. a square region of the same size, but may be positioned differently.
  3003. Either or both of the dimensions of the graphics display can be
  3004. specified explicitly. For example, @var{pagesize} could be specified as
  3005. "letter,xsize=4in", or "a4,xsize=10cm,ysize=15cm". The dimensions are
  3006. allowed to be negative (@w{a negative} dimension results in a
  3007. reflection).
  3008. The position of the graphics display, relative to its default
  3009. position, may optionally be adjusted by specifying an offset vector.
  3010. For example, @var{pagesize} could be specified as
  3011. "letter,yoffset=1.2in", or "a4,xoffset=@minus{}5mm,yoffset=2.0cm".
  3012. @w{It is} also possible to position the graphics display precisely, by
  3013. specifying the location of its lower left corner relative to the lower
  3014. left corner of the page. For example, @var{pagesize} could be
  3015. specified as "letter,xorigin=2in,yorigin=3in", or
  3016. "a4,xorigin=0.5cm,yorigin=0.5cm". The preceding options may be
  3017. intermingled.
  3018. @code{tek2plot -T svg} and @code{tek2plot -T cgm} ignore the
  3019. "xoffset", "yoffset", "xorigin", and "yorigin" options, since SVG
  3020. format and WebCGM format have no notion of the Web page on which the
  3021. graphics display will ultimately be positioned. However, they do
  3022. respect the "xsize" and "ysize" options. For more on page sizes, see
  3023. @ref{Page and Viewport Sizes}.
  3024. @item --pen-color @var{name}
  3025. (String, default "black".) Set the pen color to be @var{name}. An
  3026. unrecognized name sets the pen color to the default. For information on
  3027. what color names are recognized, see @ref{Color Names}.
  3028. @item --position-chars
  3029. Position the characters in each text string individually on the display.
  3030. @w{If the} text font is not a member of the Courier family, and
  3031. especially if it is not a fixed-width font, this option is recommended.
  3032. @w{It will} improve the appearance of text strings, at the price of
  3033. making it difficult to edit the output file with @code{xfig} or
  3034. @code{idraw}.
  3035. @item --rotation @var{angle}
  3036. (Float, default 0.0.) Set the rotation angle of the graphics display
  3037. to be @var{angle} degrees. The rotation is counterclockwise. The
  3038. environment variable @code{ROTATION} can equally well be used to
  3039. specify the rotation angle.
  3040. This option is used for switching between portrait and landscape
  3041. orientations, which have rotation angles @w{0 and} 90 degrees
  3042. respectively. Postmodernists may also find it useful.
  3043. @item --use-tek-fonts
  3044. Use the fonts that were used on the original Tektronix 4010/4014
  3045. terminal, to produce the most faithful rendition possible. This
  3046. option is relevant only to @code{tek2plot @w{-T X}}. Bitmap versions
  3047. of the the four original Tektronix fonts are distributed with the
  3048. plotting utilities package, under the names
  3049. @code{tekfont0}@dots{}@code{tekfont3}. They may easily be installed
  3050. on any modern @w{X Window} System display. For this option to work
  3051. properly, you must also select a window size of 1024x1024 pixels,
  3052. either by using the @samp{--bitmap-size 1024x1024} option or by
  3053. setting the value of the @code{Xplot.geometry} resource. The reason
  3054. for this restriction is to prevent rescaling of the bitmap fonts.
  3055. This option is useful only if you have a file in Tektronix format that
  3056. draws text using native Tektronix fonts. Tektronix files produced by
  3057. the GNU plotting utilities (e.g., by @code{graph -T tek}) @w{do not} use
  3058. native Tektronix fonts to draw text.
  3059. @end table
  3060. The following option is relevant only to raw @code{tek2plot}, i.e.,
  3061. relevant only if no output format is specified with the
  3062. @samp{-T} option. In this case @code{tek2plot} outputs a graphics
  3063. metafile, which may be translated to other formats by invoking
  3064. @code{plot}.
  3065. @table @samp
  3066. @item -O
  3067. @itemx --portable-output
  3068. Output the portable (human-readable) version of GNU metafile format,
  3069. rather than a binary version (the default). This can also be requested
  3070. by setting the environment variable @code{META_PORTABLE} to "yes".
  3071. @end table
  3072. The following options request information.
  3073. @table @samp
  3074. @item --help
  3075. Print a list of command-line options, and then exit.
  3076. @item --help-fonts
  3077. Print a table of available fonts, and then exit. The table will depend
  3078. on which output format is specified with the @samp{-T}
  3079. option. @code{tek2plot @w{-T X}}, @code{tek2plot -T svg},
  3080. @code{tek2plot -T ai}, @code{tek2plot -T ps}, @code{tek2plot -T cgm},
  3081. and @code{tek2plot -T fig} each support the 35 standard Postscript
  3082. fonts. @code{tek2plot -T svg}, @code{tek2plot -T ai}, @code{tek2plot -T
  3083. pcl}, and @code{tek2plot -T hpgl} support the 45 standard @w{PCL 5}
  3084. fonts, and @code{tek2plot -T pcl} and @code{tek2plot -T hpgl} support a
  3085. number of Hewlett--Packard vector fonts. All of the preceding, together
  3086. with @code{tek2plot -T png}, @code{tek2plot -T pnm}, @code{tek2plot -T
  3087. gif}, @code{tek2plot -T regis}, and @code{tek2plot -T tek}, support a
  3088. set of 22 Hershey vector fonts. Raw @code{tek2plot} @w{in principle}
  3089. supports any of these fonts, since its output must be translated to
  3090. other formats with @code{plot}. The @code{plotfont} utility will
  3091. produce a character map of any available font. @xref{plotfont}.
  3092. @item --list-fonts
  3093. Like @samp{--help-fonts}, but lists the fonts in a single column to
  3094. facilitate piping to other programs. @w{If no} output
  3095. format is specified with the @samp{-T} option, the full set of supported
  3096. fonts is listed.
  3097. @item --version
  3098. Print the version number of @code{tek2plot} and the plotting utilities
  3099. package, and exit.
  3100. @end table
  3101. @node tek2plot Environment, , tek2plot Invocation, tek2plot
  3102. @section Environment variables
  3103. The behavior of @code{tek2plot} is affected by several environment
  3104. variables, which are the same as those that affect @code{graph} and
  3105. @code{plot}. For convenience, we list them here.
  3106. We have already mentioned the environment variables @code{BITMAPSIZE},
  3107. @code{PAGESIZE}, @code{BG_COLOR}, @code{EMULATE_COLOR},
  3108. @code{MAX_LINE_LENGTH}, and @code{ROTATION}@. They serve as backups for
  3109. the several options @samp{--bitmap-size}, @samp{--page-size},
  3110. @samp{--bg-color}, @samp{--emulate-color}, @samp{--max-line-length}, and
  3111. @samp{--rotation}. The remaining environment variables are specific to
  3112. individual output formats.
  3113. @code{tek2plot @w{-T X}}, which pops up a window on an @w{X Window}
  3114. System display and draws graphics @w{in it}, checks the @code{DISPLAY}
  3115. environment variable. The value of this variable determines the display
  3116. on which the window will be @w{popped up}.
  3117. @code{tek2plot -T png} and @code{tek2plot -T gif}, which produce output
  3118. in PNG format and pseudo-GIF format respectively, are affected by two
  3119. environment variables. If the value of the @code{INTERLACE} variable is
  3120. "yes", the output file will be interlaced. Also, if the value of the
  3121. @code{TRANSPARENT_COLOR} environment variable is the name of a color
  3122. that appears in the output file, that color will be treated as
  3123. transparent by most applications. For information on what color names
  3124. are recognized, see @ref{Color Names}.
  3125. @code{tek2plot -T pnm}, which produces output in Portable Anymap
  3126. (PBM/PGM/PPM) format, is affected by the @code{PNM_PORTABLE} environment
  3127. variable. If its value is "yes", the output file will be in the
  3128. portable (human readable) version of PBM, PGM, or PPM format, rather
  3129. than the default (binary) version.
  3130. @code{tek2plot -T cgm}, which produces CGM files that comply with the
  3131. WebCGM profile for Web-based vector graphics, is affected by two
  3132. environment variables. By default, a @w{version 3} CGM file is
  3133. generated. Many older CGM interpreters and viewers, such as the ones
  3134. built into Microsoft Office and other commercial software, only support
  3135. @w{version 1} CGM files. The @code{CGM_MAX_VERSION} environment
  3136. variable may be set to "1", "2", "3", @w{or "4"} (the default) to
  3137. specify a maximum value for the version number. The @code{CGM_ENCODING}
  3138. variable may also be set, to specify the type of encoding used in the
  3139. CGM file. Supported values are "clear_text" (i.e., human readable) and
  3140. "binary" (the default). The WebCGM profile requires that the binary
  3141. encoding be used.
  3142. @code{tek2plot -T pcl}, which produces @w{PCL 5} output for
  3143. Hewlett--Packard printers, is affected by the environment variable
  3144. @code{PCL_ASSIGN_COLORS}@. It should be set to "yes" when producing
  3145. @w{PCL 5} output for a color printer or other color device. This will
  3146. ensure accurate color reproduction by giving the output device complete
  3147. freedom in assigning colors, internally, to its ``logical pens''. If it
  3148. is "no" then the device will use a fixed set of colored pens, and will
  3149. emulate other colors by shading. The default is "no" because monochrome
  3150. @w{PCL 5} devices, which are more common than colored ones, must use
  3151. shading to emulate color.
  3152. @code{tek2plot -T hpgl}, which produces Hewlett--Packard Graphics
  3153. Language output, is also affected by several environment variables. The
  3154. most important is @code{HPGL_VERSION}, which may be set to "1", "1.5",
  3155. @w{or "2"} (the default). @w{"1" means} that the output should be
  3156. generic HP-GL, @w{"1.5" means} that the output should be suitable for
  3157. the HP7550A graphics plotter and the HP758x, HP7595A and HP7596A
  3158. drafting plotters (HP-GL with some HP-GL/2 extensions), and @w{"2"
  3159. means} that the output should be modern HP-GL/2. @w{If the} version is
  3160. "1" @w{or "1.5"} then the only available fonts will be vector fonts, and
  3161. all lines will be drawn with a default thickness (the @samp{-W} option
  3162. will not work).
  3163. The position of the @code{tek2plot -T hpgl} graphics display on the page
  3164. can be rotated @w{90 degrees} counterclockwise by setting the
  3165. @code{HPGL_ROTATE} environment variable to "yes". This is not the same
  3166. as the rotation obtained with the @samp{--rotation} option, since it
  3167. both rotates the graphics display and repositions its lower left corner
  3168. toward another corner of the page. Besides "no" and "yes", recognized
  3169. values for the @code{HPGL_ROTATE} variable are "0", "90", "180", @w{and
  3170. "270"}. @w{"no" and} "yes" are equivalent to @w{"0" and "90"},
  3171. respectively. "180" and "270" are supported only if @code{HPGL_VERSION}
  3172. @w{is "2"} (the default).
  3173. The drawing of visible white lines is supported only if
  3174. @code{HPGL_VERSION} is "2" and the environment variable
  3175. @code{HPGL_OPAQUE_MODE} is "yes" (the default). @w{If the} value is
  3176. "no" then white lines (@w{if any}), which are normally drawn with @w{pen
  3177. #0}, will not be drawn. This feature is to accommodate older HP-GL/2
  3178. devices. HP-GL/2 pen plotters, @w{for example}, do not support the use
  3179. of @w{pen #0} to draw visible white lines. Some older HP-GL/2 devices
  3180. may, @w{in fact}, malfunction if asked to draw opaque objects.
  3181. @w{By default}, @code{tek2plot -T hpgl} will draw with a fixed set of
  3182. pens. Which pens are present may be specified by setting the
  3183. @code{HPGL_PENS} environment variable. If @code{HPGL_VERSION} @w{is
  3184. "1"}, the default value of @code{HPGL_PENS} is "1=black"; if
  3185. @code{HPGL_VERSION} is "1.5" @w{or "2"}, the default value of
  3186. @code{HPGL_PENS} is
  3187. "1=black:2=red:3=green:4=yellow:5=blue:6=magenta:7=cyan". The format
  3188. should be self-explanatory. By setting @code{HPGL_PENS}, you may
  3189. specify a color for any pen in the range #1@dots{}#31. For information
  3190. on what color names are recognized, see @ref{Color Names}. @w{Pen #1}
  3191. must always be present, though it need not be black. Any pen in
  3192. the range #2@dots{}#31 may be omitted.
  3193. If @code{HPGL_VERSION} is "2" then @code{tek2plot -T hpgl} will also be
  3194. affected by the environment variable @code{HPGL_ASSIGN_COLORS}@. @w{If
  3195. the} value of this variable is "yes", then @code{tek2plot -T hpgl} will
  3196. not be restricted to the palette specified in @code{HPGL_PENS}: @w{it
  3197. will} assign colors to ``logical pens'' in the range #1@dots{}#31, @w{as
  3198. needed}. The default value is "no" because other than color LaserJet
  3199. printers and DesignJet plotters, not many HP-GL/2 devices allow the
  3200. assignment of colors to logical pens. In particular, HP-GL/2 pen
  3201. plotters do not.
  3202. @node plotfont, spline, tek2plot, Top
  3203. @chapter The @code{plotfont} Utility
  3204. @menu
  3205. * plotfont Examples:: How to use plotfont
  3206. * plotfont Invocation:: Command-line options
  3207. * plotfont Environment:: Environment variables
  3208. @end menu
  3209. @node plotfont Examples, plotfont Invocation, plotfont, plotfont
  3210. @section How to use @code{plotfont}
  3211. GNU @code{plotfont} is a simple utility that will produce a character
  3212. map for any font available to the GNU plotting utilities @code{graph},
  3213. @code{plot}, @code{pic2plot}, and @code{tek2plot}, and the GNU
  3214. @code{libplot} graphics library on which they are based. The map may be
  3215. displayed on an @w{X Window} System display, or produced in any of
  3216. several output formats. The @samp{-T} option is used to specify the
  3217. desired output format. Supported output formats include "X", "png",
  3218. "pnm", "gif", "svg", "ai", "ps", "cgm", "fig", "pcl", "hpgl", "regis",
  3219. "tek", and "meta" (the default).
  3220. Which fonts are available depends on the choice of display or output
  3221. format. @w{To get} a list of the available fonts, use the
  3222. @samp{--help-fonts} option. For example,
  3223. @example
  3224. plotfont -T ps --help-fonts
  3225. @end example
  3226. @noindent
  3227. will list the fonts that are available when producing Postscript output.
  3228. One of these fonts is "Times-Roman". Doing
  3229. @example
  3230. plotfont -T ps Times-Roman > map.ps
  3231. @end example
  3232. @noindent
  3233. will produce a character map of the lower half of this font, which
  3234. consists of printable ASCII characters. The map will be a 12x8 grid,
  3235. with a character centered in each grid cell. If you include the
  3236. @samp{-2} option, you will get a map of the upper half of the font.
  3237. Most built-in fonts are ISO-Latin-1 fonts, which means that the upper
  3238. half is arranged according to the ISO-Latin-1 encoding. The
  3239. "HersheyCyrillic" font is one that is not. If you do
  3240. @example
  3241. plotfont -T ps -2 HersheyCyrillic > map.ps
  3242. @end example
  3243. @noindent
  3244. you will get a map that illustrates its arrangment, which is called
  3245. @w{KOI8-R}@. The @w{KOI8-R} arrangement is the standard for Unix and
  3246. networking applications in the former Soviet Union. So-called dingbats
  3247. fonts, such as "ZapfDingbats" and "Wingdings", also have an
  3248. individualistic layout. In most installations of the plotting
  3249. utilities, the Wingdings font is not available when producing Postscript
  3250. output. However, @w{it is} available when producing output in @w{PCL 5}
  3251. or HP-GL/2 format. If you do
  3252. @example
  3253. plotfont -T hpgl Wingdings > map.plt
  3254. @end example
  3255. @noindent
  3256. you will get a Wingdings character map, in HP-GL/2 format, that may be
  3257. imported into any application that understands HP-GL/2. Similarly,
  3258. @code{plotfont -T pcl Wingdings} will produce a Wingdings character
  3259. map in @w{PCL 5} format, which may be printed on a LaserJet or other
  3260. @w{PCL 5} device.
  3261. In all, more than a hundred fonts are built into the plotting utilities.
  3262. @xref{Text Fonts}. Actually, if you are using the plotting utilities to
  3263. display output on an @w{X display}, you are not restricted to the
  3264. built-in fonts. Doing
  3265. @example
  3266. plotfont -T X --help-fonts
  3267. @end example
  3268. @noindent
  3269. produces a list of the built-in fonts that are available, including
  3270. both Hershey and Postscript fonts. But fonts available on your @w{X
  3271. display} may also be used. The @code{xlsfonts} command will list the
  3272. core @w{X fonts} available on your @w{X display}, most font names
  3273. being given in what is called XLFD format. The plotting utilities
  3274. refer to core @w{X fonts} by shortened versions of their XLFD names.
  3275. For example, the font "CharterBT-Roman" is available on many @w{X
  3276. displays}. Its XLFD name is
  3277. "-bitstream-charter-medium-r-normal--0-0-0-0-p-0-iso8859-1", and its
  3278. shortened XLFD name is "charter-medium-r-normal". If you do
  3279. @example
  3280. plotfont -T X charter-medium-r-normal
  3281. @end example
  3282. @noindent
  3283. then a character map for this font will be displayed in a popped-up
  3284. @w{X window}.
  3285. When using the @samp{-T X} option, you may also use the
  3286. @samp{--bitmap-size} option to choose the size of the popped-up
  3287. window. Modern @w{X displays} can scale fonts by different amounts in
  3288. the horizontal and vertical directions. If, for example, you add
  3289. @samp{--bitmap-size 600x300} to the above command line, both the
  3290. character map and the CharterBT-Roman font @w{within it} will be
  3291. scaled in this way.
  3292. @node plotfont Invocation, plotfont Environment, plotfont Examples, plotfont
  3293. @section @code{plotfont} command-line options
  3294. The @code{plotfont} font display utility will produce a character map
  3295. for any of the fonts available to the GNU plotting utilities
  3296. @code{graph}, @code{plot}, @code{pic2plot}, and @code{tek2plot}, and the
  3297. GNU @code{libplot} graphics library on which they are based. The map
  3298. may be produced in any supported output format, or displayed on an @w{X
  3299. Window} System display. The output format is specified
  3300. with the @samp{-T} option.
  3301. The names of the fonts for which a character map will be produced may
  3302. appear anywhere on the @code{plotfont} command line. That is, the
  3303. relative order of font names and command-line options does not matter.
  3304. The character map is written to standard output, unless the @samp{-T X}
  3305. option is specified. @w{In that} case the character map is displayed in
  3306. a window on an @w{X Window} System display, and there is no output file.
  3307. The possible options are listed below. There are three sorts of option:
  3308. @enumerate
  3309. @item
  3310. General options.
  3311. @item
  3312. Options relevant only to raw @code{plotfont}, i.e., relevant only if no
  3313. output format is specified with the @samp{-T} option.
  3314. @item
  3315. Options requesting information (e.g., @samp{--help}).
  3316. @end enumerate
  3317. @noindent
  3318. Each option that takes an argument is followed, in parentheses, by the
  3319. type and default value of the argument.
  3320. The following are general options.
  3321. @table @samp
  3322. @item -1
  3323. @itemx --lower-half
  3324. Generate a character map for the lower half of each specified font.
  3325. This is the default.
  3326. @item -2
  3327. @itemx --upper-half
  3328. Generate a character map for the upper half of each specified font.
  3329. @item -o
  3330. @itemx --octal
  3331. Number the characters in octal rather than in decimal (the default).
  3332. @item -x
  3333. @itemx --hexadecimal
  3334. Number the characters in hexadecimal rather than in decimal (the default).
  3335. @item --box
  3336. Surround each character with a box, showing its extent to left and
  3337. right. The default is not to do this.
  3338. @item -j @var{row}
  3339. @itemx --jis-row @var{row}
  3340. Generate a character map for row @var{row} of a Japanese font arranged
  3341. according to JIS [Japanese Industrial Standard] X0208. The only such
  3342. font currently available is the HersheyEUC [Extended Unix Code] font.
  3343. @w{If used}, this option overrides the @samp{-1} and @samp{-2} options.
  3344. The valid rows are 1@dots{}94. In the JIS X0208 standard, Roman
  3345. characters are located in @w{row 3}, and Japanese syllabic characters
  3346. (Hiragana and Katakana) are located in rows 4 @w{and 5}. Greek and
  3347. Cyrillic characters are located in rows 6 @w{and 7}. Japanese
  3348. ideographic characters (Kanji) are located in rows 16@dots{}84. Rows
  3349. 16@dots{}47 contain the JIS @w{Level 1} Kanji, which are the most
  3350. frequently used. They are arranged according @w{to On} (old Chinese)
  3351. reading. Rows 48@dots{}84 contain the less frequently used JIS @w{Level
  3352. 2} Kanji.
  3353. The HersheyEUC font contains 596 of the 2965 @w{Level 1} Kanji, and
  3354. seven of the @w{Level 2} Kanji. @w{It uses} the 8-bit EUC-JP encoding.
  3355. This encoding is a multibyte encoding that includes the ASCII character
  3356. set @w{as well} as the JIS X0208 characters. It represents each ASCII
  3357. character in the usual way, i.e., as a single byte that does not have
  3358. its high bit set. Each JIS X0208 character is represented as two bytes,
  3359. each with the high bit set. The first byte contains the row number
  3360. @w{(plus 32)}, and the second byte contains the character number.
  3361. @item -T @var{type}
  3362. @itemx --output-format @var{type}
  3363. (String, default "meta".) Select an output format of type @var{type},
  3364. which may be one of the strings "X", "png", "pnm", "gif", "svg", "ai",
  3365. "ps", "cgm", "fig", "pcl", "hpgl", "regis", "tek", and "meta". These
  3366. refer respectively to the @w{X Window System}, PNG format, portable
  3367. anymap (PBM/PGM/PPM) format, pseudo-GIF format, the XML-based Scalable
  3368. Vector Graphics format, the format used by Adobe Illustrator,
  3369. @code{idraw}-editable Postscript, the WebCGM format for Web-based
  3370. vector graphics, the format used by the @code{xfig} drawing editor,
  3371. the Hewlett--Packard @w{PCL 5} printer language, the Hewlett--Packard
  3372. Graphics Language (@w{by default}, HP-GL/2), the ReGIS (remote
  3373. graphics instruction set) format developed @w{by DEC}, Tektronix
  3374. format, and device-independent GNU graphics metafile format. The
  3375. option @samp{--display-type} is an obsolete alternative to
  3376. @samp{--output-format}.
  3377. Files in PNG, PNM, pseudo-GIF, SVG, AI, or Fig format may contain only a
  3378. single page of graphics. So if the @samp{-T png} option, the @samp{-T
  3379. pnm} option, the @samp{-T gif} option, the @samp{-T svg} option, the
  3380. @samp{-T ai} option, or the @samp{-T fig} option is used, a character
  3381. map will be produced for only the first-specified font.
  3382. @item --bg-color @var{name}
  3383. (String, default "white".) Set the color used for the background to be
  3384. @var{name}. This is relevant only to @code{plotfont @w{-T X}},
  3385. @code{plotfont -T png}, @code{plotfont -T pnm}, @code{plotfont -T gif},
  3386. @code{plotfont -T cgm}, @code{plotfont -T regis}, and @code{plotfont -T
  3387. meta}. @w{An unrecognized} name sets the color to the default. For
  3388. information on what names are recognized, see @ref{Color Names}. The
  3389. environment variable @code{BG_COLOR} can equally well be used to specify
  3390. the background color.
  3391. If the @samp{-T png} or @samp{-T gif} option is used, a transparent PNG
  3392. file or a transparent pseudo-GIF, respectively, may be produced by
  3393. setting the @code{TRANSPARENT_COLOR} environment variable to the name of
  3394. the background color. @xref{plotfont Environment}. @w{If the} @samp{-T
  3395. svg} or @samp{-T cgm} option is used, an output file without a
  3396. background may be produced by setting the background color to "none".
  3397. @item --bitmap-size @var{bitmap_size}
  3398. (String, default "570x570".) Set the size of the graphics display in
  3399. which the character map will be drawn, in terms of pixels, to be
  3400. @var{bitmap_size}. This is relevant only to @code{plotfont @w{-T X}},
  3401. @code{plotfont -T png}, @code{plotfont -T pnm}, and @code{plotfont -T
  3402. gif}, for all of which the size can be expressed in terms of pixels.
  3403. The environment variable @code{BITMAPSIZE} may equally well be used to
  3404. specify the size.
  3405. The graphics display used by @code{plotfont -T X} is a popped-up @w{X
  3406. window}. Command-line positioning of this window on an @w{X Window}
  3407. System display is supported. For example, if @var{bitmap_size} is
  3408. "570x570+0+0" then the window will be @w{popped up} in the upper left
  3409. corner.
  3410. If you choose a rectangular (non-square) window size, the fonts in the
  3411. plot will be scaled anisotropically, i.e., by different factors in the
  3412. horizontal and vertical direction.
  3413. For backward compatibility, @code{plotfont -T X} allows the user to set
  3414. the window size and position by setting the @w{X resource}
  3415. @code{Xplot.geometry}, instead of @samp{--bitmap-size} or
  3416. @code{BITMAPSIZE}@.
  3417. @item --emulate-color @var{option}
  3418. (String, default "no".) If @var{option} is "yes", replace each color in
  3419. the output by an appropriate shade of gray. This is seldom useful,
  3420. except when using @samp{plotfont -T pcl} to prepare output for a @w{PCL
  3421. 5} device. (Many monochrome @w{PCL 5} devices, such as monochrome
  3422. LaserJets, do a poor job of emulating color on their own. They usually
  3423. map HP-GL/2's seven standard pen colors, including even yellow, to
  3424. black.) You may equally well request color emulation by setting the
  3425. environment variable @code{EMULATE_COLOR} to "yes".
  3426. @item --numbering-font-name @var{font_name}
  3427. (String, default "Helvetica" except for @code{plotfont -T pcl}, for
  3428. which "Univers" is the default, and @code{plotfont -T png},
  3429. @code{plotfont -T pnm}, @code{plotfont -T gif}, @code{plotfont -T hpgl},
  3430. @code{plotfont -T regis}, and @code{plotfont -T tek}, for all of which
  3431. "HersheySerif" is the default.) Set the font used for the numbering of
  3432. the characters in the character map(s) to be @var{font_name}.
  3433. @item --page-size @var{pagesize}
  3434. (String, default "letter".) Set the size of the page on which the
  3435. character map(s) will be drawn. This is relevant only to @code{plotfont
  3436. -T svg}, @code{plotfont -T ai}, @code{plotfont -T ps}, @code{plotfont -T
  3437. fig}, @code{plotfont -T pcl}, and @code{plotfont @w{-T} hpgl}. "letter"
  3438. means an 8.5@dmn{in} by 11@dmn{in} page. Any ISO page size in the range
  3439. "a0"@dots{}"a4" or ANSI page size in the range "a"@dots{}"e" may be
  3440. specified ("letter" is an alias @w{for "a"} and "tabloid" is an alias
  3441. @w{for "b"}). "legal", "ledger", @w{and "b5"} are recognized page sizes
  3442. also. The environment variable @code{PAGESIZE} can equally well be used
  3443. to specify the page size.
  3444. For @code{plotfont -T ai}, @code{plotfont -T ps}, @code{plotfont -T
  3445. pcl}, and @code{plotfont -T fig}, the graphics display (or `viewport')
  3446. within which the character map is drawn will be, by default, a square
  3447. region centered on the specified page. For @code{plotfont -T hpgl}, it
  3448. will be a square region of the same size, but may be positioned
  3449. differently. Either or both of the dimensions of the graphics display
  3450. can be specified explicitly. For example, @var{pagesize} could be
  3451. specified as "letter,xsize=4in", or "a4,xsize=10cm,ysize=15cm". The
  3452. dimensions are allowed to be negative (@w{a negative} dimension results
  3453. in a reflection).
  3454. The position of the graphics display, relative to its default
  3455. position, may optionally be adjusted by specifying an offset vector.
  3456. For example, @var{pagesize} could be specified as
  3457. "letter,yoffset=1.2in", or "a4,xoffset=@minus{}5mm,yoffset=2.0cm".
  3458. @w{It is} also possible to position the graphics display precisely, by
  3459. specifying the location of its lower left corner relative to the lower
  3460. left corner of the page. For example, @var{pagesize} could be
  3461. specified as "letter,xorigin=2in,yorigin=3in", or
  3462. "a4,xorigin=0.5cm,yorigin=0.5cm". The preceding options may be
  3463. intermingled.
  3464. @code{plotfont -T svg} and @code{plotfont -T cgm} ignore the
  3465. "xoffset", "yoffset", "xorigin", and "yorigin" options, since SVG
  3466. format and WebCGM format have no notion of the Web page on which the
  3467. graphics display will ultimately be positioned. However, they do
  3468. respect the "xsize" and "ysize" options. For more on page sizes, see
  3469. @ref{Page and Viewport Sizes}.
  3470. @item --pen-color @var{name}
  3471. (String, default "black".) Set the pen color to be @var{name}. An
  3472. unrecognized name sets the pen color to the default. For information on
  3473. what color names are recognized, see @ref{Color Names}.
  3474. @item --rotation @var{angle}
  3475. (Float, default 0.0.) Set the rotation angle of the graphics display
  3476. to be @var{angle} degrees. The rotation is counterclockwise. The
  3477. environment variable @code{ROTATION} can equally well be used to
  3478. specify the rotation angle.
  3479. This option is used for switching between portrait and landscape
  3480. orientations, which have rotation angles @w{0 and} 90 degrees
  3481. respectively. Postmodernists may also find it useful.
  3482. @item --title-font-name @var{font_name}
  3483. (String) Set the font used for the title of each character map to be
  3484. @var{font_name}. Normally the font used for the title is the same as
  3485. the font whose character set is being displayed. This option is useful
  3486. when producing character maps for unusual fonts such as "ZapfDingbats"
  3487. and "Wingdings".
  3488. @end table
  3489. The following option is relevant only to raw @code{plotfont}, i.e.,
  3490. relevant only if no output format is specified with the
  3491. @samp{-T} option. In this case @code{plotfont} outputs a graphics
  3492. metafile, which may be translated to other formats by invoking
  3493. @code{plot}.
  3494. @table @samp
  3495. @item -O
  3496. @itemx --portable-output
  3497. Output the portable (human-readable) version of GNU metafile format,
  3498. rather than a binary version (the default). This can also be requested
  3499. by setting the environment variable @code{META_PORTABLE} to "yes".
  3500. @end table
  3501. The following options request information.
  3502. @table @samp
  3503. @item --help
  3504. Print a list of command-line options, and then exit.
  3505. @item --help-fonts
  3506. Print a table of available fonts, and then exit. The table will depend
  3507. on which output format is specified with the @samp{-T}
  3508. option. @code{plotfont @w{-T X}}, @code{plotfont -T svg},
  3509. @code{plotfont -T ai}, @code{plotfont -T ps}, @code{plotfont -T cgm},
  3510. and @code{plotfont -T fig} each support the 35 standard Postscript
  3511. fonts. @code{plotfont -T svg}, @code{plotfont -T ai}, @code{plotfont -T
  3512. pcl}, and @code{plotfont -T hpgl} support the 45 standard @w{PCL 5}
  3513. fonts, and @code{plotfont -T pcl} and @code{plotfont -T hpgl} support a
  3514. number of Hewlett--Packard vector fonts. All of the preceding, together
  3515. with @code{plotfont -T png}, @code{plotfont -T pnm}, @code{plotfont -T
  3516. gif}, @code{plotfont -T regis}, and @code{plotfont -T tek}, support a
  3517. set of 22 Hershey vector fonts. Raw @code{plotfont} @w{in principle}
  3518. supports any of these fonts, since its output must be translated to
  3519. other formats with @code{plot}.
  3520. @item --list-fonts
  3521. Like @samp{--help-fonts}, but lists the fonts in a single column to
  3522. facilitate piping to other programs. @w{If no} output
  3523. format is specified with the @samp{-T} option, the full set of supported
  3524. fonts is listed.
  3525. @item --version
  3526. Print the version number of @code{plotfont} and the plotting utilities
  3527. package, and exit.
  3528. @end table
  3529. @node plotfont Environment, , plotfont Invocation, plotfont
  3530. @section Environment variables
  3531. The behavior of @code{plotfont} is affected by several environment
  3532. variables, which are the same as those that affect @code{graph},
  3533. @code{plot}, and @code{tek2plot}. For convenience, we list them here.
  3534. We have already mentioned the environment variables @code{BITMAPSIZE},
  3535. @code{PAGESIZE}, @code{BG_COLOR}, @samp{EMULATE_COLOR}, and
  3536. @code{ROTATION}@. They serve as backups for the several options
  3537. @samp{--bitmap-size}, @samp{--page-size}, @samp{--bg-color},
  3538. @code{--emulate-color}, and @samp{--rotation}. The remaining
  3539. environment variables are specific to individual output formats.
  3540. @code{plotfont @w{-T X}}, which pops up a window on an @w{X Window}
  3541. System display and draws a character map @w{in it}, checks the
  3542. @code{DISPLAY} environment variable. The value of this variable
  3543. determines the display on which the window will be @w{popped up}.
  3544. @code{plotfont -T png} and @code{plotfont -T gif}, which produce output
  3545. in PNG format and pseudo-GIF format respectively, are affected by two
  3546. environment variables. If the value of the @code{INTERLACE} variable is
  3547. "yes", the output file will be interlaced. Also, if the value of the
  3548. @code{TRANSPARENT_COLOR} environment variable is the name of a color
  3549. that appears in the output file, that color will be treated as
  3550. transparent by most applications. For information on what color names
  3551. are recognized, see @ref{Color Names}.
  3552. @code{plotfont -T pnm}, which produces output in Portable Anymap
  3553. (PBM/PGM/PPM) format, is affected by the @code{PNM_PORTABLE} environment
  3554. variable. If its value is "yes", the output file will be in the
  3555. portable (human readable) version of PBM, PGM, or PPM format, rather
  3556. than the default (binary) version.
  3557. @code{plotfont -T cgm}, which produces CGM files that comply with the
  3558. WebCGM profile for Web-based vector graphics, is affected by two
  3559. environment variables. By default, a @w{version 3} CGM file is
  3560. generated. Many older CGM interpreters and viewers, such as the ones
  3561. built into Microsoft Office and other commercial software, only support
  3562. @w{version 1} CGM files. The @code{CGM_MAX_VERSION} environment
  3563. variable may be set to "1", "2", "3", @w{or "4"} (the default) to
  3564. specify a maximum value for the version number. The @code{CGM_ENCODING}
  3565. variable may also be set, to specify the type of encoding used in the
  3566. CGM file. Supported values are "clear_text" (i.e., human readable) and
  3567. "binary" (the default). The WebCGM profile requires that the binary
  3568. encoding be used.
  3569. @code{plotfont -T pcl}, which produces @w{PCL 5} output for
  3570. Hewlett--Packard printers, is affected by the environment variable
  3571. @code{PCL_ASSIGN_COLORS}@. It should be set to "yes" when producing
  3572. @w{PCL 5} output for a color printer or other color device. This will
  3573. ensure accurate color reproduction by giving the output device complete
  3574. freedom in assigning colors, internally, to its ``logical pens''. If it
  3575. is "no" then the device will use a fixed set of colored pens, and will
  3576. emulate other colors by shading. The default is "no" because monochrome
  3577. @w{PCL 5} devices, which are more common than colored ones, must use
  3578. shading to emulate color.
  3579. @code{plotfont -T hpgl}, which produces Hewlett--Packard Graphics
  3580. Language output, is also affected by several environment variables. The
  3581. most important is @code{HPGL_VERSION}, which may be set to "1", "1.5",
  3582. @w{or "2"} (the default). @w{"1" means} that the output should be
  3583. generic HP-GL, @w{"1.5" means} that the output should be suitable for
  3584. the HP7550A graphics plotter and the HP758x, HP7595A and HP7596A
  3585. drafting plotters (HP-GL with some HP-GL/2 extensions), and @w{"2"
  3586. means} that the output should be modern HP-GL/2. @w{If the} version is
  3587. "1" @w{or "1.5"} then the only available fonts will be vector fonts.
  3588. The position of the @code{plotfont -T hpgl} graphics display on the page
  3589. can be rotated @w{90 degrees} counterclockwise by setting the
  3590. @code{HPGL_ROTATE} environment variable to "yes". This is not the same
  3591. as the rotation obtained with the @samp{--rotation} option, since it
  3592. both rotates the graphics display and repositions its lower left corner
  3593. toward another corner of the page. Besides "no" and "yes", recognized
  3594. values for the @code{HPGL_ROTATE} variable are "0", "90", "180", @w{and
  3595. "270"}. @w{"no" and} "yes" are equivalent to @w{"0" and "90"},
  3596. respectively. "180" and "270" are supported only if @code{HPGL_VERSION}
  3597. @w{is "2"} (the default).
  3598. @w{By default}, @code{plotfont -T hpgl} will draw with a fixed set of
  3599. pens. Which pens are present may be specified by setting the
  3600. @code{HPGL_PENS} environment variable. If @code{HPGL_VERSION} @w{is
  3601. "1"}, the default value of @code{HPGL_PENS} is "1=black"; if
  3602. @code{HPGL_VERSION} is "1.5" @w{or "2"}, the default value of
  3603. @code{HPGL_PENS} is
  3604. "1=black:2=red:3=green:4=yellow:5=blue:6=magenta:7=cyan". The format
  3605. should be self-explanatory. By setting @code{HPGL_PENS}, you may
  3606. specify a color for any pen in the range #1@dots{}#31. For information
  3607. on what color names are recognized, see @ref{Color Names}. @w{Pen #1}
  3608. must always be present, though it need not be black. Any pen in
  3609. the range #2@dots{}#31 may be omitted.
  3610. If @code{HPGL_VERSION} is "2" then @code{plotfont -T hpgl} will also be
  3611. affected by the environment variable @code{HPGL_ASSIGN_COLORS}@. @w{If
  3612. the} value of this variable is "yes", then @code{plotfont -T hpgl} will
  3613. not be restricted to the palette specified in @code{HPGL_PENS}: @w{it
  3614. will} assign colors to ``logical pens'' in the range #1@dots{}#31, @w{as
  3615. needed}. The default value is "no" because other than color LaserJet
  3616. printers and DesignJet plotters, not many HP-GL/2 devices allow the
  3617. assignment of colors to logical pens. In particular, HP-GL/2 pen
  3618. plotters do not.
  3619. @code{plotfont -T tek}, which produces output for a Tektronix terminal
  3620. or emulator, checks the @code{TERM} environment variable. @w{If the}
  3621. value of @code{TERM} is a string beginning with "xterm", "nxterm", or
  3622. "kterm", @w{it is} taken as a sign that @code{plotfont} is running in an
  3623. @w{X Window} System VT100 terminal emulator: @w{an @code{xterm}},
  3624. @code{nxterm}, or @code{kterm}. Before drawing graphics, @code{plotfont
  3625. -T tek} will emit an escape sequence that causes the terminal emulator's
  3626. auxiliary Tektronix window, which is normally hidden, to @w{pop up}.
  3627. After the graphics are drawn, an escape sequence that returns control to
  3628. the original VT100 window will be emitted. The Tektronix window will
  3629. remain on the screen.
  3630. If the value of @code{TERM} is a string beginning with "kermit",
  3631. "ansi.sys", or "nansi.sys", @w{it is} taken as a sign that
  3632. @code{plotfont} is running in the VT100 terminal emulator provided by
  3633. the MS-DOS version of @code{kermit}. Before drawing graphics,
  3634. @code{plotfont -T tek} will emit an escape sequence that switches the
  3635. terminal emulator to Tektronix mode. Also, some of the Tektronix
  3636. control codes emitted by @code{plotfont -T tek} will be
  3637. @code{kermit}-specific. There will be a limited amount of color
  3638. support, which is not normally the case (the 16 @code{ansi.sys} colors
  3639. will be supported). After drawing graphics, @code{plotfont -T tek} will
  3640. emit an escape sequence that returns the emulator to VT100 mode. The
  3641. key sequence `@w{ALT minus}' can be employed manually within
  3642. @code{kermit} to switch between the two modes.
  3643. @node spline, ode, plotfont, Top
  3644. @chapter The @code{spline} Program
  3645. @menu
  3646. * spline Examples:: How to use spline
  3647. * Advanced Use of spline:: More sophisticated uses
  3648. * spline Invocation:: Command-line options
  3649. @end menu
  3650. @node spline Examples, Advanced Use of spline, spline, spline
  3651. @section How to use @code{spline}
  3652. GNU @code{spline} is a program for interpolating between the data points
  3653. in one or more datasets. Each dataset would consist of values for an
  3654. independent variable and a dependent variable, which may be a vector of
  3655. specified fixed length. When discussing interpolation, we call these
  3656. variables `@math{t}' and `@math{y}', respectively. @w{To emphasize:}
  3657. @w{@math{t} is a scalar}, but @w{in general} the dependent variable
  3658. @w{@math{y} may} be a vector.
  3659. The simplest case is when there is a single input file, which is in
  3660. ASCII format, and the @w{vector @math{y}} is one-dimensional. This is
  3661. the default. For example, the input file could contain the dataset
  3662. @example
  3663. @group
  3664. 0.0 0.0
  3665. 1.0 1.0
  3666. 2.0 0.0
  3667. @end group
  3668. @end example
  3669. @noindent
  3670. which are the coordinates @math{(t,y)} of the data points (0,0), (1,1),
  3671. and (2,0). Data points do not need to be on different lines, nor do the
  3672. @math{t} @w{and @math{y}} coordinates of a data point need to be on the
  3673. same line. However, there should be no blank lines in the input if it
  3674. is to be viewed as forming a single dataset. Also, @w{by default} the
  3675. @math{t} coordinate should be monotonically increasing, so that
  3676. @w{@math{y} may} be viewed as a function @w{of @math{t}}.
  3677. You would construct a spline (the graph of an `interpolating function')
  3678. passing through the points in this dataset by doing
  3679. @example
  3680. spline input_file > output_file
  3681. @end example
  3682. @noindent
  3683. To produce a Postscript plot of the spline with the @code{graph}
  3684. utility, you would do
  3685. @example
  3686. spline input_file | graph -T ps > output.ps
  3687. @end example
  3688. @noindent
  3689. To display a spline on an @w{X Window} System display, you could do
  3690. @example
  3691. echo 0 0 1 1 2 0 | spline | graph -T X
  3692. @end example
  3693. @noindent
  3694. Notice that the last example avoids the use of the input file
  3695. altogether. @code{spline} will read from standard input if no files are
  3696. specified on the command line, or if the special file @w{name @samp{-}}
  3697. is specified.
  3698. What exactly does @code{spline} do? First, it fits a curve (the graph
  3699. of an interpolating function) through the points in the dataset. Then
  3700. it splits the interval over which the independent @w{variable @math{t}}
  3701. ranges into 100 sub-intervals, and computes the @w{@math{y} values} at
  3702. each of the 101 subdivision points. @w{It then} outputs each of the
  3703. pairs @math{(t, y)}. These are the coordinates of 101 points that lie
  3704. along a curve that interpolates between the points in the dataset. If
  3705. there is more than one dataset in the input (separated by blank lines),
  3706. each dataset is interpolated separately.
  3707. You may use the @samp{-n} option to replace `100' by any other positive
  3708. integer. You may also use the @samp{-t} option to specify an
  3709. interpolation interval that differs from the default (the interval over
  3710. which the independent variable ranges). For example, the command
  3711. @example
  3712. echo 0 0 1 1 2 0 | spline -n 20 -t 1.0 1.5 > output_file
  3713. @end example
  3714. @noindent
  3715. will produce a dataset consisting of 21 (rather than 101) data points,
  3716. with @w{@math{t} values} spaced regularly between 1.0 and 1.5 (rather
  3717. than between 0.0 and 2.0). The data points will lie along a curve
  3718. passing through (0,0), (1,1), and (2,0). This curve will be a parabola.
  3719. In general, the interpolating function will be a piecewise cubic spline.
  3720. That is, between each pair of adjacent `knots' (points in the input
  3721. dataset), @w{@math{y} will} be a cubic function @w{of @math{t}}. This
  3722. function will differ, depending on which pair of knots @w{@math{y} lies}
  3723. between. At each knot, both the slope and curvature of the cubic pieces
  3724. to either side will match. In mathematical terms, the interpolating
  3725. curve will be twice continuously differentiable.
  3726. @code{spline} supports `adding tension' to the interpolating curve.
  3727. @w{A nonzero} value for the tension can be specified with the @samp{-T}
  3728. option. For example, a spline under considerable tension can be
  3729. computed and displayed by doing
  3730. @example
  3731. echo 0 0 1 0 2 0 | spline -T 10 | graph -T X
  3732. @end example
  3733. @noindent
  3734. As the tension parameter is increased to positive infinity, the spline
  3735. will converge to a polygonal line. You are meant to think of the spline
  3736. as being drawn taut. Actually, tension may be negative @w{as well} as
  3737. positive. @w{A spline} with negative tension will tend to bow outward,
  3738. @w{in fact} to oscillate sinusoidally. But as the tension decreases to
  3739. negative infinity, the spline, though oscillatory, will again converge
  3740. to a polygonal line.
  3741. If the tension is positive, its reciprocal will be the maximum range of
  3742. the independent @w{variable @math{t}} over which the spline will `like
  3743. to curve'. Increasing the tension far above zero will accordingly force
  3744. the spline to consist of short curved sections, centered on the data
  3745. points, and sections that are almost straight. It follows that tension
  3746. is a `dimensionful' quantity. @w{If the} tension is nonzero, then when
  3747. the values of the independent variable are multiplied by some common
  3748. positive factor, the tension should be divided by the same factor to
  3749. obtain a scaled version of the original spline. @w{If the} tension is
  3750. zero (the default, or cubic spline case), then the computation of the
  3751. spline will be unaffected by linear scaling of the data.
  3752. In mathematical terms, a spline under tension will satisfy the
  3753. differential equation
  3754. @ifnottex
  3755. @math{y''''=sgn(tension)*(tension^2)y''}
  3756. @end ifnottex
  3757. @tex
  3758. $$y''''={\rm sgn}({\sl tension}){\sl tension}^2\thinspace y''$$
  3759. @end tex
  3760. between each successive pair of knots. If the tension equals zero,
  3761. which is the default, the fourth derivative of @math{y} with respect
  3762. @w{to @math{t}} will equal zero at every point. In this case, @math{y}
  3763. as a function @w{of @math{t}} will reduce to a cubic polynomial between
  3764. each successive pair of knots. But if the tension is nonzero, @math{y}
  3765. will not be a polynomial function @w{of @math{t}}. @w{It may} be expressed
  3766. @w{in terms} of exponential functions, however.
  3767. Irrespective of whether or not the spline is under tension, you may
  3768. specify the @samp{-p} option if you wish the spline to be a periodic
  3769. function @w{of @math{t}}. This will only work if the @math{y} values for
  3770. the first and last points in the dataset are equal. Otherwise, it would
  3771. make no sense to compute a periodic interpolation.
  3772. It is sometimes useful to interpolate between data points at the same
  3773. time as they are generated by an auxiliary program. @w{That is}, @w{it
  3774. is} useful for @code{spline} to function as a real-time filter.
  3775. @code{spline} does not normally act as a filter, since computing an
  3776. interpolating curve that is as smooth as possible is a global task. But
  3777. if the @samp{-f} option is specified, @code{spline} will indeed function
  3778. as a filter. @w{A different} interpolation algorithm (cubic Bessel
  3779. interpolation, which is local rather than global) will be used. @w{If
  3780. @samp{-f}} is specified, @samp{-p} may not be specified. Also, if
  3781. @samp{-f} is specified then an interpolation interval (@w{a range} of
  3782. @w{@math{t} values}) must be requested explicitly with the @samp{-t}
  3783. option.
  3784. Cubic Bessel interpolation is inherently less smooth than the
  3785. construction of a global cubic spline. @w{If the} @samp{-f} option is
  3786. specified, the slope of the spline at each knot will be chosen by
  3787. fitting a parabola through that knot, and the two adjacent knots. The
  3788. slopes of the two interpolating segments to either side of each interior
  3789. knot will match at that knot, but typically their curvatures will not.
  3790. In mathematical terms, the interpolating curve will be continuously
  3791. differentiable, but in general not twice continuously differentiable.
  3792. This loss of differentiability is the price that is paid for functioning
  3793. as a real-time filter.
  3794. @node Advanced Use of spline, spline Invocation, spline Examples, spline
  3795. @section Advanced use of @code{spline}
  3796. The preceding section explains how @code{spline} can be employed to
  3797. interpolate a function @math{y} of a scalar variable @math{t}, in the
  3798. case when @math{y} is a scalar. In this section we explain how to
  3799. perform more sophisticated interpolations. This includes
  3800. multidimensional interpolations, and interpolations that are splinings
  3801. of curves, rather than of functions.
  3802. @code{spline} can handle the case when @w{@math{y} is} a vector of
  3803. arbitrary specified dimensionality. The dimension can be specified with
  3804. the @samp{-d} option. For example, an input file could contain the
  3805. multidimensional dataset
  3806. @example
  3807. @group
  3808. 0.0 0.0 1.0
  3809. 1.0 1.0 0.0
  3810. 2.0 0.0 1.0
  3811. @end group
  3812. @end example
  3813. @noindent
  3814. which are the coordinates @math{(t,y)} of the data points (0,0,1),
  3815. (1,1,0), and (2,0,1). You would construct a spline (the graph of an
  3816. interpolating function) passing through the points in this dataset by
  3817. doing
  3818. @example
  3819. spline -d 2 input_file > output_file
  3820. @end example
  3821. @noindent
  3822. The option @samp{-d 2} is used because in this example, the dependent
  3823. variable @math{y} is a two-dimensional vector. Each of the components
  3824. of @math{y} will be interpolated independently, and the output file will
  3825. contain points that lie along the graph of the resulting interpolating
  3826. function.
  3827. When doing multidimensional splining, you may use any of the options
  3828. that apply in the default one-dimensional case. For example, the
  3829. @samp{-f} option will yield real-time cubic Bessel interpolation. @w{As
  3830. in} the one-dimensional case, if the @samp{-f} option is used then the
  3831. @samp{-t} option must be used @w{as well}, to specify an interpolation
  3832. interval (@w{a range} of @w{@math{t} values}). The @samp{-p} option
  3833. will yield a periodic spline, i.e., the graph of a periodic
  3834. vector-valued function. For this, the first and last dataset
  3835. @w{@math{y} values} must be the same.
  3836. @code{spline} can also be used to draw a curve through arbitrarily
  3837. chosen points in the plane, or @w{in general} through arbitrarily chosen
  3838. points in @math{d}-dimensional space. This is not the same as splining,
  3839. @w{at least} as the term is conventionally defined. The reason is that
  3840. `splining' refers to construction of a function, rather than the
  3841. construction of a curve that may or may not be the graph of a function.
  3842. Not every curve is the graph of a function.
  3843. The following example shows how you may `spline a curve'. The command
  3844. @example
  3845. echo 0 0 1 0 1 1 0 1 | spline -d 2 -a -s | graph -T X
  3846. @end example
  3847. @noindent
  3848. will construct a curve in the plane through the four points (0,0),
  3849. (1,0), (1,1), and (0,1), and graph it on an @w{X Window} System display.
  3850. The @samp{-d 2} option specifies that the dependent variable @math{y} is
  3851. two-dimensional. The @samp{-a} option specifies that @w{@math{t}
  3852. values} are missing from the input, and should be automatically
  3853. generated. @w{By default}, the first @w{@math{t} value} @w{is 0}, the
  3854. second @w{is 1}, etc. The @samp{-s} option specifies that the
  3855. @w{@math{t} values} should be stripped from the output.
  3856. The same technique may be used to spline a closed curve. For example,
  3857. doing
  3858. @example
  3859. echo 0 0 1 0 0 1 0 0 | spline -d 2 -a -s -p | graph -T X
  3860. @end example
  3861. @noindent
  3862. will construct and graph a closed, lozenge-shaped curve through the
  3863. three points (0,0), (1,0), and (0,1). The construction of a closed
  3864. curve is guaranteed by the @samp{-p} (i.e., @samp{--periodic}) option,
  3865. and by the repetition of the initial point (0,0) at the end of the
  3866. sequence.
  3867. When splining a curve, whether open or closed, you may wish to
  3868. substitute the @samp{-A} option for the @samp{-a} option. Like the
  3869. @samp{-a} option, the @samp{-A} option specifies that @w{@math{t}
  3870. values} are missing from the input and should be automatically
  3871. generated. However, the increment from one @w{@math{t} value} to the
  3872. next will be the distance between the corresponding values @w{of
  3873. @math{y}}. This scheme for generating @w{@math{t} values}, when
  3874. constructing a curve through a sequence of data points, is the scheme
  3875. that is used in the @w{well known} FITPACK subroutine library. @w{It
  3876. is} probably the best approach when the distances between successive
  3877. points fluctuate considerably.
  3878. A curve through a sequence of points in the plane, whether open or
  3879. closed, may cross itself. Some interesting visual effects can be
  3880. obtained by adding negative tension to such a curve. For example, doing
  3881. @example
  3882. echo 0 0 1 0 1 1 0 0 | spline -d 2 -a -s -p -T -14 -n 500 | graph -T X
  3883. @end example
  3884. @noindent
  3885. will construct a closed curve through the three points (0,0), (1,0),
  3886. and (0,1), which is wound into curlicues. The @samp{-n 500} option is
  3887. included because there are so many windings. @w{It specifies} that 501
  3888. points should be generated, which is enough to draw a smooth curve.
  3889. @noindent
  3890. @node spline Invocation, , Advanced Use of spline, spline
  3891. @section @code{spline} command-line options
  3892. The @code{spline} program will interpolate vector-valued functions of a
  3893. scalar @w{variable @math{t}}, and curves in @math{d}-dimensional space.
  3894. The algorithms used by @code{spline} are similar to those discussed in
  3895. @w{D. Kincaid} and @w{[E.] W.} Cheney, @cite{Numerical Analysis} (2nd
  3896. ed., Brooks/Cole, 1996), section 6.4, and @w{C. de Boor}, @cite{A
  3897. Practical Guide to Splines} (Springer-Verlag, 1978), @w{Chapter 4}.
  3898. Input file names may be specified anywhere on the command line. That
  3899. is, the relative order of font names and command-line options does not
  3900. matter. If no file names are specified, or the file @w{name @samp{-}}
  3901. is specified, the standard input is read.
  3902. An input file may contain more than a single dataset. Unless the
  3903. @samp{-a} or @samp{-A} options are used (see below), each dataset is
  3904. expected to consist of a sequence of data points, given as alternating
  3905. @math{t} @w{and @math{y}} values. @w{@math{t} is} the scalar
  3906. independent variable, and @w{@math{y} is} the vector-valued dependent
  3907. variable. The dimensionality @w{of @math{y}} is specified with the
  3908. @samp{-d} option (the default @w{is @math{1}}).
  3909. If the input file is in ASCII format (the default), its datasets are
  3910. separated by blank lines. An input file may also contain any number of
  3911. comment lines, which must begin with the comment @w{character `#'}.
  3912. Comment lines are ignored. They are not treated as blank, i.e., they do
  3913. not interrupt a dataset in progress.
  3914. The options to @code{spline} are listed below. There are three sorts of
  3915. option:
  3916. @enumerate
  3917. @item
  3918. Options specifying the type of interpolation to be performed on each dataset.
  3919. @item
  3920. Options specifying the input or output format.
  3921. @item
  3922. Options requesting information (e.g., @samp{--help}).
  3923. @end enumerate
  3924. @noindent
  3925. Options that take an argument are followed, in parentheses, by the type
  3926. and default value of the argument.
  3927. The following options specify the type of interpolation to be performed
  3928. on each dataset.
  3929. @table @samp
  3930. @item -f
  3931. @itemx --filter
  3932. Use a local interpolation algorithm (the cubic Bessel algorithm), so
  3933. that @code{spline} can be used as a real-time filter. The slope of the
  3934. interpolating curve at each point in a dataset will be chosen by fitting
  3935. a quadratic function through that point and the two adjacent points in
  3936. the dataset. If @samp{-f} is specified then the @samp{-t} option,
  3937. otherwise optional, must be used @w{as well}. Also, if @samp{-f} is
  3938. specified then the @samp{-k}, @samp{-p}, and @samp{-T} options may not
  3939. be used.
  3940. If @samp{-f} is @emph{not} specified, then a different (global)
  3941. interpolation algorithm will be used.
  3942. @item -k @var{k}
  3943. @itemx --boundary-condition @var{k}
  3944. (Float, default 1.0.) Set the boundary condition parameter for each
  3945. constructed spline to @w{be @var{k}}. In each of its components, the
  3946. spline will satisfy the two boundary conditions @math{y''[0]=ky''[1]}
  3947. and @math{y''[n]=ky''[n-1]}. Here @math{y[0]} and @math{y[1]} signify
  3948. the values of a specified component of the vector-valued dependent
  3949. variable @math{y} at the first two points of a dataset, and
  3950. @math{y[n-1]} and @math{y[n]} the values at the last two points.
  3951. Setting @var{k} to zero will yield a `natural' spline, i.e., one that
  3952. has zero curvature at the two ends of the dataset. The @samp{-k} option
  3953. may not be used if @samp{-f} or @samp{-p} is specified.
  3954. @item -n @var{n}
  3955. @itemx --number-of-intervals @var{n}
  3956. (Positive integer, default 100.) Subdivide the interval over which
  3957. interpolation occurs into @var{n} subintervals. The number of data
  3958. points computed, and written to the output, will be @math{n+1}.
  3959. @item -p
  3960. @itemx --periodic
  3961. Construct a periodic spline. If this option is specified, the @math{y}
  3962. values for the first and last points in each dataset must be equal. The
  3963. @samp{-f} and @samp{-k} options may not be used if @samp{-p} is
  3964. specified.
  3965. @item -T @var{tension}
  3966. @itemx --tension @var{tension}
  3967. (Float, default 0.0.) Set the tension in each interpolating spline to
  3968. be @var{tension}. Between each pair of successive points in a dataset,
  3969. the constructed spline will satisfy the differential equation
  3970. @ifnottex
  3971. @math{y''''=sgn(tension)*(tension^2)y''}
  3972. @end ifnottex
  3973. @tex
  3974. $y''''={\rm sgn}({\sl tension}){\sl tension}^2\thinspace y''$
  3975. @end tex
  3976. in each of its components. If @var{tension} equals zero, the spline
  3977. will be piecewise cubic. As @var{tension} increases to positive
  3978. infinity, the spline will converge to a polygonal line. The @samp{-T}
  3979. option may not be used if @samp{-f} is specified.
  3980. @item -t @var{tmin} @var{tmax} [@var{tspacing}]
  3981. @itemx --t-limits @var{tmin} @var{tmax} [@var{tspacing}]
  3982. For each dataset, set the interval over which interpolation occurs to be
  3983. the interval between @var{tmin} @w{and @var{tmax}}. If @var{tspacing}
  3984. is not specified, the interval will be divided into the number of
  3985. subintervals specified by the @samp{-n} option. @w{If the} @samp{-t}
  3986. option is not used, the interval over which interpolation occurs will be
  3987. the entire range of the independent variable in the dataset. The
  3988. @samp{-t} option must always be used if the @samp{-f} option is used to
  3989. request filter-like behavior (see above).
  3990. @end table
  3991. @noindent
  3992. The following options specify the format of the input file(s) and the
  3993. output file.
  3994. @table @samp
  3995. @item -d @var{dimension}
  3996. @itemx --y-dimension @var{dimension}
  3997. (Integer, default 1.) Set the dimensionality of the dependent variable
  3998. @math{y} in the input and output files to be @var{dimension}.
  3999. @item -I @var{data-format}
  4000. @itemx --input-format @var{data-format}
  4001. (Character, default @samp{a}.) Set the data format for the input file(s)
  4002. to be @var{data-format}. The possible data formats are as follows.
  4003. @table @samp
  4004. @item a
  4005. ASCII format. Each file is a sequence of floating point numbers,
  4006. interpreted as the @math{t} @w{and @math{y}} coordinates of the
  4007. successive data points in a dataset. If @math{y} is
  4008. @math{d}-dimensional, there will be @math{d+1} numbers for each point.
  4009. The @math{t} @w{and @math{y}} coordinates of a point need not appear on
  4010. the same line, and points need not appear on different lines. But if a
  4011. blank line occurs (i.e., two newlines in succession are seen), @w{it is}
  4012. interpreted as the end of a dataset, and the beginning of the next.
  4013. @item f
  4014. @ifnottex
  4015. Single precision binary format. Each file is a sequence of floating
  4016. point numbers, interpreted as the @math{t} @w{and @math{y}} coordinates
  4017. of the successive data points in a dataset. If @math{y} is
  4018. @math{d}-dimensional, there will be @math{d+1} numbers for each point.
  4019. Successive datasets are separated by a single occurrence of the quantity
  4020. @code{FLT_MAX}, which is the largest possible single precision floating
  4021. point number. @w{On most} machines this is approximately 3.4x10^38.
  4022. @end ifnottex
  4023. @tex
  4024. Single precision binary format. Each file is a sequence of floating
  4025. point numbers, interpreted as the @math{t} @w{and @math{y}} coordinates
  4026. of the successive data points in a dataset. If @math{y} is
  4027. @math{d}-dimensional, there will be @math{d+1} numbers for each point.
  4028. Successive datasets are separated by a single occurrence of the quantity
  4029. @code{FLT_MAX}, which is the largest possible single precision floating
  4030. point number. @w{On most} machines this is approximately
  4031. $3.4\times10^{38}$.
  4032. @end tex
  4033. @item d
  4034. @ifnottex
  4035. Double precision binary format. Each file is a sequence of double
  4036. precision floating point numbers, interpreted as the @math{t} @w{and
  4037. @math{y}} coordinates of the successive data points in a dataset. If
  4038. @math{y} is @math{d}-dimensional, there will be @math{d+1} numbers for
  4039. each point. Successive datasets are separated by a single occurrence of
  4040. the quantity @code{DBL_MAX}, which is the largest possible double
  4041. precision floating point number. @w{On most} machines this is
  4042. approximately 1.8x10^308.
  4043. @end ifnottex
  4044. @tex
  4045. Double precision binary format. Each file is a sequence of double
  4046. precision floating point numbers, interpreted as the @math{t} @w{and
  4047. @math{y}} coordinates of the successive data points in a dataset. If
  4048. @math{y} is @math{d}-dimensional, there will be @math{d+1} numbers for
  4049. each point. Successive datasets are separated by a single occurrence of
  4050. the quantity @code{DBL_MAX}, which is the largest possible double
  4051. precision floating point number. @w{On most} machines this is
  4052. approximately $1.8\times10^{308}$.
  4053. @end tex
  4054. @item i
  4055. @ifnottex
  4056. Integer binary format. Each file is a sequence of integers, interpreted
  4057. as the @math{t} @w{and @math{y}} coordinates of the successive data
  4058. points in a dataset. If @math{y} is @math{d}-dimensional, there will be
  4059. @math{d+1} numbers for each point. Successive datasets are separated by
  4060. a single occurrence of the quantity @code{INT_MAX}, which is the largest
  4061. possible integer. @w{On most} machines this is 2^31-1.
  4062. @end ifnottex
  4063. @tex
  4064. Integer binary format. Each file is a sequence of integers, interpreted
  4065. as the @math{t} @w{and @math{y}} coordinates of the successive data
  4066. points in a dataset. If @math{y} is @math{d}-dimensional, there will be
  4067. @math{d+1} numbers for each point. Successive datasets are separated by
  4068. a single occurrence of the quantity @code{INT_MAX}, which is the largest
  4069. possible integer. @w{On most} machines this is $2^{31}-1$.
  4070. @end tex
  4071. @end table
  4072. @item -a [@var{step_size} [@var{lower_limit}]]
  4073. @itemx --auto-abscissa [@var{step_size} [@var{lower_limit}]]
  4074. (Floats, defaults 1.0 and 0.0.) Automatically generate values for the
  4075. independent @w{variable (@math{t})}. Irrespective of data format
  4076. (@samp{a}, @samp{f}, @samp{d}, @w{or @samp{i}}), this option specifies
  4077. that the values of the independent variable (@math{t}) are missing from
  4078. the input file: the dataset(s) to be read contain only values of the
  4079. dependent @w{variable (@math{y})}, @w{so that} if @math{y} is
  4080. @math{d}-dimensional, there will be only @w{@math{d} numbers} for each
  4081. point. The increment from each @w{@math{t} value} to the next will be
  4082. @var{step_size}, and the first @w{@math{t} value} will be
  4083. @var{lower_limit}.
  4084. @item -A
  4085. @itemx --auto-dist-abscissa
  4086. Automatically generate values for the independent @w{variable
  4087. (@math{t})}. This is a variant form of the @samp{-a} option. The
  4088. increment from each @w{@math{t} value} to the next will be the distance
  4089. between the corresponding @w{@math{y}} values, and the first @w{@math{t}
  4090. value} will be 0.0. This option is useful when interpolating curves
  4091. rather than functions (@pxref{Advanced Use of spline}).
  4092. @item -O @var{data-format}
  4093. @itemx --output-format @var{data-format}
  4094. (Character, default @samp{a}.) Set the data format for the output file
  4095. to be @var{data-format}. The interpretation of the @var{data-format}
  4096. argument is the same as for the @samp{-I} option.
  4097. @item -P @var{significant-digits}
  4098. @itemx --precision @var{significant-digits}
  4099. (Positive integer, default 6.) Set the numerical precision for the
  4100. @math{t} and @math{y} values in the output file to be
  4101. @var{significant-digits}. This takes effect only if the output file is
  4102. written in @samp{a} format, i.e., in ASCII@.
  4103. @item -s
  4104. @itemx --suppress-abscissa
  4105. Omit the independent variable @math{t} from the output file; for each
  4106. point, supply only the dependent @w{variable @math{y}}. If @math{y} is
  4107. @math{d}-dimensional, there will be only @w{@math{d} numbers} for each
  4108. point, @w{not @math{d+1}}. This option is useful when interpolating
  4109. curves rather than functions (@pxref{Advanced Use of spline}).
  4110. @end table
  4111. @noindent
  4112. The following options request information.
  4113. @table @samp
  4114. @item --help
  4115. Print a list of command-line options, and then exit.
  4116. @item --version
  4117. Print the version number of @code{spline} and the plotting utilities
  4118. package, and exit.
  4119. @end table
  4120. @node ode, libplot, spline, Top
  4121. @chapter The @code{ode} Program
  4122. The GNU @code{ode} utility can produce a numerical solution to the
  4123. initial value problem for many systems of first-order ordinary
  4124. differential equations (ODE's). @code{ode} can also be used to solve
  4125. systems of higher-order ODE's, since a simple procedure converts an
  4126. @math{n}'th-order equation into @w{@math{n} first-order} equations. The
  4127. output of @code{ode} can easily be piped to @code{graph}, so that one or
  4128. more solution curves may be plotted as they are generated.
  4129. Three distinct schemes for numerical solution are implemented:
  4130. Runge--Kutta--Fehlberg (the default), Adams--Moulton, and Euler. The
  4131. Runge--Kutta--Fehlberg and Adams--Moulton schemes are available with
  4132. adaptive stepsize.
  4133. @menu
  4134. * Basic Math:: Ordinary differential equations
  4135. * Simple ode Examples:: Simple examples using ode
  4136. * Additional ode Examples:: Additional examples using ode
  4137. * ode Invocation:: ode command-line options
  4138. * Diagnostics:: Diagnostic messages
  4139. * Numerical Error:: Numerical error and how to avoid it
  4140. * Running Time:: Time spent running ode
  4141. * Input Language:: The ode input language formally specified
  4142. * ODE Bibliography:: Bibliography on ode and ODE's
  4143. @end menu
  4144. @node Basic Math, Simple ode Examples, ode, ode
  4145. @section Mathematical basics
  4146. We begin with some standard definitions. A @emph{differential equation}
  4147. is an equation involving an unknown function and its derivatives. @w{A
  4148. differential} equation is @emph{ordinary} if the unknown function
  4149. depends on only one independent variable, often @w{denoted @math{t}}.
  4150. The @emph{order} of the differential equation is the order of the
  4151. highest-order derivative in the equation. One speaks of a family, or
  4152. @emph{system} of equations when more than one equation is involved.
  4153. @w{If the} equations are dependent on one another, they are said to be
  4154. @emph{coupled}. @w{A @emph{solution}} is any function satisfying the
  4155. equations. An @emph{initial value problem} is present when there exist
  4156. subsidiary conditions on the unknown function and its derivatives, all
  4157. of which are given at the same value of the independent variable. In
  4158. principle, such an `initial condition' specifies a unique solution.
  4159. Questions about the existence and uniqueness of a solution, along with
  4160. further terminology, are discussed in any introductory text. (See
  4161. @w{Chapter 1} of Birkhoff and Rota's @cite{Ordinary Differential
  4162. Equations}. For this and other references relevant to @code{ode}, see
  4163. @ref{ODE Bibliography}.)
  4164. In practical problems, the solution of a differential equation is
  4165. usually not expressible @w{in terms} of elementary functions. Hence the
  4166. need for a numerical solution.
  4167. A numerical scheme for solving an initial value problem produces an
  4168. approximate solution, using only functional evaluations and the
  4169. operations of arithmetic. @code{ode} solves first-order initial value
  4170. problems of the form:
  4171. @ifnottex
  4172. @example
  4173. @group
  4174. @math{x' = f(t,x,y,@dots{},z)}
  4175. @math{y' = g(t,x,y,@dots{},z)}
  4176. .
  4177. .
  4178. .
  4179. @math{z' = h(t,x,y,@dots{},z)}
  4180. @end group
  4181. @end example
  4182. @end ifnottex
  4183. @tex
  4184. @example
  4185. @group
  4186. $x' = f(t,x,y,@ldots{},z)$
  4187. $y' = g(t,x,y,@ldots{},z)$
  4188. .
  4189. .
  4190. .
  4191. $z' = h(t,x,y,@ldots{},z)$
  4192. @end group
  4193. @end example
  4194. @end tex
  4195. @noindent
  4196. given the initial values for each dependent variable at the initial
  4197. value of the independent @w{variable @math{t}}, i.e.,
  4198. @example
  4199. @group
  4200. @math{x(a) = b}
  4201. @math{y(a) = c}
  4202. .
  4203. .
  4204. .
  4205. @math{z(a) = d}
  4206. @math{t = a}
  4207. @end group
  4208. @end example
  4209. @tex
  4210. @noindent
  4211. where $a,b,c,\ldots,d$ are constants.
  4212. @end tex
  4213. @ifnottex
  4214. @noindent
  4215. where @math{a,b,c,...,d} are constants.
  4216. @end ifnottex
  4217. @tex
  4218. For @code{ode} to be able to solve such a problem numerically, the
  4219. functions $f,g,\ldots,h$ must be expressed, using the usual operators
  4220. (plus, minus, multiplication, division, and exponentiation), @w{in
  4221. terms} of certain basic functions that @code{ode} recognizes. These are
  4222. the same functions that the plotting program @code{gnuplot} recognizes.
  4223. Moreover, each of $f,g,\ldots,h$ must be given explicitly. @code{ode}
  4224. cannot deal with a system in which one or more of the first derivatives
  4225. is defined implicitly rather than explicitly.
  4226. @end tex
  4227. @ifnottex
  4228. For @code{ode} to be able to solve such a problem numerically, the
  4229. functions f,g,@dots{},h must be expressed, using the usual operators
  4230. (@w{@math{+}, @math{-}}, @math{*}, @math{/}, @w{and ^}), @w{in terms} of
  4231. certain basic functions that @code{ode} recognizes. These are the same
  4232. functions that the plotting program @code{gnuplot} recognizes.
  4233. Moreover, each of f,g,@dots{},h must be given explicitly. @code{ode}
  4234. cannot deal with a system in which one or more of the first derivatives
  4235. is defined implicitly rather than explicitly.
  4236. @end ifnottex
  4237. All schemes for numerical solution involve the calculation of an
  4238. approximate solution at discrete values of the independent @w{variable
  4239. @math{t}}, where the `stepsize' (the difference between any two
  4240. successive values @w{of @math{t}}, usually @w{denoted @math{h}}) may be
  4241. constant or chosen adaptively. @w{In general}, as the stepsize
  4242. decreases the solution becomes more accurate. @w{In @code{ode}}, the
  4243. stepsize can be adjusted by the user.
  4244. @node Simple ode Examples, Additional ode Examples, Basic Math, ode
  4245. @section Simple examples using @code{ode}
  4246. The following examples should illustrate the procedure of stating an
  4247. initial value problem and solving it with @code{ode}. @w{If these}
  4248. examples are too elementary, see @ref{Input Language}, for a formal
  4249. specification of the @code{ode} input language. There is also a
  4250. directory containing examples of @code{ode} input, which is distributed
  4251. along with the GNU plotting utilities. @w{On most} systems it is
  4252. installed as @file{/usr/share/ode} or @file{/usr/local/share/ode}.
  4253. Our first example is a simple one, namely
  4254. @example
  4255. @math{y'(t) = y(t)}
  4256. @end example
  4257. @noindent
  4258. with the initial condition
  4259. @example
  4260. @math{y(0) = 1}
  4261. @end example
  4262. @noindent
  4263. The solution to this differential equation is
  4264. @ifnottex
  4265. @example
  4266. @math{y(t) = e^t}.
  4267. @end example
  4268. @end ifnottex
  4269. @tex
  4270. @example
  4271. @math{y(t) = e^t}.
  4272. @end example
  4273. @end tex
  4274. @noindent
  4275. In particular
  4276. @ifnottex
  4277. @example
  4278. @math{y(1) = e^1 = 2.718282}
  4279. @end example
  4280. @end ifnottex
  4281. @tex
  4282. @example
  4283. @math{y(1) = e^1 = 2.718282}
  4284. @end example
  4285. @end tex
  4286. @noindent
  4287. to seven digits of accuracy.
  4288. You may obtain this result with the aid of @code{ode} by typing on the
  4289. command line the sequence of commands
  4290. @example
  4291. @group
  4292. ode
  4293. y' = y
  4294. y = 1
  4295. print t, y
  4296. step 0, 1
  4297. @end group
  4298. @end example
  4299. @noindent
  4300. Two columns of numbers will appear. Each line will show the value of
  4301. the independent @w{variable @math{t}}, and the value of the
  4302. @w{variable @math{y}}, as @math{t} is `stepped' from 0 @w{to 1}. The
  4303. last line will be
  4304. @example
  4305. 1 2.718282
  4306. @end example
  4307. @noindent
  4308. as expected. You may use the @samp{-p} option to change the precision.
  4309. If, @w{for example}, you type @samp{ode -p 10} rather than @samp{ode},
  4310. you will get ten digits of accuracy in the output, rather than seven
  4311. (the default).
  4312. After the above output, @code{ode} will wait for further instructions.
  4313. Entering for example the line
  4314. @example
  4315. step 1, 0
  4316. @end example
  4317. @noindent
  4318. should yield two more columns of numbers, containing the values of
  4319. @math{t} and @math{y} that are computed when @w{@math{t} is} stepped
  4320. back from 1 @w{to 0}. You could type instead
  4321. @example
  4322. step 1, 2
  4323. @end example
  4324. @noindent
  4325. to increase rather than @w{decrease @math{t}}. @w{To exit} @code{ode},
  4326. you would type a line containing only @samp{.}, i.e.@: @w{a single} period,
  4327. and tap `return'. @code{ode} will also exit if it sees an end-of-file
  4328. indicator in its input stream, which you may send from your terminal by
  4329. typing control-D@.
  4330. Each line of the preceding example should be self-explanatory. @w{A
  4331. @samp{step}} statement sets the beginning and the end of an interval
  4332. over which the independent variable (@w{here, @math{t}}) will range, and
  4333. causes @code{ode} to set the numerical scheme in motion. The initial
  4334. value appearing in the first @samp{step} statement (@w{i.e., 0}) and the
  4335. assignment statement
  4336. @example
  4337. y = 1
  4338. @end example
  4339. @noindent
  4340. are equivalent to the initial condition @math{y(0) = 1}. The statements
  4341. @w{@samp{y' = y}} and @samp{y = 1} are very different: @samp{y' = y}
  4342. defines a way of computing the derivative @w{of @math{y}}, while @samp{y
  4343. = 1} sets the initial value @w{of @math{y}}. Whenever a @samp{step}
  4344. statement is encountered, @code{ode} tries to step the independent
  4345. variable through the interval it specifies. Which values are to be
  4346. printed at each step is specified by the most recent @samp{print}
  4347. statement. @w{For example},
  4348. @example
  4349. print t, y, y'
  4350. @end example
  4351. @noindent
  4352. would cause the current value of the independent @w{variable @math{t}},
  4353. the @w{variable @math{y}}, and its derivative to be printed at each
  4354. step.
  4355. To illustrate @code{ode}'s ability to take its input or the initial part
  4356. of its input from a file, you could prepare a file containing the
  4357. following lines:
  4358. @example
  4359. @group
  4360. # an ode to Euler
  4361. y = 1
  4362. y' = y
  4363. print t, y, y'
  4364. @end group
  4365. @end example
  4366. @noindent
  4367. Call this file @file{euler}. (The @samp{#} line is a comment line,
  4368. which may appear at any point. Everything from @w{the @samp{#}} to the
  4369. end of the line on which it appears will be ignored.) @w{To process}
  4370. this file with @code{ode}, you could type on your terminal
  4371. @example
  4372. @group
  4373. ode -f euler
  4374. step 0, 1
  4375. @end group
  4376. @end example
  4377. @noindent
  4378. These two lines cause @code{ode} to read the file @file{euler}, and the
  4379. stepping to take place. You will now get three quantities (@math{t},
  4380. @math{y}, and @math{y'}) printed at each of the values @w{of @math{t}}
  4381. between 0 @w{and 1}. @w{At the} conclusion of the stepping, @code{ode}
  4382. will wait for any further commands to be input from the terminal. This
  4383. example illustrates that
  4384. @example
  4385. ode -f euler
  4386. @end example
  4387. @noindent
  4388. is not equivalent to
  4389. @example
  4390. ode < euler
  4391. @end example
  4392. @noindent
  4393. The latter would cause @code{ode} to take all its input from the file
  4394. @file{euler}, while the former allows subsequent input from the
  4395. terminal. For the latter to produce output, you would need to include a
  4396. @samp{step} line at the end of the file. You would not need to include
  4397. a @samp{.} line, however. @w{@samp{.} is} used to terminate input only
  4398. when input is being read from a terminal.
  4399. A second simple example involves the numerical solution of a
  4400. second-order differential equation. Consider the initial value problem
  4401. @example
  4402. @group
  4403. @math{y''(t) = -y(t)}
  4404. @math{y(0) = 0}
  4405. @math{y'(0) = 1}
  4406. @end group
  4407. @end example
  4408. @noindent
  4409. Its solution would be
  4410. @ifnottex
  4411. @example
  4412. @math{y(t) = sin(t)}
  4413. @end example
  4414. @end ifnottex
  4415. @tex
  4416. @example
  4417. @math{y(t) = \sin(t)}
  4418. @end example
  4419. @end tex
  4420. @noindent
  4421. To solve this problem using @code{ode}, you must express this
  4422. second-order equation as two first-order equations. Toward this end you
  4423. would introduce a new function, called @math{yp} say, of the independent
  4424. @w{variable @math{t}}. The pair of equations
  4425. @example
  4426. @group
  4427. @math{y' = yp}
  4428. @math{yp' = -y}
  4429. @end group
  4430. @end example
  4431. @noindent
  4432. would be equivalent to the single equation above. This sort of
  4433. reduction of an @math{n}'th order problem to @math{n} first order
  4434. problems is a standard technique.
  4435. To plot the variable @math{y} as a function of the @w{variable
  4436. @math{t}}, you could create a file containing the lines
  4437. @example
  4438. @group
  4439. # sine : y''(t) = -y(t), y(0) = 0, y'(0) = 1
  4440. sine' = cosine
  4441. cosine' = -sine
  4442. sine = 0
  4443. cosine = 1
  4444. print t, sine
  4445. @end group
  4446. @end example
  4447. @noindent
  4448. (@math{y} and @math{yp} have been renamed @i{sine} and @i{cosine}, since
  4449. that is what they will be.) Call this file @file{sine}. To display the
  4450. generated data points on an @w{X Window} System display as they are
  4451. generated, you would type
  4452. @example
  4453. @group
  4454. ode -f sine | graph -T X -x 0 10 -y -1 1
  4455. step 0, 2*PI
  4456. .
  4457. @end group
  4458. @end example
  4459. @noindent
  4460. After you type the @code{ode} line, @code{graph @w{-T X}} will @w{pop
  4461. up} a window, and after you type the @samp{step} line, the generated
  4462. dataset will be drawn @w{in it}. The @samp{-x 0 10} and @samp{-y -1 1}
  4463. options, which set the bounds for the two axes, are necessary if you
  4464. wish to display points in @w{real time}: as they are generated.
  4465. @w{If the} axis bounds were not specified on the command line,
  4466. @code{graph @w{-T X}} would wait until all points are read from the
  4467. input before determining the bounds, and drawing the plot.
  4468. A slight modification of this example, showing how @code{ode} can
  4469. generate several datasets in succession and plot them on the same graph,
  4470. would be the following. Suppose that you type on your terminal the
  4471. following lines.
  4472. @example
  4473. @group
  4474. ode -f sine | graph -T X -C -x 0 10 -y -1 1
  4475. step 0, PI
  4476. step PI, 2*PI
  4477. step 2*PI, 3*PI
  4478. .
  4479. @end group
  4480. @end example
  4481. @noindent
  4482. Then the sine curve will be traced out in three stages. Since the
  4483. output from each @samp{step} statement ends with a blank line,
  4484. @code{graph @w{-T X}} will treat each section of the sine curve as a
  4485. different dataset. If you are using a color display, each of the three
  4486. sections will be plotted in a different color. This is a feature
  4487. provided by @code{graph}, which normally changes its linemode after each
  4488. dataset it reads. If you do not like this feature, you may turn it off
  4489. by using @code{graph -T X -B} instead of @code{graph @w{-T X}}.
  4490. In the above examples, you could use any of the other variants of
  4491. @code{graph} instead of @code{graph @w{-T X}}. For example, you could use
  4492. @code{graph -T ps} to obtain a plot in encapsulated Postscript format,
  4493. by typing
  4494. @example
  4495. @group
  4496. ode -f sine | graph -T ps > plot.ps
  4497. step 0, 2*PI
  4498. .
  4499. @end group
  4500. @end example
  4501. @noindent
  4502. You should note that of the variants of @code{graph}, the variants
  4503. @code{graph -T png}, @code{graph -T pnm}, @code{graph -T gif},
  4504. @code{graph -T svg}, @code{graph -T ai}, @code{graph -T ps}, @code{graph
  4505. -T cgm}, @code{graph -T fig}, @code{graph -T pcl} and @code{graph -T
  4506. hpgl} do not produce output in real time, even when the axis bounds are
  4507. specified with the @samp{-x} @w{and @samp{-y}} options. @w{So if} any
  4508. of these variants is used, the plot will be produced only when input
  4509. from @code{ode} is terminated, which will occur when you @w{type
  4510. @samp{.}}.
  4511. In the preceding examples, the derivatives of the dependent variables
  4512. were specified by comparatively simple expressions. They are allowed to
  4513. be arbitrarily complicated functions of the dependent variables and the
  4514. independent variable. They may also involve any of the functions that
  4515. are built into @code{ode}. @code{ode} has a fair number of functions
  4516. @w{built in}, including @t{abs}, @t{sqrt}, @t{exp}, @t{log}, @t{log10},
  4517. @t{sin}, @t{cos}, @t{tan}, @t{asin}, @t{acos}, @t{atan}, @t{sinh},
  4518. @t{cosh}, @t{tanh}, @t{asinh}, @t{acosh}, and @t{atanh}. Less familiar
  4519. functions which are built @w{into it} are @t{besj0}, @t{besj1},
  4520. @t{besy0}, @t{besy1}, @t{erf}, @t{erfc}, @t{inverf}, @t{lgamma},
  4521. @t{gamma}, @t{norm}, @t{invnorm}, @t{ibeta}, and @t{igamma}. These have
  4522. the same definitions as in the plotting program @code{gnuplot}. (All
  4523. functions take a single argument, except for @t{ibeta}, which takes
  4524. three, and @t{igamma}, which takes two). @code{ode} also knows the
  4525. meaning of the constant @samp{PI}, as the above examples show. The
  4526. names of the preceding functions are reserved, so, e.g., @samp{cos} and
  4527. @samp{sin} may not be used as names for variables.
  4528. Other than the restriction of avoiding reserved names and keywords, the
  4529. names of variables may be chosen arbitrarily. Any sequence of
  4530. alphanumeric characters starting with an alphabetic character may be
  4531. used; the first 32 characters are significant. @w{It is} worth noting
  4532. that @code{ode} identifies the independent variable by the fact that it
  4533. is (or should be) the only variable that has not appeared on the left
  4534. side of a differential equation or an initial value assignment. @w{If
  4535. there} is more than than one such variable then no stepping takes place;
  4536. instead, an error message is printed. @w{If there} is no such variable,
  4537. @w{a dummy} independent variable is invented and given the name
  4538. @samp{(indep)}, internally.
  4539. @node Additional ode Examples, ode Invocation, Simple ode Examples, ode
  4540. @section Additional examples using @code{ode}
  4541. We explain here how to use some additional features of @code{ode}.
  4542. However, the discussion below does not cover all of its capabilities.
  4543. For a complete list of command-line options, see @ref{ode Invocation}.
  4544. It is easy to use @code{ode} to create plots of great beauty. An
  4545. example would be a plot of a @emph{strange attractor}, namely the Lorenz
  4546. attractor. Suppose that a file named @file{lorenz} contains the
  4547. following lines.
  4548. @example
  4549. @group
  4550. # The Lorenz model, a system of three coupled ODE's with parameter r.
  4551. x' = -3*(x-y)
  4552. y' = -x*z+r*x-y
  4553. z' = x*y-z
  4554. @end group
  4555. @group
  4556. r = 26
  4557. x = 0; y = 1; z = 0
  4558. @end group
  4559. @group
  4560. print x, y
  4561. step 0, 200
  4562. @end group
  4563. @end example
  4564. @noindent
  4565. Then executing the command
  4566. @example
  4567. ode < lorenz | graph -T X -C -x -10 10 -y -10 10
  4568. @end example
  4569. @noindent
  4570. would produce a plot of the Lorenz attractor (strictly speaking, @w{a
  4571. plot} of one of its two-dimensional projections). You may produce a
  4572. Postscript plot of the Lorenz attractor, and print it, by doing
  4573. something like
  4574. @example
  4575. ode < lorenz | graph -T ps -x -10 10 -y -10 10 -W 0 | lpr
  4576. @end example
  4577. @noindent
  4578. The @samp{-W 0} (``zero width'') option requests that @code{graph -T ps}
  4579. use the thinnest line possible, to improve the visual appearance of the
  4580. plot on a printer or other Postscript device.
  4581. Besides plotting a visually striking object in real time, the Lorenz
  4582. attractor example shows how statements may be separated by semicolons,
  4583. rather than appearing on different lines. @w{It also} shows how to use
  4584. symbolic constants. @w{In the} description read by @code{ode} the
  4585. @w{parameter @math{r}} is a variable like @math{x}, @math{y}, @w{and
  4586. @math{z}}. But unlike them it is not updated during stepping, since no
  4587. formula for its @w{derivative @math{r'}} is given.
  4588. Our second example deals with the interactive construction of a `phase
  4589. portrait': @w{a set} of solution curves with different initial
  4590. conditions. Phase portraits are of paramount interest in the
  4591. qualitative theory of differential equations, and also possess
  4592. @ae{}sthetic appeal.
  4593. Since a description read by @code{ode} may contain any number of
  4594. @samp{step} statements, multiple solution curves may be plotted in a
  4595. single run. The most recent @samp{print} statement will be used with
  4596. each @samp{step} statement. @w{In practice}, a phase portrait would be
  4597. drawn from a few well-chosen solution curves. Choosing a good set of
  4598. solution curves may require experimentation, which makes interactivity
  4599. and real-time plotting all-important.
  4600. As an example, consider a so-called Lotka--Volterra predator--prey
  4601. model. Suppose that in a lake there are two species of fish: @w{A (the
  4602. prey)} who live by eating a plentiful supply of plants, and B (the
  4603. predator) who @w{eat A}@. Let @math{x(t)} be the population @w{of A}
  4604. and @math{y(t)} the population @w{of B} at @w{time @math{t}}. @w{A
  4605. crude} model for the interaction of A @w{and B} is given by the
  4606. equations
  4607. @example
  4608. @group
  4609. @math{x' = x(a-by)}
  4610. @math{y' = y(cx-d)}
  4611. @end group
  4612. @end example
  4613. @noindent
  4614. where @math{a, b, c, d} are positive constants. To draw a phase
  4615. portrait for this system interactively, you could type
  4616. @example
  4617. @group
  4618. ode | graph -T X -C -x 0 5 -y 0 5
  4619. x' = (a - b*y) * x
  4620. y' = (c*x - d) * y
  4621. a = 1; b = 1; c = 1; d = 1;
  4622. print x, y
  4623. @end group
  4624. @group
  4625. x = 1; y = 2
  4626. step 0, 10
  4627. x = 1; y = 3
  4628. step 0, 10
  4629. x = 1; y = 4
  4630. step 0, 10
  4631. x = 1; y = 5
  4632. step 0, 10
  4633. .
  4634. @end group
  4635. @end example
  4636. @noindent
  4637. Four curves will be drawn in succession, one per @samp{step} line. They
  4638. will be periodic; this periodicity is similar to the fluctuations
  4639. between predator and prey populations that occur in real-world
  4640. ecosystems. @w{On a} color display the curves will appear in different
  4641. colors, since @w{by default}, @code{graph} changes the linemode between
  4642. datasets. That feature may be @w{turned off} by using @code{graph -T X
  4643. -B} rather than @code{graph @w{-T X}}.
  4644. It is sometimes useful to use @code{ode} and @code{graph} to plot
  4645. discrete points, which are not joined by line segments to form a curve.
  4646. Our third example illustrates this. Suppose the file @file{atwoods}
  4647. contains the lines
  4648. @example
  4649. @group
  4650. m = 1
  4651. M = 1.0625
  4652. a = 0.5; adot = 0
  4653. l = 10; ldot = 0
  4654. @end group
  4655. @group
  4656. ldot' = ( m * l * adot * adot - M * 9.8 + m * 9.8 * cos(a) ) / (m + M)
  4657. l' = ldot
  4658. adot' = (-1/l) * (9.8 * sin(a) + 2 * adot * ldot)
  4659. a' = adot
  4660. @end group
  4661. @group
  4662. print l, ldot
  4663. step 0, 400
  4664. @end group
  4665. @end example
  4666. @noindent
  4667. The first few lines describe the functioning of a so-called swinging
  4668. Atwood's machine. An ordinary Atwood's machine consists of a taut cord
  4669. draped over a pulley, with a mass attached to the cord at each end.
  4670. Normally, the heavier @w{mass (@math{M})} would win against the lighter
  4671. @w{mass (@math{m})}, and draw it upward. @w{A swinging} Atwood's
  4672. machine allows the lighter mass to swing back and forth @w{as well} as
  4673. move vertically.
  4674. The @samp{print l, ldot} statement requests that the vertical position
  4675. and vertical velocity of the lighter mass be printed out at each step.
  4676. @w{If you} run the command
  4677. @example
  4678. ode < atwoods | graph -T X -x 9 11 -y -1 1 -m 0 -S 1 -X l -Y ldot
  4679. @end example
  4680. @noindent
  4681. you will obtain a real-time plot. The @samp{-m 0} option requests that
  4682. successive data points not be joined by line segments, and the @samp{-S
  4683. 1} option requests that plotting @w{symbol #1} (@w{a dot}) be plotted at
  4684. the location of each point. As you will see if you run this command,
  4685. the heavy mass does not win against the lighter mass. Instead the
  4686. machine oscillates non-periodically. Since the motion is non-periodic,
  4687. the plot benefits from being drawn as a sequence of unconnected points.
  4688. We conclude by mentioning a few features of @code{ode} that may be
  4689. useful when things are not going quite right. One of them is the
  4690. @samp{examine} statement. @w{It may} be used to discover pertinent
  4691. information about any variable in a system. For details, see @ref{Input
  4692. Language}.
  4693. Another useful feature is that the @samp{print} statement may be used to
  4694. print out more than just the value of a variable. As we have seen, if
  4695. the name of the variable is followed by @samp{'}, the derivative of the
  4696. variable will be printed instead. @w{In a} similar way, following the
  4697. variable name with @samp{?}, @samp{!}, or @samp{~} prints respectively
  4698. the relative single-step error, the absolute single-step error, or the
  4699. accumulated error (not currently implemented). These quantities are
  4700. discussed in @ref{Numerical Error}.
  4701. The @samp{print} statement may be more complicated than was shown in the
  4702. preceding examples. Its general structure is
  4703. @example
  4704. print <pr-list> [every <const>] [from <const>]
  4705. @end example
  4706. @noindent
  4707. The bracket notation @samp{[@dots{}]} means that the enclosed statements
  4708. are optional. Until now we have not mentioned the @samp{every} clause
  4709. or the @samp{from} clause. The @t{<pr-list>} is familiar, however; it
  4710. is simply a comma-separated list of variables. For example, in the
  4711. statement
  4712. @example
  4713. print t, y, y' every 5 from 1
  4714. @end example
  4715. @noindent
  4716. the @t{<pr-list>} is @t{<t, y, y'>}. The clauses @samp{every 5} and
  4717. @samp{from 1} specify that printing should take place after every fifth
  4718. step, and that the printing should begin when the independent
  4719. @w{variable @math{t}} @w{reaches 1}. @w{An @samp{every}} clause is
  4720. useful if you wish to `@w{thin out}' the output generated by a
  4721. @samp{step} statement, and a @samp{from} clause is useful if you wish to
  4722. view only the final portion of a solution curve.
  4723. @node ode Invocation, Diagnostics, Additional ode Examples, ode
  4724. @section @code{ode} command-line options
  4725. @noindent
  4726. The command-line options to @code{ode} are listed below. There are
  4727. several sorts of option:
  4728. @enumerate
  4729. @item
  4730. Options affecting the way in which input is read.
  4731. @item
  4732. Options affecting the format of the output.
  4733. @item
  4734. Options affecting the choice of numerical solution scheme, and the
  4735. error bounds that will be imposed @w{on it}.
  4736. @item
  4737. Options that request information.
  4738. @end enumerate
  4739. @noindent
  4740. The following option affects the way input is read.
  4741. @table @samp
  4742. @item -f @var{filename}
  4743. @itemx --input-file @var{filename}
  4744. Read input from @var{filename} before reading from standard input.
  4745. @end table
  4746. @noindent
  4747. The following options affect the output format.
  4748. @table @samp
  4749. @item -p @var{significant-digits}
  4750. @itemx --precision @var{significant-digits}
  4751. (Positive integer, default 6.) When printing numerical results, use a
  4752. precision specified by @var{significant-digits}. @w{If this} option is
  4753. given, the print format will be scientific notation.
  4754. @item -t
  4755. @itemx --title
  4756. Print a title line at the head of the output, naming the columns. @w{If
  4757. this} option is given, the print format will be scientific notation.
  4758. @end table
  4759. @noindent
  4760. The following options specify the numerical integration scheme. Only
  4761. one of the three basic option @samp{-R}, @samp{-A}, and @samp{-E} may be
  4762. specified. The default is @samp{-R} (Runge--Kutta--Fehlberg).
  4763. @table @samp
  4764. @item -R [@var{stepsize}]
  4765. @itemx --runge-kutta [@var{stepsize}]
  4766. Use a fifth-order Runge--Kutta--Fehlberg algorithm, with an adaptive
  4767. stepsize unless a constant stepsize is specified. When a constant
  4768. stepsize is specified and no error analysis is requested, then a
  4769. classical fourth-order Runge--Kutta scheme is used.
  4770. @item -A [@var{stepsize}]
  4771. @itemx --adams-moulton [@var{stepsize}]
  4772. Use a fourth-order Adams--Moulton predictor--corrector scheme, with an
  4773. adaptive stepsize unless a constant stepsize, @var{stepsize}, is
  4774. specified. The Runge--Kutta--Fehlberg algorithm is used to get past
  4775. `bad' points (@w{if any}).
  4776. @item -E [@var{stepsize}]
  4777. @itemx --euler [@var{stepsize}]
  4778. Use a `quick and dirty' Euler scheme, with a constant stepsize. The
  4779. default value of @var{stepsize} @w{is 0.1}. Not recommended for serious
  4780. applications.
  4781. The error bound options @samp{-r} and @samp{-e} (see below) may not
  4782. be used if @samp{-E} is specified.
  4783. @item -h @var{hmin} [@var{hmax}]
  4784. @itemx --step-size-bound @var{hmin} [@var{hmax}]
  4785. Use a lower bound @var{hmin} on the stepsize. The numerical scheme will
  4786. not let the stepsize go below @var{hmin}. The default is to allow the
  4787. stepsize to shrink to the machine limit, i.e., the minimum nonzero
  4788. double-precision floating point number. The optional argument
  4789. @var{hmax}, if included, specifies a maximum value for the stepsize.
  4790. @w{It is} useful in preventing the numerical routine from skipping
  4791. quickly over an interesting region.
  4792. @end table
  4793. @noindent
  4794. The following options set the error bounds on the numerical solution
  4795. scheme.
  4796. @table @samp
  4797. @item -r @var{rmax} [@var{rmin}]
  4798. @itemx --relative-error-bound @var{rmax} [@var{rmin}]
  4799. @item -e @var{emax} [@var{emin}]
  4800. @itemx --absolute-error-bound @var{emax} [@var{emin}]
  4801. @ifnottex
  4802. The @samp{-r} option sets an upper bound on the relative single-step
  4803. error. If the @samp{-r} option is used, the relative single-step error
  4804. in any dependent variable will never exceed @var{rmax} (the default for
  4805. which is @math{10^(-9)}). If this should occur, the solution will be
  4806. abandoned and an error message will be printed. @w{If the} stepsize is
  4807. not constant, the stepsize will be decreased `adaptively', so that the
  4808. upper bound on the single-step error is not violated. Thus, choosing a
  4809. smaller upper bound on the single-step error will cause smaller
  4810. stepsizes to be chosen. @w{A lower} bound @var{rmin} may optionally be
  4811. specified, to suggest when the stepsize should be increased (the default
  4812. for @var{rmin} is @var{rmax}/1000). The @samp{-e} option is similar to
  4813. @samp{-r}, but bounds the absolute rather than the relative single-step
  4814. error.
  4815. @end ifnottex
  4816. @tex
  4817. The @samp{-r} option sets an upper bound on the relative single-step
  4818. error. If the @samp{-r} option is used, the relative single-step error
  4819. in any dependent variable will never exceed @var{rmax} (the default for
  4820. which is $10^{-9}$). If this should occur, the solution will be
  4821. abandoned and an error message will be printed. @w{If the} stepsize is
  4822. not constant, the stepsize will be decreased `adaptively', so that the
  4823. upper bound on the single-step error is not violated. Thus, choosing a
  4824. smaller upper bound on the single-step error will cause smaller
  4825. stepsizes to be chosen. @w{A lower} bound @var{rmin} may optionally be
  4826. specified, to suggest when the stepsize should be increased (the default
  4827. for @var{rmin} is @var{rmax}/1000). The @samp{-e} option is similar to
  4828. @samp{-r}, but bounds the absolute rather than the relative single-step
  4829. error.
  4830. @end tex
  4831. @item -s
  4832. @itemx --suppress-error-bound
  4833. Suppress the ceiling on single-step error, allowing @code{ode} to
  4834. continue even if this ceiling is exceeded. This may result in large
  4835. numerical errors.
  4836. @end table
  4837. @noindent
  4838. Finally, the following options request information.
  4839. @table @samp
  4840. @item --help
  4841. Print a list of command-line options, and then exit.
  4842. @item --version
  4843. Print the version number of @code{ode} and the plotting utilities
  4844. package, and exit.
  4845. @end table
  4846. @node Diagnostics, Numerical Error, ode Invocation, ode
  4847. @section Diagnostic messages
  4848. @code{ode} is always in one of two states:
  4849. @itemize @bullet
  4850. @item
  4851. Reading input. The input includes a specification of a system of
  4852. ordinary differential equations, together with instructions for
  4853. @w{solving it} numerically: @w{a @samp{print}} line and a @samp{step}
  4854. line.
  4855. @item
  4856. Numerically solving a system, and printing the resulting output.
  4857. @end itemize
  4858. @noindent
  4859. @code{ode} moves from the first to the second state after it sees and
  4860. processes a @samp{step} line. @w{It returns} to the first state after
  4861. the generated output has been printed. Errors may occur in the
  4862. `reading' state or the `solving' state, and may terminate computations
  4863. or even cause @code{ode} to exit. We now explain the possible sorts of
  4864. error.
  4865. While reading input, @code{ode} may encounter a syntax error: an
  4866. ungrammatical line that it is unable to parse. (For a summary of its
  4867. input grammar, see @ref{Input Language}.) @w{If so}, it emits the error
  4868. message
  4869. @example
  4870. ode::nnn: syntax error
  4871. @end example
  4872. @noindent
  4873. where @samp{nnn} is the number of the line containing the error. When
  4874. the @samp{-f filename} option is used to specify an input file,
  4875. the error message will read
  4876. @example
  4877. ode:filename:nnn: syntax error
  4878. @end example
  4879. @noindent
  4880. for errors encountered inside the input file. Subsequently, when
  4881. @code{ode} begins reading the standard input, line numbers will start
  4882. over again @w{from 1}.
  4883. No effort is made to recover from syntax errors in the input. However,
  4884. there is a meager effort to resynchronize, so that more than one syntax
  4885. error in a file may be found at the same time.
  4886. It is also possible that a fatal arithmetic exception (such as a
  4887. division by zero, or a floating point overflow) may occur while
  4888. @code{ode} is reading input. If such an exception occurs, @code{ode}
  4889. will print an ``Floating point exception'' error message and exit.
  4890. Arithmetic exceptions are machine-dependent. @w{On some} machines, the
  4891. line
  4892. @example
  4893. y = 1/0
  4894. @end example
  4895. @noindent
  4896. would induce an arithmetic exception. Also on some machines (not
  4897. necessarily the same ones), the lines
  4898. @example
  4899. @group
  4900. y = 1e100
  4901. z = y^4
  4902. @end group
  4903. @end example
  4904. @ifnottex
  4905. @noindent
  4906. would induce an arithmetic exception. That is because on most
  4907. machines, the double precision quantities that @code{ode} uses
  4908. internally are limited to a maximum size of approximately 1.8x10^308.
  4909. @end ifnottex
  4910. @tex
  4911. @noindent
  4912. would induce an arithmetic exception. That is because on most machines,
  4913. the double precision quantities that @code{ode} uses internally are
  4914. limited to a maximum size of approximately $1.8\times10^{308}$.
  4915. @end tex
  4916. When @code{ode} is in the `solving' state, i.e., computing a numerical
  4917. solution, similar arithmetic exceptions may occur. If so, the solution
  4918. will be interrupted and a message resembling
  4919. @example
  4920. ode: arithmetic exception while calculating y'
  4921. @end example
  4922. @noindent
  4923. will be printed. However, @code{ode} will not exit; the exception will
  4924. be `caught'. @code{ode} itself recognizes the following exceptional
  4925. conditions: square root of a negative number, logarithm of a
  4926. non-positive number, and negative number raised to a non-integer power.
  4927. @code{ode} will catch any of these operations before it is performed,
  4928. and print an error message specifying which illegal operation it has
  4929. encountered.
  4930. @example
  4931. ode: square root of a negative number while calculating y'
  4932. @end example
  4933. @noindent
  4934. would be a typical error message.
  4935. If the machine on which @code{ode} is running supports the
  4936. @samp{matherr} facility for reporting errors in the computation of
  4937. standard mathematical functions, it will be used. This facility reports
  4938. domain errors and range errors (overflows, underflows, and losses of
  4939. significance) that could occur when evaluating such functions as
  4940. @samp{log}, @samp{gamma}, etc.; again, before they are performed. If
  4941. the @code{matherr} facility is present, the error message will be fairly
  4942. informative. @w{For example}, the error message
  4943. @example
  4944. ode: range error (overflow) in lgamma while calculating y'
  4945. @end example
  4946. @noindent
  4947. could be generated if the logarithmic gamma function @samp{lgamma} is
  4948. evaluated at a value of its argument that is too large. The generation
  4949. of any such message, except a message warning of an underflow, will
  4950. cause the numerical solution to be interrupted.
  4951. There is another sort of error that may occur during numerical solution:
  4952. the condition that an error ceiling, which the user may set with the
  4953. @samp{-r} option or the @samp{-e} option, is exceeded. This too will
  4954. cause the numerical solution to be abandoned, and @code{ode} to switch
  4955. back to reading input.
  4956. @node Numerical Error, Running Time, Diagnostics, ode
  4957. @section Numerical error and how to avoid it
  4958. This discussion is necessarily incomplete. Entire books exist on any
  4959. subject mentioned below (e.g., floating point error). Our goals are
  4960. modest: first, to introduce the basic notions of error analysis as they
  4961. apply to @code{ode}; second, @w{to steer} you around the more obvious
  4962. pitfalls. You should look through a numerical analysis text (e.g.,
  4963. Atkinson's @cite{Introduction to Numerical Analysis}) before beginning
  4964. this discussion.
  4965. We begin with some key definitions. The error of greatest concern is
  4966. the difference between the actual solution and the numerical
  4967. approximation to the solution; this is termed the @emph{accumulated
  4968. error}, since the error is @w{built up} during each numerical step.
  4969. Unfortunately, an estimate of this error is usually not available
  4970. without knowledge of the actual solution. There are, however, several
  4971. more usable notions of error. The @emph{single-step error}, in
  4972. particular, is the difference between the actual solution and the
  4973. numerical approximation to the solution after any single step, assuming
  4974. the value at the beginning of the step is correct.
  4975. @ifnottex
  4976. The @emph{relative single-step error} is the single-step error, divided
  4977. by the current value of the numerical approximation to the solution.
  4978. Why not divided by the current value of the solution itself? The reason
  4979. is that the solution is not exactly known. When free to choose a
  4980. stepsize, @code{ode} will do so on the basis of the relative single-step
  4981. error. @w{By default}, it will choose the stepsize so as to maintain an
  4982. accuracy of eight significant digits in each step. That is, it will
  4983. choose the stepsize so as not to violate an upper bound of
  4984. @math{10^(-9)} on the relative single-step error. This ceiling may be
  4985. adjusted with the @samp{-r} option.
  4986. @end ifnottex
  4987. @tex
  4988. The @emph{relative single-step error} is the single-step error, divided
  4989. by the current value of the numerical approximation to the solution.
  4990. Why not divided by the current value of the solution itself? The reason
  4991. is that the solution is not exactly known. When free to choose a
  4992. stepsize, @code{ode} will do so on the basis of the relative single-step
  4993. error. @w{By default}, it will choose the stepsize so as to maintain an
  4994. accuracy of eight significant digits in each step. That is, it will
  4995. choose the stepsize so as not to violate an upper bound of $10^{-9}$ on
  4996. the relative single-step error. This ceiling may be adjusted with the
  4997. @samp{-r} option.
  4998. @end tex
  4999. Where does numerical error come from? There are two sources. The first
  5000. is the finite precision of machine computation. All computers work with
  5001. floating point numbers, which are not real numbers, but only an
  5002. approximation to real numbers. However, all computations performed by
  5003. @code{ode} are done to double precision, so floating point error tends
  5004. to be relatively small. You may nonetheless detect the difference
  5005. between real numbers and floating point numbers by experimenting with
  5006. the @samp{-p 17} option, which will print seventeen significant digits.
  5007. @w{On most} machines, that is the precision of a double precision
  5008. floating point number.
  5009. The second source of numerical error is often called the
  5010. @emph{theoretical truncation error}. @w{It is} the difference between
  5011. the actual solution and the approximate solution due solely to the
  5012. numerical scheme. At the root of many numerical schemes is an infinite
  5013. series; for ordinary differential equations, @w{it is} a Taylor
  5014. expansion. Since the computer cannot compute all the terms in an
  5015. infinite series, @w{a numerical} scheme necessarily uses a truncated
  5016. series; hence the term. The single-step error is the sum of the
  5017. theoretical truncation error and the floating point error, though in
  5018. practice the floating point error is seldom included. The single-step
  5019. error estimated by @code{ode} consists only of the theoretical
  5020. truncation error.
  5021. We say that a numerical scheme is @emph{stable}, when applied to a
  5022. particular initial value problem, if the error accumulated during the
  5023. solution of the problem over a fixed interval decreases as the stepsize
  5024. decreases; @w{at least}, over a wide range of step sizes. With this
  5025. definition both the Runge--Kutta--Fehlberg (@samp{-R}) scheme and the
  5026. Adams--Moulton (@samp{-A}) scheme are stable (@w{a statement} based more
  5027. on experience than on theoretical results) for a wide class of problems.
  5028. After these introductory remarks, we list some common sources of
  5029. accumulated error and instability in any numerical scheme. Usually,
  5030. problems with large accumulated error and instability are due to the
  5031. single-step error in the vicinity of a `bad' point being large.
  5032. @enumerate
  5033. @item Singularities.
  5034. @code{ode} should not be used to generate a numerical solution on any
  5035. interval containing a singularity. That is, @code{ode} should not be
  5036. asked to step over points at which the system of differential equations
  5037. is singular or undefined.
  5038. You will find the definitions of singular point, regular singular point,
  5039. and irregular singular point in any good differential equations text.
  5040. If you have no favorite, try Birkhoff and Rota's @cite{Ordinary
  5041. Differential Equations}, @w{Chapter 9}. Always locate and classify the
  5042. singularities of a system, @w{if any}, before applying @code{ode}.
  5043. @item
  5044. Ill-posed problems.
  5045. For @code{ode} to yield an accurate numerical solution on an interval,
  5046. the true solution must be defined and well-behaved on that interval.
  5047. The solution must also be real. Whenever any of these conditions is
  5048. violated, the problem is said to be @emph{ill-posed}. Ill-posedness may
  5049. occur even if the system of differential equations is well-behaved on
  5050. the interval. Strange results, e.g., the stepsize suddenly shrinking to
  5051. the machine limit or the solution suddenly @w{blowing up}, may indicate
  5052. ill-posedness.
  5053. As an example of ill-posedness (in fact, an undefined solution) consider
  5054. the innocent-looking problem:
  5055. @ifnottex
  5056. @example
  5057. @group
  5058. @math{y' = y^2}
  5059. @math{y(1) = -1}
  5060. @end group
  5061. @end example
  5062. @end ifnottex
  5063. @tex
  5064. @example
  5065. @group
  5066. $y' = y^2$
  5067. $y(1) = -1$
  5068. @end group
  5069. @end example
  5070. @end tex
  5071. @noindent
  5072. The solution on the domain @math{t > 0} is
  5073. @example
  5074. @math{y(t) = -1/t}.
  5075. @end example
  5076. @noindent
  5077. With this problem you must not compute a numerical solution on any
  5078. interval that includes @math{t=0}. To convince yourself of this, try to
  5079. use the @samp{step} statement
  5080. @example
  5081. step 1, -1
  5082. @end example
  5083. @noindent
  5084. on this system. How does @code{ode} react?
  5085. As another example of ill-posedness, consider the system
  5086. @example
  5087. @math{y'=1/y}
  5088. @end example
  5089. which is undefined at @math{y=0}. The general solution is
  5090. @ifnottex
  5091. @example
  5092. @math{y = +/- (2(t-C))^(1/2)},
  5093. @end example
  5094. @end ifnottex
  5095. @tex
  5096. @example
  5097. $y = \pm (2(t-C))^{1/2}$,
  5098. @end example
  5099. @end tex
  5100. @ifnottex
  5101. so that if the condition @math{y(2)=2} is imposed, the solution will be
  5102. @math{(2t)^(1/2)}. Clearly, if the domain specified in a @samp{step}
  5103. statement includes negative values @w{of @math{t}}, the generated
  5104. solution will be bogus.
  5105. @end ifnottex
  5106. @tex
  5107. so that if the condition @math{y(2)=2} is imposed, the solution will be
  5108. $(2t)^{1/2}$. Clearly, if the domain specified in a @samp{step}
  5109. statement includes negative values @w{of @math{t}}, the generated
  5110. solution will be bogus.
  5111. @end tex
  5112. In general, when using a constant stepsize you should be careful not to
  5113. @w{`step over'} bad points or bad regions. When allowed to choose a
  5114. stepsize adaptively, @code{ode} will often spot bad points, but not
  5115. always.
  5116. @item
  5117. Critical points.
  5118. An @emph{autonomous} system is one that does not include the independent
  5119. variable explicitly on the right-hand side of any differential equation.
  5120. A @emph{critical point} for such a system is a point at which all
  5121. right-hand sides equal zero. For example, the system
  5122. @example
  5123. @group
  5124. @math{y' = 2x}
  5125. @math{x' = 2y}
  5126. @end group
  5127. @end example
  5128. has only one critical point, at @math{(x,y) = (0,0)}.
  5129. A critical point is sometimes referred to as a @emph{stagnation point}.
  5130. That is because a system at a critical point will remain there forever,
  5131. though a system near a critical point may undergo more violent motion.
  5132. Under some circumstances, passing near a critical point may give rise to
  5133. a large accumulated error.
  5134. As an exercise, solve the system above using @code{ode}, with the
  5135. initial condition @math{x(0) = y(0) = 0}. The solution should be
  5136. constant in time. Now do the same with points near the critical point.
  5137. What happens?
  5138. You should always locate the critical points of a system before
  5139. attempting a solution with @code{ode}. Critical points may be
  5140. classified (as equilibrium, vortex, unstable, stable, etc.) and this
  5141. classification may be @w{of use}. To find out more about this, consult
  5142. any book dealing with the qualitative theory of differential equations
  5143. (e.g., Birkhoff and Rota's @cite{Ordinary Differential Equations},
  5144. @w{Chapter 6}).
  5145. @item
  5146. Unsuitable numerical schemes
  5147. If the results produced by @code{ode} are bad in the sense that
  5148. instability appears to be present, or an unusually small stepsize needs
  5149. to be chosen needed in order to reduce the single-step error to
  5150. manageable levels, it may simply be that the numerical scheme being used
  5151. is not suited to the problem. @w{For example}, @code{ode} currently has
  5152. no numerical scheme which handles so-called `stiff' problems very well.
  5153. As an example, you may wish to examine the stiff problem:
  5154. @example
  5155. @group
  5156. @math{y' = -100 + 100t + 1}
  5157. @math{y(0) = 1}
  5158. @end group
  5159. @end example
  5160. @noindent
  5161. on the domain @math{[0,1]}. The exact solution is
  5162. @ifnottex
  5163. @example
  5164. @math{y(t) = e^(-100t) + t}.
  5165. @end example
  5166. @end ifnottex
  5167. @tex
  5168. @example
  5169. $y(t) = e^{-100t} + t$.
  5170. @end example
  5171. @end tex
  5172. @noindent
  5173. It is a useful exercise to solve this problem with @code{ode} using
  5174. various numerical schemes, stepsizes, and relative single-step error
  5175. bounds, and compare the generated solution curves with the actual
  5176. solution.
  5177. @end enumerate
  5178. There are several rough and ready heuristic checks you may perform on
  5179. the accuracy of any numerical solution produced by @code{ode}. We
  5180. discuss them @w{in turn}.
  5181. @enumerate
  5182. @item Examine the stability of solution curves: do they converge?
  5183. That is, check how changing the stepsize affects a solution curve. As
  5184. the stepsize decreases, the curve should converge. If it does not, then
  5185. the stepsize is not small enough or the numerical scheme is not suited
  5186. to the problem. In practice, you would proceed as follows.
  5187. @itemize @bullet
  5188. @item
  5189. If using an adaptive stepsize, superimpose the solution curves for
  5190. successively smaller bounds on the relative single-step error (obtained
  5191. with, e.g., @samp{-r 1e-9}, @samp{-r 1e-11}, @samp{-r 1e-13}, @dots{}).
  5192. If the curves converge then the solution is to all appearances stable,
  5193. and your accuracy is sufficient.
  5194. @item
  5195. If employing a constant stepsize, perform a similar analysis by
  5196. successively halving the stepsize.
  5197. @end itemize
  5198. The following example is one that you may wish to experiment with. Make
  5199. a file named @file{qcd} containing:
  5200. @example
  5201. @group
  5202. # an equation arising in QCD (quantum chromodynamics)
  5203. f' = fp
  5204. fp' = -f*g^2
  5205. g' = gp
  5206. gp' = g*f^2
  5207. f = 0; fp = -1; g = 1; gp = -1
  5208. @end group
  5209. @group
  5210. print t, f
  5211. step 0, 5
  5212. @end group
  5213. @end example
  5214. @noindent
  5215. Next make a file named @file{stability}, containing the lines:
  5216. @example
  5217. @group
  5218. : sserr is the bound on the relative single-step error
  5219. for sserr
  5220. do
  5221. ode -r $sserr < qcd
  5222. done | spline -n 500 | graph -T X -C
  5223. @end group
  5224. @end example
  5225. This is a `shell script', which when run will superimpose numerical
  5226. solutions with specified bounds on the relative single-step error. To
  5227. run it, type:
  5228. @example
  5229. sh stability 1 .1 .01 .001
  5230. @end example
  5231. and a plot of the solutions with the specified error bounds will be
  5232. drawn. The convergence, showing stability, should be quite
  5233. illuminating.
  5234. @item Check invariants of the system: are they constant?
  5235. Many systems have invariant quantities. For example, if the system is a
  5236. mathematical model of a `conservative' physical system then the `energy'
  5237. (@w{a particular} function of the dependent variables of the system)
  5238. should be constant in time. In general, knowledge about the qualitative
  5239. behavior of any dependent variable may be used to check the quality of
  5240. the solution.
  5241. @item Check a family of solution curves: do they diverge?
  5242. A rough idea of how error is propagated is obtained by viewing a family
  5243. of solution curves about the numerical solution in question, obtained by
  5244. varying the initial conditions. @w{If they} diverge sharply---@w{that
  5245. is}, if two solutions which start out very close nonetheless @w{end up}
  5246. far apart---then the quality of the numerical solution is dubious.
  5247. @w{On the} other hand, if the curves do not diverge sharply then any
  5248. error that is present will in all likelihood not increase by more than
  5249. an order of magnitude @w{or so} over the interval. Problems exhibiting
  5250. no sharp divergence of neighboring solution curves are sometimes called
  5251. @emph{well-conditioned}.
  5252. @end enumerate
  5253. @node Running Time, Input Language, Numerical Error, ode
  5254. @section Running time
  5255. The time required for @code{ode} to solve numerically a system of
  5256. ordinary differential equations depends on a great many factors. @w{A
  5257. few} of them are: number of equations, complexity of equations (number
  5258. of operators and nature of the operators), and number of steps taken
  5259. (@w{a very} complicated function of the difficulty of solution, unless
  5260. constant stepsizes are used). The most effective way to gauge the time
  5261. required for solution of a system is to clock a short or imprecise run
  5262. of the problem, and reason as follows: the time required to take two
  5263. steps is roughly twice that required for one; and there is a
  5264. relationship between the number of steps required and the relative error
  5265. ceiling chosen. That relationship depends on the numerical scheme being
  5266. used, the difficulty of solution, and perhaps on the magnitude of the
  5267. error ceiling itself. @w{A few} carefully planned short runs may be
  5268. used to determine this relationship, enabling a long but imprecise run
  5269. to be used as an aid in projecting the cost of a more precise run over
  5270. the same region. Lastly, if a great deal of data is printed, @w{it is}
  5271. likely that more time is spent in printing the results than in computing
  5272. the numerical solution.
  5273. @node Input Language, ODE Bibliography, Running Time, ode
  5274. @section The @code{ode} input language formally specified
  5275. The following is a formal specification of the grammar for @code{ode}'s
  5276. input language, in Backus--Naur form. Nonterminal symbols in the
  5277. grammar are enclosed in angle brackets. Terminal tokens are in all
  5278. capitals. Bare words and symbols stand for themselves.
  5279. @example
  5280. @group
  5281. <program> ::= ... empty ...
  5282. | <program> <statement>
  5283. @end group
  5284. @group
  5285. <statement> ::= SEP
  5286. | IDENTIFIER = <const> SEP
  5287. | IDENTIFIER ' = <expression> SEP
  5288. | print <printlist> <optevery> <optfrom> SEP
  5289. | step <const> , <const> , <const> SEP
  5290. | step <const> , <const> SEP
  5291. | examine IDENTIFIER SEP
  5292. @end group
  5293. @group
  5294. <printlist> ::= <printitem>
  5295. | <printlist> , <printitem>
  5296. @end group
  5297. @group
  5298. <printitem> ::= IDENTIFIER
  5299. | IDENTIFIER '
  5300. | IDENTIFIER ?
  5301. | IDENTIFIER !
  5302. | IDENTIFIER ~
  5303. @end group
  5304. @group
  5305. <optevery> ::= ... empty ...
  5306. | every <const>
  5307. @end group
  5308. @group
  5309. <optfrom> ::= ... empty ...
  5310. | from <const>
  5311. @end group
  5312. @group
  5313. <const> ::= <expression>
  5314. @end group
  5315. @group
  5316. <expression> ::= ( <expression> )
  5317. | <expression> + <expression>
  5318. | <expression> - <expression>
  5319. | <expression> * <expression>
  5320. | <expression> / <expression>
  5321. | <expression> ^ <expression>
  5322. | FUNCTION ( <expression> )
  5323. | - <expression>
  5324. | NUMBER
  5325. | IDENTIFIER
  5326. @end group
  5327. @end example
  5328. @noindent
  5329. Since this grammar is ambiguous, the following table summarizes the
  5330. precedences and associativities of operators within expressions.
  5331. Precedences decrease from top to bottom.
  5332. @example
  5333. @group
  5334. Class Operators Associativity
  5335. Exponential ^ right
  5336. Multiplicative * / left
  5337. Additive + - left
  5338. @end group
  5339. @end example
  5340. As noted in the grammar, there are six types of nontrivial statement.
  5341. We now explain the effects (the `semantics') of each type, @w{in turn}.
  5342. @enumerate
  5343. @item
  5344. @t{IDENTIFIER ' = <expression>}
  5345. @noindent This defines a first-order differential equation.
  5346. The derivative of @t{IDENTIFIER} is specified by @t{<expression>}. If a
  5347. dynamic variable does not appear on the left side of a statement of this
  5348. form, its derivative is assumed to be zero. That is, @w{it is} a
  5349. symbolic constant.
  5350. @item
  5351. @t{IDENTIFIER = <expression>}
  5352. @noindent
  5353. This sets the value of @t{IDENTIFIER} to the current value of
  5354. @t{<expression>}. Dynamic variables that have not been initialized in
  5355. this way are set to zero.
  5356. @item
  5357. @t{step <const> , <const>}
  5358. @item
  5359. @t{step <const> , <const> , <const>}
  5360. @noindent
  5361. A @samp{step} statement causes the numerical scheme to be executed. The
  5362. first @t{<const>} is the initial value of the independent variable. The
  5363. second is its final value. The third is a stepsize; if given, it
  5364. overrides any stepsize that may be specified on the command line.
  5365. Usually the stepsize is not specified, and it varies adaptively as the
  5366. computation proceeds.
  5367. @item
  5368. @t{print <printlist> [ every <const> ] [ from <const> ]}
  5369. @noindent
  5370. A @samp{print} statement controls the content and frequency of the
  5371. numerical output. @t{<printlist>} is a comma-separated list of
  5372. @t{IDENTIFIER}s, where each @t{IDENTIFIER} may be followed by @samp{'},
  5373. denoting the derivative, or @samp{?}, denoting the relative single-step
  5374. error, or @samp{!}, denoting the absolute single-step error, or
  5375. @samp{~}, denoting the accumulated error (not currently implemented).
  5376. The specified values are printed in the order they are found. Both the
  5377. @samp{every} clause and the @samp{from} clause are optional. @w{If the}
  5378. @samp{every} clause is present, a printing occurs every @t{<const>}
  5379. iterations of the numerical algorithm. The default is to print on every
  5380. iteration (i.e.@: @samp{every 1}). The first and last values are always
  5381. printed. @w{If the} @samp{from} clause is present, it means to begin
  5382. printing when the independent variable reaches or exceeds @t{<const>}.
  5383. The default is to begin printing immediately.
  5384. If no @samp{print} statement has been supplied, then the independent
  5385. variable and all dependent variables which have differential equations
  5386. associated with them are printed. The independent variable is printed
  5387. first; the dependent variables follow in the order their equations were
  5388. given.
  5389. @item
  5390. @t{examine IDENTIFIER}
  5391. @noindent
  5392. An @samp{examine} statement, when executed, causes a table of
  5393. interesting information about the named variable to be printed on the
  5394. standard output. For example, if the statement @samp{examine y} were
  5395. encountered after execution of the `ode to Euler' example discussed
  5396. elsewhere, the output would be:
  5397. @example
  5398. @group
  5399. "y" is a dynamic variable
  5400. value:2.718282
  5401. prime:2.718282
  5402. sserr:1.121662e-09
  5403. aberr:3.245638e-09
  5404. acerr:0
  5405. code: push "y"
  5406. @end group
  5407. @end example
  5408. The phrase `dynamic variable' means that there is a differential
  5409. equation describing the behavior @w{of @t{y}}. The numeric items in the
  5410. table are:
  5411. @table @t
  5412. @item value
  5413. Current value of the variable.
  5414. @item prime
  5415. Current derivative of the variable.
  5416. @item sserr
  5417. Relative single-step error for the last step taken.
  5418. @item aberr
  5419. Absolute single-step error for the last step taken.
  5420. @item acerr
  5421. Total error accumulated during the most recent @samp{step} statement.
  5422. Not currently implemented.
  5423. @end table
  5424. The @samp{code} section of the table lists the stack operations required
  5425. to compute the derivative @w{of @t{y}} (somewhat reminiscent of a
  5426. reverse Polish calculator). This information may be useful in
  5427. discovering whether the precedences in the differential equation
  5428. statement were interpreted correctly, or in determining the time or
  5429. space expense of a particular calculation. @samp{@t{push "y"}} means to
  5430. load @t{y}'s value on the stack, which is all that is required to
  5431. compute its derivative in this case.
  5432. @end enumerate
  5433. The grammar for the @code{ode} input language contains four types of
  5434. terminal token: @t{FUNCTION}, @t{IDENTIFIER}, @t{NUMBER}, @w{and
  5435. @t{SEP}}. They have the following meanings.
  5436. @enumerate
  5437. @item
  5438. @t{FUNCTION}
  5439. One of the words: @t{abs}, @t{sqrt}, @t{exp}, @t{log}, @t{ln},
  5440. @t{log10}, @t{sin}, @t{cos}, @t{tan}, @t{asin}, @t{acos}, @t{atan},
  5441. @t{sinh}, @t{cosh}, @t{tanh}, @t{asinh}, @t{acosh}, @t{atanh},
  5442. @t{floor}, @t{ceil}, @t{besj0}, @t{besj1}, @t{besy0}, @t{besy1},
  5443. @t{erf}, @t{erfc}, @t{inverf}, @t{lgamma}, @t{gamma}, @t{norm},
  5444. @t{invnorm}, @t{ibeta}, @t{igamma}. These are defined to have the same
  5445. meaning as in the plotting program @code{gnuplot}. All functions take a
  5446. single argument, except for @t{ibeta}, which takes three, and
  5447. @t{igamma}, which takes two. For trigonometric functions, all arguments
  5448. are expressed in radians. The @t{atan} function is defined to give a
  5449. value between @minus{}PI/2 and PI/2 (inclusive).
  5450. @item
  5451. @t{IDENTIFIER}
  5452. A sequence of alphanumeric characters starting with an alphabetic
  5453. character. The first 32 characters are significant. Upper and
  5454. lower-case letters are distinct. In identifiers, the underscore
  5455. character is considered alphabetic. Function names and keywords may not
  5456. be used as identifiers, nor may @samp{PI}@.
  5457. @item
  5458. @t{NUMBER}
  5459. A non-empty sequence of digits possibly containing a decimal point and
  5460. possibly followed by an exponent. An exponent is @samp{e} @w{or
  5461. @samp{E}}, followed by an (optionally signed) one, two, or three-digit
  5462. number. All numbers and all parts of numbers are @w{radix 10}. @w{A
  5463. number} may not contain any white space. The special word @samp{PI} is
  5464. a number.
  5465. @item
  5466. @t{SEP}
  5467. A separator: a semicolon or a (non-escaped) newline.
  5468. @end enumerate
  5469. In the @code{ode} input language, upper and lower-case letters are
  5470. distinct. Comments begin with the character @samp{#} and continue to
  5471. the end of the line. Long lines may be continued onto a second line by
  5472. ending the first line with a @w{backslash (@samp{\})}. That is because
  5473. the combination backslash-newline is equivalent to a space.
  5474. Spaces or tabs are required in the input whenever they are needed to
  5475. separate identifiers, numbers, and keywords from one another. Except as
  5476. separators, they are ignored.
  5477. @node ODE Bibliography, , Input Language, ode
  5478. @section Bibliography on @code{ode} and solving differential equations
  5479. @itemize @asis
  5480. @item
  5481. K. E. Atkinson, @cite{An Introduction to Numerical Analysis}, Wiley,
  5482. 1978. @w{Chapter 6} contains a discussion of the literature on the
  5483. numerical solution of ordinary differential equations.
  5484. @item
  5485. G. Birkhoff and G. Rota, @cite{Ordinary Differential Equations}, 4th
  5486. ed., Wiley, 1989.
  5487. @item
  5488. N. B. Tufillaro, T. Abbott, and J. Reilly, @cite{An Experimental
  5489. Approach to Nonlinear Dynamics and Chaos}, Addison--Wesley, 1992.
  5490. @w{Appendix C} discusses an earlier version of @code{ode}.
  5491. @item
  5492. N. B. Tufillaro, E. F. Redish, and J. S. Risley, ``@code{ode}: @w{A
  5493. numerical} simulation of ordinary differential equations,''
  5494. pp.@: 480--481 in @cite{Proceedings of the Conference on Computers in
  5495. Physics Instruction}, Addison--Wesley, 1990.
  5496. @end itemize
  5497. @node libplot, Appendices, ode, Top
  5498. @chapter @code{libplot}, a 2-D Vector Graphics Library
  5499. @ifnottex
  5500. This is the documentation for version 4.4 of GNU libplot, which is
  5501. a free function library for drawing two-dimensional vector graphics.
  5502. @end ifnottex
  5503. @menu
  5504. * libplot Overview:: Programming with libplot: An overview
  5505. * C Programming:: C programming with libplot
  5506. * C++ Programming:: C++ programming with libplotter
  5507. * Functions:: A list of functions contained in libplot
  5508. * Plotter Parameters:: Plotter parameters
  5509. @end menu
  5510. @node libplot Overview, C Programming, libplot, libplot
  5511. @section Programming with @code{libplot}: An overview
  5512. GNU @code{libplot} 4.4 is a free function library for drawing
  5513. two-dimensional vector graphics. It can produce smooth,
  5514. double-buffered animations for the @w{X Window} System, and can export
  5515. graphics files in many file formats. @w{It is} `device-independent'
  5516. in the sense that its API (application programming interface) is to a
  5517. large extent independent of the output format. The API is
  5518. thread-safe, so it may be used in multithreaded programs.
  5519. There are bindings for C, C++, and other languages. The @w{C binding},
  5520. which is the most frequently used, is also called @code{libplot}, and
  5521. the C++ binding, when it needs to be distinguished, is called
  5522. @code{libplotter}. @w{In this} section we use @code{libplot} to refer
  5523. to the library itself, irrespective of binding.
  5524. The graphical objects that @code{libplot} can draw include paths,
  5525. `adjusted labels' (i.e., justified text strings), marker symbols, and
  5526. points (i.e., pixels). Paths may be simple or compound. @w{A simple}
  5527. path is a contiguous sequence of line segments, circular arcs, elliptic
  5528. arcs, quadratic Bezier curves, and/or cubic Bezier curves. @w{A simple}
  5529. path may also be a circle, an ellipse, or a rectangle. @w{A compound}
  5530. path consists of one or more nested simple paths. User-specified
  5531. filling of paths, both simple and compound, is supported (fill color and
  5532. fill rule, @w{as well} as pen color, may be specified).
  5533. There is support for maintaining a Postscript-style stack of graphics
  5534. contexts, i.e., @w{a stack} of drawing attribute sets. Path-related
  5535. attributes include pen color, line thickness, line type, cap type, join
  5536. type, miter limit, fill color, fill rule, and transformation matrix, and
  5537. text-related attributes include font name, font size, text angle, and
  5538. transformation matrix.
  5539. The fundamental abstraction provided by @code{libplot} is that of a
  5540. @emph{Plotter}. A Plotter is an object with an interface for the
  5541. drawing of vector graphics which is similar to the interface provided by
  5542. a traditional pen plotter. There are many types of Plotter, which
  5543. differ in the output format they produce. Any number of Plotters, of
  5544. the same or different types, may exist simultaneously in an application.
  5545. The drawing operations supported by Plotters of different types are
  5546. identical, in agreement with the principle of device independence.
  5547. @w{So a} graphics application that is linked with @code{libplot} may
  5548. easily be written so as to produce output in any or all of the
  5549. supported output formats.
  5550. The following are the currently supported types of Plotter.
  5551. @itemize @bullet
  5552. @item
  5553. X Plotters. An X Plotter, when opened, pops up a window on an @w{X
  5554. Window} System display and draws graphics @w{in it}. The window will be
  5555. `@w{spun off}' when the Plotter is closed; if it is subsequently
  5556. reopened, a new window will be @w{popped up}. A spun-off window will
  5557. remain on the screen but will vanish if you type @samp{q} or click your
  5558. mouse @w{in it}. Future releases may permit @w{X Plotters}, when
  5559. reopened, to reuse an existing window.
  5560. @item
  5561. X Drawable Plotters. An X Drawable Plotter draws graphics in one or two
  5562. specified drawables associated with an @w{X Window System} display.
  5563. @w{A `drawable'} is either a window or a pixmap. The drawables must be
  5564. passed to the Plotter as parameters. (@xref{Plotter Parameters}.)
  5565. @item
  5566. PNG Plotters. A PNG Plotter produces a single page of output in PNG
  5567. (Portable Network Graphics) format, and directs it to a file or other
  5568. specified output stream. The file may be viewed or edited with many
  5569. applications, such as @code{display}, which is part of the free
  5570. @code{ImageMagick} package.
  5571. @item
  5572. PNM Plotters. A PNM Plotter produces a single page of output in
  5573. ``portable anymap'' format, and directs it to a file or other specified
  5574. output stream. There are three types of portable anymap: PBM (portable
  5575. bitmap, for monochrome graphics), PGM (portable graymap), and PPM
  5576. (portable pixmap, for colored graphics). The output file will be in
  5577. whichever of these three formats is most appropriate. The file may be
  5578. viewed or edited with many applications, such as @code{display}.
  5579. @item
  5580. GIF Plotters. A GIF Plotter produces a single page of output in a
  5581. pseudo-GIF format. Unlike true GIF format, the pseudo-GIF format does
  5582. not use LZW compression: @w{it uses} run-length encoding instead.
  5583. @w{So it} does not transgress the Unisys patent that restricts the use
  5584. of LZW compression. However, the output file may be viewed or edited
  5585. with any application that understands GIF format, such as
  5586. @code{display}. The creation of animated pseudo-GIFs is supported.
  5587. @item
  5588. SVG Plotters. An SVG Plotter produces a single page of output in
  5589. Scalable Vector Graphics format and directs it to a file or other
  5590. specified output stream. SVG is an XML-based format for vector
  5591. graphics on the Web, which is being developed by the
  5592. @uref{http://www.w3.org/Graphics, Graphics Activity} of the
  5593. @uref{http://www.w3.org, @w{W3 Consortium}}. The output conforms to
  5594. the @w{3 March} 2000 version of the SVG specification.
  5595. @item
  5596. Illustrator Plotters. An Illustrator Plotter produces a single page of
  5597. output in the format used by Adobe Illustrator, and directs it to a file
  5598. or other specified output stream. The file may be edited with Adobe
  5599. Illustrator (@w{version 5}, and more recent versions), or other
  5600. applications.
  5601. @item
  5602. Postscript Plotters. A Postscript Plotter produces Postscript output
  5603. and directs it to a file or other specified output stream. If only a
  5604. single page of graphics is drawn on the Plotter then its output is in
  5605. EPS (encapsulated Postscript) format, so it may be included in another
  5606. document. @w{It may} also be edited with the free @code{idraw} drawing
  5607. editor. See @ref{idraw}.
  5608. @item
  5609. CGM Plotters. A CGM Plotter produces output in Computer Graphics
  5610. Metafile format and directs it to a file or other specified output
  5611. stream. By default, binary-encoded @w{version 3} CGM format is used.
  5612. The output complies with the WebCGM profile for Web-based vector
  5613. graphics, so it may be displayed in any Web browser with WebCGM support.
  5614. The @uref{http://www.cgmopen.org, CGM Open Consortium} has more
  5615. information on WebCGM.
  5616. @item
  5617. Fig Plotters. A Fig Plotter produces a single page of output in Fig
  5618. format and directs it to a file or other specified output stream. The
  5619. output may be edited with the free @code{xfig} drawing editor. The
  5620. @code{xfig} editor can export drawings in various other formats for
  5621. inclusion in documents. See @ref{xfig}.
  5622. @item
  5623. PCL Plotters. A PCL Plotter produces output in @w{PCL 5} format and
  5624. directs it to a file or other specified output stream. @w{PCL 5} is a
  5625. powerful version of Hewlett--Packard's Printer Control Language, which
  5626. supports vector graphics. The output may be sent to a @w{PCL 5} device
  5627. such as a LaserJet printer or high-end inkjet.
  5628. @item
  5629. HP-GL Plotters. An HP-GL Plotter produces output in the
  5630. Hewlett--Packard Graphics Language (@w{by default}, in HP-GL/2), and
  5631. directs it to a file or other specified output stream. The output may
  5632. be imported into another application, or sent to a plotter.
  5633. @item
  5634. ReGIS Plotters. A ReGIS Plotter produces output in ReGIS (remote
  5635. graphics instruction set) format and directs it to a file or other
  5636. specified output stream. The output may be displayed on any terminal or
  5637. emulator that understands ReGIS format. This includes several terminals
  5638. from DEC (in particular, the VT340, VT330, VT241, and VT240 terminals),
  5639. and @code{dxterm}, the DECwindows terminal emulation program.
  5640. @item
  5641. Tektronix Plotters. A Tektronix Plotter produces output in Tektronix
  5642. 4014 format and directs it to a file or other specified output stream.
  5643. The output may be displayed on any Tektronix 4014 emulator. Such an
  5644. emulator is built into @code{xterm}, the @w{X Window} System terminal
  5645. emulation program. The MS-DOS version of @code{kermit} also includes
  5646. such an emulator.
  5647. @item
  5648. Metafile Plotters. A Metafile Plotter produces output in GNU graphics
  5649. metafile format and directs it to a file or other specified output
  5650. stream. This format is an extended version of the `plot(5)' format
  5651. found on some other operating systems. (@xref{Metafiles}.) @w{It may}
  5652. be translated to other formats by an invocation of GNU @code{plot}.
  5653. (@xref{plot}.)
  5654. @end itemize
  5655. A distinction among these types of Plotter is that all except X and @w{X
  5656. Drawable} Plotters write graphics to a file or other output stream. An
  5657. @w{X Plotter} @w{pops up} its own windows, and an @w{X Drawable} Plotter
  5658. draws graphics in one or two @w{X drawables}.
  5659. Another distinction is that the first five types of Plotter (X, @w{X
  5660. Drawable}, PNG, PNM, and GIF) produce bitmap output, while the remaining
  5661. types produce output in a vector graphics format. In bitmap output the
  5662. structure of the graphical objects is lost, but in a vector format it is
  5663. retained.
  5664. An additional distinction is that X, X Drawable, ReGIS, Tektronix and
  5665. Metafile Plotters are real-time. This means that they draw graphics or
  5666. write to an output stream as the drawing operations are invoked on them.
  5667. The remaining types of Plotter are not real-time, since their output
  5668. streams can only be emitted after all functions have been called. For
  5669. PNM and GIF Plotters, this is because the bitmap must be constructed
  5670. before it is written out. For Illustrator and Postscript Plotters,
  5671. @w{it is} because a `bounding box' line must be placed at the head of
  5672. the output file. For a Fig Plotter, @w{it is} because color definitions
  5673. must be placed at the head of the output file.
  5674. The most important operations supported by any Plotter are @code{openpl}
  5675. and @code{closepl}, which open and @w{close it}. Graphics may be drawn,
  5676. and drawing attributes set, only within an
  5677. @code{openpl}@dots{}@code{closepl} pair. The graphics produced within
  5678. each @code{openpl}@dots{}@code{closepl} pair constitute a `page'. In
  5679. principle, any Plotter may be opened and closed arbitrarily many times.
  5680. An @w{X Plotter} displays each page in a separate @w{X window}, and
  5681. Postscript, PCL, and HP-GL Plotters render each page as a separate
  5682. physical page. @w{X Drawable}, ReGIS and Tektronix Plotters manipulate
  5683. a single drawable or display, on which pages are displayed in
  5684. succession. Plotters that do not draw in real time (PNG, PNM, GIF,
  5685. Illustrator, Postscript, CGM, Fig, PCL, and HP-GL Plotters) may wait
  5686. until their existence comes to an end (i.e., until they are deleted)
  5687. before outputting their pages of graphics.
  5688. In the current release of @code{libplot}, Postscript and CGM Plotters
  5689. delay outputting graphics in this way, but PCL and HP-GL Plotters output
  5690. each page of graphics individually, i.e., when @code{closepl} is
  5691. invoked. PNG, PNM, GIF, SVG, Illustrator and Fig Plotters are similar,
  5692. but output only the first page. That is because PNG, PNM, GIF, SVG,
  5693. Illustrator and Fig formats support only a single page of graphics.
  5694. The graphics display, or `viewport', that is @w{drawn in} by a Plotter
  5695. is normally a square or rectangular region on its output device. But
  5696. when using any Plotter to draw graphics, @w{a user} will specify the
  5697. coordinates of graphical objects in device-independent `user'
  5698. coordinates, not in device coordinates. @w{A Plotter} transforms user
  5699. coordinates to device coordinates by performing an affine
  5700. transformation.
  5701. After invoking @code{openpl} to open a Plotter, an application would
  5702. usually invoke @code{space}. @code{space} specifies a rectangular
  5703. `window' in the user coordinate system that will be mapped affinely to
  5704. the viewport on the output device. (The default window is a square,
  5705. with opposite corners (0,0) @w{and (1,1)}.) The transformation from
  5706. user coordinates to device coordinates may be updated at any later time
  5707. by reinvoking @code{space}, or by invoking @code{fconcat}. The
  5708. @code{fconcat} operation will concatenate (i.e., compose) the current
  5709. affine transformation with any specified affine transformation. This
  5710. sort of concatenation is a capability familiar from, e.g., Postscript.
  5711. Each Plotter maintains a Postscript-style stack of graphics contexts.
  5712. This makes possible the rapid, efficient drawing of complicated pages of
  5713. graphics. @w{A graphics} context includes the current affine
  5714. transformation from user coordinates to device coordinates. @w{It also}
  5715. includes such modal drawing attributes as graphics cursor position, pen
  5716. color, line type, line thickness, fill color, and the font used for
  5717. drawing text. The state of any uncompleted path @w{(if any)} is
  5718. included @w{as well}, since paths may be drawn incrementally, one
  5719. portion (line segment, arc, or Bezier curve) at a time.
  5720. @strong{Warning}: Much as in Postscript, the current graphics context
  5721. may be pushed onto the stack by calling @code{savestate}, and @w{popped
  5722. off} by calling @code{restorestate}. However, @code{libplot}'s and
  5723. Postscript's drawing models are significantly different. In
  5724. @code{libplot}, the new graphics context created by @code{savestate}
  5725. contains no path. So a new path may be constructed @w{in it} from
  5726. scratch, and drawn. Afterwards, the path in the former graphics context
  5727. will be @w{returned to} when @code{restorestate} is called, at which
  5728. time it may be extended further. Another difference from Postscript is
  5729. that in @code{libplot}, there is no need to start a new path by calling
  5730. a `@code{newpath}' function. Instead, you just start drawing. @w{At
  5731. least} in theory, you do need to end a path explicitly, by calling
  5732. @code{endpath} to request that it be drawn on the graphics display. But
  5733. the call to @code{endpath} can usually be omitted. For example, calling
  5734. @code{restorestate} automatically invokes @code{endpath} to end the path
  5735. (@w{if any}) contained in the current graphics context.
  5736. To permit vector graphics animation, any page of graphics may be split
  5737. into `frames'. @w{A frame} is ended, and a new frame is begun, by
  5738. invoking the @code{erase} operation. This first terminates the path
  5739. under construction, @w{if any}. What then happens depends on whether
  5740. the Plotter does real-time plotting. @w{If it} does (i.e., if the
  5741. Plotter is @w{an X}, @w{X Drawable}, ReGIS, Tektronix, or Metafile
  5742. Plotter), @code{erase} removes all plotted objects from the graphics
  5743. display, allowing a new frame to be drawn. Displaying a sequence of
  5744. frames in succession creates the illusion of smooth animation.
  5745. @w{On most} Plotters that do not do real-time plotting (i.e., PNG, PNM,
  5746. SVG, Illustrator, Postscript, CGM, Fig, PCL, or HP-GL Plotters),
  5747. invoking @code{erase} deletes all plotted objects from an internal
  5748. buffer. For this reason, most Plotters that do not do real-time
  5749. plotting will display only the final frame of any multiframe page.
  5750. GIF Plotters are in a class by themselves. Even though they do not do
  5751. real time plotting, @w{a GIF} Plotter can produce multi-image output,
  5752. i.e., an animated pseudo-GIF file, from a multiframe page. @w{As noted}
  5753. above, the pseudo-GIF file produced by a GIF Plotter will contain only
  5754. the first page of graphics. But if this page consists of multiple
  5755. frames, then each invocation of @code{erase} after the first will be
  5756. treated, @w{by default}, as a separator between successive images.
  5757. @node C Programming, C++ Programming, libplot Overview, libplot
  5758. @section C Programming with @code{libplot}
  5759. @menu
  5760. * The C API:: The C application programming interface
  5761. * Older C APIs:: Older C interfaces
  5762. * C Compiling and Linking:: C compiling and linking
  5763. * Sample C Drawings:: Sample drawings in C
  5764. * Paths and Subpaths:: Simple paths and compound paths
  5765. * Drawing on a Page:: Drawing on a physical page
  5766. * Animated GIFs:: Animated GIFs in C
  5767. * X Animations:: X Window System animations in C
  5768. * X Programming:: Advanced X Window System programming
  5769. @end menu
  5770. @node The C API, Older C APIs, C Programming, C Programming
  5771. @subsection The C application programming interface
  5772. GNU @code{libplot} has bindings for several programming languages.
  5773. Regardless of which binding is used, the concepts behind @code{libplot}
  5774. (Plotters, and a fixed set of operations that may be applied to any
  5775. Plotter) remain the same. However, the ways in which Plotters are
  5776. manipulated (created, selected @w{for use}, and deleted) may differ
  5777. between bindings. This section discusses the current @w{C binding}.
  5778. For information on older @w{C bindings}, see @ref{Older C APIs}.
  5779. In the @w{C binding}, a Plotter is implemented as an opaque datatype,
  5780. @code{plPlotter}, which must be accessed through a pointer. Each
  5781. drawing operation takes a pointer to a @code{plPlotter} as its first
  5782. argument. The functions @code{pl_newpl_r} and @code{pl_deletepl_r} are
  5783. the constructor and destructor for the @code{plPlotter} datatype. The
  5784. final argument of @code{pl_newpl_r} must be a pointer to a
  5785. @code{plPlotterParams} object, which specifies Plotter parameters.
  5786. @code{pl_newpl_r} returns a pointer to a @code{plPlotter}.
  5787. You should always call @code{pl_deletepl_r} when you are finished using
  5788. a Plotter. In general, Plotters that do not plot graphics in real time
  5789. (Postscript Plotters and CGM Plotters in particular) @w{write out}
  5790. graphics only when @code{pl_deletepl_r} is called.
  5791. The following tables summarize the action of the Plotter manipulation
  5792. functions in the @w{C binding}.
  5793. @table @asis
  5794. @item plPlotter * @t{pl_newpl_r} (const char *@var{type}, FILE *@var{infile}, FILE *@var{outfile}, FILE *@var{errfile}, plPlotterParams *@var{params});
  5795. Create a Plotter of type @var{type}, where @var{type} may be "X",
  5796. "Xdrawable", "png", "pnm", "gif", "svg", "ai", "ps", "cgm", "fig",
  5797. "pcl", "hpgl", "regis", "tek", or "meta". The Plotter will have input
  5798. stream @var{infile}, output stream @var{outfile}, and error stream
  5799. @var{errfile}. Any or all of these three may be NULL@. Currently, all
  5800. Plotters are write-only, so @var{infile} is ignored. @w{X Plotters} and
  5801. @w{X Drawable} Plotters write graphics to an @w{X Window} System display
  5802. rather than to an output stream, so if @var{type} is "X" or "Xdrawable"
  5803. then @var{outfile} is ignored @w{as well}. Error messages (@w{if any})
  5804. are written to the stream @var{errfile}, unless @var{errfile} is NULL@.
  5805. All Plotter parameters will be copied from the @code{plPlotterParams}
  5806. object pointed to by @var{params}. @w{A NULL} return value indicates
  5807. the Plotter could not be created.
  5808. @item int @t{pl_deletepl_r} (plPlotter *@var{plotter});
  5809. Delete the specified Plotter. A negative return value indicates the
  5810. Plotter could not be deleted.
  5811. @end table
  5812. The functions @code{pl_newplparams}, @code{pl_deleteplparams}, and
  5813. @code{pl_copyplparams} are the constructor, destructor, and copy
  5814. constructor for the @code{plPlotterParams} datatype. The function
  5815. @code{pl_setplparam} sets any single Plotter parameter in a
  5816. @code{plPlotterParams} object.
  5817. @table @asis
  5818. @item plPlotterParams * @t{pl_newplparams} ();
  5819. @item int @t{pl_deleteplparams} (plPlotterParams *@var{plotter_params});
  5820. @item plPlotterParams * @t{pl_copyplparams} (const plPlotterParams *@var{params});
  5821. @item int @t{pl_setplparam} (plPlotterParams *@var{params}, const char *@var{parameter}, void *@var{value});
  5822. Set the value of the parameter @var{parameter} to @var{value} in the
  5823. object pointed to by @var{params}. For most parameters, @var{value}
  5824. should be a @code{char *}, i.e., a string. @w{If @var{value}} is NULL,
  5825. the parameter is unset.
  5826. For a list of recognized parameters and their meaning, see @ref{Plotter
  5827. Parameters}. Unrecognized parameters are ignored.
  5828. @end table
  5829. The reason why the @code{plPlotterParams} datatype exists is that even
  5830. though the Plotter interface is largely Plotter-independent, @w{it is}
  5831. useful to be able to specify certain aspects of a Plotter's behavior at
  5832. creation time. @w{If a} a parameter has been set in the specified
  5833. @code{plPlotterParams} object, that will be the value used by the
  5834. Plotter. @w{If a} parameter is @emph{not} set, the Plotter will use a
  5835. default value @w{for it}, unless the parameter is string-valued and
  5836. there is an environment variable of the same name, in which case the
  5837. value of that environment variable will be used. This rule increases
  5838. run-time flexibility: @w{an application} programmer may allow
  5839. non-critical Plotter parameters to be specified by the user via
  5840. environment variables.
  5841. In the C binding, each drawing operation that may be invoked on a
  5842. Plotter is represented by a function whose name begins with "pl_" and
  5843. ends with "_r". For example, the @code{openpl} operation is invoked on
  5844. a Plotter by calling the function @code{pl_openpl_r}, the first argument
  5845. of which is a pointer to the corresponding @code{plPlotter} object.
  5846. @node Older C APIs, C Compiling and Linking, The C API, C Programming
  5847. @subsection Older C application programming interfaces
  5848. The current C API (application programming interface), which is
  5849. thread-safe, is a revision of an older API that is not thread-safe.
  5850. That is why most functions in the current API have names that end @w{in
  5851. "_r"}, which stands for `revised' or `reentrant'.
  5852. In the old C API, the Plotter on which an operation was performed is not
  5853. specified as an argument of the function that was called to perform the
  5854. operation. Instead, a Plotter is first `selected'. Then the API
  5855. function is called. @code{pl_openpl} was one such function; @w{it
  5856. opens} the currently selected Plotter, i.e., begins a page of graphics.
  5857. The old API is deprecated, but is still supported. The four functions
  5858. in the old API that perform Plotter manipulation have the following
  5859. semantics.
  5860. @table @asis
  5861. @item int @t{pl_newpl} (const char *@var{type}, FILE *@var{infile}, FILE *@var{outfile}, FILE *@var{errfile});
  5862. Create a Plotter of type @var{type}, where @var{type} may be "X",
  5863. "Xdrawable", "png", "pnm", "gif", "svg", "ai", "ps", "fig", "pcl",
  5864. "hpgl", "regis", "tek", or "meta". The Plotter will have input stream
  5865. @var{infile}, output stream @var{outfile}, and error stream
  5866. @var{errfile}. The return value is a `handle': @w{a nonnegative}
  5867. integer by which the newly created Plotter is @w{referred to}. @w{A
  5868. negative} return value indicates the Plotter could not be created.
  5869. @item int @t{pl_selectpl} (int @var{handle});
  5870. Select a Plotter, referred to by its handle, for use. Only one Plotter
  5871. may be selected at a time. @w{A negative} return value indicates the
  5872. specified Plotter could not be selected. Otherwise, the return value is
  5873. the handle of the previously selected Plotter.
  5874. At startup, a single Metafile Plotter that writes to standard output
  5875. (with @w{handle `0'}) is automatically created and selected.
  5876. @item int @t{pl_deletepl} (int @var{handle});
  5877. Delete a Plotter, specified by its handle. The Plotter must not be
  5878. selected at the time it is deleted. @w{A negative} return value
  5879. indicates the Plotter could not be deleted.
  5880. @item int @t{pl_parampl} (const char *@var{parameter}, void *@var{value});
  5881. Set the global value of the Plotter parameter @var{parameter} to
  5882. @var{value}. The parameter values @w{in effect} at the time any Plotter
  5883. is created will be copied @w{into it}.
  5884. @end table
  5885. @noindent
  5886. In the old API, selecting a Plotter with @code{pl_selectpl} and setting
  5887. a value for a Plotter parameter with @code{pl_parampl} are global
  5888. operations. That is why the old API is not thread-safe.
  5889. An even older @w{C API} omitted the prefix "pl_" from the names of
  5890. @code{libplot} functions. The prefix "pl_" was added @w{in part} to
  5891. distinguish GNU @code{libplot} from pre-GNU versions of @code{libplot}.
  5892. @w{If you} need to compile code written for very early versions of GNU
  5893. @code{libplot} or for pre-GNU @code{libplot}, you should include the
  5894. header file @code{plotcompat.h}. @code{plotcompat.h} redefines
  5895. @code{openpl} as @code{pl_openpl}, and @w{so forth}. @xref{C Compiling
  5896. and Linking}.
  5897. @node C Compiling and Linking, Sample C Drawings, Older C APIs, C Programming
  5898. @subsection C compiling and linking
  5899. The source code for a graphics application written in C, if it is to use
  5900. the GNU @code{libplot} @w{C API} (@w{C application} programming
  5901. interface), must contain the lines
  5902. @example
  5903. @group
  5904. #include <stdio.h>
  5905. #include <plot.h>
  5906. @end group
  5907. @end example
  5908. @noindent
  5909. The header file @file{plot.h} is distributed with @code{libplot}, and
  5910. should have been installed on your system where your @w{C compiler} will
  5911. find it. @w{It contains} a prototype for each of the functions in the
  5912. @w{C API}, and some miscellaneous definitions.
  5913. To each Plotter operation there corresponds a function in the @w{C API}
  5914. whose name begins with "pl_" and ends @w{with "_r"}. @w{To invoke} the
  5915. Plotter operation, this function would be called. For example, the
  5916. @code{openpl} operation would be invoked on a Plotter by calling the
  5917. function @code{pl_openpl_r}, the first argument of which is a pointer to
  5918. the Plotter. All such functions are declared in @file{plot.h}.
  5919. In releases of GNU @code{libplot} before @code{libplot} 3.0, Plotter
  5920. operations were performed in a different way. For example, there was a
  5921. function @code{pl_openpl} that operated on a Plotter that was
  5922. `selected', rather than specified as an argument. The old @w{C API} is
  5923. still supported by @file{plot.h}. For more information @w{on it}, see
  5924. @ref{Older C APIs}.
  5925. In even older releases of GNU @code{libplot}, and in the non-GNU
  5926. versions of @code{libplot} that preceded it, the "pl_" prefix was not
  5927. used. @w{If you} need to compile code written for early versions of GNU
  5928. @code{libplot} or for non-GNU @code{libplot}, you should also include
  5929. the header file @code{plotcompat.h}. That file redefines @code{openpl}
  5930. as @code{pl_openpl}, and @w{so forth}.
  5931. To link your application with GNU @code{libplot}, you would use the
  5932. appropriate @samp{-l} option(s) on the command line when compiling it.
  5933. You would use
  5934. @example
  5935. -lplot -lXaw -lXmu -lXt -lXext -lX11 -lpng -lz -lm
  5936. @end example
  5937. @noindent
  5938. or, in recent releases of the @w{X Window} System,
  5939. @example
  5940. -lplot -lXaw -lXmu -lXt -lSM -lICE -lXext -lX11 -lpng -lz -lm
  5941. @end example
  5942. @noindent
  5943. These linking options assume that your version of @code{libplot} has
  5944. been compiled with PNG support; @w{if not}, you would omit the
  5945. @samp{-lpng -lz} options.
  5946. As an alternative to the preceding, you may need to use @samp{-lplot
  5947. -lXm -lXt -lXext -lX11 -lpng -lz -lm}, @samp{-lplot -lXm -lXt -lXext
  5948. -lX11 -lpng -lz -lm -lc -lgen}, or @samp{-lplot -lXm -lXt -lXext -lX11
  5949. -lpng -lz -lm -lc -lPW}, on systems that provide Motif widgets instead
  5950. of Athena widgets. In recent releases of the @w{X Window} System, you
  5951. would insert @samp{-lSM -lICE}@. Recent releases of Motif require
  5952. @samp{-lXp} and possibly @samp{-lXpm} @w{as well}.)
  5953. On some platforms, the directories in which @code{libplot} or the other
  5954. libraries are stored must be specified on the command line. @w{For
  5955. example}, the options @samp{-lXaw -lXmu -lXt -lSM -lICE -lXext -lX11},
  5956. which specify @w{X Window} System libraries, may need to be preceded by
  5957. an option like @samp{-L/usr/X11/lib}.
  5958. On most systems @code{libplot} is installed as a shared library. This
  5959. means that the linking with your application will take place at run time
  5960. rather than compile time. The environment variable
  5961. @code{LD_LIBRARY_PATH} lists the directories which will be searched for
  5962. shared libraries at run time. For your application to be executable,
  5963. this environment variable should include the directory in which
  5964. @code{libplot} is stored.
  5965. @node Sample C Drawings, Paths and Subpaths, C Compiling and Linking, C Programming
  5966. @subsection Sample drawings in C
  5967. The following is a sample application, written in C, that invokes GNU
  5968. @code{libplot} operations to draw vector graphics. @w{It draws} an
  5969. intricate and beautiful path (Bill Gosper's @w{``C'' curve}, discussed
  5970. as Item #135 in @cite{HAKMEM}, MIT Artificial Intelligence Laboratory
  5971. Memo #239, 1972). @w{As the} numeric constant @code{MAXORDER} (here
  5972. equal @w{to 12}) is increased, the path will @w{take on} the shape of a
  5973. curly @w{letter ``C''}, which is the envelope of a myriad of epicyclic
  5974. octagons.
  5975. @example
  5976. @group
  5977. #include <stdio.h>
  5978. #include <plot.h>
  5979. #define MAXORDER 12
  5980. @end group
  5981. @group
  5982. void draw_c_curve (plPlotter *plotter, double dx, double dy, int order)
  5983. @{
  5984. if (order >= MAXORDER)
  5985. /* continue path along (dx, dy) */
  5986. pl_fcontrel_r (plotter, dx, dy);
  5987. @end group
  5988. @group
  5989. else
  5990. @{
  5991. draw_c_curve (plotter,
  5992. 0.5 * (dx - dy), 0.5 * (dx + dy), order + 1);
  5993. draw_c_curve (plotter,
  5994. 0.5 * (dx + dy), 0.5 * (dy - dx), order + 1);
  5995. @}
  5996. @}
  5997. @end group
  5998. @group
  5999. int main ()
  6000. @{
  6001. plPlotter *plotter;
  6002. plPlotterParams *plotter_params;
  6003. /* set a Plotter parameter */
  6004. plotter_params = pl_newplparams ();
  6005. pl_setplparam (plotter_params, "PAGESIZE", "letter");
  6006. @end group
  6007. @group
  6008. /* create a Postscript Plotter that writes to standard output */
  6009. if ((plotter = pl_newpl_r ("ps", stdin, stdout, stderr,
  6010. plotter_params)) == NULL)
  6011. @{
  6012. fprintf (stderr, "Couldn't create Plotter\n");
  6013. return 1;
  6014. @}
  6015. @end group
  6016. @group
  6017. if (pl_openpl_r (plotter) < 0) /* open Plotter */
  6018. @{
  6019. fprintf (stderr, "Couldn't open Plotter\n");
  6020. return 1;
  6021. @}
  6022. @end group
  6023. @group
  6024. pl_fspace_r (plotter, 0.0, 0.0, 1000.0, 1000.0); /* set coor system */
  6025. pl_flinewidth_r (plotter, 0.25); /* set line thickness */
  6026. pl_pencolorname_r (plotter, "red"); /* use red pen */
  6027. @end group
  6028. @group
  6029. pl_erase_r (plotter); /* erase graphics display */
  6030. pl_fmove_r (plotter, 600.0, 300.0); /* position the graphics cursor */
  6031. draw_c_curve (plotter, 0.0, 400.0, 0);
  6032. @end group
  6033. @group
  6034. if (pl_closepl_r (plotter) < 0) /* close Plotter */
  6035. @{
  6036. fprintf (stderr, "Couldn't close Plotter\n");
  6037. return 1;
  6038. @}
  6039. @end group
  6040. @group
  6041. if (pl_deletepl_r (plotter) < 0) /* delete Plotter */
  6042. @{
  6043. fprintf (stderr, "Couldn't delete Plotter\n");
  6044. return 1;
  6045. @}
  6046. return 0;
  6047. @}
  6048. @end group
  6049. @end example
  6050. As you can see, this application begins by creating a
  6051. @code{plPlotterParams} object to hold Plotter parameters, and sets the
  6052. @code{PAGESIZE} parameter. @w{It then} calls the @code{pl_newpl_r}
  6053. function to create a Postscript Plotter. The Postscript Plotter will
  6054. produce output for a US letter-sized page, though any other standard
  6055. page size, e.g., "a4", could be substituted. This would be arranged by
  6056. altering the call to @code{pl_setplparam}. The @code{PAGESIZE}
  6057. parameter is one of several Plotter parameters that an application
  6058. programmer may set. For a list, see @ref{Plotter Parameters}.
  6059. After the Plotter is created, the application @w{opens it} and draws the
  6060. @w{``C'' curve} recursively. The drawing of the curve is accomplished
  6061. by calling the @code{pl_fmove_r} function to position the Plotter's
  6062. graphics cursor, and then calling @code{draw_c_curve}. This subroutine
  6063. repeatedly calls @code{pl_fcontrel_r}. The @code{pl_fcontrel_r}
  6064. function continues a path by adding a line segment @w{to it}. The
  6065. endpoint of each line segment is specified in relative floating point
  6066. coordinates, i.e., as a floating point offset from the previous cursor
  6067. position. After the @w{``C'' curve} is drawn, the Plotter is closed by
  6068. calling @code{pl_closepl_r}, which automatically invokes
  6069. @code{pl_endpath_r} to end the path. @w{A Postscript} file is written
  6070. to standard output when @code{pl_deletepl_r} is called to delete the
  6071. Plotter.
  6072. Specifying "png", "pnm", "gif", "svg", "ai", "cgm", "fig", "pcl",
  6073. "hpgl", "regis", "tek", or "meta" as the first argument in the call to
  6074. @code{pl_newpl_r}, instead of "ps", would yield a Plotter that would
  6075. write graphics to standard output in the specified format, instead of
  6076. Postscript. The @code{PAGESIZE} parameter is relevant to the "svg",
  6077. "ai", "cgm", "fig", "pcl", and "hpgl" output formats, but is ignored for
  6078. the others. Specifying "meta" as the Plotter type may be useful if you
  6079. wish to avoid recompilation for different output devices. Graphics
  6080. metafile output may be piped to the @code{plot} utility and converted to
  6081. any other supported output format, or displayed in an @w{X window}.
  6082. @xref{plot}.
  6083. @w{If "X"} were specified as the first argument of @code{pl_newpl_r},
  6084. the curve would be drawn in a popped-up @w{X window}, and the output
  6085. stream argument would be ignored. Which @w{X Window} System display the
  6086. window would @w{pop up} on would be determined by the @code{DISPLAY}
  6087. parameter, or if that parameter were not set, by the @code{DISPLAY}
  6088. environment variable. The size of the @w{X window} would be determined
  6089. by the @code{BITMAPSIZE} parameter, or if that parameter were not set,
  6090. by the @code{BITMAPSIZE} environment variable. The default value is
  6091. "570x570". For the "png", "pnm", and "gif" Plotter types, the
  6092. interpretation of @code{BITMAPSIZE} is similar.
  6093. You could also specify "Xdrawable" as the Plotter type. For you to make
  6094. this work, you would need to know a bit about @w{X Window} System
  6095. programming. You would need to create @w{at least} one @w{X drawable}
  6096. (i.e., window or a pixmap), and by invoking @code{pl_setplparam} before
  6097. @code{pl_newpl_r} is called, set it as the value of the parameter
  6098. @code{XDRAWABLE_DRAWABLE1} or @code{XDRAWABLE_DRAWABLE2}. For the
  6099. parameters that affect @w{X Drawable} Plotters, see @ref{Plotter
  6100. Parameters}.
  6101. The following is another sample application, written in C, that invokes
  6102. @code{libplot} operations to draw vector graphics. @w{It draws} a
  6103. spiral consisting of elliptically boxed text strings, each of which
  6104. reads "GNU libplot!". This figure will be sent to standard output in
  6105. Postscript format.
  6106. @example
  6107. @group
  6108. #include <stdio.h>
  6109. #include <plot.h>
  6110. #include <math.h>
  6111. #define SIZE 100.0 /* nominal size of user coordinate frame */
  6112. #define EXPAND 2.2 /* expansion factor for elliptical box */
  6113. @end group
  6114. @group
  6115. void draw_boxed_string (plPlotter *plotter,
  6116. char *s, double size, double angle)
  6117. @{
  6118. double true_size, width;
  6119. pl_ftextangle_r (plotter, angle); /* set text angle (degrees) */
  6120. true_size = pl_ffontsize_r (plotter, size); /* set font size */
  6121. width = pl_flabelwidth_r (plotter, s); /* compute width of string */
  6122. pl_fellipserel_r (plotter, 0.0, 0.0,
  6123. EXPAND * 0.5 * width, EXPAND * 0.5 * true_size,
  6124. angle); /* draw surrounding ellipse */
  6125. pl_alabel_r (plotter, 'c', 'c', s); /* draw centered text string */
  6126. @}
  6127. @end group
  6128. @group
  6129. int main()
  6130. @{
  6131. plPlotter *plotter;
  6132. plPlotterParams *plotter_params;
  6133. int i;
  6134. @end group
  6135. @group
  6136. /* set a Plotter parameter */
  6137. plotter_params = pl_newplparams ();
  6138. pl_setplparam (plotter_params, "PAGESIZE", "letter");
  6139. @end group
  6140. @group
  6141. /* create a Postscript Plotter that writes to standard output */
  6142. if ((plotter = pl_newpl_r ("ps", stdin, stdout, stderr,
  6143. plotter_params)) == NULL)
  6144. @{
  6145. fprintf (stderr, "Couldn't create Plotter\n");
  6146. return 1;
  6147. @}
  6148. @end group
  6149. @group
  6150. if (pl_openpl_r (plotter) < 0) /* open Plotter */
  6151. @{
  6152. fprintf (stderr, "Couldn't open Plotter\n");
  6153. return 1;
  6154. @}
  6155. @end group
  6156. @group
  6157. /* specify user coor system */
  6158. pl_fspace_r (plotter, -(SIZE), -(SIZE), SIZE, SIZE);
  6159. pl_pencolorname_r (plotter, "blue"); /* use blue pen */
  6160. pl_fillcolorname_r (plotter, "white"); /* set white fill color */
  6161. pl_filltype_r (plotter, 1); /* fill ellipses with fill color */
  6162. /* choose a Postscript font */
  6163. pl_fontname_r (plotter, "NewCenturySchlbk-Roman");
  6164. @end group
  6165. @group
  6166. for (i = 80; i > 1; i--) /* loop through angles */
  6167. @{
  6168. double theta, radius;
  6169. @end group
  6170. @group
  6171. theta = 0.5 * (double)i; /* theta is in radians */
  6172. radius = SIZE / pow (theta, 0.35); /* this yields a spiral */
  6173. pl_fmove_r (plotter, radius * cos (theta), radius * sin (theta));
  6174. draw_boxed_string (plotter, "GNU libplot!", 0.04 * radius,
  6175. (180.0 * theta / M_PI) - 90.0);
  6176. @}
  6177. @end group
  6178. @group
  6179. if (pl_closepl_r (plotter) < 0) /* close Plotter */
  6180. @{
  6181. fprintf (stderr, "Couldn't close Plotter\n");
  6182. return 1;
  6183. @}
  6184. @end group
  6185. @group
  6186. if (pl_deletepl_r (plotter) < 0) /* delete Plotter */
  6187. @{
  6188. fprintf (stderr, "Couldn't delete Plotter\n");
  6189. return 1;
  6190. @}
  6191. return 0;
  6192. @}
  6193. @end group
  6194. @end example
  6195. This example shows what is involved in plotting a text string or text
  6196. strings. First, the desired font must be retrieved. @w{A font} is
  6197. fully specified by calling @code{pl_fontname_r}, @code{pl_fontsize_r},
  6198. and @code{pl_textangle_r}, or their floating point counterparts
  6199. @code{pl_ffontname_r}, @code{pl_ffontsize_r}, and
  6200. @code{pl_ftextangle_r}. Since these three functions may be called in
  6201. any order, each of them returns the size of the font that it selects, as
  6202. a convenience to the programmer. This may differ slightly from the size
  6203. specified in the most recent call to @code{pl_fontsize_r} or
  6204. @code{pl_ffontsize_r}, since many Plotters have only a limited repertory
  6205. of fonts. The above example plots each text string in the
  6206. "NewCenturySchlbk-Roman" font, which is available on Postscript
  6207. Plotters. @xref{Text Fonts}.
  6208. If you replace "ps" by "X" in the call to @code{pl_newpl_r}, an @w{X
  6209. Plotter} rather than a Postscript Plotter will be used, and the spiral
  6210. will be drawn in a popped-up @w{X window}. If your @w{X display} does
  6211. not support the "NewCenturySchlbk-Roman" font, you may substitute any
  6212. core @w{X font}, such as the widely available scalable font
  6213. "charter-medium-r-normal", or the traditional screen font "fixed".
  6214. For the format of font names, see @ref{Text Fonts in X}@. @w{If the}
  6215. @w{X Plotter} is unable to retrieve the font you specify, it will
  6216. first attempt to use a default scalable font ("Helvetica", interpreted
  6217. in the context of the @w{X Window} System as
  6218. "helvetica-medium-r-normal"), and if that fails, use a default Hershey
  6219. vector font ("HersheySerif") instead. Hershey fonts are constructed
  6220. from line segments, so each built-in Hershey font is available on all
  6221. types of Plotter.
  6222. If you are using an ancient (pre-X11R6) @w{X Window} System display,
  6223. you will find that retrieving a font is a time-consuming operation.
  6224. The above example may run slowly on such displays, since a new font
  6225. must be retrieved before each text string is drawn. That is because
  6226. each text string has a different angle of inclination. @w{It is}
  6227. possible to retrieve individual characters from an X11R6 display,
  6228. rather than retrieving an entire font. @w{If this} feature is
  6229. available, the @w{X Plotter} will automatically take advantage @w{of
  6230. it} to save time.
  6231. @node Paths and Subpaths, Drawing on a Page, Sample C Drawings, C Programming
  6232. @subsection Simple paths and compound paths
  6233. The most sophisticated sort of graphical object that @code{libplot} can
  6234. draw is a @emph{path}. In this section we explain the fine details of
  6235. constructing paths. The other three sorts of graphical object (text
  6236. strings, marker symbols, and points [i.e., pixels]) are discussed
  6237. elsewhere.
  6238. As in Postscript, paths may be simple or compound. @w{A simple} path is
  6239. a contiguous sequence of line segments, circular arcs, elliptic arcs,
  6240. quadratic Bezier curves, and/or cubic Bezier curves. @w{A simple} path
  6241. may also be a circle, an ellipse, or a rectangle. @w{A compound} path
  6242. consists of one or more simple paths, which must be @emph{nested}: they
  6243. should not intersect each other. @emph{This is more restrictive than in
  6244. Postscript.}
  6245. @code{libplot}'s drawing model is significantly different from
  6246. Postscript's, and is more user-friendly. Before drawing a path by
  6247. invoking @code{libplot} operations, you do not need to call any special
  6248. function. You would specify the attributes of the path before drawing,
  6249. however. Attributes include pen color, line type, line width, cap type,
  6250. join type, and miter limit. @w{If the} path is to be filled, the fill
  6251. color and fill rule would be specified too. All these attributes are
  6252. `modal': their values are preserved from path to path.
  6253. In principle, you would end any path you construct, and request that it
  6254. be drawn on the graphics display, by invoking the @code{endpath}
  6255. operation. But @code{endpath} is called automatically when any
  6256. path-related attribute is changed, when @code{move} is called to change
  6257. the graphics cursor position, and before any other object is constructed
  6258. and drawn. @w{It is} also called at the end of each page of graphics,
  6259. i.e., when @code{closepl} is invoked. So invoking @code{endpath}
  6260. explicitly is usually unnecessary. This is quite different from
  6261. Postscript, where an explicit command to stroke or fill a path is
  6262. required.
  6263. @code{libplot} also differs from Postscript in the way it constructs and
  6264. draws compound paths. In @code{libplot}, you would end each of the
  6265. constituent simple paths of a compound path by invoking the
  6266. @code{endsubpath} operation. After all simple paths are drawn, the
  6267. compound path as a whole would be drawn by invoking @code{endpath}.
  6268. After each of the calls to @code{endsubpath}, you are allowed to call
  6269. @code{move} to reposition the graphics cursor, prior to beginning the
  6270. next simple path. Immediately after an invocation of @code{endsubpath},
  6271. a call to @code{move} will not automatically invoke @code{endpath}.
  6272. The following sample program uses a Postscript Plotter to produce
  6273. Postscript output. It draws a typical compound path, which consists of
  6274. @w{17 simple} paths. The first simple path is a large box. This box
  6275. contains @w{7 circles}, nested within each other, and a separate set of
  6276. @w{7 circles} that are also nested within each other. Within each of
  6277. the two sets of nested circles is a pair of contiguous line segments,
  6278. which make up an additional simple path. The compound path is drawn in
  6279. green, and it is filled. The fill color is light blue.
  6280. @example
  6281. @group
  6282. #include <stdio.h>
  6283. #include <plot.h>
  6284. @end group
  6285. @group
  6286. int main ()
  6287. @{
  6288. int i, j;
  6289. plPlotter *plotter;
  6290. plPlotterParams *plotter_params;
  6291. @end group
  6292. @group
  6293. /* set a Plotter parameter */
  6294. plotter_params = pl_newplparams ();
  6295. pl_setplparam (plotter_params, "PAGESIZE", "letter");
  6296. @end group
  6297. @group
  6298. /* create a Postscript Plotter that writes to standard output */
  6299. plotter = pl_newpl_r ("ps", stdin, stdout, stderr, plotter_params);
  6300. @end group
  6301. @group
  6302. /* open Plotter, i.e. begin a page of graphics */
  6303. pl_openpl_r (plotter);
  6304. @end group
  6305. @group
  6306. pl_fspace_r (plotter, 0.0, 0.0, 1000.0, 1000.0); /* set coor system */
  6307. pl_flinewidth_r (plotter, 5.0); /* set line thickness */
  6308. pl_pencolorname_r (plotter, "green");
  6309. pl_fillcolorname_r (plotter, "light blue");
  6310. pl_filltype_r (plotter, 1); /* do filling, full strength */
  6311. pl_erase_r (plotter); /* erase graphics display */
  6312. @end group
  6313. @group
  6314. /* draw a compound path consisting of 17 simple paths */
  6315. /* draw the first simple path: a large box */
  6316. pl_orientation_r (plotter, 1);
  6317. pl_fbox_r (plotter, 50.0, 50.0, 950.0, 950.0);
  6318. pl_endsubpath_r (plotter);
  6319. @end group
  6320. @group
  6321. for (i = 0; i < 2; i++)
  6322. /* draw 8 simple paths that are nested inside the box */
  6323. @{
  6324. @end group
  6325. @group
  6326. /* first, draw 7 simple paths: nested circles */
  6327. for (j = 9; j >= 3; j--)
  6328. @{
  6329. pl_orientation_r (plotter, j % 2 ? -1 : 1);
  6330. pl_fcircle_r (plotter, 250.0 + 500 * i, 500.0, j * 20.0);
  6331. pl_endsubpath_r (plotter);
  6332. @}
  6333. @end group
  6334. @group
  6335. /* draw an open simple path comprising two line segments */
  6336. pl_fmove_r (plotter, 225.0 + 500 * i, 475.0);
  6337. pl_fcont_r (plotter, 250.0 + 500 * i, 525.0);
  6338. pl_fcont_r (plotter, 275.0 + 500 * i, 475.0);
  6339. pl_endsubpath_r (plotter);
  6340. @}
  6341. @end group
  6342. @group
  6343. /* formally end the compound path (not actually necessary) */
  6344. pl_endpath_r (plotter);
  6345. @end group
  6346. @group
  6347. /* close Plotter, i.e. end page of graphics */
  6348. pl_closepl_r (plotter);
  6349. @end group
  6350. @group
  6351. /* delete Plotter */
  6352. if (pl_deletepl_r (plotter) < 0)
  6353. @{
  6354. fprintf (stderr, "Couldn't delete Plotter\n");
  6355. return 1;
  6356. @}
  6357. return 0;
  6358. @}
  6359. @end group
  6360. @end example
  6361. As you will see if you run this program, the filling of the compound
  6362. path takes place in a visually pleasing way: alternating annular regions
  6363. are filled. That is because @code{libplot}'s default fill rule is
  6364. "even-odd". Since a compound path's constituent simple paths must
  6365. always be nested, it is easy for @code{libplot} to determine which
  6366. regions between them are `even' and which are `odd'. @w{It is} the
  6367. latter that are filled.
  6368. The above program includes many invocations of @code{orientation}. The
  6369. value of the modal `orientation' attribute (@w{1, meaning}
  6370. counterclockwise, @w{or @minus{}1}, meaning clockwise) applies to
  6371. subsequently drawn boxes, circles, and ellipses. If "even-odd" filling
  6372. is used, they have no effect. @w{But if} the fill rule for the compound
  6373. path is set to "nonzero-winding" by an initial call to @code{fillmod},
  6374. these calls to @code{orientation} will arrange matters so that
  6375. alternating annular regions are filled, just as if "even-odd" filling
  6376. were used.
  6377. If the preceding paragraph is mysterious, it would be wise to consult a
  6378. good book on Postscript programming, or any other reference on the
  6379. subject of `winding numbers'.
  6380. @node Drawing on a Page, Animated GIFs, Paths and Subpaths, C Programming
  6381. @subsection Drawing on a physical page
  6382. GNU @code{libplot} can draw graphics over an entire page of paper, not
  6383. merely within the graphics display or `viewport' that it normally uses.
  6384. The default viewport used by an Illustrator, Postscript, Fig, or PCL
  6385. Plotter is a square region centered on the page. The size of the
  6386. default viewport depends on the @code{PAGESIZE} parameter, which may be
  6387. "letter", "a4", etc. See @ref{Page and Viewport Sizes}. For example,
  6388. the default viewport on a letter-sized page, which has width 8.5@dmn{}in
  6389. and height 11@dmn{}in, is a square of side 8@dmn{}in.
  6390. However, you may specify different dimensions for the viewport, and a
  6391. different position @w{as well}. In particular, you may specify a
  6392. viewport that covers the entire page. This would be accomplished by
  6393. setting @code{PAGESIZE} to, for example,
  6394. "letter,xsize=8.5in,ysize=11in,xorigin=0in,yorigin=0in". "xorigin" and
  6395. "yorigin" specify the location of the lower left corner of the viewport,
  6396. relative to the lower left corner of the page.
  6397. With this choice for the viewport, the entire page is @w{in principle}
  6398. imageable. For full-page drawing, it is convenient to define a user
  6399. coordinate system in terms of which the lower left corner of the page is
  6400. (0,0), and in which the units are physical inches or centimeters. @w{To
  6401. do} so, you would use appropriate arguments when invoking the
  6402. @code{space} operation on the Plotter. The following program shows how
  6403. the @code{space} operation would be invoked.
  6404. @example
  6405. @group
  6406. #include <stdio.h>
  6407. #include <plot.h>
  6408. @end group
  6409. @group
  6410. int main()
  6411. @{
  6412. plPlotter *plotter;
  6413. plPlotterParams *plotter_params;
  6414. @end group
  6415. @group
  6416. /* set page size parameter, including viewport size and location */
  6417. plotter_params = pl_newplparams ();
  6418. pl_setplparam (plotter_params, "PAGESIZE",
  6419. "letter,xsize=8.5in,ysize=11in,xorigin=0in,yorigin=0in");
  6420. @end group
  6421. @group
  6422. /* create a Postscript Plotter with the specified parameter */
  6423. plotter = pl_newpl_r ("ps", stdin, stdout, stderr, plotter_params);
  6424. @end group
  6425. @group
  6426. pl_openpl_r (plotter); /* begin page of graphics */
  6427. pl_fspace_r (plotter,
  6428. 0.0, 0.0, 8.5, 11.0); /* set user coor system */
  6429. @end group
  6430. @group
  6431. pl_fontname_r (plotter, "Times-Bold");
  6432. pl_ffontsize_r (plotter, 0.5); /* font size = 0.5in = 36pt */
  6433. @end group
  6434. @group
  6435. pl_fmove_r (plotter, 1.0, 10.0);
  6436. pl_alabel_r (plotter, 'l', 'x', "One inch below the top");
  6437. pl_fline_r (plotter, 1.0, 10.0, 7.5, 10.0);
  6438. @end group
  6439. @group
  6440. pl_fmove_r (plotter, 7.5, 1.0);
  6441. pl_alabel_r (plotter, 'r', 'x', "One inch above the bottom");
  6442. pl_fline_r (plotter, 1.0, 1.0, 7.5, 1.0);
  6443. @end group
  6444. @group
  6445. pl_closepl_r (plotter); /* end page of graphics */
  6446. pl_deletepl_r (plotter); /* delete Plotter */
  6447. return 0;
  6448. @}
  6449. @end group
  6450. @end example
  6451. @noindent
  6452. The program will print two strings and draw the baseline for each. The
  6453. first string will be left-justified at position (1.0,11.0), which is one
  6454. inch below the top of the page. The second string will be
  6455. right-justified at position (7.5,1.0), which is one inch above the
  6456. bottom of the page. For both strings, the @t{'x'} argument of
  6457. @code{pl_alabel_r} specifies the vertical positioning: @w{it requests}
  6458. that the baseline of the string, rather than (say) its top or bottom, be
  6459. positioned at the current vertical position.
  6460. The preceding discussion and sample program dealt with the portrait
  6461. orientation of the printed page, which is the default. Drawing in
  6462. landscape orientation is only slightly more complicated. For this,
  6463. the viewport would be rotated on the page by setting the Plotter
  6464. parameter @code{ROTATION}@. Its default value @w{is "0"} (@w{or
  6465. "no"}), but any other rotation angle may be specified. To obtain
  6466. landscape orientation, one would specify "90" (for historical reasons,
  6467. "yes" is equivalent @w{to "90"}). The following program is a modified
  6468. version of the preceding, showing how a landscape orientation would be
  6469. produced.
  6470. @example
  6471. @group
  6472. #include <stdio.h>
  6473. #include <plot.h>
  6474. @end group
  6475. @group
  6476. int main()
  6477. @{
  6478. plPlotter *plotter;
  6479. plPlotterParams *plotter_params;
  6480. @end group
  6481. @group
  6482. /* set Plotter parameters */
  6483. plotter_params = pl_newplparams ();
  6484. pl_setplparam (plotter_params, "PAGESIZE",
  6485. "letter,xsize=8.5in,ysize=11in,xorigin=0in,yorigin=0in");
  6486. pl_setplparam (plotter_params, "ROTATION", "90");
  6487. @end group
  6488. @group
  6489. /* create a Postscript Plotter with the specified parameters */
  6490. plotter = pl_newpl_r ("ps", stdin, stdout, stderr, plotter_params);
  6491. @end group
  6492. @group
  6493. pl_openpl_r (plotter); /* begin page of graphics */
  6494. pl_fspace_r (plotter,
  6495. 0.0, 0.0, 11.0, 8.5); /* set user coor system */
  6496. @end group
  6497. @group
  6498. pl_fontname_r (plotter, "Times-Bold");
  6499. pl_ffontsize_r (plotter, 0.5); /* font size = 0.5in = 36pt */
  6500. @end group
  6501. @group
  6502. pl_fmove_r (plotter, 1.0, 7.5);
  6503. pl_alabel_r (plotter, 'l', 'x', "One inch below the top");
  6504. pl_fline_r (plotter, 1.0, 7.5, 10.0, 7.5);
  6505. @end group
  6506. @group
  6507. pl_fmove_r (plotter, 10.0, 1.0);
  6508. pl_alabel_r (plotter, 'r', 'x', "One inch above the bottom");
  6509. pl_fline_r (plotter, 1.0, 1.0, 10.0, 1.0);
  6510. @end group
  6511. @group
  6512. pl_closepl_r (plotter); /* end page of graphics */
  6513. pl_deletepl_r (plotter); /* delete Plotter */
  6514. return 0;
  6515. @}
  6516. @end group
  6517. @end example
  6518. In this example the viewport is the same centered 8@dmn{}in by
  6519. 8@dmn{}in square, but it is rotated by 90 degrees counterclockwise; or
  6520. equivalently, the graphics within it are rotated. As in the preceding
  6521. example, the call to @code{pl_fspace_r} @w{sets up} the user
  6522. coordinate system so that the units are physical inches. The origin
  6523. of coordinates is now the lower right corner of the page. The
  6524. @math{x} @w{and @math{y}} coordinates increase upward and to the left,
  6525. respectively.
  6526. @node Animated GIFs, X Animations, Drawing on a Page, C Programming
  6527. @subsection Animated GIFs in C
  6528. Using GNU @code{libplot} to create pseudo-GIF files, including animated
  6529. pseudo-GIFs, is straightforward. @w{A GIF} Plotter is a Plotter like
  6530. any other, and it supports the same drawing operations. However, it has
  6531. two special properties. @w{(1) It} can draw only a single page of
  6532. graphics, i.e., only the graphics contained in the first
  6533. @code{openpl}@dots{}@code{closepl} pair appear in the output file.
  6534. @w{In this}, it resembles other Plotters that do not plot in real time.
  6535. @w{(2) Within} this page, each invocation of @code{erase} is normally
  6536. treated as the beginning of a new image in the output file. There is an
  6537. exception to this: the first invocation of @code{erase} begins a new
  6538. image only if something has already been drawn.
  6539. The reason for the exception is that many programmers who use
  6540. @code{libplot} are in the habit of invoking @code{erase} immediately
  6541. after a Plotter is opened. That is not a bad habit, since a few types
  6542. of Plotter (e.g., @w{X Drawable} and Tektronix Plotters) are
  6543. `persistent' in the sense that previously drawn graphics remain visible.
  6544. The following program creates a simple animated pseudo-GIF, 150 pixels
  6545. wide and 100 pixels high.
  6546. @example
  6547. @group
  6548. #include <stdio.h>
  6549. #include <plot.h>
  6550. @end group
  6551. @group
  6552. int main()
  6553. @{
  6554. plPlotter *plotter;
  6555. plPlotterParams *plotter_params;
  6556. int i;
  6557. @end group
  6558. /* set Plotter parameters */
  6559. plotter_params = pl_newplparams ();
  6560. pl_setplparam (plotter_params, "BITMAPSIZE", "150x100");
  6561. pl_setplparam (plotter_params, "BG_COLOR", "orange");
  6562. pl_setplparam (plotter_params, "TRANSPARENT_COLOR", "orange");
  6563. pl_setplparam (plotter_params, "GIF_ITERATIONS", "100");
  6564. pl_setplparam (plotter_params, "GIF_DELAY", "5");
  6565. /* create a GIF Plotter with the specified parameters */
  6566. plotter = pl_newpl_r ("gif", stdin, stdout, stderr, plotter_params);
  6567. pl_openpl_r (plotter); /* begin page of graphics */
  6568. pl_fspace_r (plotter,
  6569. -0.5, -0.5, 149.5, 99.5); /* set user coor system */
  6570. pl_pencolorname_r (plotter, "red"); /* use red pen */
  6571. pl_linewidth_r (plotter, 5); /* set line thickness */
  6572. pl_filltype_r (plotter, 1); /* objects will be filled */
  6573. pl_fillcolorname_r (plotter, "black"); /* set the fill color */
  6574. @group
  6575. for (i = 0; i < 180 ; i += 15)
  6576. @{
  6577. pl_erase_r (plotter); /* begin new GIF image */
  6578. pl_ellipse_r (plotter, 75, 50, 40, 20, i); /* draw an ellipse */
  6579. @}
  6580. @end group
  6581. @group
  6582. pl_closepl_r (plotter); /* end page of graphics */
  6583. pl_deletepl_r (plotter); /* delete Plotter */
  6584. return 0;
  6585. @}
  6586. @end group
  6587. @end example
  6588. The animated pseudo-GIF will be written to standard output. @w{It will}
  6589. consist of twelve images, showing the counterclockwise rotation of a
  6590. black-filled red ellipse through 180 degrees. The pseudo-GIF will be
  6591. `looped' (see below), so the ellipse will rotate repeatedly.
  6592. The parameters of the ellipse are expressed in terms of user
  6593. coordinates, not pixel coordinates. But the call to @code{pl_fspace_r}
  6594. defines user coordinates that are effectively the same as pixel
  6595. coordinates. In the user coordinate system, the lower left corner of
  6596. the rectangle mapped into the 150x100 pseudo-GIF image is given
  6597. coordinates (@minus{}0.5,@minus{}0.5), and the upper right corner is
  6598. given coordinates (149.5,99.5). So individual pixels may be addressed
  6599. in terms of integer user coordinates. @w{For example}, invoking
  6600. @code{pl_point_r(plotter,0,0)} and @code{pl_point_r(plotter,149,99)}
  6601. would set the pixels in the lower left and upper right corners of the
  6602. image to the current pen color.
  6603. Besides @code{BITMAPSIZE} and @code{BG_COLOR}, there are several
  6604. important GIF Plotter parameters that may be set with the
  6605. @code{pl_setplparam} function. The @code{TRANSPARENT_COLOR} parameter
  6606. may be set to the name of a color. Pixels in a pseudo-GIF that have
  6607. that color will be treated as transparent by most software. This is
  6608. usually used to create a transparent background. @w{In the} example
  6609. above, the background color is specified as orange, but the transparent
  6610. color is also specified as orange. @w{So the} background will not
  6611. actually be displayed.
  6612. The @code{GIF_ITERATIONS} parameter, @w{if set}, specifies the number of
  6613. times that a multi-frame pseudo-GIF should be looped. The
  6614. @code{GIF_DELAY} parameter specifies the number of hundredths of a
  6615. seconds that should elapse between successive images.
  6616. The @code{INTERLACE} parameter is sometimes useful. If it is set to
  6617. "yes", the pseudo-GIF will be interlaced. This is of greatest value for
  6618. single-frame GIFs. For full details on Plotter parameters, see
  6619. @ref{Plotter Parameters}.
  6620. @node X Animations, X Programming, Animated GIFs, C Programming
  6621. @subsection X Window System animations in C
  6622. You may use GNU @code{libplot} to produce vector graphics animations on
  6623. any Plotter that does real-time plotting (i.e., @w{an X}, @w{X
  6624. Drawable}, ReGIS, Tektronix, or Metafile Plotter). By definition, the
  6625. `frames' in any page of graphics are separated by invocations of
  6626. @code{erase}. @w{So the} graphics display will be cleared after each
  6627. frame. If successive frames differ only slightly, @w{a smooth}
  6628. animation will result.
  6629. The following is a sample application, written @w{in C}, that produces
  6630. an animation for the @w{X Window} System. @w{It displays} a `drifting
  6631. eye'. @w{As the} eye drifts across a popped-up window from left to
  6632. right, it slowly rotates. After the eye has drifted across twice, the
  6633. window will vanish.
  6634. @example
  6635. @group
  6636. #include <stdio.h>
  6637. #include <plot.h>
  6638. @end group
  6639. @group
  6640. int main ()
  6641. @{
  6642. plPlotter *plotter;
  6643. plPlotterParams *plotter_params;
  6644. int i = 0, j;
  6645. /* set Plotter parameters */
  6646. plotter_params = pl_newplparams ();
  6647. pl_setplparam (plotter_params, "BITMAPSIZE", "300x150");
  6648. pl_setplparam (plotter_params, "VANISH_ON_DELETE", "yes");
  6649. pl_setplparam (plotter_params, "USE_DOUBLE_BUFFERING", "yes");
  6650. @end group
  6651. @group
  6652. /* create an X Plotter with the specified parameters */
  6653. if ((plotter = pl_newpl_r ("X", stdin, stdout, stderr,
  6654. plotter_params)) == NULL)
  6655. @{
  6656. fprintf (stderr, "Couldn't create Plotter\n");
  6657. return 1;
  6658. @}
  6659. @end group
  6660. @group
  6661. if (pl_openpl_r (plotter) < 0) /* open Plotter */
  6662. @{
  6663. fprintf (stderr, "Couldn't open Plotter\n");
  6664. return 1;
  6665. @}
  6666. @end group
  6667. @group
  6668. pl_fspace_r (plotter,
  6669. -0.5, -0.5, 299.5, 149.5); /* set user coor system */
  6670. pl_linewidth_r (plotter, 8); /* set line thickness */
  6671. pl_filltype_r (plotter, 1); /* objects will be filled */
  6672. pl_bgcolorname_r (plotter, "saddle brown"); /* set background color */
  6673. @end group
  6674. @group
  6675. for (j = 0; j < 300; j++)
  6676. @{
  6677. pl_erase_r (plotter); /* erase window */
  6678. pl_pencolorname_r (plotter, "red"); /* use red pen */
  6679. pl_fillcolorname_r (plotter, "cyan"); /* use cyan filling */
  6680. pl_ellipse_r (plotter, i, 75, 35, 50, i); /* draw an ellipse */
  6681. pl_colorname_r (plotter, "black"); /* use black pen and filling */
  6682. pl_circle_r (plotter, i, 75, 12); /* draw a circle [the pupil] */
  6683. i = (i + 2) % 300; /* shift rightwards */
  6684. @}
  6685. @end group
  6686. @group
  6687. if (pl_closepl_r (plotter) < 0) /* close Plotter */
  6688. @{
  6689. fprintf (stderr, "Couldn't close Plotter\n");
  6690. return 1;
  6691. @}
  6692. @end group
  6693. @group
  6694. if (pl_deletepl_r (plotter) < 0) /* delete Plotter */
  6695. @{
  6696. fprintf (stderr, "Couldn't delete Plotter\n");
  6697. return 1;
  6698. @}
  6699. return 0;
  6700. @}
  6701. @end group
  6702. @end example
  6703. As you can see, this application begins by calling @code{pl_setplparam}
  6704. several times to set Plotter parameters, and then calls
  6705. @code{pl_newpl_r} to create an @w{X Plotter}. The @w{X Plotter} window
  6706. will have size 300x150 pixels. This window will vanish when the Plotter
  6707. is deleted. @w{If the} @code{VANISH_ON_DELETE} parameter were not set
  6708. to "yes", the window would remain on the screen until removed by the
  6709. user (@w{by typing} @samp{q} @w{in it}, or by clicking with a mouse).
  6710. Setting the parameter @code{USE_DOUBLE_BUFFERING} to "yes" requests
  6711. that double buffering be used. This is very important if you wish to
  6712. produce a smooth animation, with no jerkiness. Normally, an @w{X
  6713. Plotter} draws graphics into a window in real time, and erases the
  6714. window when @code{pl_erase_r} is called. But if double buffering is
  6715. used, each frame of graphics is written into an off-screen buffer, and
  6716. is copied into the window, pixel by pixel, when @code{pl_erase_r} is
  6717. called or the Plotter is closed. This is exactly what is needed for
  6718. smooth animation.
  6719. After the Plotter is created, it is selected for use and opened. When
  6720. @code{pl_openpl_r} is called, the window @w{pops up}, and the animation
  6721. begins. In the body of the @t{for} loop there is a call to
  6722. @code{pl_erase_r}, and also a sequence of @code{libplot} operations that
  6723. draws the eye. The pen color and fill color are changed twice with each
  6724. passage through the loop. You may wish to experiment with the animation
  6725. parameters to produce the best effects on your video hardware.
  6726. The positions of the objects that are plotted in the animation are
  6727. expressed in terms of user coordinates, not pixel coordinates. But the
  6728. call to @code{pl_fspace_r} defines user and pixel coordinates to be
  6729. effectively the same. User coordinates are chosen so that the lower
  6730. left corner of the rectangle mapped to the @w{X window} is
  6731. (@minus{}0.5,@minus{}0.5) and the upper right corner is (299.5,149.5).
  6732. Since this agrees with the window size, individual pixels may be
  6733. addressed in terms of integer user coordinates. @w{For example},
  6734. @code{pl_point_r(plotter,299,149)} would set the pixel in the upper
  6735. right corner of the window to the current pen color.
  6736. The following is another sample animation, this time of a rotating
  6737. @w{letter `A'}.
  6738. @example
  6739. @group
  6740. #include <stdio.h>
  6741. #include <plot.h>
  6742. @end group
  6743. @group
  6744. int main()
  6745. @{
  6746. plPlotter *plotter;
  6747. plPlotterParams *plotter_params;
  6748. int angle = 0;
  6749. /* set Plotter parameters */
  6750. plotter_params = pl_newplparams ();
  6751. pl_setplparam (plotter_params, "BITMAPSIZE", "300x300");
  6752. pl_setplparam (plotter_params, "USE_DOUBLE_BUFFERING", "yes");
  6753. pl_setplparam (plotter_params, "BG_COLOR", "blue");
  6754. @end group
  6755. @group
  6756. /* create an X Plotter with the specified parameters */
  6757. plotter = pl_newpl_r ("X", stdin, stdout, stderr, plotter_params);
  6758. /* open X Plotter, initialize coordinates, pen, and font */
  6759. pl_openpl_r (plotter);
  6760. pl_fspace_r (plotter, 0.0, 0.0, 1.0, 1.0); /* use normalized coors */
  6761. pl_pencolorname_r (plotter, "white");
  6762. pl_ffontsize_r (plotter, 1.0);
  6763. pl_fontname_r (plotter, "NewCenturySchlbk-Roman");
  6764. @end group
  6765. @group
  6766. pl_fmove_r (plotter, 0.5, 0.5); /* move to center */
  6767. while (1) /* loop endlessly */
  6768. @{
  6769. pl_erase_r (plotter);
  6770. pl_textangle_r (plotter, angle++); /* set new rotation angle */
  6771. pl_alabel_r (plotter, 'c', 'c', "A"); /* draw a centered `A' */
  6772. @}
  6773. pl_closepl_r (plotter); /* close Plotter */
  6774. @end group
  6775. @group
  6776. pl_deletepl_r (plotter); /* delete Plotter */
  6777. return 0;
  6778. @}
  6779. @end group
  6780. @end example
  6781. This animation serves as a good test of the capabilities of an @w{X
  6782. Window} System display. @w{On a} modern X11R6 display, animation will
  6783. be smooth and fast. That is because X11R6 displays can retrieve
  6784. individual characters from a font without retrieving the entire font.
  6785. @w{If your} @w{X display} does not support the
  6786. "NewCenturySchlbk-Roman" font, you may substitute most core @w{X
  6787. fonts}, such as the widely available scalable font
  6788. "charter-medium-r-normal", or the traditional screen font "fixed".
  6789. For the format of font names, see @ref{Text Fonts in X}@. @w{If the}
  6790. @w{X Plotter} is unable to retrieve the font you specify, it will
  6791. first attempt to use a default scalable font ("Helvetica", interpreted
  6792. in the context of the @w{X Window} System as
  6793. "helvetica-medium-r-normal"). @w{If that} too fails, it will use a
  6794. default Hershey vector font ("HersheySerif") instead.
  6795. Animations that use Hershey fonts are normally faster than ones that
  6796. use Postscript fonts or other @w{X Window} System fonts, since the
  6797. Hershey fonts are constructed from line segments. Rasterizing line
  6798. segments can be done rapidly.
  6799. If you are writing an application that performs a lengthy sequence of
  6800. drawing operations on an @w{X Plotter}, you may find it useful to set
  6801. the Plotter parameter @code{X_AUTO_FLUSH} to "no". By default, an
  6802. @w{X Plotter} flushes all graphics to its @w{X Window} System display
  6803. after each drawing operation. This flushing ensures that graphics are
  6804. visible to the user immediately after they are drawn. However, it
  6805. sometimes slows down the rendering process. For additional details on
  6806. Plotter parameters, see @ref{Plotter Parameters}.
  6807. @node X Programming, , X Animations, C Programming
  6808. @subsection Advanced X Window System programming
  6809. Applications that run under the X Window System are often built using
  6810. Xt, the @w{X Toolkit}. @w{In Xt}, an application is constructed from
  6811. `widgets' such as text entry fields, buttons, sliders, drawing areas,
  6812. etc. When the application @w{starts up}, each widget is configured to
  6813. respond appropriately to `events', which include key presses and mouse
  6814. clicks. After the widgets are configured, control is transferred to the
  6815. @w{Xt event} loop.
  6816. GNU @code{libplot} can be used within the Xt event loop to draw vector
  6817. graphics. For this, it would use one or more @w{X Drawable} Plotters.
  6818. An @w{X Drawable} Plotter is a Plotter that can plot into an off-screen
  6819. pixmap or an on-screen window, such as a window associated with a
  6820. widget.
  6821. The following sample application shows how an @w{X Drawable} Plotter
  6822. would be used. The application draws a @w{`C' curve}, as defined in a
  6823. previous section, in a popped-up window. The usual Xt command-line
  6824. options may be used: the window background color is specified with the
  6825. @samp{-bg} option, the window geometry with @samp{-geometry}, etc. The
  6826. curve is initially drawn in red, but clicking once with the mouse will
  6827. redraw it in green. @w{A second} mouse click will redraw it in red, and
  6828. @w{so forth}. The application will terminate when @samp{q} is typed.
  6829. @example
  6830. @group
  6831. #include <stdio.h>
  6832. #include <stdlib.h>
  6833. #include <plot.h>
  6834. @end group
  6835. @group
  6836. #include <X11/Xlib.h>
  6837. #include <X11/Intrinsic.h>
  6838. #include <X11/Shell.h>
  6839. #include <X11/StringDefs.h>
  6840. #include <X11/Core.h>
  6841. @end group
  6842. plPlotter *plotter;
  6843. int green = 0; /* draw in green, not red? */
  6844. @group
  6845. #define MAXORDER 12
  6846. void draw_c_curve (double dx, double dy, int order)
  6847. @{
  6848. if (order >= MAXORDER)
  6849. /* continue path along (dx, dy) */
  6850. pl_fcontrel_r (plotter, dx, dy);
  6851. @end group
  6852. @group
  6853. else
  6854. @{
  6855. draw_c_curve (0.5 * (dx - dy), 0.5 * (dx + dy), order + 1);
  6856. draw_c_curve (0.5 * (dx + dy), 0.5 * (dy - dx), order + 1);
  6857. @}
  6858. @}
  6859. @end group
  6860. void Redraw (Widget w, XEvent *ev, String *params, Cardinal *n_params)
  6861. @{
  6862. /* draw C curve */
  6863. pl_erase_r (plotter);
  6864. pl_pencolorname_r (plotter, green ? "green" : "red");
  6865. pl_fmove_r (plotter, 600.0, 300.0);
  6866. draw_c_curve (0.0, 400.0, 0);
  6867. pl_endpath_r (plotter);
  6868. @}
  6869. @group
  6870. void Toggle (Widget w, XEvent *ev, String *params, Cardinal *n_params)
  6871. @{
  6872. green = (green ? 0 : 1);
  6873. Redraw (w, ev, params, n_params);
  6874. @}
  6875. @end group
  6876. @group
  6877. void Quit (Widget w, XEvent *ev, String *params, Cardinal *n_params)
  6878. @{
  6879. exit (0);
  6880. @}
  6881. @end group
  6882. @group
  6883. /* mapping of events to actions */
  6884. static const String translations =
  6885. "<Expose>: redraw()\n\
  6886. <Btn1Down>: toggle()\n\
  6887. <Key>q: quit()";
  6888. @end group
  6889. @group
  6890. /* mapping of actions to subroutines */
  6891. static XtActionsRec actions[] =
  6892. @{
  6893. @{"redraw", Redraw@},
  6894. @{"toggle", Toggle@},
  6895. @{"quit", Quit@},
  6896. @};
  6897. @end group
  6898. @group
  6899. /* default parameters for widgets */
  6900. static String default_resources[] =
  6901. @{
  6902. "Example*geometry: 250x250",
  6903. (String)NULL
  6904. @};
  6905. @end group
  6906. @group
  6907. int main (int argc, char *argv[])
  6908. @{
  6909. plPlotterParams *plotter_params;
  6910. Arg wargs[10]; /* storage of widget args */
  6911. Display *display; /* X display */
  6912. Widget shell, canvas; /* toplevel widget; child */
  6913. @end group
  6914. @group
  6915. Window window; /* child widget's window */
  6916. XtAppContext app_con; /* application context */
  6917. int i;
  6918. char *bg_colorname = "white";
  6919. @end group
  6920. @group
  6921. /* take background color from command line */
  6922. for (i = 0; i < argc - 1; i++)
  6923. if (strcmp (argv[i], "-bg") == 0)
  6924. bg_colorname = argv[i + 1];
  6925. @end group
  6926. @group
  6927. /* create toplevel shell widget */
  6928. shell = XtAppInitialize (&app_con,
  6929. (String)"Example", /* app class */
  6930. NULL, /* options */
  6931. (Cardinal)0, /* num of options */
  6932. &argc, /* command line */
  6933. argv, /* command line */
  6934. default_resources,
  6935. NULL, /* ArgList */
  6936. (Cardinal)0 /* num of Args */
  6937. );
  6938. @end group
  6939. @group
  6940. /* set default widget parameters (including window size) */
  6941. XtAppSetFallbackResources (app_con, default_resources);
  6942. @end group
  6943. @group
  6944. /* map actions to subroutines */
  6945. XtAppAddActions (app_con, actions, XtNumber (actions));
  6946. @end group
  6947. @group
  6948. /* create canvas widget as child of shell widget; realize both */
  6949. XtSetArg(wargs[0], XtNargc, argc);
  6950. XtSetArg(wargs[1], XtNargv, argv);
  6951. canvas = XtCreateManagedWidget ((String)"", coreWidgetClass,
  6952. shell, wargs, (Cardinal)2);
  6953. XtRealizeWidget (shell);
  6954. @end group
  6955. @group
  6956. /* for the canvas widget, map events to actions */
  6957. XtSetArg (wargs[0], XtNtranslations,
  6958. XtParseTranslationTable (translations));
  6959. XtSetValues (canvas, wargs, (Cardinal)1);
  6960. @end group
  6961. @group
  6962. /* initialize GNU libplot */
  6963. plotter_params = pl_newplparams ();
  6964. display = XtDisplay (canvas);
  6965. window = XtWindow (canvas);
  6966. @end group
  6967. @group
  6968. pl_setplparam (plotter_params, "XDRAWABLE_DISPLAY", display);
  6969. pl_setplparam (plotter_params, "XDRAWABLE_DRAWABLE1", &window);
  6970. pl_setplparam (plotter_params, "BG_COLOR", bg_colorname);
  6971. @end group
  6972. @group
  6973. plotter = pl_newpl_r ("Xdrawable", NULL, NULL, stderr,
  6974. plotter_params);
  6975. pl_openpl_r (plotter);
  6976. pl_fspace_r (plotter, 0.0, 0.0, 1000.0, 1000.0);
  6977. pl_flinewidth_r (plotter, 0.25);
  6978. @end group
  6979. @group
  6980. /* transfer control to X Toolkit event loop (doesn't return) */
  6981. XtAppMainLoop (app_con);
  6982. @end group
  6983. return 1;
  6984. @}
  6985. @end example
  6986. Even if you are not familiar with @w{X Window} System programming, the
  6987. structure of this application should be clear. @w{It defines} three
  6988. callbacks: @code{Redraw}, @code{Toggle}, and @code{Quit}. They are
  6989. invoked respectively in response to @w{(1) a} window expose event or
  6990. mouse click, @w{(2) a} mouse click, and @w{(3) a} @w{typed @samp{q}}.
  6991. The first drawing of the @w{`C' curve} (@w{in red}) takes place because
  6992. the window receives an initial expose event.
  6993. This example could be extended to take window resizing into account.
  6994. Actually, @w{X Drawable} Plotters are usually used to draw vector
  6995. graphics in off-screen pixmaps rather than on-screen windows. Pixmaps,
  6996. unlike windows, are never resized.
  6997. @node C++ Programming, Functions, C Programming, libplot
  6998. @section C++ Programming with @code{libplotter}
  6999. @menu
  7000. * The Plotter Class:: The Plotter class
  7001. * C++ Compiling and Linking:: C++ compiling and linking
  7002. * Sample C++ Drawings:: Sample drawings in C++
  7003. @end menu
  7004. @node The Plotter Class, C++ Compiling and Linking, C++ Programming, C++ Programming
  7005. @subsection The @code{Plotter} class
  7006. The C++ binding for @code{libplot} is provided by a class library named
  7007. @code{libplotter}. This library implements a @code{Plotter} class @w{of
  7008. which} all Plotters are instances. Actually, a Plotter would normally
  7009. be an instance of an appropriate derived class, determined by the
  7010. Plotter's output format. Derived classes include @code{XPlotter},
  7011. @code{XDrawablePlotter}, @code{PNGPlotter}, @code{PNMPlotter},
  7012. @code{GIFPlotter}, @code{AIPlotter}, @code{PSPlotter},
  7013. @code{CGMPlotter}, @code{FigPlotter}, @code{PCLPlotter},
  7014. @code{HPGLPlotter}, @code{ReGISPlotter}, @code{TekPlotter}, and
  7015. @code{MetaPlotter}. The names should be self-explanatory. The
  7016. operations that may be applied to any Plotter (e.g., the @code{openpl}
  7017. operation, which begins a page of graphics) are implemented as public
  7018. function members of the @code{Plotter} class.
  7019. At the time a Plotter is created, its input, output, and error streams
  7020. must be specified, along with a PlotterParams object that optionally
  7021. contains other Plotter parameters. (The input stream is ignored, since
  7022. @w{at present}, all Plotters are write-only.) The streams may be
  7023. specified either as iostreams or as @code{FILE} pointers. That is, the
  7024. two constructors
  7025. @example
  7026. Plotter(istream& instream, ostream& outstream, ostream& errstream,
  7027. PlotterParams &params);
  7028. Plotter(FILE *infile, FILE *outfile, FILE *errfile,
  7029. PlotterParams &params);
  7030. @end example
  7031. @noindent
  7032. are provided for the base Plotter class, and similarly for each of its
  7033. derived classes. So, for example, both
  7034. @example
  7035. PSPlotter plotter(cin, cout, cerr, params);
  7036. @end example
  7037. @noindent
  7038. and
  7039. @example
  7040. PSPlotter plotter(stdin, stdout, stderr, params);
  7041. @end example
  7042. @noindent
  7043. are possible declarations of a Postscript Plotter that writes to
  7044. standard output. In the iostream case, an ostream with a null stream
  7045. buffer may be specified as the output stream and/or the error stream, to
  7046. request that no output take place. @w{In the} @code{FILE} pointer case,
  7047. specifying a null @code{FILE} pointer would accomplish the same thing.
  7048. Instances of the @code{XPlotter} and @code{XDrawablePlotter} classes
  7049. always ignore the output stream argument, since they write graphics to
  7050. an @w{X Display} rather than to a stream.
  7051. The @code{PlotterParams} class supports copying and assignment, but has
  7052. only a single public function member, @code{setplparam}. The following
  7053. is a formal description.
  7054. @table @asis
  7055. @item int @t{PlotterParams::setplparam} (const char *@var{parameter}, void *@var{value});
  7056. Set the value of the Plotter parameter @var{parameter} to @var{value}.
  7057. For most parameters, @var{value} should be a @code{char *}, i.e., a
  7058. string. Unrecognized parameters are ignored. For a list of the
  7059. recognized parameters and their meaning, see @ref{Plotter Parameters}.
  7060. @end table
  7061. Like the @code{plPlotterParams} datatype and the function
  7062. @code{pl_setplparam} of the C binding, the @code{PlotterParams} class
  7063. and the @code{PlotterParams::setplparam} function of the C++ binding
  7064. give the programmer fine control over the parameters of subsequently
  7065. created Plotters. The parameter values used by any Plotter are constant
  7066. over the lifetime of the Plotter, and are those that were specified when
  7067. the Plotter was created. @w{If at} Plotter creation time a parameter
  7068. has @emph{not} been set in the specified @code{PlotterParams} object,
  7069. its default value will be used, unless the parameter is string-valued
  7070. and there is an environment variable of the same name, in which case the
  7071. value of that environment variable will be used.
  7072. Once set in a PlotterParams object, @w{a parameter} may be unset by the
  7073. programmer by invoking @code{PlotterParams::setplparam} with a value
  7074. argument of NULL@. This further increases flexibility.
  7075. There is an alternative (older) way of constructing a Plotter, which is
  7076. deprecated but still supported. By using either of
  7077. @example
  7078. Plotter(istream& instream, ostream& outstream, ostream& errstream);
  7079. Plotter(FILE *infile, FILE *outfile, FILE *errfile);
  7080. @end example
  7081. @noindent
  7082. one may construct a Plotter without specifying a PlotterParams object.
  7083. @w{In this} case the parameter values for the Plotter are copied from
  7084. static storage. @w{A parameter} may be set in static storage by
  7085. invoking a static member function of the Plotter class,
  7086. @code{Plotter::parampl}, which has declaration
  7087. @table @asis
  7088. int @t{PlotterParams::parampl} (const char *@var{parameter}, void *@var{value});
  7089. @end table
  7090. @noindent
  7091. This alternative way of creating a Plotter is not thread-safe, which is
  7092. why it is deprecated.
  7093. @node C++ Compiling and Linking, Sample C++ Drawings, The Plotter Class, C++ Programming
  7094. @subsection C++ compiling and linking
  7095. The source code for a graphics application written in C++, if it is to
  7096. use @code{libplotter}, must contain the line
  7097. @example
  7098. #include <plotter.h>
  7099. @end example
  7100. @noindent
  7101. The header file @code{plotter.h} is distributed with @code{libplotter},
  7102. and should have been installed on your system where your @w{C++
  7103. compiler} will find it. @w{It declares} the @code{Plotter} class and
  7104. its derived classes, and also contains some miscellaneous definitions.
  7105. @w{It includes} the header files @code{<iostream.h>} and
  7106. @code{<stdio.h>}, so you do not need to include them separately.
  7107. To link your application with @code{libplotter}, you would use the
  7108. appropriate @samp{-l} option(s) on the command line when compiling it.
  7109. You would use
  7110. @example
  7111. -lplotter -lXaw -lXmu -lXt -lXext -lX11 -lpng -lz -lm
  7112. @end example
  7113. @noindent
  7114. or, in recent releases of the @w{X Window} System,
  7115. @example
  7116. -lplotter -lXaw -lXmu -lXt -lSM -lICE -lXext -lX11 -lpng -lz -lm
  7117. @end example
  7118. @noindent
  7119. These linking options assume that your version of @code{libplotter} has
  7120. been compiled with PNG support; @w{if not}, you would omit the
  7121. @samp{-lpng -lz} options.
  7122. As an alternative to the preceding, you may need to use @samp{-lplotter
  7123. -lXm -lXt -lXext -lX11 -lpng -lz -lm}, @samp{-lplotter -lXm -lXt -lXext
  7124. -lX11 -lpng -lz -lm -lc -lgen}, or @samp{-lplotter -lXm -lXt -lXext
  7125. -lX11 -lpng -lz -lm -lc -lPW}, on systems that provide Motif widgets
  7126. instead of Athena widgets. In recent releases of the @w{X Window}
  7127. System, you would insert @samp{-lSM -lICE}@. Recent releases of Motif
  7128. require @samp{-lXp} and possibly @samp{-lXpm} @w{as well}.)
  7129. On some platforms, the directories in which @code{libplotter} or the
  7130. other libraries are stored must be specified on the command line.
  7131. @w{For example}, the options @samp{-lXaw -lXmu -lXt -lSM -lICE -lXext
  7132. -lX11}, which specify @w{X Window} System libraries, may need to be
  7133. preceded by an option like @samp{-L/usr/X11/lib}.
  7134. On most systems @code{libplotter} is installed as a shared library.
  7135. This means that the linking with your application will take place at run
  7136. time rather than compile time. The environment variable
  7137. @code{LD_LIBRARY_PATH} lists the directories which will be searched for
  7138. shared libraries at run time. For your application to be executable,
  7139. this environment variable should include the directory in which
  7140. @code{libplotter} is stored.
  7141. @node Sample C++ Drawings, , C++ Compiling and Linking, C++ Programming
  7142. @subsection Sample drawings in C++
  7143. In a previous section, there are several sample @w{C programs} that show
  7144. how to draw vector graphics using @code{libplot}'s @w{C binding}.
  7145. @xref{Sample C Drawings}. @w{In this} section, we give a modified
  7146. version of one of the C programs, showing how @code{libplot}'s C++
  7147. binding, i.e., @code{libplotter}, can be used similarly.
  7148. The following C++ program draws an intricate and beautiful path (Bill
  7149. Gosper's @w{``C'' curve}).
  7150. @example
  7151. @group
  7152. #include <plotter.h>
  7153. const int maxorder = 12;
  7154. @end group
  7155. @group
  7156. void draw_c_curve (Plotter& plotter, double dx, double dy, int order)
  7157. @{
  7158. if (order >= maxorder)
  7159. plotter.fcontrel (dx, dy); // continue path along (dx, dy)
  7160. @end group
  7161. @group
  7162. else
  7163. @{
  7164. draw_c_curve (plotter,
  7165. 0.5 * (dx - dy), 0.5 * (dx + dy), order + 1);
  7166. draw_c_curve (plotter,
  7167. 0.5 * (dx + dy), 0.5 * (dy - dx), order + 1);
  7168. @}
  7169. @}
  7170. @end group
  7171. @group
  7172. int main ()
  7173. @{
  7174. // set a Plotter parameter
  7175. PlotterParams params;
  7176. params.setplparam ("PAGESIZE", (char *)"letter");
  7177. @end group
  7178. @group
  7179. PSPlotter plotter(cin, cout, cerr, params); // declare Plotter
  7180. if (plotter.openpl () < 0) // open Plotter
  7181. @{
  7182. cerr << "Couldn't open Plotter\n";
  7183. return 1;
  7184. @}
  7185. @end group
  7186. plotter.fspace (0.0, 0.0, 1000.0, 1000.0); // specify user coor system
  7187. plotter.flinewidth (0.25); // line thickness in user coordinates
  7188. plotter.pencolorname ("red"); // path will be drawn in red
  7189. plotter.erase (); // erase Plotter's graphics display
  7190. plotter.fmove (600.0, 300.0); // position the graphics cursor
  7191. draw_c_curve (plotter, 0.0, 400.0, 0);
  7192. @group
  7193. if (plotter.closepl () < 0) // close Plotter
  7194. @{
  7195. cerr << "Couldn't close Plotter\n";
  7196. return 1;
  7197. @}
  7198. return 0;
  7199. @}
  7200. @end group
  7201. @end example
  7202. The above is a straightforward translation of the corresponding @w{C
  7203. program}. Here, @code{plotter} is declared as an instance of the
  7204. @code{PSPlotter} class, which will write Postscript graphics to the
  7205. output stream @code{cout}. The graphics are drawn by invoking member
  7206. functions.
  7207. @node Functions, Plotter Parameters, C++ Programming, libplot
  7208. @section The functions in @code{libplot}: A detailed listing
  7209. In the current release of GNU @code{libplot}, any Plotter supports 97
  7210. distinct operations. @w{A language} binding for @code{libplot}
  7211. necessarily includes 97 functions that correspond to these operations.
  7212. @w{In the} C binding, these 97 functions belong to the @w{C API}
  7213. (application programming interface). The name of each function begins
  7214. with the prefix "pl_" and ends with the @w{suffix "_r"}. @w{In the} C++
  7215. binding, the 97 functions are implemented as public members of the
  7216. @code{Plotter} class. @w{No prefix} or suffix is used.
  7217. @w{A language} binding may also include functions for creating,
  7218. selecting, and deleting Plotters. For example, the @w{C binding}
  7219. includes the additional functions @code{pl_newpl_r} and
  7220. @code{pl_deletepl_r}. @xref{The C API}.
  7221. The 97 functions that operate on a specified Plotter are divided into
  7222. the four sets tabulated below.
  7223. @iftex
  7224. @enumerate
  7225. @item
  7226. Control functions: functions that open, initialize, or close the Plotter.
  7227. @item
  7228. Functions that cause the Plotter to draw objects.
  7229. @item
  7230. Functions that set or affect the Plotter's drawing attributes.
  7231. @item
  7232. Functions that alter the affine map used by the Plotter to transform
  7233. user coordinates to device coordinates.
  7234. @end enumerate
  7235. @end iftex
  7236. Many functions come in two versions: integer and double precision
  7237. floating point. Internally, @code{libplot} uses double precision
  7238. floating point. The integer versions are provided for backward
  7239. compatibility. @w{If there} are two versions of a function, the name of
  7240. the floating point version begins with the @w{letter @samp{f}}.
  7241. Many functions come in both absolute and relative versions, also. The
  7242. latter use relative coordinates (i.e., coordinates relative to the
  7243. current position of the graphics cursor), and their names end in
  7244. @samp{rel}.
  7245. Currently, only a few of the 97 functions have meaningful return values.
  7246. @menu
  7247. * Control Functions:: Functions that open, initialize or close a Plotter
  7248. * Drawing Functions:: Functions that draw objects
  7249. * Attribute Functions:: Functions that affect drawing attributes
  7250. * Mapping Functions:: Functions affecting the user -> device coordinate map
  7251. @end menu
  7252. @node Control Functions, Drawing Functions, Functions, Functions
  7253. @subsection Control functions
  7254. The following are the ``control functions'' in @code{libplot}. They are
  7255. the basic functions that open, initialize, or close an already-created
  7256. Plotter. They are listed in the approximate order in which they would
  7257. be called.
  7258. In the current @w{C binding}, each of these functions takes a pointer to
  7259. a @code{plPlotter} as its first argument. Also in the current @w{C
  7260. binding}, the name of each function begins with "pl_" and ends @w{with
  7261. "_r"}. (@w{"_r" stands} for `revised' or `reentrant'.) For information
  7262. on older @w{C bindings}, see @ref{Older C APIs}. @w{In the} C++
  7263. binding, these are member functions of the @code{Plotter} class and its
  7264. subclasses, and the prefix and suffix are not used.
  7265. @table @asis
  7266. @item int @t{openpl} ();
  7267. @t{openpl} opens a Plotter, i.e., begins a page of graphics. This
  7268. resets the Plotter's drawing attributes to their default values. @w{A
  7269. negative} return value indicates the Plotter could not be opened.
  7270. Currently, an X Plotter @w{pops up} a new window on an @w{X Window}
  7271. System display for each page of graphics, i.e., with each invocation of
  7272. @code{openpl}. Future releases may support window re-use.
  7273. @item int @t{bgcolor} (int @var{red}, int @var{green}, int @var{blue});
  7274. @t{bgcolor} sets the background color for the Plotter's graphics
  7275. display, using a 48-bit RGB color model. The arguments @var{red},
  7276. @var{green} and @var{blue} specify the red, green and blue intensities
  7277. of the background color. Each is an integer in the range
  7278. @t{0x0000}@dots{}@t{0xffff}, i.e., 0@dots{}65535. The choice @w{(0, 0,
  7279. 0)} signifies black, and the choice (65535, 65535, 65535) signifies
  7280. white.
  7281. @t{bgcolor} affects only Plotters that have a notion of background
  7282. color, i.e., @w{X Plotters}, X Drawable Plotters, PNG Plotters, PNM
  7283. Plotters, and GIF Plotters (all of which produce bitmaps), CGM Plotters,
  7284. ReGIS Plotters and Metafile Plotters. Its effect is simple: the next
  7285. time the @t{erase} operation is invoked on such a Plotter, its display
  7286. will be filled with the specified color.
  7287. @item int @t{bgcolorname} (const char *@var{name});
  7288. @t{bgcolorname} sets the background color for the the graphics display
  7289. to be @var{name}. Unrecognized colors are interpreted as "white". For
  7290. information on what color names are recognized, see @ref{Color Names}.
  7291. @w{A 24-bit} RGB color may also be specified as a six-digit hexadecimal
  7292. string, e.g., "#c0c0c0".
  7293. @t{bgcolorname} affects only Plotters that have a notion of background
  7294. color, i.e., @w{X Plotters}, @w{X Drawable} Plotters, PNG Plotters, PNM
  7295. Plotters, and GIF Plotters (all of which produce bitmaps), CGM Plotters,
  7296. ReGIS Plotters, and Metafile Plotters. Its effect is simple: the next
  7297. time the @t{erase} operation is invoked on such a Plotter, its display
  7298. will be filled with the specified color.
  7299. SVG Plotters and CGM Plotters support "none" as a value for the
  7300. background color. It will @w{turn off} the background: the drawn
  7301. objects will not be backed by anything. This is useful when the
  7302. generated SVG or WebCGM file is to be placed on a Web page.
  7303. @item int @t{erase} ();
  7304. @t{erase} begins the next frame of a multiframe page, by clearing all
  7305. previously plotted objects from the graphics display, and filling it
  7306. with the background color @w{(if any)}.
  7307. It is frequently useful to invoke @t{erase} at the beginning of each
  7308. page, i.e., immediately after invoking @t{openpl}. That is because some
  7309. Plotters are persistent, in the sense that objects drawn within an
  7310. @code{openpl}@dots{}@code{closepl} pair remain on the graphics display
  7311. even after a new page is begun by a subsequent invocation of
  7312. @code{openpl}. Currently, only @w{X Drawable} Plotters and Tektronix
  7313. Plotters are persistent. Future releases may support optional
  7314. persistence for @w{X Plotters} also.
  7315. On X Plotters and X Drawable Plotters the effects of invoking @t{erase}
  7316. will be altogether different if the Plotter parameter
  7317. @code{USE_DOUBLE_BUFFERING} is set to "yes". @w{In this} case, objects
  7318. will be written to an off-screen buffer rather than to the graphics
  7319. display, and invoking @t{erase} will @w{(1) copy} the contents of this
  7320. buffer to the display, and @w{(2) erase} the buffer by filling it with
  7321. the background color. This `double buffering' feature facilitates
  7322. smooth animation. @xref{Plotter Parameters}.
  7323. @item int @t{space} (int @var{x0}, int @var{y0}, int @var{x1}, int @var{y1});
  7324. @itemx int @t{fspace} (double @var{x0}, double @var{y0}, double @var{x1}, double @var{y1});
  7325. @t{space} and @t{fspace} take two pairs of arguments, specifying the
  7326. positions of the lower left and upper right corners of a rectangular
  7327. window in the user coordinate system that will be mapped to the
  7328. `viewport': the rectangular portion of the output device that graphics
  7329. will be @w{drawn in}. The default window is a square, with opposite
  7330. corners (0,0) @w{and (1,1)}.
  7331. In mathematical terms, calling @t{space} or @t{fspace} sets the affine
  7332. transformation from user coordinates to device coordinates. That is, it
  7333. sets the transformation matrix attribute for each object subsequently
  7334. drawn on the display. Either @t{space} or @t{fspace} would usually be
  7335. invoked at the beginning of each page of graphics, i.e., immediately
  7336. after the call to @t{openpl}. Additional calls to @t{space} or
  7337. @t{fspace} are allowed, and there are several ``mapping functions'' that
  7338. also affect the transformation matrix attribute. See @ref{Mapping
  7339. Functions}.
  7340. Note that the size and location of the viewport depend on the type of
  7341. Plotter, and on the Plotter parameters that are specified at Plotter
  7342. creation time. For example, the default viewport used by any
  7343. Illustrator, Postscript, Fig, PCL, and HP-GL Plotter is a square whose
  7344. size depends on the Plotter's page type. See @ref{Page and Viewport
  7345. Sizes}.
  7346. @item int @t{space2} (int @var{x0}, int @var{y0}, int @var{x1}, int @var{y1}, int @var{x2}, int @var{y2});
  7347. @itemx int @t{fspace2} (double @var{x0}, double @var{y0}, double @var{x1}, double @var{y1}, double @var{x2}, double @var{y2});
  7348. @t{space2} and @t{fspace2} are extended versions of @t{space} and
  7349. @t{fspace}. Their arguments are the three defining vertices of an
  7350. parallelogram-shaped window in the user coordinate system. The
  7351. specified vertices are the lower left, the lower right, and the upper
  7352. left. This window will be mapped affinely onto the viewport: the
  7353. rectangular portion of the output device that graphics will be @w{drawn
  7354. in}.
  7355. @item int @t{havecap} (const char *@var{s});
  7356. @t{havecap} is not really a control function: it is a query function.
  7357. @w{It tests} whether or not a Plotter, which need not be open, has a
  7358. specified capability. The return value is @w{0, 1}, @w{or 2},
  7359. signifying no/yes/maybe. For unrecognized capabilities the return value
  7360. is zero. Recognized capabilities include "WIDE_LINES" (i.e., the
  7361. ability to draw lines with a non-default thickness), "DASH_ARRAY" (the
  7362. ability to draw in arbitrary dashing styles, as requested by the
  7363. @t{linedash} function), "SETTABLE_BACKGROUND" (the ability to set the
  7364. color of the background), and "SOLID_FILL". The "HERSHEY_FONTS",
  7365. "PS_FONTS", "PCL_FONTS", and "STICK_FONTS" capabilities indicate whether
  7366. or not fonts of a particular class are supported. @xref{Text Fonts}.
  7367. All Plotters except Tektronix Plotters have the "SOLID_FILL" capability,
  7368. meaning they can fill paths with solid color. Each such Plotter has at
  7369. least one of the "EVEN_ODD_FILL" and "NONZERO_WINDING_NUMBER_FILL"
  7370. capabilities. These indicate the supported rules for determining the
  7371. `inside' of a path.
  7372. The `maybe' value is returned for most capabilities by Metafile
  7373. Plotters, which do no drawing themselves. The output of a Metafile
  7374. Plotter must be translated to another format, or displayed, by invoking
  7375. @code{plot}.
  7376. @item int @t{flushpl} ();
  7377. @t{flushpl} flushes (i.e., pushes onward) all previously plotted objects
  7378. to the graphics display. This is useful only if the affected Plotter is
  7379. one that does real-time plotting (@w{X Plotters}, @w{X Drawable}
  7380. Plotters, ReGIS Plotters, Tektronix Plotters, and Metafile Plotters).
  7381. @w{It ensures} that all previously plotted objects are visible to the
  7382. user. @w{On Plotters} that do not do real-time plotting, this operation
  7383. has no effect.
  7384. @item int @t{closepl} ();
  7385. @t{closepl} closes a Plotter, i.e., ends a page of graphics. If a path
  7386. is in progress, it is first ended and plotted, as if @t{endpath} had
  7387. been called. @w{A negative} return value indicates the Plotter could
  7388. not be closed.
  7389. In the present release of @code{libplot}, some Plotters output each page
  7390. of graphics immediately after it is plotted, i.e., when @t{closepl} is
  7391. invoked to end the page. That is the case with PCL and HP-GL Plotters,
  7392. in particular. Plotters that can output only a single page of graphics
  7393. (PNG, PNM, GIF, SVG, Illustrator, and Fig Plotters) do so immediately
  7394. after the first page is plotted, i.e., when @t{closepl} is invoked for
  7395. the first time. Postscript and CGM Plotters store all pages of graphics
  7396. internally, and do not produce output until they are deleted.
  7397. @end table
  7398. @node Drawing Functions, Attribute Functions, Control Functions, Functions
  7399. @subsection Object-drawing functions
  7400. The following are the ``drawing functions'' in @code{libplot}. When
  7401. invoked on a Plotter, these functions cause it to draw objects (paths,
  7402. text strings, marker symbols, and points [i.e., pixels]) on the
  7403. associated graphics display.
  7404. Paths may be simple or compound. @w{A simple} path is a sequence of
  7405. contiguous line segments, arc segments (either circular or elliptic),
  7406. and/or Bezier curve segments (either quadratic or cubic). Such simple
  7407. paths are drawn incrementally, one segment at a time. @w{A simple} path
  7408. may also be a circle, rectangle, or ellipse. @w{A compound} path
  7409. consists of multiple simple paths, which must be nested.
  7410. You do not need to begin a path by calling any special function. You
  7411. should, @w{at least} in theory, end a path under construction, and
  7412. request that it be drawn on the graphics display, by calling
  7413. @code{endpath}. But the @code{endpath} function is automatically called
  7414. when any other object is drawn, and at the end of each page of graphics.
  7415. @w{It is} also called automatically when any path-related attribute is
  7416. changed: for example, when @code{move} is called to change the graphics
  7417. cursor position. So @code{endpath} seldom needs to be invoked
  7418. explicitly.
  7419. When drawing a compound path, you would end each of its constituent
  7420. simple paths by calling @code{endsubpath}, and the compound path as a
  7421. whole by calling @code{endpath}. After each call to @code{endsubpath},
  7422. you are allowed to call @code{move} to reposition the graphics cursor,
  7423. prior to beginning the next simple path. Such a call to @code{move}
  7424. will not automatically invoke @code{endpath}. This is an exception to
  7425. the above rule.
  7426. In the current @w{C binding}, each of these functions takes a pointer to
  7427. a @code{plPlotter} as its first argument. Also in the current @w{C
  7428. binding}, the name of each function begins with "pl_" and ends @w{with
  7429. "_r"}. (@w{"_r" stands} for `revised' or `reentrant'.) For information
  7430. on older @w{C bindings}, see @ref{Older C APIs}. @w{In the} C++
  7431. binding, these are member functions of the @code{Plotter} class and its
  7432. subclasses, and the prefix and suffix are not used.
  7433. @table @asis
  7434. @item int @t{alabel} (int @var{horiz_justify}, int @var{vert_justify}, const char *@var{s});
  7435. @t{alabel} takes three arguments @var{horiz_justify},
  7436. @var{vert_justify}, and @var{s}, which specify an `adjusted label,'
  7437. i.e., a justified text string. The path under construction (@w{if any})
  7438. is ended and drawn, as if @t{endpath} had been called, and the string
  7439. @var{s} is drawn according to the specified justifications. If
  7440. @var{horiz_justify} is equal to @samp{l}, @samp{c}, or @samp{r}, then
  7441. the string will be drawn with left, center or right justification,
  7442. relative to the current graphics cursor position. If @var{vert_justify}
  7443. is equal to @samp{b}, @samp{x}, @samp{c}, @samp{C}, or @samp{t}, then
  7444. the bottom, baseline, center, cap line, or top of the string will be
  7445. placed even with the current graphics cursor position. The graphics
  7446. cursor is moved to the right end of the string if left justification is
  7447. specified, and to the left end if right justification is specified.
  7448. The string may contain escape sequences of various sorts (see @ref{Text
  7449. String Format}), though it should not contain line feeds or carriage
  7450. returns. @w{In fact} it should include only printable characters, from
  7451. the byte ranges @t{0x20}@dots{}@t{0x7e} and @t{0xa0}@dots{}@t{0xff}.
  7452. The string may be plotted at a nonzero angle, if @code{textangle} has
  7453. been called.
  7454. @item int @t{arc} (int @var{xc}, int @var{yc}, int @var{x0}, int @var{y0}, int @var{x1}, int @var{y1});
  7455. @itemx int @t{farc} (double @var{xc}, double @var{yc}, double @var{x0}, double @var{y0}, double @var{x1}, double @var{y1});
  7456. @itemx int @t{arcrel} (int @var{xc}, int @var{yc}, int @var{x0}, int @var{y0}, int @var{x1}, int @var{y1});
  7457. @itemx int @t{farcrel} (double @var{xc}, double @var{yc}, double @var{x0}, double @var{y0}, double @var{x1}, double @var{y1});
  7458. @t{arc} and @t{farc} take six arguments specifying the beginning
  7459. (@var{x0}, @var{y0}), end (@var{x1}, @var{y1}), and center (@var{xc},
  7460. @var{yc}) of a circular arc. @w{If the} graphics cursor is at
  7461. (@var{x0}, @var{y0}) and a path is under construction, then the arc is
  7462. added to the path. Otherwise the current path (@w{if any}) is ended and
  7463. drawn, as if @t{endpath} had been called, and the arc begins a new
  7464. path. In all cases the graphics cursor is moved to (@var{x1},
  7465. @var{y1}).
  7466. The direction of the arc (clockwise or counterclockwise) is determined
  7467. by the convention that the arc, centered at (@var{xc}, @var{yc}), sweep
  7468. through an angle of at most 180 degrees. @w{If the} three points appear
  7469. to be collinear, the direction is taken to be counterclockwise. If
  7470. (@var{xc}, @var{yc}) is not equidistant from (@var{x0}, @var{y0}) and
  7471. (@var{x1}, @var{y1}) as it @w{should be}, @w{it is} corrected by being
  7472. moved to the closest point on the perpendicular bisector of the line
  7473. segment joining (@var{x0}, @var{y0}) and (@var{x1}, @var{y1}).
  7474. @t{arcrel} and @t{farcrel} are similar to @code{arc} and @code{farc},
  7475. but use cursor-relative coordinates.
  7476. @item int @t{bezier2} (int @var{x0}, int @var{y0}, int @var{x1}, int @var{y1}, int @var{x2}, int @var{y2});
  7477. @itemx int @t{fbezier2} (double @var{x0}, double @var{y0}, double @var{x1}, double @var{y1}, double @var{x2}, double @var{y2});
  7478. @itemx int @t{bezier2rel} (int @var{x0}, int @var{y0}, int @var{x1}, int @var{y1}, int @var{x2}, int @var{y2});
  7479. @itemx int @t{fbezier2rel} (double @var{x0}, double @var{y0}, double @var{x1}, double @var{y1}, double @var{x2}, double @var{y2});
  7480. @t{bezier2} and @t{fbezier2} take six arguments specifying the beginning
  7481. @code{p0}=(@var{x0}, @var{y0}) and end @code{p2}=(@var{x2}, @var{y2}) of
  7482. a quadratic Bezier curve, and its intermediate control point
  7483. @code{p1}=(@var{x1}, @var{y1}). @w{If the} graphics cursor is @w{at
  7484. @code{p0}} and a path is under construction, then the curve is added to
  7485. the path. Otherwise the current path (@w{if any}) is ended and drawn,
  7486. as if @t{endpath} had been called, and the curve begins a new path.
  7487. @w{In all} cases the graphics cursor is moved @w{to @code{p2}}.
  7488. @t{bezier2rel} and @t{fbezier2rel} are similar to @code{bezier2} and
  7489. @code{fbezier2}, but use cursor-relative coordinates.
  7490. The quadratic Bezier curve is tangent at @code{p0} to the line segment
  7491. joining @code{p0} @w{to @code{p1}}, and is tangent @w{at @code{p2}} to
  7492. the line segment joining @code{p1} @w{to @code{p2}}. @w{So it} fits
  7493. snugly into a triangle with vertices @code{p0}, @code{p1}, @w{and
  7494. @code{p2}}.
  7495. When using a PCL Plotter to draw Bezier curves on a LaserJet III, you
  7496. should set the parameter @code{PCL_BEZIERS} to "no". That is because
  7497. the LaserJet III, which was Hewlett--Packard's first @w{PCL 5} printer,
  7498. does not recognize the Bezier instructions supported by later @w{PCL 5}
  7499. printers. See @ref{Plotter Parameters}.
  7500. @item int @t{bezier3} (int @var{x0}, int @var{y0}, int @var{x1}, int @var{y1}, int @var{x2}, int @var{y2}, int @var{x3}, int @var{y3});
  7501. @itemx int @t{fbezier3} (double @var{x0}, double @var{y0}, double @var{x1}, double @var{y1}, double @var{x2}, double @var{y2}, double @var{x3}, double @var{y3});
  7502. @itemx int @t{bezier3rel} (int @var{x0}, int @var{y0}, int @var{x1}, int @var{y1}, int @var{x2}, int @var{y2}, int @var{x3}, int @var{y3});
  7503. @itemx int @t{fbezier3rel} (double @var{x0}, double @var{y0}, double @var{x1}, double @var{y1}, double @var{x2}, double @var{y2}, double @var{x3}, double @var{y3});
  7504. @t{bezier3} and @t{fbezier3} take eight arguments specifying the
  7505. beginning @code{p0}=(@var{x0}, @var{y0}) and end @code{p3}=(@var{x3},
  7506. @var{y3}) of a cubic Bezier curve, and its intermediate control points
  7507. @code{p1}=(@var{x1}, @var{y1}) and @code{p2}=(@var{x2}, @var{y2}).
  7508. @w{If the} graphics cursor is @w{at @code{p0}} and a path is under
  7509. construction, then the curve is added to the path. Otherwise the
  7510. current path (@w{if any}) is ended and drawn, as if @t{endpath} had been
  7511. called, and the curve begins a new path. @w{In all} cases the graphics
  7512. cursor is moved @w{to @code{p3}}. @t{bezier3rel} and @t{fbezier3rel}
  7513. are similar to @code{bezier3} and @code{fbezier3}, but use
  7514. cursor-relative coordinates.
  7515. The cubic Bezier curve is tangent at @code{p0} to the line segment
  7516. joining @code{p0} @w{to @code{p1}}, and is tangent @w{at @code{p3}} to
  7517. the line segment joining @code{p2} @w{to @code{p3}}. @w{So it} fits
  7518. snugly into a quadrangle with vertices @code{p0}, @code{p1}, @code{p2},
  7519. @w{and @code{p3}}.
  7520. When using a PCL Plotter to draw Bezier curves on a LaserJet III, you
  7521. should set the parameter @code{PCL_BEZIERS} to "no". That is because
  7522. the LaserJet III, which was Hewlett--Packard's first @w{PCL 5} printer,
  7523. does not recognize the Bezier instructions supported by later @w{PCL 5}
  7524. printers. See @ref{Plotter Parameters}.
  7525. @item int @t{box} (int @var{x1}, int y@var{1}, int @var{x2}, int @var{y2});
  7526. @itemx int @t{fbox} (double @var{x1}, double @var{y1}, double @var{x2}, double @var{y2});
  7527. @itemx int @t{boxrel} (int @var{x1}, int y@var{1}, int @var{x2}, int @var{y2});
  7528. @itemx int @t{fboxrel} (double @var{x1}, double y@var{1}, double @var{x2}, double @var{y2});
  7529. @t{box} and @t{fbox} take four arguments specifying the starting corner
  7530. (@var{x1}, @var{y1}) and opposite corner (@var{x2}, @var{y2}) of a
  7531. `box', or rectangle. The path under construction (@w{if any}) is ended,
  7532. and the box is drawn as a new path. This path is also ended, and the
  7533. graphics cursor is moved to the midpoint of the box. @t{boxrel} and
  7534. @t{fboxrel} are similar to @t{box} and @t{fbox}, but use cursor-relative
  7535. coordinates.
  7536. @item int @t{circle} (int @var{xc}, int @var{yc}, int @var{r});
  7537. @itemx int @t{fcircle} (double @var{xc}, double @var{yc}, double @var{r});
  7538. @itemx int @t{circlerel} (int @var{xc}, int @var{yc}, int @var{r});
  7539. @itemx int @t{fcirclerel} (double @var{xc}, double @var{yc}, double @var{r});
  7540. @t{circle} and @t{fcircle} take three arguments specifying the center
  7541. (@var{xc}, @var{yc}) and radius (@var{r}) of a circle. The path under
  7542. construction (@w{if any}) is ended, and the circle is drawn as a new
  7543. path. This path is also ended, and the graphics cursor is moved to
  7544. (@var{xc}, @var{yc}). @t{circlerel} and @t{fcirclerel} are similar to
  7545. @t{circle} and @t{fcircle}, but use cursor-relative coordinates for
  7546. @var{xc} and @var{yc}.
  7547. @item int @t{cont} (int @var{x}, int @var{y});
  7548. @itemx int @t{fcont} (double @var{x}, double @var{y});
  7549. @itemx int @t{contrel} (int @var{x}, int @var{y});
  7550. @itemx int @t{fcontrel} (double @var{x}, double @var{y});
  7551. @t{cont} and @t{fcont} take two arguments specifying the coordinates
  7552. (@var{x}, @var{y}) of a point. If a path is under construction, the
  7553. line segment from the current graphics cursor position to the point
  7554. (@var{x}, @var{y}) is added to it. Otherwise the line segment begins a
  7555. new path. In all cases the graphics cursor is moved to (@var{x},
  7556. @var{y}). @t{contrel} and @t{fcontrel} are similar to @t{cont} and
  7557. @t{fcont}, but use cursor-relative coordinates.
  7558. @item int @t{ellarc} (int @var{xc}, int @var{yc}, int @var{x0}, int @var{y0}, int @var{x1}, int @var{y1});
  7559. @itemx int @t{fellarc} (double @var{xc}, double @var{yc}, double @var{x0}, double @var{y0}, double @var{x1}, double @var{y1});
  7560. @itemx int @t{ellarcrel} (int @var{xc}, int @var{yc}, int @var{x0}, int @var{y0}, int @var{x1}, int @var{y1});
  7561. @itemx int @t{fellarcrel} (double @var{xc}, double @var{yc}, double @var{x0}, double @var{y0}, double @var{x1}, double @var{y1});
  7562. @t{ellarc} and @t{fellarc} take six arguments specifying the three
  7563. points @code{pc}=(@var{xc},@var{yc}), @code{p0}=(@var{x0},@var{y0}), and
  7564. @code{p1}=(@var{x1},@var{y1}) that define a so-called quarter ellipse.
  7565. This is an elliptic arc from @code{p0} to @code{p1} with @w{center
  7566. @code{pc}}. @w{If the} graphics cursor is at point @code{p0} and a path
  7567. is under construction, the quarter-ellipse is added to it. Otherwise
  7568. the path under construction (@w{if any}) is ended and drawn, as if
  7569. @t{endpath} had been called, and the quarter-ellipse begins a new path.
  7570. @w{In all} cases the graphics cursor is moved to @code{p1}.
  7571. The quarter-ellipse is an affinely transformed version of a quarter
  7572. circle. @w{It is} drawn so as to have control points @code{p0},
  7573. @code{p1}, and @math{@code{p0}+@code{p1}-@code{pc}}. This means that it
  7574. is tangent at @code{p0} to the line segment joining @code{p0} to
  7575. @math{@code{p0}+@code{p1}-@code{pc}}, and is tangent at @code{p1} to the
  7576. line segment joining @code{p1} to @math{@code{p0}+@code{p1}-@code{pc}}.
  7577. @w{So it} fits snugly into a triangle with these three control points as
  7578. vertices. Notice that the third control point is the reflection of
  7579. @code{pc} through the line joining @code{p0} @w{and @code{p1}}.
  7580. @t{ellarcrel} and @t{fellarcrel} are similar to @t{ellarc} and
  7581. @t{fellarc}, but use cursor-relative coordinates.
  7582. @item int @t{ellipse} (int @var{xc}, int @var{yc}, int @var{rx}, int @var{ry}, int @var{angle});
  7583. @itemx int @t{fellipse} (double @var{xc}, double @var{yc}, double @var{rx}, double @var{ry}, double @var{angle});
  7584. @itemx int @t{ellipserel} (int @var{xc}, int @var{yc}, int @var{rx}, int @var{ry}, int @var{angle});
  7585. @itemx int @t{fellipserel} (double @var{xc}, double @var{yc}, double @var{rx}, double @var{ry}, double @var{angle});
  7586. @t{ellipse} and @t{fellipse} take five arguments specifying the center
  7587. (@var{xc}, @var{yc}) of an ellipse, the lengths of its semiaxes
  7588. (@var{rx} and @var{ry}), and the inclination of the first semiaxis in
  7589. the counterclockwise direction from the @w{@math{x} axis} in the user
  7590. coordinate system. The path under construction (@w{if any}) is ended,
  7591. and the ellipse is drawn as a new path. This path is also ended, and
  7592. the graphics cursor is moved to (@var{xc}, @var{yc}). @t{ellipserel}
  7593. and @t{fellipserel} are similar to @t{ellipse} and @t{fellipse}, but use
  7594. cursor-relative coordinates.
  7595. @item int @t{endpath} ();
  7596. @t{endpath} terminates the path under construction, @w{if any}, and
  7597. @w{draws it}. @w{It also} removes the path from the current graphics
  7598. context, so that a new path may be constructed.
  7599. The path under construction may be a simple path, or a compound path
  7600. constructed with the aid of @t{endsubpath} (see below). @w{A simple}
  7601. path is constructed by one or more successive calls to @t{cont},
  7602. @t{line}, @t{arc}, @t{ellarc}, @t{bezier2}, @t{bezier3}, and/or their
  7603. floating point counterparts. @w{A simple} path may also be constructed
  7604. by a single call to @t{circle}, @t{ellipse}, or @t{box}.
  7605. It is often not necessary to call @t{endpath} explicitly, since it is
  7606. frequently called automatically. It will be called if any non-path
  7607. object is drawn, if any path-related drawing attribute is set, or if
  7608. @t{move} or @t{fmove} is invoked to set the cursor position. @w{It
  7609. will} also be called if @t{restorestate} is called to pop a graphics
  7610. context off the stack, and if @t{closepl} is called to end a page of
  7611. graphics. So it is seldom necessary to call @t{endpath} explicitly.
  7612. However, if a Plotter plots objects in real time, calling @t{endpath}
  7613. will ensure that a completed path is drawn on the graphics display
  7614. without delay.
  7615. @item int @t{endsubpath} ();
  7616. @t{endsubpath} terminates the simple path under construction, @w{if
  7617. any}, and signals that the construction of the next simple path in a
  7618. compound path is to begin. Immediately after @t{endsubpath} is called,
  7619. it is permissible to call @t{move} or @t{fmove} to reposition the
  7620. graphics cursor. (At other times in the drawing of a compound path,
  7621. calling @t{move} or @t{fmove} would force a premature end to the path,
  7622. by automatically invoking @t{endpath}.)
  7623. @item int @t{label} (const char *@var{s});
  7624. @t{label} takes a single string argument @var{s} and draws the text
  7625. contained in @var{s} at the current graphics cursor position. The text
  7626. is left justified, and the graphics cursor is moved to the right end of
  7627. the string. This function is provided for backward compatibility; the
  7628. function call @t{label}(@var{s}) is equivalent to @t{alabel}(`l',`x',@var{s}).
  7629. @item int @t{labelwidth} (const char *@var{s});
  7630. @itemx double @t{flabelwidth} (const char *@var{s});
  7631. @t{labelwidth} and @t{flabelwidth} are not really object-drawing
  7632. functions: they are query functions. They compute and return the width
  7633. of a string in the current font, in the user coordinate system. The
  7634. string is not drawn.
  7635. @item int @t{line} (int @var{x1}, int @var{y1}, int @var{x2}, int @var{y2});
  7636. @itemx int @t{fline} (double @var{x1}, double y@var{1}, double @var{x2}, double @var{y2});
  7637. @itemx int @t{linerel} (int @var{x1}, int y@var{1}, int @var{x2}, int @var{y2});
  7638. @itemx int @t{flinerel} (double @var{x1}, double y@var{1}, double @var{x2}, double @var{y2});
  7639. @t{line} and @t{fline} take four arguments specifying the start point
  7640. (@var{x1}, @var{y1}) and end point (@var{x2}, @var{y2}) of a line
  7641. segment. @w{If the} graphics cursor is at (@var{x1}, @var{y1}) and a
  7642. path is under construction, the line segment is added to it. Otherwise
  7643. the path under construction (@w{if any}) is ended and drawn, as if
  7644. @t{endpath} had been called, and the line segment begins a new path.
  7645. @w{In all} cases the graphics cursor is moved to (@var{x2}, @var{y2}).
  7646. @t{linerel} and @t{flinerel} are similar to @t{line} and @t{fline}, but
  7647. use cursor-relative coordinates.
  7648. @item int @t{marker} (int @var{x}, int @var{y}, int @var{type}, int @var{size});
  7649. @itemx int @t{fmarker} (double @var{x}, double @var{y}, int @var{type}, double @var{size});
  7650. @itemx int @t{markerrel} (int @var{x}, int @var{y}, int @var{type}, int @var{size});
  7651. @itemx int @t{fmarkerrel} (double @var{x}, double @var{y}, int @var{type}, double @var{size});
  7652. @t{marker} and @t{fmarker} take four arguments specifying the position
  7653. (@var{x},@var{y}) of a marker symbol, its type, and its font size in
  7654. user coordinates. The path under construction (@w{if any}) is ended and
  7655. drawn, as if @t{endpath} had been called, and the marker symbol is
  7656. plotted. The graphics cursor is moved to (@var{x},@var{y}).
  7657. @t{markerrel} and @t{fmarkerrel} are similar to @t{marker} and
  7658. @t{fmarker}, but use cursor-relative coordinates for the position
  7659. (@var{x},@var{y}).
  7660. A marker symbol is a visual representation of a point, which is visible
  7661. on all types of Plotter. @w{In this} it differs from the points
  7662. produced by the @t{point} function (see below). Marker symbol types
  7663. 0@dots{}31 are taken from a standard set, and marker symbol types 32 and
  7664. above are interpreted as the index of a character in the current text
  7665. font. @xref{Marker Symbols}.
  7666. @item int @t{point} (int @var{x}, int @var{y});
  7667. @itemx int @t{fpoint} (double @var{x}, double @var{y});
  7668. @itemx int @t{pointrel} (int @var{x}, int @var{y});
  7669. @itemx int @t{fpointrel} (double @var{x}, double @var{y});
  7670. @t{point} and @t{fpoint} take two arguments specifying the coordinates
  7671. (@var{x}, @var{y}) of a point. The path under construction @w{(if any)}
  7672. is ended and drawn, as if @t{endpath} had been called, and the point is
  7673. plotted. The graphics cursor is moved to (@var{x}, @var{y}).
  7674. @t{pointrel} and @t{fpointrel} are similar to @t{point} and @t{fpoint},
  7675. but use cursor-relative coordinates.
  7676. `Point' is a misnomer. Any Plotter that produces a bitmap, i.e., an
  7677. @w{X Plotter}, an @w{X Drawable} Plotter, @w{a PNG} Plotter, @w{a PNM}
  7678. Plotter, or @w{a GIF} Plotter, draws a point as a single pixel. Most
  7679. other Plotters draw a point as a small solid circle, usually @w{so
  7680. small} @w{as to} be invisible. @w{So @t{point}} should really be called
  7681. @t{pixel}.
  7682. @end table
  7683. @node Attribute Functions, Mapping Functions, Drawing Functions, Functions
  7684. @subsection Attribute-setting functions
  7685. The following are the ``attribute functions'' in @code{libplot}. When
  7686. invoked on a Plotter, these functions set its drawing attributes, or
  7687. save them or restore them. Path-related attributes include graphics
  7688. cursor position, pen color, fill color, fill rule, line thickness, line
  7689. style, cap style, join style, miter limit, and transformation matrix.
  7690. Text-related attributes include pen color, font name, font size, text
  7691. angle, and transformation matrix.
  7692. Setting any path-related drawing attribute automatically terminates and
  7693. draws the path under construction (@w{if any}), @w{as if} the
  7694. @code{endpath} operation had been invoked. The `orientation' attribute
  7695. (clockwise/counterclockwise), which affects circles, ellipses, and
  7696. boxes, is an exception to this. The exception allows a compound path to
  7697. include circles, ellipses, and boxes with different orientations.
  7698. In the current @w{C binding}, each of these functions takes a pointer to
  7699. a @code{plPlotter} as its first argument. Also in the current @w{C
  7700. binding}, the name of each function begins with "pl_" and ends @w{with
  7701. "_r"}. (@w{"_r" stands} for `revised' or `reentrant'.) For information
  7702. on older @w{C bindings}, see @ref{Older C APIs}. @w{In the} C++
  7703. binding, these are member functions of the @code{Plotter} class and its
  7704. subclasses, and the prefix and suffix are not used.
  7705. @table @asis
  7706. @item int @t{capmod} (const char *@var{s});
  7707. @t{capmod} terminates and draws the path under construction (@w{if
  7708. any}), as if @t{endpath} had been called, and sets the cap mode (i.e.,
  7709. cap style) for all paths subsequently drawn on the graphics display.
  7710. Recognized styles are "butt" (the default), "round", and "projecting".
  7711. The three styles are visibly distinct only if the line thickness is
  7712. fairly large. Butt caps @w{do not} extend beyond the end of the path.
  7713. The other two kinds do, however. Round caps are filled semicircles, and
  7714. projecting caps are filled rectangular regions that extend a distance
  7715. equal to half the line width beyond the end of the path.
  7716. PNG, PNM, GIF, PCL, and HP-GL Plotters support a fourth cap mode,
  7717. "triangular". (For all but PCL and HP-GL Plotters, the support is
  7718. currently only partial.) Plotters other than these treat "triangular"
  7719. as equivalent to "round".
  7720. This function has no effect on ReGIS or Tektronix Plotters. Also, it
  7721. has no effect on HP-GL Plotters if the parameter @code{HPGL_VERSION} is
  7722. set to a value less @w{than "2"} (the default), or on CGM Plotters if
  7723. the parameter @code{CGM_MAX_VERSION} is set to a value less @w{than
  7724. "3"}. @xref{Plotter Parameters}.
  7725. @item int @t{color} (int @var{red}, int @var{green}, int @var{blue});
  7726. @t{color} is a convenience function. Calling @t{color} is equivalent to
  7727. calling both @t{pencolor} and @t{fillcolor}, to set both the the pen
  7728. color and fill color of all objects subsequently drawn on the graphics
  7729. display. Note that the physical fill color depends also on the fill
  7730. level, which is specified by calling @t{filltype}.
  7731. @item int @t{colorname} (const char *@var{name});
  7732. @t{colorname} is a convenience function. Calling @t{colorname} is
  7733. equivalent to calling both @t{pencolorname} and @t{fillcolorname}, to
  7734. set both the the pen color and fill color of all objects subsequently
  7735. drawn on the graphics display. Note that the physical fill color
  7736. depends also on the fill level, which is specified by calling
  7737. @t{filltype}.
  7738. @item int @t{fillcolor} (int @var{red}, int @var{green}, int @var{blue});
  7739. @t{fillcolor} terminates and draws the path under construction (@w{if
  7740. any}), as if @t{endpath} had been called, and sets the fill color for
  7741. all paths subsequently drawn on the graphics display, using a 48-bit RGB
  7742. color model. The arguments @var{red}, @var{green} and @var{blue}
  7743. specify the red, green and blue intensities of the fill color. Each is
  7744. an integer in the range @t{0x0000}@dots{}@t{0xffff}, i.e.,
  7745. 0@dots{}65535. The choice @w{(0, 0, 0)} signifies black, and the choice
  7746. (65535, 65535, 65535) signifies white. Note that the physical fill
  7747. color depends also on the fill level, which is specified by calling
  7748. @t{filltype}.
  7749. @item int @t{fillcolorname} (const char *@var{name});
  7750. @t{fillcolorname} sets the fill color of all paths subsequently drawn on
  7751. the graphics display to be @var{name}. Unrecognized colors are
  7752. interpreted as "black". For information on what color names are
  7753. recognized, see @ref{Color Names}. @w{A 24-bit} RGB color may also be
  7754. specified as a six-digit hexadecimal string, e.g., "#c0c0c0".
  7755. Note that the physical fill color depends also on the fill level, which
  7756. is specified by calling @t{filltype}.
  7757. @item int @t{fillmod} (const char *@var{s});
  7758. @t{fillmod} terminates and draws the path under construction (@w{if
  7759. any}), as if @t{endpath} had been called, and sets the fill mode, i.e.,
  7760. fill rule, for all paths subsequently drawn on the graphics display.
  7761. The fill rule affects only compound paths and self-intersecting simple
  7762. paths: it determines which points are `inside'. Two rules are
  7763. supported: "even-odd" (the default for all Plotters), and
  7764. "nonzero-winding". For the distinction, see the @cite{Postscript
  7765. Language Reference Manual}. "alternate" is an alias for "even-odd" and
  7766. "winding" is an alias for "nonzero-winding".
  7767. CGM, Fig, and ReGIS Plotters do not support the "nonzero-winding" rule,
  7768. because the CGM, Fig, and ReGIS vector graphics formats do not
  7769. @w{support it}. Also, HP-GL Plotters do not support "nonzero-winding"
  7770. if @code{HPGL_VERSION} is set to a value less than "2" (the default).
  7771. @xref{Plotter Parameters}.
  7772. The LaserJet III, which was Hewlett--Packard's first @w{PCL 5} printer,
  7773. did not support the nonzero-winding fill rule. However, all later
  7774. @w{PCL 5} printers from Hewlett--Packard @w{support it}.
  7775. @item int @t{filltype} (int @var{level});
  7776. @t{filltype} terminates and draws the path under construction (@w{if
  7777. any}), as if @t{endpath} had been called, and sets the fill level for
  7778. all subsequently drawn paths. @w{A value} @w{of 0} for @var{level}
  7779. specifies no filling. This is the default. @w{A value} @w{of 1}
  7780. specifies 100% filling: the fill color will be the color previously
  7781. specified by calling @t{fillcolor} or @t{fillcolorname}.
  7782. As a convenience to the user, @var{level} may be set to any value in the
  7783. range @t{0x0000}@dots{}@t{0xffff}, i.e., 0@dots{}65535. Any nonzero
  7784. value will produce filling. If @var{level}=@t{0xffff}, the fill color
  7785. will be white. Values in the range @t{0x0001}@dots{}@t{0xffff} are
  7786. interpreted as specifying a desaturation, or gray level. @w{For
  7787. example}, @t{0x8000} specifies 50% filling (the fill color will be
  7788. half-way between the color specified by calling @t{fillcolor} or
  7789. @t{fillcolorname}, and white).
  7790. To draw the region bounded by a path in an edgeless way, you would call
  7791. @t{filltype} to @w{turn on} the filling of the interior, and @t{pentype}
  7792. to @w{turn off} the drawing of the boundary.
  7793. Tektronix Plotters do not support filling, and HP-GL Plotters support
  7794. filling of arbitrary paths only if the parameter @code{HPGL_VERSION} is
  7795. equal to "1.5" @w{or "2"} (the default). (If the version @w{is "1"}
  7796. then only circles and rectangles aligned with the coordinate axes may be
  7797. filled.) @emph{Opaque} filling, including white filling, is supported
  7798. only if the parameter @code{HPGL_VERSION} @w{is "2"} and the parameter
  7799. @code{HPGL_OPAQUE_MODE} is "yes" (the default). @xref{Plotter
  7800. Parameters}.
  7801. @item int @t{fmiterlimit} (double @var{limit});
  7802. @t{fmiterlimit} terminates and draws the path under construction (@w{if
  7803. any}), as if @t{endpath} had been called, and sets the miter limit for
  7804. all paths subsequently drawn on the graphics display. The miter limit
  7805. controls the treatment of corners, if the join mode is set to "miter"
  7806. (the default). @w{At a} join point of a path, the `miter length' is
  7807. defined to be the distance between the inner corner and the outer
  7808. corner. The miter limit is the maximum value that will be tolerated for
  7809. the miter length divided by the line thickness. If this value is
  7810. exceeded, the miter will be @w{cut off}: the "bevel" join mode will be
  7811. used instead.
  7812. Examples of typical values for @var{limit} are 10.43 (the default, which
  7813. cuts off miters if the join angle is less than 11 degrees), 2.0 (the
  7814. same, for 60 degrees), and 1.414 (the same, for 90 degrees). @w{In
  7815. general}, the miter limit is the cosecant of one-half the minimum angle
  7816. for mitered joins. The minimum meaningful value for @var{limit} @w{is
  7817. 1.0}, which converts all mitered joins to beveled joins, irrespective of
  7818. join angle. Specifying a value less than 1.0 resets the limit to the
  7819. default.
  7820. This function has no effect on @w{X Drawable} Plotters or @w{X
  7821. Plotters}, since the @w{X Window} System miter limit, which is also
  7822. 10.43, cannot be altered. It also has no effect on Tektronix, ReGIS, or
  7823. Fig Plotters, or on HP-GL Plotters if the parameter @code{HPGL_VERSION}
  7824. is set to a value less @w{than "2"} (the default). @xref{Plotter
  7825. Parameters}. The miter limit used by HP-GL or PCL Plotters is always
  7826. rounded to the closest integer, downward.
  7827. @item int @t{fontname} (const char *@var{font_name});
  7828. @itemx double @t{ffontname} (const char *@var{font_name});
  7829. @t{fontname} and @t{ffontname} take a single case-insensitive string
  7830. argument, @var{font_name}, specifying the name of the font to be used
  7831. for all text strings subsequently drawn on the graphics display. (The
  7832. font for plotting strings is fully specified by calling @t{fontname},
  7833. @t{fontsize}, and @t{textangle}.) The size of the font in user
  7834. coordinates is returned.
  7835. The default font name depends on the type of Plotter. @w{It is}
  7836. "Helvetica" for all Plotters except for PCL Plotters, for which it is
  7837. "Univers", and PNG, PNM, GIF, HP-GL, ReGIS, Tektronix and Metafile
  7838. Plotters, for which it is "HersheySerif". @w{If the} argument
  7839. @var{font_name} is NULL or the empty string, or the font is not
  7840. available, the default font name will be used. Which fonts are
  7841. available also depends on the type of Plotter; for a list of all
  7842. available fonts, see @ref{Text Fonts}.
  7843. @item int @t{fontsize} (int @var{size});
  7844. @itemx double @t{ffontsize} (double @var{size});
  7845. @t{fontsize} and @t{ffontsize} take a single argument, interpreted as
  7846. the size, in the user coordinate system, of the font to be used for all
  7847. text strings subsequently drawn on the graphics display. (The font for
  7848. plotting strings is fully specified by calling @t{fontname},
  7849. @t{fontsize}, and @t{textangle}.) The size of the font in user
  7850. coordinates is returned.
  7851. @w{A negative} value for @var{size} sets the size to the default, which
  7852. depends on the type of Plotter. Typically, the default font size is
  7853. 1/50 times the size (i.e., minimum dimension) of the display. The
  7854. interpretation of zero font size is also Plotter-dependent (most
  7855. Plotters do not draw text strings if the font size is zero).
  7856. @item int @t{joinmod} (const char *@var{s});
  7857. @t{joinmod} terminates and draws the path under construction (@w{if
  7858. any}), as if @t{endpath} had been called, and sets the join mode (i.e.,
  7859. join style) for all paths subsequently drawn on the graphics display.
  7860. Recognized styles are "miter" (the default), "round", and "bevel". The
  7861. three styles are visibly distinct only if the line thickness is fairly
  7862. large. Mitered joins are sharp, rounded joins are round, and beveled
  7863. joins are @w{squared off}. However, unusually sharp joins are never
  7864. mitered: instead, they are beveled. The angle at which beveling
  7865. replaces mitering may be specified by calling @t{fmiterlimit}.
  7866. PNG, PNM, GIF, PCL, and HP-GL Plotters support a fourth join mode,
  7867. "triangular". Other Plotters treat "triangular" as equivalent to
  7868. "round".
  7869. This function has no effect on ReGIS or Tektronix Plotters. Also, it
  7870. has no effect on HP-GL Plotters if the parameter @code{HPGL_VERSION} is
  7871. set to a value less @w{than "2"} (the default), or on CGM Plotters if
  7872. the parameter @code{CGM_MAX_VERSION} is set to a value less @w{than
  7873. "3"}. @xref{Plotter Parameters}.
  7874. @item int @t{linedash} (int @var{n}, const int *@var{dashes}, int @var{offset});
  7875. @itemx int @t{flinedash} (int @var{n}, const double *@var{dashes}, double @var{offset});
  7876. @t{linedash} and @t{flinedash} terminate and draw the path under
  7877. construction (@w{if any}), as if @t{endpath} had been called, and set
  7878. the line style for all paths subsequently drawn on the graphics display.
  7879. They provide much finer control of dash patterns than the @t{linemod}
  7880. function (see below) provides. @var{dashes} should be an array of
  7881. @w{length @var{n}}. Its elements, which should be positive, are
  7882. interpreted as distances in the user coordinate system. Along any path,
  7883. circle, or ellipse, the elements
  7884. @var{dashes}[0]@dots{}@var{dashes}[@var{n}-1] alternately specify the
  7885. length of a dash and the length of a gap between dashes. When the end
  7886. of the array is reached, the reading of the array wraps around to the
  7887. beginning. If the array is empty, i.e., @var{n} equals zero, there is
  7888. no dashing: the drawn line is solid.
  7889. The @var{offset} argument specifies the `phase' of the dash pattern
  7890. relative to the start of the path. It is interpreted as the distance
  7891. into the dash pattern at which the dashing should begin. For example,
  7892. if @var{offset} equals zero then the path will begin with a dash, of
  7893. length @var{dashes}[0] in user space. @w{If @var{offset}} equals
  7894. @var{dashes}[0] then the path will begin with a gap of length
  7895. @var{dashes}[1], and @w{so forth}. @var{offset} is allowed to be
  7896. negative.
  7897. Not all Plotters fully support @t{linedash} and @t{flinedash}. PCL and
  7898. HP-GL Plotters cannot dash with a nonzero offset, and in the dash
  7899. patterns used by @w{X and} @w{X Drawable} Plotters, each dash or gap has
  7900. a maximum length of 255 pixels. @t{linedash} and @t{flinedash} have no
  7901. effect @w{at all} on Tektronix, ReGIS, and Fig Plotters. Also, they
  7902. have no effect on HP-GL Plotters for which the parameter
  7903. @code{HPGL_VERSION} is less @w{than "2"} (the default), or on CGM
  7904. Plotters for which the parameter @code{CGM_MAX_VERSION} is less @w{than
  7905. "3"}. For information on Plotter parameters, see @ref{Plotter
  7906. Parameters}.
  7907. @strong{Warning}: If the transformation from the user coordinate system
  7908. to the device coordinate system is anisotropic, each dash pattern should
  7909. ideally be drawn on the graphics display with a length that depends on
  7910. its direction. But currently, only SVG and Postscript Plotters @w{do
  7911. this}. Other Plotters always draw any specified dash pattern with the
  7912. same length, irrespective of its direction. The length that is used is
  7913. the minimum length, in the device coordinate system, that can correspond
  7914. to the specified dash pattern length in the user coordinate system.
  7915. @item int @t{linemod} (const char *@var{s});
  7916. @t{linemod} terminates and draws the path under construction (@w{if
  7917. any}), as if @t{endpath} had been called, and sets the line style for
  7918. all paths subsequently drawn on the graphics display. The supported
  7919. line styles are "solid", "dotted", "dotdashed", "shortdashed",
  7920. "longdashed", "dotdotdashed", "dotdotdotdashed", and "disconnected".
  7921. The first seven correspond to the following dash patterns:
  7922. @example
  7923. @group
  7924. "solid" --------------------------------
  7925. "dotted" - - - - - - - -
  7926. "dotdashed" ---- - ---- - ---- -
  7927. "shortdashed" ---- ---- ---- ----
  7928. "longdashed" ------- ------- -------
  7929. "dotdotdashed" ---- - - ---- - -
  7930. "dotdotdotdashed" ---- - - - ---- - - -
  7931. @end group
  7932. @end example
  7933. @noindent
  7934. @w{In the} preceding patterns, each hyphen stands for one line
  7935. thickness. This is the case for sufficiently thick lines, @w{at least}.
  7936. @w{So for} sufficiently thick lines, the distance over which a dash
  7937. pattern repeats is scaled proportionately to the line thickness.
  7938. The "disconnected" line style is special. A "disconnected" path is
  7939. rendered as a set of filled circles, each of which has diameter equal to
  7940. the nominal line thickness. One of these circles is centered on each of
  7941. the juncture points of the path (i.e., the endpoints of the line
  7942. segments or arcs from which it is constructed). Circles and ellipses
  7943. with "disconnected" line style are invisible. Disconnected paths are
  7944. not filled; this includes circles and ellipses.
  7945. All line styles are supported by all Plotters, with the following
  7946. exceptions. HP-GL Plotters do not support the "dotdotdotdashed" style
  7947. unless the parameter @code{HPGL_VERSION} is set to "2" (the default).
  7948. Tektronix Plotters do not support the "dotdotdotdashed" style, and do
  7949. not support the "dotdotdashed" style unless the parameter @code{TERM} is
  7950. set to "kermit". @xref{Plotter Parameters}.
  7951. @item int @t{linewidth} (int @var{size});
  7952. @itemx int @t{flinewidth} (double @var{size});
  7953. @t{linewidth} and @t{flinewidth} terminate and draws the path under
  7954. construction (@w{if any}), as if @t{endpath} had been called, and set
  7955. the thickness, in the user coordinate system, of all paths subsequently
  7956. drawn on the graphics display. @w{A negative} value resets the
  7957. thickness to the default. The default thickness depends on the type of
  7958. Plotter. For most Plotters, it is 1/850 times the size of the viewport,
  7959. i.e., the drawn-on portion of the display. (Here `size' means minimum
  7960. dimension.) But for Plotters that produce bitmaps, i.e., @w{X
  7961. Plotters}, @w{X Drawable} Plotters, PNG Plotters, PNM Plotters, and GIF
  7962. Plotters, @w{it is} zero.
  7963. By convention, a zero-thickness line is the thinnest line that can be
  7964. drawn. However, the drawing editors @code{idraw} and @code{xfig} treat
  7965. zero-thickness lines as invisible. @w{So when} producing editable
  7966. graphics with a Postscript or Fig Plotter, using a zero line thickness
  7967. may not be desirable.
  7968. Tektronix and ReGIS Plotters do not support drawing with other than a
  7969. default thickness, and HP-GL Plotters do not support doing so if the
  7970. parameter @code{HPGL_VERSION} is set to a value less @w{than "2"} (the
  7971. default; see @ref{Plotter Parameters}).
  7972. @strong{Warning}: If the transformation from the user coordinate system
  7973. to the device coordinate system is anisotropic, each line segment in a
  7974. polygonal path should ideally be drawn on the graphics display with a
  7975. thickness that depends on its direction. But currently, only SVG and
  7976. Postscript Plotters @w{do this}. Other Plotters draw all line segments
  7977. in a path with the same thickness. The thickness that is used is the
  7978. minimum thickness, in the device coordinate system, that can correspond
  7979. to the specified line thickness in the user coordinate system.
  7980. @item int @t{move} (int @var{x}, int @var{y});
  7981. @itemx int @t{fmove} (double @var{x}, double @var{y});
  7982. @itemx int @t{moverel} (int @var{x}, int @var{y});
  7983. @itemx int @t{fmoverel} (double @var{x}, double @var{y});
  7984. @t{move} and @t{fmove} take two arguments specifying the coordinates
  7985. (@var{x}, @var{y}) of a point to which the graphics cursor should be
  7986. moved. The path under construction @w{(if any)} is ended and drawn, as
  7987. if @t{endpath} had been called, and the graphics cursor is moved to
  7988. (@var{x}, @var{y}). This is equivalent to lifting the pen on a plotter
  7989. and moving it to a new position, without drawing any line. @t{moverel}
  7990. and @t{fmoverel} are similar to @t{move} and @t{fmove}, but use
  7991. cursor-relative coordinates.
  7992. When a new page of graphics is begun by invoking @t{openpl}, the cursor
  7993. is initially at the point (0,0) in user space. Most of the drawing
  7994. functions reposition the cursor. @xref{Drawing Functions}.
  7995. @item int @t{orientation} (int @var{direction});
  7996. @t{orientation} sets the orientation for all circles, ellipses, and
  7997. boxes subsequently drawn on the graphics display. @var{direction} must
  7998. @w{be 1}, meaning counterclockwise, @w{or @minus{}1}, meaning clockwise.
  7999. The default @w{is 1}.
  8000. @t{orientation} will have a visible effect on a circle, ellipse, or box
  8001. only if it is dashed, or if it is one of the simple paths in a filled
  8002. compound path. Its effects on filling, when the "nonzero-winding" fill
  8003. rule is used, are dramatic, since it is the orientation of each simple
  8004. path in a compound path that determines which points are `inside' and
  8005. which are `outside'.
  8006. @item int @t{pencolor} (int @var{red}, int @var{green}, int @var{blue});
  8007. @t{pencolor} terminates and draws the path under construction (@w{if
  8008. any}), as if @t{endpath} had been called, and sets the pen color for all
  8009. objects subsequently drawn on the graphics display, using a 48-bit RGB
  8010. color model. The arguments @var{red}, @var{green} and @var{blue}
  8011. specify the red, green and blue intensities of the pen color. Each is
  8012. an integer in the range @t{0x0000}@dots{}@t{0xffff}, i.e.,
  8013. 0@dots{}65535. The choice @w{(0, 0, 0)} signifies black, and the choice
  8014. (65535, 65535, 65535) signifies white.
  8015. HP-GL Plotters support drawing with a white pen only if the value of the
  8016. parameter @code{HPGL_VERSION} @w{is "2"} (the default), and the value of
  8017. the parameter @code{HPGL_OPAQUE_MODE} is "yes" (the default).
  8018. @xref{Plotter Parameters}.
  8019. @item int @t{pencolorname} (const char *@var{name});
  8020. @t{pencolorname} sets the pen color of all objects subsequently drawn on
  8021. the graphics display to be @var{name}. Unrecognized colors are
  8022. interpreted as "black". For information on what color names are
  8023. recognized, see @ref{Color Names}. @w{A 24-bit} RGB color may also be
  8024. specified as a six-digit hexadecimal string, e.g., "#c0c0c0".
  8025. HP-GL Plotters support drawing with a white pen only if the value of the
  8026. parameter @code{HPGL_VERSION} @w{is "2"} (the default) and the value of
  8027. the parameter @code{HPGL_OPAQUE_MODE} is "yes" (the default).
  8028. @xref{Plotter Parameters}.
  8029. @item int @t{pentype} (int @var{level});
  8030. @t{pentype} terminates and draws the path under construction (@w{if
  8031. any}), as if @t{endpath} had been called, and sets the pen level for all
  8032. subsequently drawn paths. @w{A value} @w{of 1} for @var{level}
  8033. specifies that an outline of each of these objects should be drawn, in
  8034. the color previously specified by calling @t{pencolor} or
  8035. @t{pencolorname}. This is the default. @w{A value} @w{of 0} specifies
  8036. that outlines should not be drawn.
  8037. To draw the region bounded by a path in an edgeless way, you would call
  8038. @t{pentype} to @w{turn off} the drawing of the boundary, and
  8039. @t{filltype} to @w{turn on} the filling of the interior.
  8040. @t{pentype} also affects the drawing of marker symbols and points, i.e.,
  8041. pixels. @w{A value} @w{of 0} specifies that they should not be drawn.
  8042. @strong{Note}: In future releases, @t{pentype} may also affect the
  8043. drawing of text strings (@w{a value} @w{of 0} will specify that they
  8044. should not be drawn). @w{It already} affects text strings that are
  8045. rendered using Hershey fonts, since they are drawn using polygonal
  8046. paths.
  8047. @item int @t{restorestate} ();
  8048. @t{restorestate} pops the current graphics context off the stack of
  8049. drawing states. The graphics context consists largely of
  8050. @code{libplot}'s drawing attributes, which are set by the attribute
  8051. functions documented in this section. So @w{popping off} the graphics
  8052. context restores the drawing attributes to values they previously had.
  8053. @w{A path} under construction is regarded as part of the graphics
  8054. context. For this reason, calling @t{restorestate} automatically calls
  8055. @t{endpath} to terminate and draw the path under construction, @w{if
  8056. any}. All graphics contexts on the stack are @w{popped off} when
  8057. @code{closepl} is called, @w{as if} @code{restorestate} had been called
  8058. repeatedly.
  8059. @item int @t{savestate} ();
  8060. @t{savestate} pushes the current graphics context onto the stack of
  8061. drawing states. The graphics context consists largely of
  8062. @code{libplot}'s drawing attributes, which are set by the attribute
  8063. functions documented in this section. @w{A path} under construction,
  8064. @w{if any}, is regarded as part of the graphics context. That is
  8065. because paths may be drawn incrementally, one line segment or arc at a
  8066. time. The new graphics context created by @t{savestate} will contain no
  8067. path. When the previous graphics context is @w{returned to} by calling
  8068. @t{restorestate}, the path previously under construction may be
  8069. continued.
  8070. @item int @t{textangle} (int @var{angle});
  8071. @itemx double @t{ftextangle} (double @var{angle});
  8072. @t{textangle} and @t{ftextangle} take one argument, which specifies the
  8073. angle in degrees counterclockwise from the @math{x} (horizontal) axis in
  8074. the user coordinate system, for text strings subsequently drawn on the
  8075. graphics display. The default angle is zero. (The font for plotting
  8076. strings is fully specified by calling @t{fontname}, @t{fontsize}, and
  8077. @t{textangle}.) The size of the font for plotting strings, in user
  8078. coordinates, is returned.
  8079. @strong{Warning:} Some X Window System displays do not generate or
  8080. display rotated fonts correctly. In effect, they only support a zero
  8081. rotation angle.
  8082. @end table
  8083. @node Mapping Functions, , Attribute Functions, Functions
  8084. @subsection Mapping functions
  8085. The following are the ``mapping functions'' in @code{libplot}. When
  8086. invoked on a Plotter, they affect the affine transformation it employs
  8087. to map the user coordinate system to the device coordinate system.
  8088. @w{That is}, they affect the transformation matrix attribute of objects
  8089. subsequently drawn on the graphics display.
  8090. The names of these functions resemble those of the corresponding
  8091. functions in the Postscript language. For information on how to use
  8092. them to draw graphics efficiently, consult any good book on Postscript
  8093. programming, or the @cite{Postscript Language Reference Manual}.
  8094. Each of these functions, if called, terminates and draws the path under
  8095. construction (@w{if any}), as if @t{endpath} had been called.
  8096. In the current @w{C binding}, each of these functions takes a pointer to
  8097. a @code{plPlotter} as its first argument. Also in the current @w{C
  8098. binding}, the name of each function begins with "pl_" and ends @w{with
  8099. "_r"}. (@w{"_r" stands} for `revised' or `reentrant'.) For information
  8100. on older @w{C bindings}, see @ref{Older C APIs}. @w{In the} C++
  8101. binding, these are member functions of the @code{Plotter} class and its
  8102. subclasses, and the prefix and suffix are not used.
  8103. @table @asis
  8104. @item int @t{fsetmatrix} (double @var{m0}, double @var{m1}, double @var{m2}, double @var{m3}, double @var{tx}, double @var{ty});
  8105. Use the Postscript-style transformation matrix [@var{m0} @var{m1}
  8106. @var{m2} @var{m3} @var{tx} @var{ty}] as the transformation matrix from
  8107. user space to NDC (normalized device coordinate) space. This matrix
  8108. determines the transformation matrix from user space to unnormalized
  8109. device space, i.e., sets the transformation matrix attribute that will
  8110. be used when subsequently drawing objects on the graphics display.
  8111. In NDC space, the graphics display (i.e., viewport) has corners
  8112. @code{(0,0)}, @code{(1,0)}, @code{(1,1)}, and @code{(0,1)}. For
  8113. information on the size of the graphics display in physical units, see
  8114. @ref{Page and Viewport Sizes}.
  8115. The default transformation matrix from user space to NDC space is
  8116. @w{[1 0 0 1 0 0]}, which means that by default, user coordinates are the
  8117. same as NDC coordinates. This transformation matrix is also altered by
  8118. @t{space}, @t{fspace}, @t{space2}, and @t{fspace2}, and by the following
  8119. functions.
  8120. @item int @t{fconcat} (double @var{m0}, double @var{m1}, double @var{m2}, double @var{m3}, double @var{tx}, double @var{ty});
  8121. Modify the transformation matrix from user space to NDC space by
  8122. pre-multiplying it by the matrix [@var{m0} @var{m1} @var{m2} @var{m3}
  8123. @var{tx} @var{ty}]. Equivalently, apply the linear transformation
  8124. defined by the two-by-two matrix [@var{m0} @var{m1} @var{m2} @var{m3}]
  8125. to the user coordinate system, and then translate by @var{tx} units in
  8126. the @w{@math{x} direction} and @w{@var{ty} units} in the @w{@math{y}
  8127. direction}.
  8128. @t{fconcat} is a wrapper around the more fundamental @t{fsetmatrix}
  8129. function. The following three functions (@t{frotate}, @t{fscale},
  8130. @t{ftranslate}) are convenience functions that are special cases of
  8131. @t{fconcat}.
  8132. @item int @t{frotate} (double @var{theta});
  8133. Modify the transformation matrix from user space to NDC space by
  8134. pre-multiplying it by the matrix [cos(@var{theta}) sin(@var{theta})
  8135. @minus{}sin(@var{theta}) cos(@var{theta}) 0 0]. Equivalently, rotate
  8136. the user coordinate system axes about their origin by @var{theta}
  8137. degrees counterclockwise, with respect to their former orientation. The
  8138. position of the user coordinate origin and the size of the @math{x}
  8139. @w{and @math{y}} units remain unchanged.
  8140. @item int @t{fscale} (double @var{sx}, double @var{sy});
  8141. Modify the transformation matrix from user space to NDC space by
  8142. pre-multiplying it by the matrix [@var{sx} 0 0 @var{sy} 0 0].
  8143. Equivalently, make the @math{x} and @math{y} units in the user
  8144. coordinate system be the size of @var{sx} and @var{sy} units in the
  8145. former user coordinate system. The position of the user coordinate
  8146. origin and the orientation of the coordinate axes are unchanged.
  8147. @item int @t{ftranslate} (double @var{tx}, double @var{ty});
  8148. Modify the transformation matrix from user space to NDC space by
  8149. pre-multiplying it by the matrix [0 0 0 0 @var{tx} @var{ty}].
  8150. Equivalently, move the origin of the user coordinate system by @var{tx}
  8151. units in the @w{@math{x} direction} and @w{@var{ty} units} in the
  8152. @w{@math{y} direction}, relative to the former user coordinate system.
  8153. The size of the @math{x} and @w{@math{y} units} and the orientation of
  8154. the coordinate axes are unchanged.
  8155. @end table
  8156. @node Plotter Parameters, , Functions, libplot
  8157. @section Plotter parameters
  8158. In designing the @code{libplot} library, every effort was made to make
  8159. the Plotter interface independent of the type of Plotter. @w{To the}
  8160. extent that Plotters display individual (i.e., instance-specific)
  8161. behavior, that behavior is captured by a manageable number of
  8162. @emph{Plotter parameters}. Each parameter has a value that is allowed
  8163. to be a generic pointer (@w{a @code{void *}}). For most parameters, the
  8164. value is a string (@w{a @code{char *}}).
  8165. The parameter values of any Plotter are constant over the lifetime of
  8166. the Plotter, and are specified when the Plotter is created. In the @w{C
  8167. binding}, @w{a value} for any parameter is specified by calling the
  8168. @code{pl_setplparam} function. The @code{pl_setplparam} function acts
  8169. on a @code{plPlotterParams} object, which encapsulates Plotter
  8170. parameters. When a Plotter is created by calling @code{pl_newpl_r},
  8171. @w{a pointer} to a @code{plPlotterParams} object is passed as the final
  8172. argument.
  8173. If at Plotter creation time a parameter is @emph{not} specified, its
  8174. default value will be used, unless the parameter is string-valued and
  8175. there is an environment variable of the same name, in which case the
  8176. value of that environment variable will be used. This rule increases
  8177. run-time flexibility: @w{an application} programmer may allow
  8178. non-critical Plotter parameters to be specified by the user via
  8179. environment variables.
  8180. In the C++ binding, the @code{PlotterParams} class and
  8181. @code{PlotterParams::setplparam}, @w{a member} function, are the
  8182. analogues of the @code{plPlotterParams} datatype and the function
  8183. @code{pl_setplparam}.
  8184. The following are the currently recognized parameters (unrecognized ones
  8185. are ignored). The most important ones are @code{DISPLAY}, which affects
  8186. @w{X Plotters}, @code{BITMAPSIZE}, which affects @w{X Plotters}, PNG
  8187. Plotters, PNM Plotters, and GIF Plotters, @code{PAGESIZE}, which affects
  8188. Illustrator, Postscript, CGM, Fig, and HP-GL Plotters, and
  8189. @code{ROTATION}, which affects all Plotters except Metafile Plotters.
  8190. These four parameters are listed first and the others alphabetically.
  8191. Most of the remaining parameters, such as the several whose names begin
  8192. with "HPGL", affect only a single type of Plotter.
  8193. @table @code
  8194. @item @t{DISPLAY}
  8195. (Default NULL@.) The @w{X Window} System display on which the graphics
  8196. display will be @w{popped up}, as an @w{X window}. This is relevant
  8197. only to @w{X Plotters}.
  8198. @item BITMAPSIZE
  8199. (Default "570x570".) The size of the graphics display (i.e., the
  8200. viewport) in terms of pixels. This is relevant only to @w{X Plotters},
  8201. PNG Plotters, PNM Plotters, and GIF Plotters. For @w{X Plotters}, the
  8202. value of this parameter will automatically, if it is not set, be taken
  8203. from the @w{X resource} @code{Xplot.geometry}. That is for backward
  8204. compatibility.
  8205. X Plotters support precise positioning of the graphics display. For
  8206. example, if @code{BITMAPSIZE} is "570x570+0+0" then it will be
  8207. positioned in the upper left corner of the @w{X Window} System display.
  8208. @item PAGESIZE
  8209. (Default "letter".) The page type, which determines the size of the
  8210. graphics display (i.e., the viewport) used by the Plotter. This is
  8211. relevant only to SVG, Illustrator, Postscript, CGM, Fig, PCL, and HP-GL
  8212. Plotters. "letter" means an 8.5@dmn{in} by 11@dmn{in} page. Any ISO
  8213. page size in the range "a0"@dots{}"a4" or ANSI page size in the range
  8214. "a"@dots{}"e" may be specified ("letter" is an alias @w{for "a"} and
  8215. "tabloid" is an alias @w{for "b"}). "legal", "ledger", @w{and "b5"} are
  8216. recognized page sizes also.
  8217. For Illustrator, Postscript, PCL and Fig Plotters, the graphics
  8218. display will be, by default, a square region centered on the specified
  8219. page. (For example, it will be a centered 8@dmn{in} square if
  8220. @code{PAGESIZE} is "letter".) For HP-GL Plotters, it will be a square
  8221. region of the same size, but will not @w{by default} be centered. SVG
  8222. format and WebCGM format have no notion of the Web page on which the
  8223. graphics display will ultimately be positioned. They do have a notion
  8224. of default display size, though this will normally be overridden when
  8225. the SVG or WebCGM file is placed on a Web page. For this default
  8226. display size, SVG and CGM Plotters will use the same graphics display
  8227. size that is used by other Plotters.
  8228. For the default size (and location) of the graphics display for each
  8229. page type, see @ref{Page and Viewport Sizes}. You do not need to use
  8230. the default size, since either or both of its dimensions can be
  8231. specified explicitly. For example, @code{PAGESIZE} could be specified
  8232. as "letter,xsize=4in", or "a4,xsize=10cm,ysize=15cm". The dimensions
  8233. are allowed to be negative (@w{a negative} dimension results in a
  8234. reflection).
  8235. For Plotters other than SVG and CGM Plotters, the position of the
  8236. graphics display on the page, relative to its default position, can be
  8237. adjusted by specifying an offset vector. For example, @code{PAGESIZE}
  8238. could be specified as "letter,yoffset=1.2in", or
  8239. "a4,xoffset=@minus{}5mm,yoffset=2.0cm". Inches, centimeters, and
  8240. millimeters are the supported units. The "xoffset" and "yoffset"
  8241. options may be used in conjunction with "xsize" and "ysize".
  8242. @w{It is} also possible to position the graphics display precisely, by
  8243. specifying the location of its lower left corner relative to the lower
  8244. left corner of the page. For example, @code{PAGESIZE} could be
  8245. specified as "letter,xorigin=2in,yorigin=3in", or
  8246. "a4,xorigin=0.5cm,yorigin=0.5cm". The "xorigin" and "yorigin" options
  8247. may be used in conjunction with "xsize" and "ysize". SVG and WebCGM
  8248. Plotters ignore the "xoffset", "yoffset", "xorigin", and "yorigin"
  8249. options, since SVG format and WebCGM format have no notion of the Web
  8250. page on which the graphics display will ultimately be positioned.
  8251. @item ROTATION
  8252. (Default "0.0".) Relevant to all Plotters other than Metafile
  8253. Plotters, which have no output device. The angle, in degrees, by
  8254. which the graphics display (i.e., the viewport) should be rotated,
  8255. relative to its default orientation. The rotation is
  8256. counterclockwise.
  8257. A rotated viewport does not change the position of its four corners.
  8258. Rather, the graphics are rotated @w{within it}. @w{If the} viewport is
  8259. rectangular rather than square, this `rotation' necessarily includes a
  8260. rescaling.
  8261. This parameter is useful for switching between portrait and landscape
  8262. orientations. Internally, it determines the affine transformation from
  8263. NDC (normalized device coordinate) space to device space.
  8264. @item BG_COLOR
  8265. (Default "white".) The initial background color of the graphics
  8266. display, when drawing each page of graphics. This is relevant to @w{X
  8267. Plotters}, PNG Plotters, PNM Plotters, GIF Plotters, CGM Plotters, ReGIS
  8268. Plotters, and Metafile Plotters; also to @w{X Drawable Plotters} (for
  8269. the last, the background color @w{shows up} only if @code{erase} is
  8270. invoked). For information on what color names are recognized, see
  8271. @ref{Color Names}. The background color may be changed at any later
  8272. time by invoking the @t{bgcolor} (or @t{bgcolorname}) and @t{erase}
  8273. operations.
  8274. SVG Plotters and CGM Plotters support "none" as a value for the
  8275. background color. It will @w{turn off} the background: the drawn
  8276. objects will not be backed by anything. This is useful when the
  8277. generated SVG or WebCGM file is to be placed on a Web page.
  8278. @item CGM_ENCODING
  8279. (Default "binary".) Relevant only to CGM Plotters. "binary" means that
  8280. the CGM output should use the binary encoding. "clear_text" means that
  8281. the CGM output should use a human-readable encoding. The WebCGM profile
  8282. requires that the binary encoding be used, but many CGM viewers and
  8283. interpreters can also parse the clear text encoding. The third standard
  8284. CGM encoding, "character", is not currently supported.
  8285. @item CGM_MAX_VERSION
  8286. (Default "4".) Relevant only to CGM Plotters. An upper bound on the
  8287. version number of CGM format that is produced. Many older CGM
  8288. interpreters and viewers, such as the ones built into Microsoft Office
  8289. and other commercial software, only support @w{version 1} CGM files.
  8290. For fully adequate handling of fonts and line styles, @w{version 3} is
  8291. necessary. By default, the present release of @code{libplot} produces
  8292. @w{version 3} CGM files, i.e., it does not use @w{version 4} features.
  8293. @item EMULATE_COLOR
  8294. (Default "no".) Relevant to all Plotters. "yes" means that each color
  8295. in the output should be replaced by an appropriate shade of gray. The
  8296. well known formula for CIE luminance, namely @math{0.212671R + 0.715160G
  8297. + 0.072169B}, is used.
  8298. This parameter is seldom useful, except when using a PCL Plotter to
  8299. prepare output for a monochrome @w{PCL 5} device. Many monochrome
  8300. @w{PCL 5} devices, such as monochrome LaserJets, do a poor job of
  8301. emulating color on their own. They usually map HP-GL/2's seven standard
  8302. pen colors, including even yellow, to black.
  8303. @item GIF_ANIMATION
  8304. (Default "yes".) Relevant only to GIF Plotters. "yes" means that the
  8305. @code{erase} operation will have special semantics: with the exception
  8306. of its first invocation, it will act as a separator between successive
  8307. images in the written-out pseudo-GIF file. @w{"no" means} that
  8308. @code{erase} should act as it does on other Plotters that do not write
  8309. graphics in real time, i.e., @w{it should} erase the image under
  8310. construction by filling it with the background color. @w{If "no"} is
  8311. specified, the pseudo-GIF file will contain only a single image.
  8312. @item GIF_DELAY
  8313. (Default "0".) Relevant only to GIF Plotters. The delay, in hundredths
  8314. of a second, after each image in a written-out animated pseudo-GIF file.
  8315. The value should be an integer in the range "0"@dots{}"65535".
  8316. @item GIF_ITERATIONS
  8317. (Default "0".) Relevant only to GIF Plotters. The number of times that
  8318. an animated pseudo-GIF file should be `looped'. The value should be an
  8319. integer in the range "0"@dots{}"65535".
  8320. @item HPGL_ASSIGN_COLORS
  8321. (Default "no".) Relevant only to HP-GL Plotters, and only if the value
  8322. of @code{HPGL_VERSION} @w{is "2"}. @w{"no" means} to draw with a fixed
  8323. set of pens, specified by setting the @code{HPGL_PENS} parameter. "yes"
  8324. means that pen colors will not restricted to the palette specified in
  8325. @code{HPGL_PENS}: colors will be assigned to ``logical pens'' in the
  8326. range #1@dots{}#31, @w{as needed}. Other than color LaserJet printers
  8327. and DesignJet plotters, not many HP-GL/2 devices allow the assignment of
  8328. colors to logical pens. In particular, HP-GL/2 pen plotters do not.
  8329. @w{So this} parameter should be used with caution.
  8330. @item HPGL_OPAQUE_MODE
  8331. (Default "yes".) Relevant only to HP-GL Plotters, and only if the value
  8332. of @code{HPGL_VERSION} @w{is "2"}. "yes" means that the HP-GL/2 output
  8333. device should be switched into opaque mode, rather than transparent
  8334. mode. This allows objects to be filled with opaque white and other
  8335. opaque colors. @w{It also} allows the drawing of visible white lines,
  8336. which by convention are drawn with @w{pen #0}. Not all HP-GL/2 devices
  8337. support opaque mode or the use of @w{pen #0} to draw visible white
  8338. lines. In particular, HP-GL/2 pen plotters @w{do not}. Some older
  8339. HP-GL/2 devices reportedly malfunction if asked to switch into opaque
  8340. mode. @w{If the} output of an HP-GL Plotter is to be sent to such a
  8341. device, @w{a "no"} value is recommended.
  8342. @item HPGL_PENS
  8343. (Default "1=black:2=red:3=green:4=yellow:5=blue:6=magenta:7=cyan" if the
  8344. value of @code{HPGL_VERSION} is "1.5" @w{or "2"} and "1=black" if the
  8345. value of @code{HPGL_VERSION} @w{is "1"}. Relevant only to HP-GL
  8346. Plotters. The set of available pens; the format should be
  8347. self-explanatory. The color for any pen in the range #1@dots{}#31 may
  8348. be specified. For information on what color names are recognized, see
  8349. @ref{Color Names}. @w{Pen #1} must always be present, though it need
  8350. not be black. Any pen in the range #2@dots{}#31 may be omitted.
  8351. @item HPGL_ROTATE
  8352. (Default "0".) Relevant only to HP-GL Plotters. The angle, in degrees,
  8353. by which the graphics display (i.e., the viewport) should be rotated on
  8354. the page relative to the default orientation. Recognized values are
  8355. "0", "90", "180", and "270"; @w{"no" and} "yes" are equivalent to @w{"0"
  8356. and "90"} respectively. "180" and "270" are supported only if
  8357. @code{HPGL_VERSION} @w{is "2"}.
  8358. The rotation requested by @code{HPGL_ROTATE} is different from the sort
  8359. requested by the @code{ROTATION} parameter. @code{ROTATION} rotates the
  8360. graphics display @w{in place}, but @code{HPGL_ROTATE} both rotates the
  8361. graphics display and moves its lower left corner toward another corner
  8362. of the page. Altering the plotting area in such a way is supported by
  8363. the HP-GL language.
  8364. The @code{HPGL_ROTATE} parameter facilitates switching between portrait
  8365. and landscape orientations. For HP-GL devices that is frequently a
  8366. concern, since some HP-GL devices (``plotters'') draw with a default
  8367. landscape orientation, while others (``printers'') draw with a default
  8368. portrait orientation. There is no programmatic way of determining which
  8369. is which.
  8370. @item HPGL_VERSION
  8371. (Default "2".) Relevant only to HP-GL Plotters. @w{"1" means} that the
  8372. output should be generic HP-GL, @w{"1.5" means} that the output should
  8373. be suitable for the HP7550A graphics plotter and the HP758x, HP7595A and
  8374. HP7596A drafting plotters (HP-GL with some HP-GL/2 extensions), and
  8375. @w{"2" means} that the output should be modern HP-GL/2. @w{If the}
  8376. version is less than "2" then the only available fonts will be vector
  8377. fonts, and all paths will be drawn with a default thickness, so that
  8378. invoking @t{linewidth}, @t{capmod}, @t{joinmod}, and @t{fmiterlimit}
  8379. will have no effect. Also, the `nonzero winding number rule' will not
  8380. be supported when filling paths, so invoking @t{fillmod} will have no
  8381. effect. Additionally, if the version @w{is "1"} then the filling of
  8382. arbitrary paths will not be supported (circles and rectangles aligned
  8383. with the coordinate axes may be filled, however).
  8384. @item INTERLACE
  8385. (Default "no".) Relevant only to PNG and GIF Plotters. If the value is
  8386. "yes", the output file will be interlaced. That means it will be
  8387. displayed in an interlaced (nonlinear) way by many applications.
  8388. @item MAX_LINE_LENGTH
  8389. (Default "500".) The maximum number of defining points that a path may
  8390. have, before it is flushed to the output device. If this flushing
  8391. occurs, the path will be split into two or more sub-paths, though the
  8392. splitting should not be noticeable. Splitting will not be performed if
  8393. the path is to be filled.
  8394. This parameter is relevant to all Plotters except Tektronix and Metafile
  8395. Plotters. The reason for splitting long paths is that some display
  8396. devices (e.g., old Postscript printers and HP-GL pen plotters) have
  8397. limited buffer sizes. @w{It is} not relevant to Tektronix or Metafile
  8398. Plotters, since they draw paths in real time and have no buffer
  8399. limitations.
  8400. @item META_PORTABLE
  8401. (Default "no".) Relevant only to Metafile Plotters. "yes" means that
  8402. the output metafile should use a portable (human-readable) encoding of
  8403. graphics, rather than the default (binary) encoding. @xref{Metafiles}.
  8404. @item PCL_ASSIGN_COLORS
  8405. (Default "no".) Relevant only to PCL Plotters. @w{"no" means} to draw
  8406. with a fixed set of pens. "yes" means that pen colors will not
  8407. restricted to this palette: colors will be assigned to ``logical pens'',
  8408. @w{as needed}. Other than color LaserJet printers, not many @w{PCL 5}
  8409. devices allow the assignment of colors to logical pens. @w{So this}
  8410. parameter should be used with caution.
  8411. @item PCL_BEZIERS
  8412. (Default "yes".) Relevant only to PCL Plotters. @w{"yes" means} that
  8413. when drawing Bezier curves, the special `Bezier instructions' will be
  8414. used. @w{"no" means} that these instructions will not be used.
  8415. Instead, each Bezier curve will be approximated and drawn as a polygonal
  8416. line. Other than the LaserJet III, which was Hewlett--Packard's first
  8417. @w{PCL 5} printer, all Hewlett--Packard's @w{PCL 5} printers support the
  8418. Bezier instructions.
  8419. @item PNM_PORTABLE
  8420. (Default "no".) Relevant only to PNM Plotters. "yes" means that the
  8421. output should be in a portable (human-readable) version of PBM/PGM/PPM
  8422. format, rather than the default (binary) version. `Portable' is
  8423. something of a misnomer, since binary PBM/PGM/PPM files are also
  8424. portable, in the sense that they are machine-independent.
  8425. @item TERM
  8426. (Default NULL@.) Relevant only to Tektronix Plotters. If the value is
  8427. a string beginning with "xterm", "nxterm", or "kterm", @w{it is} taken
  8428. as a sign that the current application is running in an @w{X Window}
  8429. System VT100 terminal emulator: @w{an @code{xterm}}, @code{nxterm}, or
  8430. @code{kterm}. Before drawing graphics, a Tektronix Plotter will emit an
  8431. escape sequence that causes the terminal emulator's auxiliary Tektronix
  8432. window, which is normally hidden, to @w{pop up}. After the graphics are
  8433. drawn, an escape sequence that returns control to the original VT100
  8434. window will be emitted. The Tektronix window will remain on the screen.
  8435. If the value is a string beginning with "kermit", "ansi.sys", or
  8436. "nansi.sys", @w{it is} taken as a sign that the current application is
  8437. running in the VT100 terminal emulator provided by the MS-DOS version of
  8438. @code{kermit}. Before drawing graphics, a Tektronix Plotter will emit
  8439. an escape sequence that switches the terminal emulator to Tektronix
  8440. mode. Also, some of the Tektronix control codes emitted by the Plotter
  8441. will be @code{kermit}-specific. There will be a limited amount of color
  8442. support, which is not normally the case (the 16 @code{ansi.sys} colors
  8443. will be supported). The "dotdotdashed" line style will be supported,
  8444. which is also not normally the case. After drawing graphics, the
  8445. Plotter will emit an escape sequence that returns the emulator to VT100
  8446. mode. The key sequence `@w{ALT minus}' may be employed manually within
  8447. @code{kermit} to switch between the two modes.
  8448. @item TRANSPARENT_COLOR
  8449. (Default "none".) Relevant only to PNG and GIF Plotters. If the value
  8450. is a recognized color name, that color, if it appears in the output
  8451. file, will be treated as transparent by most applications. For
  8452. information on what names are recognized, see @ref{Color Names}.
  8453. If @code{TRANSPARENT_COLOR} is set and an animated pseudo-GIF file is
  8454. produced, the `restore to background' disposal method will be used for
  8455. each image in the file. Otherwise, the `unspecified' disposal method
  8456. will be used.
  8457. @item USE_DOUBLE_BUFFERING
  8458. (Default "no".) Relevant only to X Plotters and X Drawable Plotters.
  8459. @w{If the} value is "yes", a double buffering scheme will be used when
  8460. drawing graphics. Each frame of graphics, within a
  8461. @t{openpl}@dots{}@t{closepl} pair, will be written to an off-screen
  8462. buffer rather than to the Plotter's display. When @t{erase} is invoked
  8463. to end a frame, or when @t{closepl} is invoked, the contents of the
  8464. off-screen buffer will be copied to the Plotter's display, pixel by
  8465. pixel. If successive frames differ only slightly, this will create the
  8466. illusion of smooth animation.
  8467. Some X displays provide special hardware support for double buffering.
  8468. @w{If this} support is available, the @w{X Plotter} will detect its
  8469. presence, and will draw graphics using the appropriate extension to the
  8470. X11 protocol (either DBE or MBX). In this case the animation will be
  8471. significantly faster; on high-end graphics hardware, @w{at least}.
  8472. @item VANISH_ON_DELETE
  8473. (Default "no".) Relevant only to X Plotters. If the value is "yes",
  8474. when a Plotter is deleted, the window or windows that it has @w{popped
  8475. up} will vanish. Otherwise, each such window will remain on the screen
  8476. until it is removed by the user (by typing @samp{q} @w{in it}, or by
  8477. clicking with a mouse).
  8478. @item XDRAWABLE_COLORMAP
  8479. (Default NULL@.) Relevant only to @w{X Drawable Plotters}. If the
  8480. value is non-NULL, it should be a @code{Colormap *}, @w{a pointer} to a
  8481. colormap from which colors should be allocated. NULL indicates that the
  8482. colormap to be used should be the default colormap of the default screen
  8483. of the @w{X display}.
  8484. @item XDRAWABLE_DISPLAY
  8485. (Default NULL@.) Relevant only to X Drawable Plotters. The value
  8486. should be a @code{Display *}, @w{a pointer} to the @w{X display} with
  8487. which the drawable(s) to be @w{drawn in} are associated.
  8488. @item XDRAWABLE_DRAWABLE1
  8489. @itemx XDRAWABLE_DRAWABLE2
  8490. (Default NULL@.) Relevant only to X Drawable Plotters. If set, the
  8491. value of each of these parameters should be a @code{Drawable *}, a
  8492. pointer to a drawable to be @w{drawn in}. @w{A `drawable'} is either a
  8493. window or a pixmap. At the time an @w{X Drawable} Plotter is created,
  8494. @w{at least} one of the two parameters must be set.
  8495. @w{X Drawable} Plotters support simultaneous drawing in two drawables
  8496. because it is often useful to be able to draw graphics simultaneously in
  8497. both an @w{X window} and its background pixmap. If two drawables are
  8498. specified, they must have the same dimensions and depth, and be
  8499. associated with the same screen of the @w{X display}.
  8500. @item XDRAWABLE_VISUAL
  8501. (Default NULL@.) Relevant only to @w{X Drawable Plotters}. If set, the
  8502. value should be a @code{Visual *}, @w{a pointer} to the `visual' with
  8503. which the colormap (see above) is associated. Setting this parameter is
  8504. not required, but it is recommended that it be set if
  8505. @code{XDRAWABLE_COLORMAP} is set. Under some circumstances, that will
  8506. @w{speed up} color cell allocation.
  8507. @item X_AUTO_FLUSH
  8508. (Default "yes".) Relevant only to X Plotters. If the value is "yes",
  8509. an @code{XFlush} operation is performed after each drawing operation.
  8510. That ensures that graphics are flushed to the @w{X Window} System
  8511. display, and are visible to the user, immediately after they are drawn.
  8512. However, it slows down rendering considerably. @w{If the} value is
  8513. "no", drawing is faster, since it does not take place in real time.
  8514. @end table
  8515. @node Appendices, , libplot, Top
  8516. @ifnottex
  8517. The following appendices contain supplementary information on the GNU
  8518. plotting utilities and the GNU @code{libplot} library.
  8519. @end ifnottex
  8520. @menu
  8521. * Fonts and Markers:: Text fonts, text strings, and marker symbols
  8522. * Color Names:: Specifying colors by name
  8523. * Page and Viewport Sizes:: Specifying the size of an output page
  8524. * Metafiles:: The device-independent GNU metafile format
  8525. * Auxiliary Software:: How to obtain auxiliary software
  8526. * History and Acknowledgements:: The contributors
  8527. * Reporting Bugs:: How to report bugs
  8528. * GNU Free Documentation License:: How this manual may be distributed
  8529. @end menu
  8530. @node Fonts and Markers, Color Names, Appendices, Appendices
  8531. @appendix Fonts, Strings, and Symbols
  8532. The GNU @code{libplot} graphics library and applications built @w{on
  8533. it}, such as @code{graph}, @code{plot}, @code{pic2plot},
  8534. @code{tek2plot}, and @code{plotfont}, can draw text strings in a wide
  8535. variety of fonts. Text strings may include characters from more than
  8536. one font in a typeface, and may include superscripts, subscripts, and
  8537. square roots. @w{A wide} variety of marker symbols can also be drawn.
  8538. The following sections explain how to use these features.
  8539. @menu
  8540. * Text Fonts:: Available text fonts
  8541. * Cyrillic and Japanese:: The Cyrillic and Japanese fonts
  8542. * Text Fonts in X:: Available text fonts in the X Window System
  8543. * Text String Format:: Text string formatting (with escape sequences)
  8544. * Marker Symbols:: Available marker symbols
  8545. @end menu
  8546. @node Text Fonts, Cyrillic and Japanese, Fonts and Markers, Fonts and Markers
  8547. @appendixsection Available text fonts
  8548. The GNU @code{libplot} library and applications built @w{on it}, such as
  8549. @code{graph}, @code{plot}, @code{pic2plot}, @code{tek2plot}, and
  8550. @code{plotfont}, can use many fonts. These include 22 Hershey vector
  8551. fonts, 35 Postscript fonts, 45 @w{PCL 5} fonts, and 18 Hewlett--Packard
  8552. vector fonts. @w{We call} these 120 supported fonts the `built-in'
  8553. fonts. The Hershey fonts are constructed from stroked characters
  8554. digitized @w{c.@: 1967} by Dr.@: @w{Allen V.} Hershey at the U.S. Naval
  8555. Surface Weapons Center in @w{Dahlgren, VA}@. The 35 Postscript fonts
  8556. are the outline fonts resident in all modern Postscript printers, and
  8557. the 45 @w{PCL 5} fonts are the outline fonts resident in modern
  8558. Hewlett--Packard LaserJet printers and plotters. (Of the @w{PCL 5}
  8559. fonts, the old LaserJet III, which was Hewlett--Packard's first @w{PCL
  8560. 5} printer, supported only eight: the Univers and CGTimes fonts.) The
  8561. 18 Hewlett--Packard vector fonts are fonts that are resident in
  8562. Hewlett--Packard printers and plotters (mostly the latter).
  8563. The Hershey fonts can be used by all types of Plotter supported by
  8564. @code{libplot}, and the Postscript fonts can be used by X, SVG,
  8565. Illustrator, Postscript, and Fig Plotters. So, for example, all
  8566. variants of @code{graph} can use the Hershey fonts, and @code{graph
  8567. @w{-T X}}, @code{graph -T svg}, @code{graph -T ai}, @code{graph -T ps},
  8568. @code{graph -T cgm} and @code{graph -T fig} can use the Postscript
  8569. fonts. The @w{PCL 5} fonts can be used by by SVG, Illustrator, PCL, and
  8570. HP-GL Plotters, and by @code{graph -T svg}, @code{graph -T ai},
  8571. @code{graph -T pcl}, and @code{graph -T hpgl}. The Hewlett--Packard
  8572. vector fonts can be used by PCL and HP-GL Plotters, and by @code{graph
  8573. -T pcl} and @code{graph -T hpgl}. @w{X Plotters} and @code{graph @w{-T
  8574. X}} are not restricted to the built-in Hershey and Postscript fonts.
  8575. They can use any @w{X Window} System font.
  8576. The @code{plotfont} utility, which accepts the @samp{-T} option, will
  8577. print a character map of any font that is available in the specified
  8578. output format. @xref{plotfont}.
  8579. For the purpose of plotting text strings (see @ref{Text String Format}),
  8580. the 120 built-in fonts are divided into typefaces. As you can see from
  8581. the following tables, our convention is that in any typeface with more
  8582. than a single font, font #1 is the normal font, font #2 is italic or
  8583. oblique, font #3 is bold, and font #4 is bold italic or bold oblique.
  8584. Additional variants @w{(if any)} are numbered #5 and higher.
  8585. The 22 Hershey fonts are divided into typefaces as follows.
  8586. @itemize @bullet
  8587. @item HersheySerif
  8588. @enumerate
  8589. @item HersheySerif
  8590. @item HersheySerif-Italic
  8591. @item HersheySerif-Bold
  8592. @item HersheySerif-BoldItalic
  8593. @item HersheyCyrillic
  8594. @item HersheyCyrillic-Oblique
  8595. @item HersheyEUC
  8596. @end enumerate
  8597. @item HersheySans
  8598. @enumerate
  8599. @item HersheySans
  8600. @item HersheySans-Oblique
  8601. @item HersheySans-Bold
  8602. @item HersheySans-BoldOblique
  8603. @end enumerate
  8604. @item HersheyScript
  8605. @enumerate
  8606. @item HersheyScript
  8607. @item HersheyScript
  8608. @item HersheyScript-Bold
  8609. @item HersheyScript-Bold
  8610. @end enumerate
  8611. @item HersheyGothicEnglish
  8612. @item HersheyGothicGerman
  8613. @item HersheyGothicItalian
  8614. @item HersheySerifSymbol
  8615. @enumerate
  8616. @item HersheySerifSymbol
  8617. @item HersheySerifSymbol-Oblique
  8618. @item HersheySerifSymbol-Bold
  8619. @item HersheySerifSymbol-BoldOblique
  8620. @end enumerate
  8621. @item HersheySansSymbol
  8622. @enumerate
  8623. @item HersheySansSymbol
  8624. @item HersheySansSymbol-Oblique
  8625. @end enumerate
  8626. @end itemize
  8627. @noindent
  8628. Nearly all Hershey fonts except the Symbol fonts use the ISO-Latin-1
  8629. encoding, which is a superset of ASCII@. The Symbol fonts consist of
  8630. Greek characters and mathematical symbols, and use the symbol font
  8631. encoding documented in the @cite{Postscript Language Reference Manual}.
  8632. By convention, each Hershey typeface contains a symbol font
  8633. (HersheySerifSymbol or HersheySansSymbol, as appropriate) as @w{font
  8634. #0}.
  8635. HersheyCyrillic, HersheyCyrillic-Oblique, and HersheyEUC (which is a
  8636. Japanese font) are the only non-Symbol Hershey fonts that do not use the
  8637. ISO-Latin-1 encoding. For their encodings, see @ref{Cyrillic and
  8638. Japanese}.
  8639. The 35 Postscript fonts are divided into typefaces as follows.
  8640. @itemize @bullet
  8641. @item Helvetica
  8642. @enumerate
  8643. @item Helvetica
  8644. @item Helvetica-Oblique
  8645. @item Helvetica-Bold
  8646. @item Helvetica-BoldOblique
  8647. @end enumerate
  8648. @item Helvetica-Narrow
  8649. @enumerate
  8650. @item Helvetica-Narrow
  8651. @item Helvetica-Narrow-Oblique
  8652. @item Helvetica-Narrow-Bold
  8653. @item Helvetica-Narrow-BoldOblique
  8654. @end enumerate
  8655. @item Times
  8656. @enumerate
  8657. @item Times-Roman
  8658. @item Times-Italic
  8659. @item Times-Bold
  8660. @item Times-BoldItalic
  8661. @end enumerate
  8662. @item AvantGarde
  8663. @enumerate
  8664. @item AvantGarde-Book
  8665. @item AvantGarde-BookOblique
  8666. @item AvantGarde-Demi
  8667. @item AvantGarde-DemiOblique
  8668. @end enumerate
  8669. @item Bookman
  8670. @enumerate
  8671. @item Bookman-Light
  8672. @item Bookman-LightItalic
  8673. @item Bookman-Demi
  8674. @item Bookman-DemiItalic
  8675. @end enumerate
  8676. @item Courier
  8677. @enumerate
  8678. @item Courier
  8679. @item Courier-Oblique
  8680. @item Courier-Bold
  8681. @item Courier-BoldOblique
  8682. @end enumerate
  8683. @item NewCenturySchlbk
  8684. @enumerate
  8685. @item NewCenturySchlbk-Roman
  8686. @item NewCenturySchlbk-Italic
  8687. @item NewCenturySchlbk-Bold
  8688. @item NewCenturySchlbk-BoldItalic
  8689. @end enumerate
  8690. @item Palatino
  8691. @enumerate
  8692. @item Palatino-Roman
  8693. @item Palatino-Italic
  8694. @item Palatino-Bold
  8695. @item Palatino-BoldItalic
  8696. @end enumerate
  8697. @item ZapfChancery-MediumItalic
  8698. @item ZapfDingbats
  8699. @item Symbol
  8700. @end itemize
  8701. @noindent
  8702. All Postscript fonts except the ZapfDingbats and Symbol fonts use the
  8703. ISO-Latin-1 encoding. The encodings used by the ZapfDingbats and Symbol
  8704. fonts are documented in the @cite{Postscript Language Reference Manual}.
  8705. By convention, each Postscript typeface contains the Symbol font as
  8706. @w{font #0}.
  8707. The 45 @w{PCL 5} fonts are divided into typefaces as follows.
  8708. @itemize @bullet
  8709. @item Univers
  8710. @enumerate
  8711. @item Univers
  8712. @item Univers-Oblique
  8713. @item Univers-Bold
  8714. @item Univers-BoldOblique
  8715. @end enumerate
  8716. @item UniversCondensed
  8717. @enumerate
  8718. @item UniversCondensed
  8719. @item UniversCondensed-Oblique
  8720. @item UniversCondensed-Bold
  8721. @item UniversCondensed-BoldOblique
  8722. @end enumerate
  8723. @item CGTimes
  8724. @enumerate
  8725. @item CGTimes-Roman
  8726. @item CGTimes-Italic
  8727. @item CGTimes-Bold
  8728. @item CGTimes-BoldItalic
  8729. @end enumerate
  8730. @item Albertus
  8731. @enumerate
  8732. @item AlbertusMedium
  8733. @item AlbertusMedium
  8734. @item AlbertusExtraBold
  8735. @item AlbertusExtraBold
  8736. @end enumerate
  8737. @item AntiqueOlive
  8738. @enumerate
  8739. @item AntiqueOlive
  8740. @item AntiqueOlive-Italic
  8741. @item AntiqueOlive-Bold
  8742. @end enumerate
  8743. @item Arial
  8744. @enumerate
  8745. @item Arial-Roman
  8746. @item Arial-Italic
  8747. @item Arial-Bold
  8748. @item Arial-BoldItalic
  8749. @end enumerate
  8750. @item ClarendonCondensed
  8751. @item Coronet
  8752. @item Courier
  8753. @enumerate
  8754. @item Courier
  8755. @item Courier-Italic
  8756. @item Courier-Bold
  8757. @item Courier-BoldItalic
  8758. @end enumerate
  8759. @item Garamond
  8760. @enumerate
  8761. @item Garamond
  8762. @item Garamond-Italic
  8763. @item Garamond-Bold
  8764. @item Garamond-BoldItalic
  8765. @end enumerate
  8766. @item LetterGothic
  8767. @enumerate
  8768. @item LetterGothic-Roman
  8769. @item LetterGothic-Italic
  8770. @item LetterGothic-Bold
  8771. @item LetterGothic-BoldItalic
  8772. @end enumerate
  8773. @item Marigold
  8774. @item CGOmega
  8775. @enumerate
  8776. @item CGOmega-Roman
  8777. @item CGOmega-Italic
  8778. @item CGOmega-Bold
  8779. @item CGOmega-BoldItalic
  8780. @end enumerate
  8781. @item TimesNewRoman
  8782. @enumerate
  8783. @item TimesNewRoman
  8784. @item TimesNewRoman-Italic
  8785. @item TimesNewRoman-Bold
  8786. @item TimesNewRoman-BoldItalic
  8787. @end enumerate
  8788. @item Wingdings
  8789. @item Symbol
  8790. @end itemize
  8791. @noindent
  8792. All PCL 5 fonts except the Wingdings and Symbol fonts use the
  8793. ISO-Latin-1 encoding. The encoding used by the Symbol font is the
  8794. symbol font encoding documented in the @cite{Postscript Language
  8795. Reference Manual}. By convention, each PCL typeface contains the Symbol
  8796. font as @w{font #0}.
  8797. The 18 Hewlett--Packard vector fonts are divided into typefaces as
  8798. follows.
  8799. @itemize @bullet
  8800. @item Arc
  8801. @enumerate
  8802. @item Arc
  8803. @item Arc-Oblique
  8804. @item Arc-Bold
  8805. @item Arc-BoldOblique
  8806. @end enumerate
  8807. @item Stick
  8808. @enumerate
  8809. @item Stick
  8810. @item Stick-Oblique
  8811. @item Stick-Bold
  8812. @item Stick-BoldOblique
  8813. @end enumerate
  8814. @item ArcANK
  8815. @enumerate
  8816. @item ArcANK*
  8817. @item ArcANK-Oblique*
  8818. @item ArcANK-Bold*
  8819. @item ArcANK-BoldOblique*
  8820. @end enumerate
  8821. @item StickANK
  8822. @enumerate
  8823. @item StickANK*
  8824. @item StickANK-Oblique*
  8825. @item StickANK-Bold*
  8826. @item StickANK-BoldOblique*
  8827. @end enumerate
  8828. @item ArcSymbol*
  8829. @item StickSymbol*
  8830. @end itemize
  8831. @noindent
  8832. The Hewlett--Packard vector fonts with an asterisk (the ANK and Symbol
  8833. fonts) are only available when producing HP-GL/2 graphics, or HP-GL
  8834. graphics for the HP7550A graphics plotter and the HP758x, HP7595A and
  8835. HP7596A drafting plotters. That is, they are available only if
  8836. @code{HPGL_VERSION} @w{is "2"} (the default) @w{or "1.5"}. The ANK
  8837. fonts are Japanese fonts (@pxref{Cyrillic and Japanese}), and the Symbol
  8838. fonts contain a few miscellaneous mathematical symbols.
  8839. All Hewlett--Packard vector fonts except the ANK and Symbol fonts use
  8840. the ISO-Latin-1 encoding. The Arc fonts are proportional
  8841. (variable-width) fonts, and the Stick fonts are fixed-width fonts. If
  8842. HP-GL/2 or HP-GL output is selected, the Arc fonts are assumed to be
  8843. kerned via device-resident kerning tables. But when producing @w{PCL 5}
  8844. output, it is assumed that the display device will do no kerning.
  8845. Apparently Hewlett--Packard dropped support for device-resident kerning
  8846. tables when emulating HP-GL/2 from within @w{PCL 5}. For information
  8847. about Hewlett--Packard vector fonts and the way in which they are kerned
  8848. (@w{in HP-GL} pen plotters, @w{at least}), see the article by
  8849. @w{L@. W@.} Hennessee @w{et al@.} in the Nov.@: 1981 issue of the
  8850. @cite{Hewlett--Packard Journal}.
  8851. To what extent do the fonts supported by @code{libplot} contain
  8852. ligatures? The Postscript fonts, the @w{PCL 5} fonts, and the
  8853. Hewlett--Packard vector fonts, @w{at least} as implemented in
  8854. @code{libplot}, @w{do not} contain ligatures. However, six of the 22
  8855. Hershey fonts contain ligatures. The character combinations "fi", "ff",
  8856. "fl", "ffi", and "ffl" are automatically drawn as ligatures in
  8857. HersheySerif and HersheySerif-Italic. (Also in the two HersheyCyrillic
  8858. fonts and HersheyEUC, since insofar as printable ASCII characters are
  8859. concerned, they are identical [or almost identical] to HersheySerif.)
  8860. @w{In addition}, "tz" and "ch" are ligatures in HersheyGothicGerman.
  8861. The German double-s @w{character `@ss{}'}, which is called an `eszet',
  8862. is not treated as a ligature in any font. @w{To obtain} an eszet, you
  8863. must either request one with the escape @w{sequence "\ss"} (@pxref{Text
  8864. String Format}), or, if you have an 8-bit keyboard, type an eszet
  8865. explicitly.
  8866. @node Cyrillic and Japanese, Text Fonts in X, Text Fonts, Fonts and Markers
  8867. @appendixsection Cyrillic and Japanese fonts
  8868. The built-in fonts discussed in the previous section include Cyrillic
  8869. and Japanese vector fonts. This section explains how these fonts are
  8870. encoded, i.e., how their character maps are @w{laid out}. You may use
  8871. the @code{plotfont} utility to display the character map for any font,
  8872. including the Cyrillic and Japanese vector fonts. @xref{plotfont}.
  8873. The HersheyCyrillic and HersheyCyrillic-Oblique fonts use an encoding
  8874. called @w{KOI8-R}, a superset of ASCII that has become the @w{de
  8875. facto} standard for Unix and networking applications in the former
  8876. Soviet Union. Insofar as printable ASCII characters go, they resemble
  8877. the HersheySerif vector font. But their upper halves are different.
  8878. The byte range @t{0xc0}@dots{}@t{0xdf} contains lower-case Cyrillic
  8879. characters and the byte range @t{0xe0}@dots{}@t{0xff} contains upper
  8880. case Cyrillic characters. Additional Cyrillic characters are located
  8881. at @t{0xa3} @w{and @t{0xb3}}. For more on the encoding scheme, see
  8882. @uref{http://koi8.pp.ru/main.html, the official KOI8-R Web page} and
  8883. Internet RFC 1489, which is available in many places, including
  8884. @uref{http://www.isi.edu, Information Sciences Institute}.
  8885. The HersheyEUC font is a vector font that is used for displaying
  8886. Japanese text. It uses the 8-bit EUC-JP encoding. EUC stands for
  8887. `extended Unix code', which is a scheme for encoding Japanese, and also
  8888. other character sets (e.g., Greek and Cyrillic) as multibyte character
  8889. strings. The format of EUC strings is explained in Ken Lunde's
  8890. @cite{Understanding Japanese Information Processing} (O'Reilly, 1993),
  8891. which contains much additional information on Japanese text processing.
  8892. See also @uref{http://www.praxagora.com/lunde/cjk_inf.html, his
  8893. on-line supplement}, and his more recent book @cite{CJKV Information
  8894. Processing} (O'Reilly, 1999).
  8895. In the HersheyEUC font, characters in the printable ASCII range,
  8896. @t{0x20}@dots{}@t{0x7e}, are similar to HersheySerif (their encoding is
  8897. `JIS Roman', an ASCII variant standardized by the Japanese Industrial
  8898. Standards Committee). Also, each successive pair of bytes in the
  8899. @code{0xa1}@dots{}@code{0xfe} range defines a single character in the
  8900. JIS X0208 standard. The characters in the JIS X0208 standard include
  8901. Japanese syllabic characters (Hiragana and Katakana), ideographic
  8902. characters (Kanji), Roman, Greek, and Cyrillic alphabets, punctuation
  8903. marks, and miscellaneous symbols. For example, the JIS X0208 standard
  8904. indexes the 83 Hiragana as @code{0x2421}@dots{}@code{0x2473}. @w{To
  8905. obtain} the EUC code for any JIS X0208 character, you would add
  8906. @code{0x80} to each byte (i.e., `set the high bit' on each byte). @w{So
  8907. the} first of the 83 Hiragana (@code{0x2421}) would be encoded as the
  8908. successive pair of bytes @code{0xa4} @w{and @code{0xa1}}.
  8909. The implementation of the JIS X0208 standard in the HersheyEUC font is
  8910. based on @w{Dr.@: Hershey's} digitizations, and is complete enough to be
  8911. useful. All 83 Hiragana and 86 Katakana are available, though the
  8912. little-used `half-width Katakana' are not supported. Also, 603 Kanji
  8913. are available, including 596 of the 2965 JIS @w{Level 1} (i.e.,
  8914. frequently used) Kanji. The Hiragana, the Katakana, and the available
  8915. Kanji all have the same width. The file @file{kanji.doc}, which on most
  8916. systems is installed in @file{/usr/share/libplot} or
  8917. @file{/usr/local/share/libplot}, lists the 603 available Kanji. Each
  8918. JIS X0208 character that is unavailable will be drawn as an `undefined
  8919. character' glyph (@w{a bundle} of horizontal lines).
  8920. The eight Hewlett--Packard vector fonts in the ArcANK and StickANK
  8921. typefaces are also used for displaying Japanese text. They are
  8922. available when producing HP-GL/2 output, or HP-GL output for the HP7550A
  8923. graphics plotter and the HP758x, HP7595A and HP7596A drafting plotters.
  8924. That is, they are available only if @code{HPGL_VERSION} @w{is "2"} (the
  8925. default) @w{or "1.5"}.
  8926. ANK stands for Alphabet, Numerals, and Katakana. The ANK fonts use a
  8927. special mixed encoding. The lower half of each font uses the JIS Roman
  8928. encoding, and the upper half contains half-width Katakana. Half-width
  8929. Katakana are simplified Katakana that may need to be equipped with
  8930. diacritical marks. The diacritical marks are included in the encoding
  8931. as separate characters.
  8932. @node Text Fonts in X, Text String Format, Cyrillic and Japanese, Fonts and Markers
  8933. @appendixsection Available text fonts for the X Window System
  8934. The command-line graphics programs @code{graph @w{-T X}}, @code{plot
  8935. @w{-T X}}, @code{pic2plot @w{-T X}}, @code{tek2plot @w{-T X}}, and
  8936. @code{plotfont @w{-T X}}, and the @code{libplot} library that they are
  8937. @w{built on}, can draw text on an @w{X Window} System display in a wide
  8938. variety of fonts. This includes the 22 built-in Hershey vector fonts.
  8939. They can use the 35 built-in Postscript fonts too, if those fonts are
  8940. available on the @w{X display}. Most releases of the plotting utilities
  8941. include freely distributable versions of the 35 Postscript fonts, in
  8942. @w{Type 1} format, that are easily installed on any @w{X display}.
  8943. The plotting utilities can in fact use most of the `core' fonts that
  8944. are available on the @w{X display}. This includes scalable fonts that
  8945. have so-called XLFD (@w{X Logical} Font Description) names. You may
  8946. determine which such fonts are available by using the low-level
  8947. @code{xlsfonts} command. Fonts whose names end in
  8948. "-0-0-0-0-p-0-iso8859-1" or "-0-0-0-0-m-0-iso8859-1" are scalable
  8949. ISO-Latin-1 fonts that can be used by @code{libplot} and the plotting
  8950. utilities. For example, the "CharterBT-Roman" font is available on
  8951. many @w{X displays}. Its full XLFD name is
  8952. "-bitstream-charter-medium-r-normal--0-0-0-0-p-0-iso8859-1". The
  8953. plotting utilities would refer to it by its base XLFD name, which has
  8954. only three hyphens; namely, "charter-medium-r-normal". The command
  8955. @example
  8956. echo 0 0 1 1 2 0 | graph -T X -F charter-medium-r-normal
  8957. @end example
  8958. @noindent
  8959. will draw a plot in a popped-up @w{X window}, in which the axis ticks
  8960. are labeled in this font.
  8961. Fonts whose names end in "iso8859-2", etc., and "adobe-fontspecific",
  8962. may also be used, though they do not employ the standard ISO-Latin-1
  8963. encoding. By default @code{libplot} will try to retrieve an
  8964. "iso8859-1", i.e., ISO-Latin-1 version of the font, if one is
  8965. available. But you can work around this by giving the full name of
  8966. the font, if you wish. Supplying the full name of an @w{X font} is
  8967. also useful if you wish to employ a screen font (i.e., bitmap font),
  8968. such as the traditional fonts "fixed" and "9x15". If you supply the
  8969. full name of an @w{X font}, rather than a base XLFD name, each
  8970. character glyph, once it is obtained from the @w{X display} as a
  8971. pattern of pixels, will be scaled by @code{libplot} to the appropriate
  8972. size.
  8973. The plotting utilities, including @code{graph}, support a
  8974. @samp{--bitmap-size} option. @w{If the} @samp{@w{-T X}} option is
  8975. used, @w{it sets} the size of the popped-up @w{X Window}. You may use
  8976. it to obtain some interesting visual effects. Each of the plotting
  8977. utilities assumes that it is drawing in a square region, so if you use
  8978. the @samp{--bitmap-size 800x400} option, your plot will be scaled
  8979. anisotropically, by a larger factor in the horizontal direction than
  8980. in the vertical direction. The @w{X fonts} in the plot will be scaled
  8981. accordingly. In the same spirit, the @samp{--rotation} option will
  8982. rotate the plot, causing all text strings to be rotated too. For
  8983. example, @samp{--rotation 45} will induce a 45-degree counterclockwise
  8984. rotation. The options @samp{--bitmap-size} and @samp{--rotation} may
  8985. be applied together.
  8986. The escape sequences that provide access to the non-ASCII `8-bit'
  8987. characters in the built-in ISO-Latin-1 fonts may be employed when using
  8988. any ISO-Latin-1 @w{X Window} System font. For more on escape sequences,
  8989. see @ref{Text String Format}. As an example, "\Po" will yield the
  8990. British pounds sterling @w{symbol `@pounds{}'}. The command
  8991. @example
  8992. echo 0 0 1 1 | graph -T X -F times-medium-r-normal -L "A \Po1 Plot"
  8993. @end example
  8994. @noindent
  8995. shows how this symbol could be used in a graph label. In the same
  8996. way, the escape sequences that provide access to mathematical symbols
  8997. and Greek characters may be employed when using any @w{X Window}
  8998. System font, whether or not it is an ISO-Latin-1 font. These symbols
  8999. and characters are taken from the Symbol font, which is available on
  9000. nearly all @w{X displays}.
  9001. @node Text String Format, Marker Symbols, Text Fonts in X, Fonts and Markers
  9002. @appendixsection Text string format and escape sequences
  9003. Text strings that are drawn by the GNU @code{libplot} library and by
  9004. applications built @w{on it}, such as @code{graph}, @code{plot},
  9005. @code{pic2plot}, @code{tek2plot}, and @code{plotfont}, must consist of
  9006. printable characters. @w{No embedded} control characters, such as
  9007. newlines or carriage returns, are allowed. Technically, a character is
  9008. `printable' if it comes from either of the two byte ranges
  9009. @t{0x20}@dots{}@t{0x7e} and @t{0xa0}@dots{}@t{0xff}. The former is the
  9010. printable ASCII range and the latter is the printable `8-bit' range.
  9011. Text strings may, however, include embedded `escape sequences' that
  9012. shift the font, append subscripts or superscripts, or include non-ASCII
  9013. characters and mathematical symbols. As a consequence, the axis labels
  9014. on a plot prepared with @code{graph} may include such features. So may
  9015. the text strings that @code{pic2plot} uses to label objects.
  9016. The format of the escape sequences should look familiar to anyone who is
  9017. familiar with the @TeX{}, @code{troff}, or @code{groff} document
  9018. formatters. Each escape sequence consists of three characters: @w{a
  9019. backslash} and two additional characters. The most frequently used
  9020. escape sequences are as follows.
  9021. @table @asis
  9022. @item "\sp"
  9023. start superscript mode
  9024. @item "\ep"
  9025. end superscript mode
  9026. @item "\sb"
  9027. start subscript mode
  9028. @item "\eb"
  9029. end subscript mode
  9030. @item "\mk"
  9031. mark position
  9032. @item "\rt"
  9033. return to marked position
  9034. @end table
  9035. @noindent
  9036. For example, the string "x\sp2\ep" would be interpreted as `x squared'.
  9037. Subscripts on subscripts, etc., are allowed. Subscripts and
  9038. superscripts may be vertically aligned by judicious use of the "\mk" and
  9039. "\rt" escape sequences. For example, "a\mk\sbi\eb\rt\sp2\ep" produces
  9040. "a sub i squared", with the exponent `2' placed immediately above the
  9041. subscript.
  9042. There are also escape sequences that switch from font to font within a
  9043. typeface. For an enumeration of the fonts within each typeface, see
  9044. @ref{Text Fonts}. Suppose @w{for example} that the current font is
  9045. Times-Roman, which is font #1 in the `Times' typeface. The string "A
  9046. \f2very\f1 well labeled axis" would be a string in which the word `very'
  9047. appears in Times-Italic rather than Times-Roman. That is because
  9048. Times-Italic is the #2 font in the typeface. Font-switching escape
  9049. sequences are of the form "\f@var{n}", where @var{n} is the number of
  9050. the font to be @w{switched to}. For compatibility with @code{troff} and
  9051. @code{groff}, "\fR", "\fI", "\fB" are equivalent to "\f1", "\f2", "\f3",
  9052. respectively. "\fP" will switch the font to the previously used font
  9053. (only one font is remembered). There is currently no support for
  9054. switching between fonts in different typefaces.
  9055. There are also a few escape sequences for horizontal shifts, which are
  9056. useful for improving horizontal alignment, such as when shifting between
  9057. italic and non-italic fonts. "\r1", "\r2", "\r4", "\r6", "\r8", and
  9058. "\r^" are escape sequences that shift right by 1 em, 1/2 em, 1/4 em, 1/6
  9059. em, 1/8 em, and 1/12 em, respectively. "\l1", "\l2", "\l4", "\l6",
  9060. "\l8", and "\l^" are similar, but shift left instead of right.
  9061. "A \fIvery\r^\fP well labeled axis" would look slightly better than
  9062. "A \fIvery\fP well labeled axis".
  9063. Square roots are handled with the aid of a special pair of escape
  9064. sequences, together with the "\mk" and "\rt" sequences discussed above.
  9065. A square root symbol is begun with "\sr", and continued arbitrarily far
  9066. to the right with the overbar (`run') escape sequence, "\rn". For
  9067. example, the string "\sr\mk\rn\rn\rtab" would be plotted as `the square
  9068. root of ab'. @w{To adjust} the length of the overbar, you may need to
  9069. experiment with the number of times "\rn" appears.
  9070. To underline a string, you would use "\ul", the underline escape
  9071. sequence, one or more times. The "\mk"@dots{}"\rt" trick would be
  9072. employed in the same way. So, for example, "\mk\ul\ul\ul\rtabc" would
  9073. yield an underlined "abc". To adjust the length of the underline, you
  9074. may need to experiment with the number of times "\ul" appears. You may
  9075. also need to use one or more of the abovementioned horizontal shifts.
  9076. @w{For example}, if the "HersheySerif" font were used,
  9077. "\mk\ul\ul\l8\ul\rtabc" would yield a better underline than
  9078. "\mk\ul\ul\ul\rtabc".
  9079. Besides the preceding escape sequences, there are also escape sequences
  9080. for the printable non-ASCII characters in each of the built-in
  9081. ISO-Latin-1 fonts (which means in every built-in font, except for the
  9082. symbol fonts, the HersheyCyrillic fonts, HersheyEUC, and ZapfDingbats).
  9083. The useful non-ASCII characters include accented characters among
  9084. others. Such `8-bit' characters, in the @t{0xa0}@dots{}@t{0xff} byte
  9085. range, may be included directly in a text string. But if your terminal
  9086. does not permit this, you may use the escape sequences for them instead.
  9087. There are escape sequences for the mathematical symbols and Greek
  9088. characters in the symbol fonts, @w{as well}. This is how the symbol
  9089. fonts are usually accessed. Which symbol font the mathematical symbols
  9090. and Greek characters are taken from depends on whether your current font
  9091. is a Hershey font or a non-Hershey font. They are taken from the
  9092. HersheySerifSymbol font or the HersheySansSymbol font in the former
  9093. case, and from the Symbol font in the latter.
  9094. The following are the escape sequences that provide access to the
  9095. non-ASCII characters of the current font, provided that it is an
  9096. ISO-Latin-1 font. Each escape sequence is followed by the position of
  9097. the corresponding character in the ISO-Latin-1 encoding (in decimal),
  9098. and the official Postscript name of the character. Most names should be
  9099. self-explanatory. @w{For example}, `eacute' is a lower-case `e',
  9100. equipped with an acute accent.
  9101. @table @asis
  9102. @item "\r!"
  9103. [161] exclamdown
  9104. @item "\ct"
  9105. [162] cent
  9106. @item "\Po"
  9107. [163] sterling
  9108. @item "\Cs"
  9109. [164] currency
  9110. @item "\Ye"
  9111. [165] yen
  9112. @item "\bb"
  9113. [166] brokenbar
  9114. @item "\sc"
  9115. [167] section
  9116. @item "\ad"
  9117. [168] dieresis
  9118. @item "\co"
  9119. [169] copyright
  9120. @item "\Of"
  9121. [170] ordfeminine
  9122. @item "\Fo"
  9123. [171] guillemotleft
  9124. @item "\no"
  9125. [172] logicalnot
  9126. @item "\hy"
  9127. [173] hyphen
  9128. @item "\rg"
  9129. [174] registered
  9130. @item "\a-"
  9131. [175] macron
  9132. @item "\de"
  9133. [176] degree
  9134. @item "\+-"
  9135. [177] plusminus
  9136. @item "\S2"
  9137. [178] twosuperior
  9138. @item "\S3"
  9139. [179] threesuperior
  9140. @item "\aa"
  9141. [180] acute
  9142. @item "\*m"
  9143. [181] mu
  9144. @item "\ps"
  9145. [182] paragraph
  9146. @item "\md"
  9147. [183] periodcentered
  9148. @item "\ac"
  9149. [184] cedilla
  9150. @item "\S1"
  9151. [185] onesuperior
  9152. @item "\Om"
  9153. [186] ordmasculine
  9154. @item "\Fc"
  9155. [187] guillemotright
  9156. @item "\14"
  9157. [188] onequarter
  9158. @item "\12"
  9159. [189] onehalf
  9160. @item "\34"
  9161. [190] threequarters
  9162. @item "\r?"
  9163. [191] questiondown
  9164. @item "\`A"
  9165. [192] Agrave
  9166. @item "\'A"
  9167. [193] Aacute
  9168. @item "\^A"
  9169. [194] Acircumflex
  9170. @item "\~A"
  9171. [195] Atilde
  9172. @item "\:A"
  9173. [196] Adieresis
  9174. @item "\oA"
  9175. [197] Aring
  9176. @item "\AE"
  9177. [198] AE
  9178. @item "\,C"
  9179. [199] Ccedilla
  9180. @item "\`E"
  9181. [200] Egrave
  9182. @item "\'E"
  9183. [201] Eacute
  9184. @item "\^E"
  9185. [202] Ecircumflex
  9186. @item "\:E"
  9187. [203] Edieresis
  9188. @item "\`I"
  9189. [204] Igrave
  9190. @item "\'I"
  9191. [205] Iacute
  9192. @item "\^I"
  9193. [206] Icircumflex
  9194. @item "\:I"
  9195. [207] Idieresis
  9196. @item "\-D"
  9197. [208] Eth
  9198. @item "\~N"
  9199. [209] Ntilde
  9200. @item "\'O"
  9201. [210] Ograve
  9202. @item "\'O"
  9203. [211] Oacute
  9204. @item "\^O"
  9205. [212] Ocircumflex
  9206. @item "\~O"
  9207. [213] Otilde
  9208. @item "\:O"
  9209. [214] Odieresis
  9210. @item "\mu"
  9211. [215] multiply
  9212. @item "\/O"
  9213. [216] Oslash
  9214. @item "\`U"
  9215. [217] Ugrave
  9216. @item "\'U"
  9217. [218] Uacute
  9218. @item "\^U"
  9219. [219] Ucircumflex
  9220. @item "\:U"
  9221. [220] Udieresis
  9222. @item "\'Y"
  9223. [221] Yacute
  9224. @item "\TP"
  9225. [222] Thorn
  9226. @item "\ss"
  9227. [223] germandbls
  9228. @item "\`a"
  9229. [224] agrave
  9230. @item "\'a"
  9231. [225] aacute
  9232. @item "\^a"
  9233. [226] acircumflex
  9234. @item "\~a"
  9235. [227] atilde
  9236. @item "\:a"
  9237. [228] adieresis
  9238. @item "\oa"
  9239. [229] aring
  9240. @item "\ae"
  9241. [230] ae
  9242. @item "\,c"
  9243. [231] ccedilla
  9244. @item "\`e"
  9245. [232] egrave
  9246. @item "\'e"
  9247. [233] eacute
  9248. @item "\^e"
  9249. [234] ecircumflex
  9250. @item "\:e"
  9251. [235] edieresis
  9252. @item "\`i"
  9253. [236] igrave
  9254. @item "\'i"
  9255. [237] iacute
  9256. @item "\^i"
  9257. [238] icircumflex
  9258. @item "\:i"
  9259. [239] idieresis
  9260. @item "\Sd"
  9261. [240] eth
  9262. @item "\~n"
  9263. [241] ntilde
  9264. @item "\`o"
  9265. [242] ograve
  9266. @item "\'o"
  9267. [243] oacute
  9268. @item "\^o"
  9269. [244] ocircumflex
  9270. @item "\~o"
  9271. [245] otilde
  9272. @item "\:o"
  9273. [246] odieresis
  9274. @item "\di"
  9275. [247] divide
  9276. @item "\/o"
  9277. [248] oslash
  9278. @item "\`u"
  9279. [249] ugrave
  9280. @item "\'u"
  9281. [250] uacute
  9282. @item "\^u"
  9283. [251] ucircumflex
  9284. @item "\:u"
  9285. [252] udieresis
  9286. @item "\'y"
  9287. [253] yacute
  9288. @item "\Tp"
  9289. [254] thorn
  9290. @item "\:y"
  9291. [255] ydieresis
  9292. @end table
  9293. The following are the escape sequences that provide access to
  9294. mathematical symbols and Greek characters in the current symbol font,
  9295. whether HersheySerifSymbol or HersheySansSymbol (for Hershey fonts) or
  9296. Symbol (for Postscript fonts). Each escape sequence is followed by the
  9297. position (in octal) of the corresponding character in the symbol
  9298. encoding, and the official Postscript name of the character. Many
  9299. escape sequences and names should be self-explanatory. "\*a" represents
  9300. a lower-case Greek alpha, @w{for example}. For a table displaying each
  9301. of the characters below, see the @cite{Postscript Language Reference
  9302. Manual}.
  9303. @table @asis
  9304. @item "\fa"
  9305. [0042] universal
  9306. @item "\te"
  9307. [0044] existential
  9308. @item "\st"
  9309. [0047] suchthat
  9310. @item "\**"
  9311. [0052] asteriskmath
  9312. @item "\=~"
  9313. [0100] congruent
  9314. @item "\*A"
  9315. [0101] Alpha
  9316. @item "\*B"
  9317. [0102] Beta
  9318. @item "\*X"
  9319. [0103] Chi
  9320. @item "\*D"
  9321. [0104] Delta
  9322. @item "\*E"
  9323. [0105] Epsilon
  9324. @item "\*F"
  9325. [0106] Phi
  9326. @item "\*G"
  9327. [0107] Gamma
  9328. @item "\*Y"
  9329. [0110] Eta
  9330. @item "\*I"
  9331. [0111] Iota
  9332. @item "\+h"
  9333. [0112] theta1
  9334. @item "\*K"
  9335. [0113] Kappa
  9336. @item "\*L"
  9337. [0114] Lambda
  9338. @item "\*M"
  9339. [0115] Mu
  9340. @item "\*N"
  9341. [0116] Nu
  9342. @item "\*O"
  9343. [0117] Omicron
  9344. @item "\*P"
  9345. [0120] Pi
  9346. @item "\*H"
  9347. [0121] Theta
  9348. @item "\*R"
  9349. [0122] Rho
  9350. @item "\*S"
  9351. [0123] Sigma
  9352. @item "\*T"
  9353. [0124] Tau
  9354. @item "\*U"
  9355. [0125] Upsilon
  9356. @item "\ts"
  9357. [0126] sigma1
  9358. @item "\*W"
  9359. [0127] Omega
  9360. @item "\*C"
  9361. [0130] Xi
  9362. @item "\*Q"
  9363. [0131] Psi
  9364. @item "\*Z"
  9365. [0132] Zeta
  9366. @item "\tf"
  9367. [0134] therefore
  9368. @item "\pp"
  9369. [0136] perpendicular
  9370. @item "\ul"
  9371. [0137] underline
  9372. @item "\rx"
  9373. [0140] radicalex
  9374. @item "\*a"
  9375. [0141] alpha
  9376. @item "\*b"
  9377. [0142] beta
  9378. @item "\*x"
  9379. [0143] chi
  9380. @item "\*d"
  9381. [0144] delta
  9382. @item "\*e"
  9383. [0145] epsilon
  9384. @item "\*f"
  9385. [0146] phi
  9386. @item "\*g"
  9387. [0147] gamma
  9388. @item "\*y"
  9389. [0150] eta
  9390. @item "\*i"
  9391. [0151] iota
  9392. @item "\+f"
  9393. [0152] phi1
  9394. @item "\*k"
  9395. [0153] kappa
  9396. @item "\*l"
  9397. [0154] lambda
  9398. @item "\*m"
  9399. [0155] mu
  9400. @item "\*n"
  9401. [0156] nu
  9402. @item "\*o"
  9403. [0157] omicron
  9404. @item "\*p"
  9405. [0160] pi
  9406. @item "\*h"
  9407. [0161] theta
  9408. @item "\*r"
  9409. [0162] rho
  9410. @item "\*s"
  9411. [0163] sigma
  9412. @item "\*t"
  9413. [0164] tau
  9414. @item "\*u"
  9415. [0165] upsilon
  9416. @item "\+p"
  9417. [0166] omega1
  9418. @item "\*w"
  9419. [0167] omega
  9420. @item "\*c"
  9421. [0170] xi
  9422. @item "\*q"
  9423. [0171] psi
  9424. @item "\*z"
  9425. [0172] zeta
  9426. @item "\ap"
  9427. [0176] similar
  9428. @item "\+U"
  9429. [0241] Upsilon1
  9430. @item "\fm"
  9431. [0242] minute
  9432. @item "\<="
  9433. [0243] lessequal
  9434. @item "\f/"
  9435. [0244] fraction
  9436. @item "\if"
  9437. [0245] infinity
  9438. @item "\Fn"
  9439. [0246] florin
  9440. @item "\CL"
  9441. [0247] club
  9442. @item "\DI"
  9443. [0250] diamond
  9444. @item "\HE"
  9445. [0251] heart
  9446. @item "\SP"
  9447. [0252] spade
  9448. @item "\<>"
  9449. [0253] arrowboth
  9450. @item "\<-"
  9451. [0254] arrowleft
  9452. @item "\ua"
  9453. [0255] arrowup
  9454. @item "\->"
  9455. [0256] arrowright
  9456. @item "\da"
  9457. [0257] arrowdown
  9458. @item "\de"
  9459. [0260] degree
  9460. @item "\+-"
  9461. [0261] plusminus
  9462. @item "\sd"
  9463. [0262] second
  9464. @item "\>="
  9465. [0263] greaterequal
  9466. @item "\mu"
  9467. [0264] multiply
  9468. @item "\pt"
  9469. [0265] proportional
  9470. @item "\pd"
  9471. [0266] partialdiff
  9472. @item "\bu"
  9473. [0267] bullet
  9474. @item "\di"
  9475. [0270] divide
  9476. @item "\!="
  9477. [0271] notequal
  9478. @item "\=="
  9479. [0272] equivalence
  9480. @item "\~~"
  9481. [0273] approxequal
  9482. @item "\.."
  9483. [0274] ellipsis
  9484. @item NONE
  9485. [0275] arrowvertex
  9486. @item "\an"
  9487. [0276] arrowhorizex
  9488. @item "\CR"
  9489. [0277] carriagereturn
  9490. @item "\Ah"
  9491. [0300] aleph
  9492. @item "\Im"
  9493. [0301] Ifraktur
  9494. @item "\Re"
  9495. [0302] Rfraktur
  9496. @item "\wp"
  9497. [0303] weierstrass
  9498. @item "\c*"
  9499. [0304] circlemultiply
  9500. @item "\c+"
  9501. [0305] circleplus
  9502. @item "\es"
  9503. [0306] emptyset
  9504. @item "\ca"
  9505. [0307] cap
  9506. @item "\cu"
  9507. [0310] cup
  9508. @item "\SS"
  9509. [0311] superset
  9510. @item "\ip"
  9511. [0312] reflexsuperset
  9512. @item "\n<"
  9513. [0313] notsubset
  9514. @item "\SB"
  9515. [0314] subset
  9516. @item "\ib"
  9517. [0315] reflexsubset
  9518. @item "\mo"
  9519. [0316] element
  9520. @item "\nm"
  9521. [0317] notelement
  9522. @item "\/_"
  9523. [0320] angle
  9524. @item "\gr"
  9525. [0321] nabla
  9526. @item "\rg"
  9527. [0322] registerserif
  9528. @item "\co"
  9529. [0323] copyrightserif
  9530. @item "\tm"
  9531. [0324] trademarkserif
  9532. @item "\PR"
  9533. [0325] product
  9534. @item "\sr"
  9535. [0326] radical
  9536. @item "\md"
  9537. [0327] dotmath
  9538. @item "\no"
  9539. [0330] logicalnot
  9540. @item "\AN"
  9541. [0331] logicaland
  9542. @item "\OR"
  9543. [0332] logicalor
  9544. @item "\hA"
  9545. [0333] arrowdblboth
  9546. @item "\lA"
  9547. [0334] arrowdblleft
  9548. @item "\uA"
  9549. [0335] arrowdblup
  9550. @item "\rA"
  9551. [0336] arrowdblright
  9552. @item "\dA"
  9553. [0337] arrowdbldown
  9554. @item "\lz"
  9555. [0340] lozenge
  9556. @item "\la"
  9557. [0341] angleleft
  9558. @item "\RG"
  9559. [0342] registersans
  9560. @item "\CO"
  9561. [0343] copyrightsans
  9562. @item "\TM"
  9563. [0344] trademarksans
  9564. @item "\SU"
  9565. [0345] summation
  9566. @item NONE
  9567. [0346] parenlefttp
  9568. @item NONE
  9569. [0347] parenleftex
  9570. @item NONE
  9571. [0350] parenleftbt
  9572. @item "\lc"
  9573. [0351] bracketlefttp
  9574. @item NONE
  9575. [0352] bracketleftex
  9576. @item "\lf"
  9577. [0353] bracketleftbt
  9578. @item "\lt"
  9579. [0354] bracelefttp
  9580. @item "\lk"
  9581. [0355] braceleftmid
  9582. @item "\lb"
  9583. [0356] braceleftbt
  9584. @item "\bv"
  9585. [0357] braceex
  9586. @item "\eu"
  9587. [0360] euro
  9588. @item "\ra"
  9589. [0361] angleright
  9590. @item "\is"
  9591. [0362] integral
  9592. @item NONE
  9593. [0363] integraltp
  9594. @item NONE
  9595. [0364] integralex
  9596. @item NONE
  9597. [0365] integralbt
  9598. @item NONE
  9599. [0366] parenrighttp
  9600. @item NONE
  9601. [0367] parenrightex
  9602. @item NONE
  9603. [0370] parenrightbt
  9604. @item "\rc"
  9605. [0371] bracketrighttp
  9606. @item NONE
  9607. [0372] bracketrightex
  9608. @item "\rf"
  9609. [0373] bracketrightbt
  9610. @item "\RT"
  9611. [0374] bracerighttp
  9612. @item "\rk"
  9613. [0375] bracerightmid
  9614. @item "\rb"
  9615. [0376] bracerightbt
  9616. @end table
  9617. Finally, there are escape sequences that apply only if the current font
  9618. is a Hershey font. Most of these escape sequences provide access to
  9619. special symbols that belong to no font, and are accessible by no other
  9620. means. These symbols are of two sorts: miscellaneous, and astronomical
  9621. or zodiacal. The escape sequences for the miscellaneous symbols are as
  9622. follows.
  9623. @table @asis
  9624. @item "\dd"
  9625. daggerdbl
  9626. @item "\dg"
  9627. dagger
  9628. @item "\hb"
  9629. hbar
  9630. @item "\li"
  9631. lineintegral
  9632. @item "\IB"
  9633. interbang
  9634. @item "\Lb"
  9635. lambdabar
  9636. @item "\~-"
  9637. modifiedcongruent
  9638. @item "\-+"
  9639. minusplus
  9640. @item "\||"
  9641. parallel
  9642. @item "\s-"
  9643. [variant form of s]
  9644. @end table
  9645. @noindent
  9646. The final escape sequence in the table above, "\s-", yields a letter
  9647. rather than a symbol. @w{It is} provided because in some Hershey fonts,
  9648. the shape of the lower-case @w{letter `s'} differs if it is the last
  9649. letter in a word. This is the case for HersheyGothicGerman. The German
  9650. word "besonders", for example, should be written as "besonder\s-" if it
  9651. is to be rendered correctly in this font. The same is true for the two
  9652. Hershey symbol fonts, with their Greek alphabets (in Greek text,
  9653. lower-case @w{final `s'} is different from lower-case @w{non-final
  9654. `s'}). @w{In Hershey} fonts where there is no distinction between final
  9655. and @w{non-final `s'}, @w{"s" and "\s-"} are equivalent.
  9656. The escape sequences for the astronomical symbols, including the signs
  9657. for the twelve constellations of the zodiac, are listed in the following
  9658. table. We stress that that like the preceding miscellaneous escape
  9659. sequences, they apply only if the current font is a Hershey font.
  9660. @table @asis
  9661. @item "\SO"
  9662. sun
  9663. @item "\ME"
  9664. mercury
  9665. @item "\VE"
  9666. venus
  9667. @item "\EA"
  9668. earth
  9669. @item "\MA"
  9670. mars
  9671. @item "\JU"
  9672. jupiter
  9673. @item "\SA"
  9674. saturn
  9675. @item "\UR"
  9676. uranus
  9677. @item "\NE"
  9678. neptune
  9679. @item "\PL"
  9680. pluto
  9681. @item "\LU"
  9682. moon
  9683. @item "\CT"
  9684. comet
  9685. @item "\ST"
  9686. star
  9687. @item "\AS"
  9688. ascendingnode
  9689. @item "\DE"
  9690. descendingnode
  9691. @item "\AR"
  9692. aries
  9693. @item "\TA"
  9694. taurus
  9695. @item "\GE"
  9696. gemini
  9697. @item "\CA"
  9698. cancer
  9699. @item "\LE"
  9700. leo
  9701. @item "\VI"
  9702. virgo
  9703. @item "\LI"
  9704. libra
  9705. @item "\SC"
  9706. scorpio
  9707. @item "\SG"
  9708. sagittarius
  9709. @item "\CP"
  9710. capricornus
  9711. @item "\AQ"
  9712. aquarius
  9713. @item "\PI"
  9714. pisces
  9715. @end table
  9716. The preceding miscellaneous and astronomical symbols are not the only
  9717. special non-font symbols that can be used if the current font is a
  9718. Hershey font. The entire library of glyphs digitized by Allen Hershey
  9719. is built into GNU @code{libplot}. @w{So text} strings may include any
  9720. Hershey glyph. Each of the available Hershey glyphs is identified by a
  9721. four-digit number. Standard Hershey @w{glyph #1} would be specified as
  9722. "\#H0001". The standard Hershey glyphs range from "\#H0001" to
  9723. "\#H3999", with a number of gaps. Some additional glyphs designed by
  9724. others appear in the "\#H4000"@dots{}"\#H4194" range. Syllabic Japanese
  9725. characters (Kana) are located in the "\#H4195"@dots{}"\#H4399" range.
  9726. You may order a table of nearly all the Hershey glyphs in the
  9727. "\#H0001"@dots{}"\#H3999" range from the U.S. National Technical
  9728. Information Service, at @w{+1 703} 487 4650. Ask for item number
  9729. PB251845; the current price is about US$40. By way of example, the
  9730. string
  9731. @example
  9732. "\#H0744\#H0745\#H0001\#H0002\#H0003\#H0869\#H0907\#H2330\#H2331"
  9733. @end example
  9734. @noindent
  9735. when drawn will display a shamrock, a fleur-de-lys, cartographic (small)
  9736. letters @w{A, B, C}, @w{a bell,} @w{a large} circle, @w{a treble}
  9737. clef, and @w{a bass} clef. Again, this assumes that the current font is
  9738. a Hershey font.
  9739. You may also use Japanese syllabic characters (Hiragana and Katakana)
  9740. and ideographic characters (Kanji) when drawing strings in any Hershey
  9741. font. @w{In all}, 603 Kanji are available; these are the same Kanji
  9742. that are available in the HersheyEUC font. The Japanese characters are
  9743. indexed according to the JIS X0208 standard for Japanese typography,
  9744. which represents each character by a two-byte sequence. The file
  9745. @file{kanji.doc}, which is distributed along with the GNU plotting
  9746. utilities, lists the available Kanji. @w{On most} systems it is
  9747. installed in @file{/usr/share/libplot} or
  9748. @file{/usr/local/share/libplot}.
  9749. Each JIS X0208 character would be specified by an escape sequence
  9750. which expresses this two-byte sequence as four hexadecimal digits,
  9751. such as "\#J357e". Both bytes must be in the
  9752. @code{0x21}@dots{}@code{0x7e} range in order to define a JIS X0208
  9753. character. Kanji are located at "\#J3021" and above. Characters
  9754. appearing elsewhere in the JIS X0208 encoding may be accessed
  9755. similarly. For example, Hiragana and Katakana are located in the
  9756. "\#J2421"@dots{}"\#J257e" range, and Roman characters in the
  9757. "\#J2321"@dots{}"\#J237e" range. The file @file{kana.doc}, which is
  9758. installed in the same directory as @file{kanji.doc}, lists the
  9759. encodings of the Hiragana and Katakana. For more on the JIS X0208
  9760. standard, see Ken Lunde's @cite{Understanding Japanese Information
  9761. Processing} (O'Reilly, 1993), and
  9762. @uref{http://www.praxagora.com/lunde/cjk_inf.html, his on-line
  9763. supplement}.
  9764. The Kanji numbering used in @w{A. N.} Nelson's @cite{Modern Reader's
  9765. Japanese-English Character Dictionary}, @w{a longtime} standard, is also
  9766. supported. (This dictionary is published by @w{C. E.} Tuttle and Co.,
  9767. with ISBN 0-8048-0408-7. @w{A revised} edition [ISBN 0-8048-2036-8]
  9768. appeared in 1997, but uses a different numbering.) `Nelson' escape
  9769. sequences for Kanji are similar to JIS X0208 escape sequences, but use
  9770. four decimal instead of four hexadecimal digits. The file
  9771. @file{kanji.doc} gives the correspondence between the JIS numbering
  9772. scheme and the Nelson numbering scheme. @w{For example}, "\#N0001" is
  9773. equivalent to "\#J306c". @w{It also} gives the positions of the
  9774. available Kanji in the Unicode encoding.
  9775. All available Kanji have the same width, which is the same as that of
  9776. the syllabic Japanese characters (Hiragana and Katakana). Each Kanji
  9777. that is not available will print as an `undefined character' glyph (@w{a
  9778. bundle} of horizontal lines). The same is true for non-Kanji JIS X0208
  9779. characters that are not available.
  9780. @node Marker Symbols, , Text String Format, Fonts and Markers
  9781. @appendixsection Available marker symbols
  9782. The GNU @code{libplot} library supports a standard set of marker
  9783. symbols, numbered 0@dots{}31. @w{A marker} symbol is a visual
  9784. representation of a point. The @code{libplot} marker symbols are the
  9785. symbols that the @code{graph} program will plot at each point of a
  9786. dataset, if the @samp{-S} option is specified.
  9787. Like a text string, a marker symbol has a font size. @w{In any} output
  9788. format, @w{a marker} symbol is guaranteed to be visible if its font size
  9789. is sufficiently large. Marker symbol #0 is an exception to this: by
  9790. convention, @w{symbol #0} means no symbol @w{at all}. Marker symbols in
  9791. the range 1@dots{}31 are defined @w{as follows}.
  9792. @enumerate
  9793. @item dot
  9794. @tex
  9795. ($\thinspace\cdot\thinspace$)
  9796. @end tex
  9797. @item plus (@math{+})
  9798. @item asterisk (@math{*})
  9799. @item circle
  9800. @tex
  9801. ($\circ$)
  9802. @end tex
  9803. @item cross
  9804. @tex
  9805. ($\times$)
  9806. @end tex
  9807. @item square
  9808. @item triangle
  9809. @item diamond
  9810. @item star
  9811. @item inverted triangle
  9812. @item starburst
  9813. @item fancy plus
  9814. @item fancy cross
  9815. @item fancy square
  9816. @item fancy diamond
  9817. @item filled circle
  9818. @item filled square
  9819. @item filled triangle
  9820. @item filled diamond
  9821. @item filled inverted triangle
  9822. @item filled fancy square
  9823. @item filled fancy diamond
  9824. @item half filled circle
  9825. @item half filled square
  9826. @item half filled triangle
  9827. @item half filled diamond
  9828. @item half filled inverted triangle
  9829. @item half filled fancy square
  9830. @item half filled fancy diamond
  9831. @item octagon
  9832. @item filled octagon
  9833. @end enumerate
  9834. @noindent
  9835. The interpretation of marker symbols 1 through 5 is the same as in the
  9836. @w{well known} Graphical Kernel System (GKS).
  9837. By convention, symbols 32 @w{and up} are interpreted as characters in a
  9838. certain text font. For @code{libplot}, this is simply the current font.
  9839. But for the @code{graph} program, @w{it is} the symbol font selected
  9840. with the @samp{--symbol-font-name} option. @w{By default}, the symbol
  9841. font is the ZapfDingbats font except in @code{graph -T png}, @code{graph
  9842. -T pnm}, @code{graph -T gif}, @code{graph -T pcl}, @code{graph -T hpgl}
  9843. and @code{graph -T tek}. Those variants of @code{graph} normally have
  9844. no access to ZapfDingbats and other Postscript fonts, so they use the
  9845. HersheySerif font instead.
  9846. Many of the characters in the ZapfDingbats font are suitable for use as
  9847. marker symbols. For example, character #74 is the Texas star. Doing
  9848. @example
  9849. echo 0 0 1 2 2 1 3 2 4 0 | graph -T ps -m 0 -S 74 0.1 > plot.ps
  9850. @end example
  9851. @noindent
  9852. will produce a Postscript plot consisting of five data points, not
  9853. joined by line segments. Each data point will be marked by a Texas
  9854. star, of a large font size (@w{0.1 times} the width of the plotting
  9855. box).
  9856. If you are using @code{graph -T pcl} or @code{graph -T hpgl} and wish to
  9857. use font characters as marker symbols, you should consider using the
  9858. Wingdings font, which is available when producing @w{PCL 5} or HP-GL/2
  9859. output. Doing
  9860. @example
  9861. echo 0 0 1 2 2 1 3 2 4 0 |
  9862. graph -T pcl -m 0 --symbol-font Wingdings -S 181 0.1 > plot.pcl
  9863. @end example
  9864. @noindent
  9865. will produce a @w{PCL 5} plot that is similar to the preceding
  9866. Postscript plot. The Wingdings font has the Texas star in location
  9867. #181.
  9868. @node Color Names, Page and Viewport Sizes, Fonts and Markers, Appendices
  9869. @appendix Specifying Colors by Name
  9870. The GNU @code{libplot} library allows colors to be specified by the
  9871. user. It includes the @code{bgcolorname}, @code{pencolorname}, and
  9872. @code{fillcolorname} functions, each of which takes a color as an
  9873. argument.
  9874. The command-line graphics programs built on @code{libplot}, namely
  9875. @code{graph}, @code{plot}, @code{pic2plot}, @code{tek2plot}, and
  9876. @code{plotfont}, allow colors to be specified on the command line. Each
  9877. of them supports a @samp{--bg-color} option, and each of them, other
  9878. than @code{graph}, supports a @samp{--pen-color} option. (@code{graph}
  9879. supports a more complicated @samp{--pen-colors} option, and a
  9880. @samp{--frame-color} option.)
  9881. In any of these contexts, a color may be specified precisely as a
  9882. hexadecimal string that gives by its 48-bit RGB representation. For
  9883. example, "#c0c0c0" is a silvery gray, and "#ffffff" is white. Also,
  9884. colors may be specified by name. 665 distinct names are recognized,
  9885. including familiar ones like "red", "green", and "blue", and obscure
  9886. ones like "dark magenta", "forest green", and "olive drab". Color names
  9887. are case-insensitive, and spaces are ignored. So, @w{for example},
  9888. "RosyBrown" is equivalent to "rosy brown", and "DarkGoldenrod3" to "dark
  9889. goldenrod 3".
  9890. The file @file{colors.txt}, which is distributed along with the GNU
  9891. plotting utilities, lists the 665 recognized color names. @w{On most}
  9892. systems it is installed in @file{/usr/share/libplot} or
  9893. @file{/usr/local/share/libplot}. The names are essentially those
  9894. recognized by recent releases of the @w{X Window} System, which on most
  9895. machines are listed in the file @file{/usr/lib/X11/rgb.txt}. However,
  9896. for every color name containing the string "gray", @w{a version}
  9897. containing "grey" has been included. @w{For example}, both "dark slate
  9898. gray 4" and "dark slate grey 4" are recognized color names.
  9899. @node Page and Viewport Sizes, Metafiles, Color Names, Appendices
  9900. @appendix Page Sizes and Viewport Sizes
  9901. When producing output in such vector formats as Illustrator,
  9902. Postscript, @w{PCL 5}, HP-GL, and Fig, it is important to specify the
  9903. size of the page on which the output will appear. Supported page
  9904. sizes are "letter", "a4", etc.; a full list appears below. The page
  9905. size is passed to the the GNU @code{libplot} library via the
  9906. @code{PAGESIZE} parameter. The command-line graphics programs
  9907. @code{graph}, @code{plot}, @code{pic2plot}, @code{tek2plot}, and
  9908. @code{plotfont}, which are @w{built on} @code{libplot}, similarly
  9909. support a @code{PAGESIZE} environment variable and a
  9910. @samp{--page-size} option.
  9911. Graphics drawn by @code{libplot} are nominally drawn within a graphics
  9912. display, or `viewport'. When producing raster formats such as PNG,
  9913. PNM, and pseudo-GIF, the viewport is simply a square or rectangular
  9914. bitmap. But when producing vector formats such as Illustrator,
  9915. Postscript, @w{PCL 5}, HP-GL, and Fig format, the viewport is a square
  9916. or rectangular region on the output page. (For the meaning of the
  9917. viewport when the output format is SVG or WebCGM, see below.) Except
  9918. in the HP-GL case, the viewport will @w{by default} be centered on the
  9919. page. For example, if the page size is "letter", the viewport will be
  9920. a square 8@dmn{in} by 8@dmn{in} region, centered on a 8.5@dmn{in} by
  9921. 11.0@dmn{in} page. Graphics will not be clipped to the viewport, so
  9922. the entire page will @w{in principle} be imageable.
  9923. Either or both of the dimensions of the viewport can be changed by the
  9924. user. For example, the page size could be specified as
  9925. "letter,xsize=4in", or "a4,xsize=10cm,ysize=15cm", where the specified
  9926. sizes will override the default dimensions of the viewport. The
  9927. dimensions of the viewport are allowed to be negative (@w{a negative}
  9928. dimension results in a reflection). Inches, centimeters, and
  9929. millimeters are the supported units.
  9930. For most vector output formats, it is possible to position the
  9931. viewport quite precisely, by specifying the location of its lower left
  9932. corner relative to the lower left corner of the page. For example,
  9933. the page size could be specified not merely as "letter" @w{or "a4"},
  9934. but as "letter,xorigin=2in,yorigin=3in", or
  9935. "a4,xorigin=0.5cm,yorigin=0.5cm". (The `xorigin' and `yorigin'
  9936. specifiers may be used in conjunction with `xsize' and `ysize'.) As
  9937. an alternative to `xorigin' and `yorigin', the viewport position could
  9938. be adjusted by supplying an offset vector, the offset being
  9939. interpreted as a shift away from the default position. For example,
  9940. the page size could be specified as "letter,yoffset=1.2in", or
  9941. "a4,xoffset=@minus{}5mm,yoffset=2.0cm". The viewport may also be
  9942. rotated, by setting the @code{ROTATION} parameter or environment
  9943. variable, or (@w{in the} case of the graphics programs) by using the
  9944. @samp{--rotation} option. A rotated viewport does not change the
  9945. position of its four corners. Rather, the graphics are rotated
  9946. @w{within it}. @w{If the} viewport is rectangular rather than square,
  9947. this `rotation' will necessarily include a rescaling.
  9948. Any ISO page size in the range "a0"@dots{}"a4" or ANSI page size in the
  9949. range "a"@dots{}"e" may be specified. ("letter" is an alias @w{for
  9950. "a"}, which is the default, and "tabloid" is an alias @w{for "b"}).
  9951. "legal", "ledger", and the JIS [Japanese Industrial Standard] size "b5"
  9952. are recognized also. The following are the supported page sizes and the
  9953. default square viewport size that corresponds to each.
  9954. @table @asis
  9955. @item "a" (or "letter"; 8.5@dmn{in} by 11.0@dmn{in})
  9956. 8.0@dmn{in}
  9957. @item "b" (or "tabloid"; 11.0@dmn{in} by 17.0@dmn{in})
  9958. 10.0@dmn{in}
  9959. @item "c" (17.0@dmn{in} by 22.0@dmn{in})
  9960. 16.0@dmn{in}
  9961. @item "d" (22.0@dmn{in} by 34.0@dmn{in})
  9962. 20.0@dmn{in}
  9963. @item "e" (34.0@dmn{in} by 44.0@dmn{in})
  9964. 32.0@dmn{in}
  9965. @item "legal" (8.5@dmn{in} by 14.0@dmn{in})
  9966. 8.0@dmn{in}
  9967. @item "ledger" (17.0@dmn{in} by 11.0@dmn{in})
  9968. 10.0@dmn{in}
  9969. @item "a4" (21.0@dmn{cm} by 29.7@dmn{cm})
  9970. 19.81@dmn{cm}
  9971. @item "a3" (29.7@dmn{cm} by 42.0@dmn{cm})
  9972. 27.18@dmn{cm}
  9973. @item "a2" (42.0@dmn{cm} by 59.4@dmn{cm})
  9974. 39.62@dmn{cm}
  9975. @item "a1" (59.4@dmn{cm} by 84.1@dmn{cm})
  9976. 56.90@dmn{cm}
  9977. @item "a0" (84.1@dmn{cm} by 118.9@dmn{cm})
  9978. 81.79@dmn{cm}
  9979. @item "b5" (18.2@dmn{cm} by 25.7@dmn{cm})
  9980. 16.94@dmn{cm}
  9981. @end table
  9982. As noted, SVG and WebCGM format are special. They have no notion of
  9983. the size of the Web page on which the viewport will ultimately be
  9984. positioned. They do have a notion of viewport size, though this will
  9985. typically be overridden when the output file is placed on a page by a
  9986. Web page designer. When producing SVG or WebCGM output, the viewport
  9987. size is set in the usual way: by @code{PAGESIZE}, or (@w{in the} case
  9988. of the graphics programs) the @samp{--page-size} option. For example,
  9989. if the specified page size is "letter", the viewport within which SVG
  9990. or WebCGM graphics are drawn will be an 8@dmn{in} by 8@dmn{in} square.
  9991. If it is "letter,xsize=6in,ysize=7in", then the viewport will be a
  9992. 6@dmn{in} by 7@dmn{in} rectangle, and so forth. The "xorigin",
  9993. "yorigin", "xoffset", and "yoffset" specifiers, if included, are
  9994. necessarily ignored.
  9995. For a similar reason, the "xorigin" and "yorigin" specifiers are
  9996. ignored when producing HP-GL or HP-GL/2 output. @w{By default}, the
  9997. lower left corner of the viewport is positioned at the HP-GL `scaling
  9998. @w{point' P1}, whose location is device-dependent and will not
  9999. normally coincide with the lower left corner of the physical page,
  10000. though it may be close to it. The "xoffset" and "yoffset" specifiers
  10001. are respected, however, and may be used to shift the viewport away
  10002. from its default position.
  10003. @node Metafiles, Auxiliary Software, Page and Viewport Sizes, Appendices
  10004. @appendix The Graphics Metafile Format
  10005. A GNU graphics metafile is produced by any application that uses the
  10006. Metafile Plotter support contained in GNU @code{libplot}. That includes
  10007. the raw variants of @code{graph}, @code{plot}, @code{pic2plot},
  10008. @code{tek2plot}, and @code{plotfont}. @w{A metafile} is a sort of audit
  10009. trail, which specifies a sequence of Plotter operations. Each operation
  10010. is represented by an @w{`op code'}: @w{a single} ASCII character. The
  10011. arguments of the operation, @w{if any}, immediately follow the @w{op
  10012. code}.
  10013. A metafile may use either of two encodings: binary (the default) or
  10014. portable (human-readable). Metafiles in the binary encoding begin with
  10015. the magic string @w{"#PLOT 1\n"}, and metafiles in the portable encoding
  10016. with the magic string @w{"#PLOT 2\n"}. @w{If you} intend to transfer
  10017. metafiles between machines of different types, you should use the
  10018. portable rather than the binary encoding. Portable metafiles are
  10019. produced by Metafile Plotters if the @code{META_PORTABLE} parameter is
  10020. set to "yes", and by the raw variants of GNU @code{graph} and the other
  10021. command-line graphics programs if the @samp{-O} option is specified.
  10022. Both binary and portable metafiles can be translated to other formats by
  10023. GNU @code{plot}. @xref{plot}.
  10024. In the portable encoding, the arguments of each operation (integers,
  10025. floating point numbers, or strings) are printed in a human-readable
  10026. form, separated by spaces, and each argument list ends with a newline.
  10027. @w{In the} binary encoding, the arguments are represented as integers,
  10028. single precision floating point numbers, or newline-terminated ASCII
  10029. strings. Using the newline character as a terminator is acceptable
  10030. because each Plotter operation includes a maximum of one string among
  10031. its arguments, and such a string may not include a newline. Also, the
  10032. string must come last among the arguments.
  10033. There are 97 Plotter operations in all. The most important are
  10034. @code{openpl} and @code{closepl}, which open and close a Plotter, i.e.,
  10035. begin and end a page of graphics. They are represented by the @w{op
  10036. codes} @w{@samp{o} and @samp{x}}, respectively. The @code{erase}
  10037. operation, if present, separates frames within a page. On real-time
  10038. display devices, @w{it is} interpreted as a screen erasure. @w{It is}
  10039. represented by the @w{op code @samp{e}}.
  10040. Each of the 94 other Plotter operations has a corresponding @w{op code},
  10041. with 12 exceptions. These 12 exceptions are @w{(1) the} control
  10042. operation @code{flushpl}, @w{(2) the} operations @code{havecap},
  10043. @code{labelwidth}, and @code{flabelwidth}, which merely return
  10044. information, @w{(3) the} @code{color}, @code{colorname},
  10045. @code{pencolorname}, @code{fillcolorname}, and @code{bgcolorname}
  10046. operations, which are internally mapped to @code{pencolor},
  10047. @code{fillcolor}, and @code{bgcolor}, @w{(4) the} @code{frotate},
  10048. @code{fscale}, and @code{ftranslate} operations, which are internally
  10049. mapped to @code{fconcat}, and @w{(5) the} @code{ffontname} operation,
  10050. which in a metafile would be indistinguishable from @code{fontname}.
  10051. @w{So besides} @w{@samp{o} and @samp{x}}, there are 83 possible @w{op
  10052. codes}, for a total @w{of 85}. The following table lists 10 of the
  10053. @w{op codes} other than @w{@samp{o} and @samp{x}}, followed by the
  10054. Plotter operation they @w{stand for}.
  10055. @table @asis
  10056. @item Op Code
  10057. Operation
  10058. @item @samp{a}
  10059. @code{arc}
  10060. @item @samp{c}
  10061. @code{circle}
  10062. @item @samp{e}
  10063. @code{erase}
  10064. @item @samp{f}
  10065. @code{linemod}
  10066. @item @samp{l}
  10067. @code{line}
  10068. @item @samp{m}
  10069. @code{move}
  10070. @item @samp{n}
  10071. @code{cont}
  10072. @item @samp{p}
  10073. @code{point}
  10074. @item @samp{s}
  10075. @code{space}
  10076. @item @samp{t}
  10077. @code{label}
  10078. @end table
  10079. @noindent
  10080. The full set of 85 @w{op codes} is listed in the @code{libplot} header
  10081. file @file{plot.h} and the @code{libplotter} header file
  10082. @file{plotter.h}, which are distributed along with the plotting
  10083. utilities. @w{On most} systems they are installed in
  10084. @file{/usr/include} or @file{/usr/local/include}.
  10085. The 10 op codes in the table above are actually the @w{op codes} of the
  10086. traditional `plot(5)' format produced by pre-GNU versions of
  10087. @code{graph} and @code{libplot}. The use of these @w{op codes} make GNU
  10088. metafile format compatible with plot(5) format. The absence of a magic
  10089. string, and the absence of the @w{@samp{o} and @samp{x}} @w{op codes},
  10090. makes it possible to distinguish files in plot(5) format from GNU
  10091. metafiles in the binary encoding. GNU @code{plot} can convert files in
  10092. plot(5) format to GNU metafiles in either the binary or the portable
  10093. encoding. @xref{plot}.
  10094. @node Auxiliary Software, History and Acknowledgements, Metafiles, Appendices
  10095. @appendix Obtaining Auxiliary Software
  10096. @menu
  10097. * idraw:: Obtaining the idraw drawing editor
  10098. * xfig:: Obtaining the xfig drawing editor
  10099. @end menu
  10100. @node idraw, xfig, Auxiliary Software, Auxiliary Software
  10101. @section How to get @code{idraw}
  10102. The @code{idraw} utility mentioned several times in this documentation
  10103. is a freely distributable interactive drawing editor for the @w{X
  10104. Window} System. @w{It can} display and edit the output of any
  10105. application that uses the Postscript Plotter support contained in GNU
  10106. @code{libplot}. That includes @code{graph -T ps}, @code{plot -T ps},
  10107. @code{pic2plot -T ps}, @code{tek2plot -T ps}, and @code{plotfont -T ps}.
  10108. The current version of @code{idraw} is maintained by Vectaport, Inc.,
  10109. and is available at @uref{http://www.vectaport.com, their Web site}.
  10110. @w{It is} part of the @code{ivtools} package, which is a framework for
  10111. building custom drawing editors. @code{idraw} was originally part of
  10112. the @code{InterViews} package, developed by Stanford University and
  10113. Silicon Graphics. The @code{InterViews} package is available at
  10114. @uref{ftp://interviews.stanford.edu, a distribution site}, but is
  10115. @w{no longer} supported. Retrieving the @code{ivtools} package instead
  10116. is recommended.
  10117. Also available at @uref{http://www.vectaport.com, Vectaport's Web
  10118. site} is an enhanced version of @code{idraw} called @code{drawtool}.
  10119. @code{drawtool} can import additional graphics in TIFF and PBM/PGM/PPM
  10120. formats, besides the X11 bitmaps that @code{idraw} can import.
  10121. @node xfig, , idraw, Auxiliary Software
  10122. @section How to get @code{xfig}
  10123. The @code{xfig} utility mentioned several times in this documentation is
  10124. a freely distributable interactive drawing editor for the @w{X Window}
  10125. System. @w{It can} display and edit the output of any application that
  10126. uses the Fig Plotter support contained in GNU @code{libplot}. That
  10127. includes @code{graph -T fig}, @code{plot -T fig}, @code{pic2plot -T
  10128. fig}, @code{tek2plot -T fig}, and @code{plotfont -T fig}.
  10129. The current version is available at
  10130. @uref{ftp://ftp.x.org/contrib/applications/drawing_tools/}. It can
  10131. import additional graphics in GIF, X11 bitmap, and Postscript formats.
  10132. Accompanying the editor is a package called @code{transfig}, which
  10133. allows @code{xfig} graphics to be exported in many formats. GIF, X11
  10134. bitmap, La@TeX{}, and Postscript formats are supported.
  10135. There is @uref{http://duke.usask.ca/~macphed/soft/fig, a Web page on Fig
  10136. format}, which discusses application software that can interoperate with
  10137. @code{xfig}.
  10138. @node History and Acknowledgements, Reporting Bugs, Auxiliary Software, Appendices
  10139. @appendix History and Acknowledgements
  10140. Several of the GNU plotting utilities were inspired by Unix plotting
  10141. utilities. A @code{graph} utility and various plot filters were present
  10142. in the first releases of Unix from Bell Laboratories, going @w{at least}
  10143. as far back as the @w{Version 4} distribution (1973). The first
  10144. supported display device was a Tektronix 611 storage scope. Most of the
  10145. work on tying the plot filters together and breaking out
  10146. device-dependent versions of @code{libplot} was performed by
  10147. @email{llc@@research.att.com, Lorinda Cherry}.
  10148. @w{By the} time of @w{Version 7} Unix (1979) and the subsequent Berkeley
  10149. releases, the package consisting of @code{graph}, @code{plot},
  10150. @code{spline}, and several device-dependent versions of @code{libplot}
  10151. was a standard Unix feature. Supported devices by the early 1980's
  10152. included Tektronix storage scopes, early graphics terminals,
  10153. 200@dmn{dpi} electrostatic printer/plotters from Versatec and Varian,
  10154. and pen plotters from Hewlett--Packard.
  10155. In 1989, @email{rich@@freebsd.org, Rich Murphey} wrote the first GNU
  10156. versions of @code{graph}, @code{plot}, and @code{spline}, and the
  10157. earliest documentation. Richard Stallman further directed development
  10158. of the programs and provided editorial support for the documentation.
  10159. @email{interran@@uluru.stanford.edu, John Interrante}, then of the
  10160. InterViews team at Stanford, generously provided the @code{idraw}
  10161. Postscript prologue now included in @code{libplot}, and helpful
  10162. comments. The package as it stood in 1991 was distributed under the
  10163. name `GNU graphics'.
  10164. In 1995 @email{rsm@@math.arizona.edu, Robert S. Maier} took over
  10165. development of the package, and designed and wrote the current,
  10166. maximally device-independent, standalone version of @code{libplot}.
  10167. He also rewrote @code{graph} from scratch, turning it into a real-time
  10168. filter that would use the new library. He fleshed out @code{spline}
  10169. too, by adding support for splines in tension, periodicity, and cubic
  10170. Bessel interpolation.
  10171. @code{libplot} now incorporates the @w{X Window} System code for
  10172. filling polygons and drawing wide polygonal lines and arcs. The code
  10173. is used when producing output in bitmap formats (e.g., PNG, PNM, and
  10174. pseudo-GIF)@. @w{It was} written by Brian Kelleher, Joel McCormack,
  10175. Todd Newman, Keith Packard, Robert Scheifler and Ken Whaley, who
  10176. worked for Digital Equipment Corp., MIT, and/or the @w{X Consortium},
  10177. and is copyright @copyright{} 1985--89 by the @w{X Consortium}.
  10178. Affinely transformed text strings are now generated and displayed by a
  10179. technique similar to that used by Alan Richardson in his
  10180. @code{xvertext} package, for displaying rotated strings.
  10181. The pseudo-GIF support now in @code{libplot} uses the `miGIF'
  10182. run-length encoding routines developed by
  10183. @email{mouse@@rodents.montreal.qc.ca, der Maus} and ivo which are
  10184. copyright @copyright{} 1998 by Hutchison Avenue Software Corporation.
  10185. The copyright notice and permission notice for the miGIF routines are
  10186. distributed with the source code distribution of the plotting
  10187. utilities.
  10188. Most development work on @code{ode} was performed by
  10189. @email{nbt@@reed.edu, Nick Tufillaro} in 1978--1994, on a sequence of
  10190. platforms that extended back to a PDP-11 running @w{Version 4} Unix. In
  10191. 1997 Robert Maier modified his 1994 version to agree with GNU
  10192. conventions on coding and command-line parsing, extended it to support
  10193. the full set of special functions supported by @code{gnuplot}, and
  10194. extended the exception handling.
  10195. Many other people aided the development of the plotting utilities
  10196. package along the way. The Hershey vector fonts now in @code{libplot}
  10197. are @w{of course} based on the characters digitized in the mid to late
  10198. 1960's by @w{Allen V.} Hershey, who deserves a vote of thanks.
  10199. Additional characters and/or marker symbols were taken from the SLAC
  10200. Unified Graphics System developed by @w{Robert C.} Beach in the
  10201. mid-1970's, and from the fonts designed by
  10202. @email{wolff@@inf.fu-berlin.de, Thomas Wolff} for Ghostscript. The
  10203. interpolation algorithms used in @code{spline} are based on the
  10204. algorithms of @email{cline@@cs.utexas.edu, @w{Alan K.} Cline}, as
  10205. described in his papers in the Apr.@: 1974 issue of
  10206. @cite{Communications of the ACM}@. The table-driven parser used in
  10207. @code{tek2plot} was written at Berkeley in the mid-1980's by
  10208. @email{moy@@parc.xerox.com, Edward Moy}. The `sagitta' algorithm used
  10209. in an extended form in @code{libplot} for drawing circular and
  10210. elliptic arcs was developed by Peter Karow of URW and
  10211. @email{turk@@computer.org, Ken Turkowski} of Apple.
  10212. @email{raymond.toy@@ericsson.com, Raymond Toy} helped with the tick mark
  10213. spacing code in @code{graph} and was the first to incorporate GNU
  10214. @code{getopt}. Arthur Smith, formerly of LASSP at Cornell, provided
  10215. code for his @code{xplot} utility. @email{beebe@@math.utah.edu,
  10216. Nelson Beebe} exhaustively tested the package installation process.
  10217. Robert Maier wrote the documentation, which now incorporates Nick
  10218. Tufillaro's @code{ode} manual. Julie Sussmann checked over the
  10219. documentation for style and clarity.
  10220. @node Reporting Bugs, GNU Free Documentation License, History and Acknowledgements, Appendices
  10221. @appendix Reporting Bugs
  10222. Please report all bugs in the GNU plotting utilities, including the
  10223. @code{libplot} library, to @email{bug-plotutils@@gnu.org}. @w{Be sure} to
  10224. say which version of the plotting utilities package you have. Each
  10225. command-line program announces the package version if you use the
  10226. @samp{--version} argument.
  10227. If you installed the package from scratch, be sure to say what
  10228. compiler (and compiler version) you used. @w{If your} problems are
  10229. installation-related, be sure to give all relevant information.
  10230. @node GNU Free Documentation License, , Reporting Bugs, Appendices
  10231. @appendix GNU Free Documentation License
  10232. @cindex FDL, GNU Free Documentation License
  10233. @center Version 1.2, November 2002
  10234. @display
  10235. Copyright @copyright{} 2000, 2001, 2002 Free Software Foundation, Inc.
  10236. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  10237. Everyone is permitted to copy and distribute verbatim copies
  10238. of this license document, but changing it is not allowed.
  10239. @end display
  10240. @enumerate 0
  10241. @item
  10242. PREAMBLE
  10243. The purpose of this License is to make a manual, textbook, or other
  10244. functional and useful document @dfn{free} in the sense of freedom: to
  10245. assure everyone the effective freedom to copy and redistribute it,
  10246. with or without modifying it, either commercially or noncommercially.
  10247. Secondarily, this License preserves for the author and publisher a way
  10248. to get credit for their work, while not being considered responsible
  10249. for modifications made by others.
  10250. This License is a kind of ``copyleft'', which means that derivative
  10251. works of the document must themselves be free in the same sense. It
  10252. complements the GNU General Public License, which is a copyleft
  10253. license designed for free software.
  10254. We have designed this License in order to use it for manuals for free
  10255. software, because free software needs free documentation: a free
  10256. program should come with manuals providing the same freedoms that the
  10257. software does. But this License is not limited to software manuals;
  10258. it can be used for any textual work, regardless of subject matter or
  10259. whether it is published as a printed book. We recommend this License
  10260. principally for works whose purpose is instruction or reference.
  10261. @item
  10262. APPLICABILITY AND DEFINITIONS
  10263. This License applies to any manual or other work, in any medium, that
  10264. contains a notice placed by the copyright holder saying it can be
  10265. distributed under the terms of this License. Such a notice grants a
  10266. world-wide, royalty-free license, unlimited in duration, to use that
  10267. work under the conditions stated herein. The ``Document'', below,
  10268. refers to any such manual or work. Any member of the public is a
  10269. licensee, and is addressed as ``you''. You accept the license if you
  10270. copy, modify or distribute the work in a way requiring permission
  10271. under copyright law.
  10272. A ``Modified Version'' of the Document means any work containing the
  10273. Document or a portion of it, either copied verbatim, or with
  10274. modifications and/or translated into another language.
  10275. A ``Secondary Section'' is a named appendix or a front-matter section
  10276. of the Document that deals exclusively with the relationship of the
  10277. publishers or authors of the Document to the Document's overall
  10278. subject (or to related matters) and contains nothing that could fall
  10279. directly within that overall subject. (Thus, if the Document is in
  10280. part a textbook of mathematics, a Secondary Section may not explain
  10281. any mathematics.) The relationship could be a matter of historical
  10282. connection with the subject or with related matters, or of legal,
  10283. commercial, philosophical, ethical or political position regarding
  10284. them.
  10285. The ``Invariant Sections'' are certain Secondary Sections whose titles
  10286. are designated, as being those of Invariant Sections, in the notice
  10287. that says that the Document is released under this License. If a
  10288. section does not fit the above definition of Secondary then it is not
  10289. allowed to be designated as Invariant. The Document may contain zero
  10290. Invariant Sections. If the Document does not identify any Invariant
  10291. Sections then there are none.
  10292. The ``Cover Texts'' are certain short passages of text that are listed,
  10293. as Front-Cover Texts or Back-Cover Texts, in the notice that says that
  10294. the Document is released under this License. A Front-Cover Text may
  10295. be at most 5 words, and a Back-Cover Text may be at most 25 words.
  10296. A ``Transparent'' copy of the Document means a machine-readable copy,
  10297. represented in a format whose specification is available to the
  10298. general public, that is suitable for revising the document
  10299. straightforwardly with generic text editors or (for images composed of
  10300. pixels) generic paint programs or (for drawings) some widely available
  10301. drawing editor, and that is suitable for input to text formatters or
  10302. for automatic translation to a variety of formats suitable for input
  10303. to text formatters. A copy made in an otherwise Transparent file
  10304. format whose markup, or absence of markup, has been arranged to thwart
  10305. or discourage subsequent modification by readers is not Transparent.
  10306. An image format is not Transparent if used for any substantial amount
  10307. of text. A copy that is not ``Transparent'' is called ``Opaque''.
  10308. Examples of suitable formats for Transparent copies include plain
  10309. @sc{ascii} without markup, Texinfo input format, La@TeX{} input
  10310. format, @acronym{SGML} or @acronym{XML} using a publicly available
  10311. @acronym{DTD}, and standard-conforming simple @acronym{HTML},
  10312. PostScript or @acronym{PDF} designed for human modification. Examples
  10313. of transparent image formats include @acronym{PNG}, @acronym{XCF} and
  10314. @acronym{JPG}. Opaque formats include proprietary formats that can be
  10315. read and edited only by proprietary word processors, @acronym{SGML} or
  10316. @acronym{XML} for which the @acronym{DTD} and/or processing tools are
  10317. not generally available, and the machine-generated @acronym{HTML},
  10318. PostScript or @acronym{PDF} produced by some word processors for
  10319. output purposes only.
  10320. The ``Title Page'' means, for a printed book, the title page itself,
  10321. plus such following pages as are needed to hold, legibly, the material
  10322. this License requires to appear in the title page. For works in
  10323. formats which do not have any title page as such, ``Title Page'' means
  10324. the text near the most prominent appearance of the work's title,
  10325. preceding the beginning of the body of the text.
  10326. A section ``Entitled XYZ'' means a named subunit of the Document whose
  10327. title either is precisely XYZ or contains XYZ in parentheses following
  10328. text that translates XYZ in another language. (Here XYZ stands for a
  10329. specific section name mentioned below, such as ``Acknowledgements'',
  10330. ``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title''
  10331. of such a section when you modify the Document means that it remains a
  10332. section ``Entitled XYZ'' according to this definition.
  10333. The Document may include Warranty Disclaimers next to the notice which
  10334. states that this License applies to the Document. These Warranty
  10335. Disclaimers are considered to be included by reference in this
  10336. License, but only as regards disclaiming warranties: any other
  10337. implication that these Warranty Disclaimers may have is void and has
  10338. no effect on the meaning of this License.
  10339. @item
  10340. VERBATIM COPYING
  10341. You may copy and distribute the Document in any medium, either
  10342. commercially or noncommercially, provided that this License, the
  10343. copyright notices, and the license notice saying this License applies
  10344. to the Document are reproduced in all copies, and that you add no other
  10345. conditions whatsoever to those of this License. You may not use
  10346. technical measures to obstruct or control the reading or further
  10347. copying of the copies you make or distribute. However, you may accept
  10348. compensation in exchange for copies. If you distribute a large enough
  10349. number of copies you must also follow the conditions in section 3.
  10350. You may also lend copies, under the same conditions stated above, and
  10351. you may publicly display copies.
  10352. @item
  10353. COPYING IN QUANTITY
  10354. If you publish printed copies (or copies in media that commonly have
  10355. printed covers) of the Document, numbering more than 100, and the
  10356. Document's license notice requires Cover Texts, you must enclose the
  10357. copies in covers that carry, clearly and legibly, all these Cover
  10358. Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
  10359. the back cover. Both covers must also clearly and legibly identify
  10360. you as the publisher of these copies. The front cover must present
  10361. the full title with all words of the title equally prominent and
  10362. visible. You may add other material on the covers in addition.
  10363. Copying with changes limited to the covers, as long as they preserve
  10364. the title of the Document and satisfy these conditions, can be treated
  10365. as verbatim copying in other respects.
  10366. If the required texts for either cover are too voluminous to fit
  10367. legibly, you should put the first ones listed (as many as fit
  10368. reasonably) on the actual cover, and continue the rest onto adjacent
  10369. pages.
  10370. If you publish or distribute Opaque copies of the Document numbering
  10371. more than 100, you must either include a machine-readable Transparent
  10372. copy along with each Opaque copy, or state in or with each Opaque copy
  10373. a computer-network location from which the general network-using
  10374. public has access to download using public-standard network protocols
  10375. a complete Transparent copy of the Document, free of added material.
  10376. If you use the latter option, you must take reasonably prudent steps,
  10377. when you begin distribution of Opaque copies in quantity, to ensure
  10378. that this Transparent copy will remain thus accessible at the stated
  10379. location until at least one year after the last time you distribute an
  10380. Opaque copy (directly or through your agents or retailers) of that
  10381. edition to the public.
  10382. It is requested, but not required, that you contact the authors of the
  10383. Document well before redistributing any large number of copies, to give
  10384. them a chance to provide you with an updated version of the Document.
  10385. @item
  10386. MODIFICATIONS
  10387. You may copy and distribute a Modified Version of the Document under
  10388. the conditions of sections 2 and 3 above, provided that you release
  10389. the Modified Version under precisely this License, with the Modified
  10390. Version filling the role of the Document, thus licensing distribution
  10391. and modification of the Modified Version to whoever possesses a copy
  10392. of it. In addition, you must do these things in the Modified Version:
  10393. @enumerate A
  10394. @item
  10395. Use in the Title Page (and on the covers, if any) a title distinct
  10396. from that of the Document, and from those of previous versions
  10397. (which should, if there were any, be listed in the History section
  10398. of the Document). You may use the same title as a previous version
  10399. if the original publisher of that version gives permission.
  10400. @item
  10401. List on the Title Page, as authors, one or more persons or entities
  10402. responsible for authorship of the modifications in the Modified
  10403. Version, together with at least five of the principal authors of the
  10404. Document (all of its principal authors, if it has fewer than five),
  10405. unless they release you from this requirement.
  10406. @item
  10407. State on the Title page the name of the publisher of the
  10408. Modified Version, as the publisher.
  10409. @item
  10410. Preserve all the copyright notices of the Document.
  10411. @item
  10412. Add an appropriate copyright notice for your modifications
  10413. adjacent to the other copyright notices.
  10414. @item
  10415. Include, immediately after the copyright notices, a license notice
  10416. giving the public permission to use the Modified Version under the
  10417. terms of this License, in the form shown in the Addendum below.
  10418. @item
  10419. Preserve in that license notice the full lists of Invariant Sections
  10420. and required Cover Texts given in the Document's license notice.
  10421. @item
  10422. Include an unaltered copy of this License.
  10423. @item
  10424. Preserve the section Entitled ``History'', Preserve its Title, and add
  10425. to it an item stating at least the title, year, new authors, and
  10426. publisher of the Modified Version as given on the Title Page. If
  10427. there is no section Entitled ``History'' in the Document, create one
  10428. stating the title, year, authors, and publisher of the Document as
  10429. given on its Title Page, then add an item describing the Modified
  10430. Version as stated in the previous sentence.
  10431. @item
  10432. Preserve the network location, if any, given in the Document for
  10433. public access to a Transparent copy of the Document, and likewise
  10434. the network locations given in the Document for previous versions
  10435. it was based on. These may be placed in the ``History'' section.
  10436. You may omit a network location for a work that was published at
  10437. least four years before the Document itself, or if the original
  10438. publisher of the version it refers to gives permission.
  10439. @item
  10440. For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve
  10441. the Title of the section, and preserve in the section all the
  10442. substance and tone of each of the contributor acknowledgements and/or
  10443. dedications given therein.
  10444. @item
  10445. Preserve all the Invariant Sections of the Document,
  10446. unaltered in their text and in their titles. Section numbers
  10447. or the equivalent are not considered part of the section titles.
  10448. @item
  10449. Delete any section Entitled ``Endorsements''. Such a section
  10450. may not be included in the Modified Version.
  10451. @item
  10452. Do not retitle any existing section to be Entitled ``Endorsements'' or
  10453. to conflict in title with any Invariant Section.
  10454. @item
  10455. Preserve any Warranty Disclaimers.
  10456. @end enumerate
  10457. If the Modified Version includes new front-matter sections or
  10458. appendices that qualify as Secondary Sections and contain no material
  10459. copied from the Document, you may at your option designate some or all
  10460. of these sections as invariant. To do this, add their titles to the
  10461. list of Invariant Sections in the Modified Version's license notice.
  10462. These titles must be distinct from any other section titles.
  10463. You may add a section Entitled ``Endorsements'', provided it contains
  10464. nothing but endorsements of your Modified Version by various
  10465. parties---for example, statements of peer review or that the text has
  10466. been approved by an organization as the authoritative definition of a
  10467. standard.
  10468. You may add a passage of up to five words as a Front-Cover Text, and a
  10469. passage of up to 25 words as a Back-Cover Text, to the end of the list
  10470. of Cover Texts in the Modified Version. Only one passage of
  10471. Front-Cover Text and one of Back-Cover Text may be added by (or
  10472. through arrangements made by) any one entity. If the Document already
  10473. includes a cover text for the same cover, previously added by you or
  10474. by arrangement made by the same entity you are acting on behalf of,
  10475. you may not add another; but you may replace the old one, on explicit
  10476. permission from the previous publisher that added the old one.
  10477. The author(s) and publisher(s) of the Document do not by this License
  10478. give permission to use their names for publicity for or to assert or
  10479. imply endorsement of any Modified Version.
  10480. @item
  10481. COMBINING DOCUMENTS
  10482. You may combine the Document with other documents released under this
  10483. License, under the terms defined in section 4 above for modified
  10484. versions, provided that you include in the combination all of the
  10485. Invariant Sections of all of the original documents, unmodified, and
  10486. list them all as Invariant Sections of your combined work in its
  10487. license notice, and that you preserve all their Warranty Disclaimers.
  10488. The combined work need only contain one copy of this License, and
  10489. multiple identical Invariant Sections may be replaced with a single
  10490. copy. If there are multiple Invariant Sections with the same name but
  10491. different contents, make the title of each such section unique by
  10492. adding at the end of it, in parentheses, the name of the original
  10493. author or publisher of that section if known, or else a unique number.
  10494. Make the same adjustment to the section titles in the list of
  10495. Invariant Sections in the license notice of the combined work.
  10496. In the combination, you must combine any sections Entitled ``History''
  10497. in the various original documents, forming one section Entitled
  10498. ``History''; likewise combine any sections Entitled ``Acknowledgements'',
  10499. and any sections Entitled ``Dedications''. You must delete all
  10500. sections Entitled ``Endorsements.''
  10501. @item
  10502. COLLECTIONS OF DOCUMENTS
  10503. You may make a collection consisting of the Document and other documents
  10504. released under this License, and replace the individual copies of this
  10505. License in the various documents with a single copy that is included in
  10506. the collection, provided that you follow the rules of this License for
  10507. verbatim copying of each of the documents in all other respects.
  10508. You may extract a single document from such a collection, and distribute
  10509. it individually under this License, provided you insert a copy of this
  10510. License into the extracted document, and follow this License in all
  10511. other respects regarding verbatim copying of that document.
  10512. @item
  10513. AGGREGATION WITH INDEPENDENT WORKS
  10514. A compilation of the Document or its derivatives with other separate
  10515. and independent documents or works, in or on a volume of a storage or
  10516. distribution medium, is called an ``aggregate'' if the copyright
  10517. resulting from the compilation is not used to limit the legal rights
  10518. of the compilation's users beyond what the individual works permit.
  10519. When the Document is included in an aggregate, this License does not
  10520. apply to the other works in the aggregate which are not themselves
  10521. derivative works of the Document.
  10522. If the Cover Text requirement of section 3 is applicable to these
  10523. copies of the Document, then if the Document is less than one half of
  10524. the entire aggregate, the Document's Cover Texts may be placed on
  10525. covers that bracket the Document within the aggregate, or the
  10526. electronic equivalent of covers if the Document is in electronic form.
  10527. Otherwise they must appear on printed covers that bracket the whole
  10528. aggregate.
  10529. @item
  10530. TRANSLATION
  10531. Translation is considered a kind of modification, so you may
  10532. distribute translations of the Document under the terms of section 4.
  10533. Replacing Invariant Sections with translations requires special
  10534. permission from their copyright holders, but you may include
  10535. translations of some or all Invariant Sections in addition to the
  10536. original versions of these Invariant Sections. You may include a
  10537. translation of this License, and all the license notices in the
  10538. Document, and any Warranty Disclaimers, provided that you also include
  10539. the original English version of this License and the original versions
  10540. of those notices and disclaimers. In case of a disagreement between
  10541. the translation and the original version of this License or a notice
  10542. or disclaimer, the original version will prevail.
  10543. If a section in the Document is Entitled ``Acknowledgements'',
  10544. ``Dedications'', or ``History'', the requirement (section 4) to Preserve
  10545. its Title (section 1) will typically require changing the actual
  10546. title.
  10547. @item
  10548. TERMINATION
  10549. You may not copy, modify, sublicense, or distribute the Document except
  10550. as expressly provided for under this License. Any other attempt to
  10551. copy, modify, sublicense or distribute the Document is void, and will
  10552. automatically terminate your rights under this License. However,
  10553. parties who have received copies, or rights, from you under this
  10554. License will not have their licenses terminated so long as such
  10555. parties remain in full compliance.
  10556. @item
  10557. FUTURE REVISIONS OF THIS LICENSE
  10558. The Free Software Foundation may publish new, revised versions
  10559. of the GNU Free Documentation License from time to time. Such new
  10560. versions will be similar in spirit to the present version, but may
  10561. differ in detail to address new problems or concerns. See
  10562. @uref{http://www.gnu.org/copyleft/}.
  10563. Each version of the License is given a distinguishing version number.
  10564. If the Document specifies that a particular numbered version of this
  10565. License ``or any later version'' applies to it, you have the option of
  10566. following the terms and conditions either of that specified version or
  10567. of any later version that has been published (not as a draft) by the
  10568. Free Software Foundation. If the Document does not specify a version
  10569. number of this License, you may choose any version ever published (not
  10570. as a draft) by the Free Software Foundation.
  10571. @end enumerate
  10572. @page
  10573. @appendixsec ADDENDUM: How to use this License for your documents
  10574. To use this License in a document you have written, include a copy of
  10575. the License in the document and put the following copyright and
  10576. license notices just after the title page:
  10577. @smallexample
  10578. @group
  10579. Copyright (C) @var{year} @var{your name}.
  10580. Permission is granted to copy, distribute and/or modify this document
  10581. under the terms of the GNU Free Documentation License, Version 1.2
  10582. or any later version published by the Free Software Foundation;
  10583. with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
  10584. Texts. A copy of the license is included in the section entitled ``GNU
  10585. Free Documentation License''.
  10586. @end group
  10587. @end smallexample
  10588. If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
  10589. replace the ``with...Texts.'' line with this:
  10590. @smallexample
  10591. @group
  10592. with the Invariant Sections being @var{list their titles}, with
  10593. the Front-Cover Texts being @var{list}, and with the Back-Cover Texts
  10594. being @var{list}.
  10595. @end group
  10596. @end smallexample
  10597. If you have Invariant Sections without Cover Texts, or some other
  10598. combination of the three, merge those two alternatives to suit the
  10599. situation.
  10600. If your document contains nontrivial examples of program code, we
  10601. recommend releasing these examples in parallel under your choice of
  10602. free software license, such as the GNU General Public License,
  10603. to permit their use in free software.
  10604. @contents
  10605. @bye