Re: Rectangular zones in graphs
Martin Michel <[email protected]> Sat, 20 Jun 2020 23:19:55 +0200
| Newsgroups | gmane.comp.type-setting.lout |
|---|---|
| Message-ID | <[email protected]> |
Just noticed that Jeff's answer and my response is missing in the mailing list archive. Here it comes… my problem was solved in a pragmatic but also elegant way. −Martin ----- Forwarded message from Martin Michel <[email protected]> ----- Date: Thu, 28 May 2020 21:48:33 +0200 From: Martin Michel <[email protected]> To: Jeffrey Kingston <[email protected]> Subject: Re: Rectangular zones in graphs User-Agent: NeoMutt/20180716 Hi Jeff, thank you for you thoughts and hints on this, it helped and I learned something new, again. Actually, I solved it by using the approach you mentioned in the last paragraph. I think this is the most pragmatic way to do it and remember that I have seen it somewhere else. I used the @Data paint { yes } command but that is the same result as with a filled histogram. My initial try where I nested the @Graph inside the @Diag was following an example from the user manual. In section 9.6 / page 207 at the top (version 3.39), I saw this diagram where two squares are connected with a line (@Link) by specification of x-y coordinates from the graph. So I tried to transfer the idea to the rectangluar. Anyhow, it is solved for me using the pragmatic way and for now I will not look into @OverStrike further. Maybe later when I have done the current task on hand. By the way, after exploring and fiddling with many settings, the resulting graph from Lout in Postscript/PDF looks really great, finest print quality IMHO and only one reason why I am using Lout with increasing frequency for technical documentation. So thank you from my side for all the effort you put also in the graph functionality and of course for Lout in general! −Martin On Mon, May 25, 2020 at 11:17:05PM +0000, Jeffrey Kingston wrote: > Martin, > > I haven't tried your example. I'm not sure what happens when > you nest a @Graph inside a @Diag like you have done. It > should work but I'm not sure that it would be helpful. @Diag is > not going to understand @Graph's coordinate system. > > Alternatively you could create a @Graph and a @Diag and > overstrike them using the @OverStrike symbol, but it would not > be easy to coordinate the two parts. There is an example in > the @Graph chapter of using @OverStrike to overstrike two graphs. > > I've had a quick look through the summary of the @Graph chapter and I can see > that there aren't any obviously applicable features. You can place an > arbitrary object on the graph but only an object of fixed size at a > particular point; I can't see a way to express both y1 and y2. Also > the object goes on top I believe, which is probably not what you want. > > So if I was doing this I think I would use @OverStrike with the corridor in the > first object (not sure how I would make it, but I would have to use trial and error > to get its size and position right) and the graph proper in the second object. > Not a great solution but it's all I can think of. > > Or here's another thought: a grey filled histogram across y2 and then > a white filled histogram across y1. If they are done first they should > come out behind the real data. Hmmm, I think that will work. > > Hope this helps. > > Jeff > ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ > From: Lout-users <[email protected]> on behalf of Martin Michel <[email protected]> > Sent: Monday, 25 May 2020 5:57 AM > To: [email protected] <[email protected]> > Subject: Rectangular zones in graphs > > Hi there, > > I want to highlight a certain "corridor" in a graph. In other words, a > zone in the range [y1:y2] should have a different colored background or > be overlayed by a semi-transparent box. I wonder if that is possible at > all with the Lout @Graph and @Diag calls. The user manual states it is > possible to place any arbitrary object in a grap, however, I have a hard > time figuring out how this should work. I even fail to draw a box inside > the graph, see this try expanding the example of the manual. My task is to > mark the band between 4 and 5 on the y-axis, but using @Node outline and > @Link fails with `undefined error: unknown or misspelt label? Command: > A` when piping the lout output to ps2pdf. Is this approach correct at > all or do I have to use @Box, other coordinates … ? > > @SysInclude { graph } > @SysInclude { diag } > @SysInclude { doc } > @Doc @Text @Begin > @Diag { > @Graph > abovecaption { New South Wales road deaths, 1960--1990 > (fatalities per 100 million vehicle km) } > objects { > @CTR at { 1960 4 } { A:: @Node outline {} } > @CTR at { 1990 4 } { B:: @Node outline {} } > @CTR at { 1990 5 } { C:: @Node outline {} } > @CTR at { 1960 5 } { D:: @Node outline {} } > } > { > @Data points { plus } pairs { dashed } > { 1963 5.6 1971 4.3 1976 3.7 1979 3.4 1982 2.9 1985 2.3 1988 2.0 } > } > @Link from { A } to { B } > @Link from { B } to { C } > @Link from { C } to { D } > @Link from { D } to { A } > } > @End @Text > > Any help is welcome, thanks for it in advance! > −Martin > ----- End forwarded message -----