9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Colors in plot(1)
@ 2024-11-10 22:09 Anthony Sorace
  2024-11-10 23:20 ` umbraticus
  0 siblings, 1 reply; 7+ messages in thread
From: Anthony Sorace @ 2024-11-10 22:09 UTC (permalink / raw)
  To: 9fans

Am I misunderstanding something, or do these just not work? For example, I'd expect this:

        echo '1 2 3 4 5' | graph -a | plot -pr -cb -fg

to give me a red diagonal line in front of a blue background, filled in with green underneath. On both Plan 9 and p9p, I instead get the same as if I'd given plot no arguments. Am I missing something, or is this just broken?
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T62d5b23c85d6a7c1-Mf3266bdd8ebfacd375848c5d
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] Colors in plot(1)
  2024-11-10 22:09 [9fans] Colors in plot(1) Anthony Sorace
@ 2024-11-10 23:20 ` umbraticus
  2024-11-10 23:51   ` Anthony Sorace
  0 siblings, 1 reply; 7+ messages in thread
From: umbraticus @ 2024-11-10 23:20 UTC (permalink / raw)
  To: 9fans

I have only ever used the pen colour option to graph.
ie. at least this does something, so it can't be all broke

echo '1 2 3 4 5' | graph -a -p r | plot

but indeed your line doesn't work for me either.
from a quick look all I can say is that these tools could
do with being converted to using ARGBEGIN{}ARGEND
(removing the space between the p & r above breaks it, eg.)
I found bcolor() but got no further. may delve later.

umbraticus

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T62d5b23c85d6a7c1-M54fc973a394c16c591fdd46f
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] Colors in plot(1)
  2024-11-10 23:20 ` umbraticus
@ 2024-11-10 23:51   ` Anthony Sorace
  2024-11-11  0:04     ` Aidan K. Wiggins
  0 siblings, 1 reply; 7+ messages in thread
From: Anthony Sorace @ 2024-11-10 23:51 UTC (permalink / raw)
  To: 9fans

Yes, I see graph working, too, but afaik graph doesn’t have a way to do fill colors. 

> On Nov 10, 2024, at 15:21, umbraticus@prosimetrum.com wrote:
> 
> I have only ever used the pen colour option to graph.
> ie. at least this does something, so it can't be all broke
> 
> echo '1 2 3 4 5' | graph -a -p r | plot
> 
> but indeed your line doesn't work for me either.
> from a quick look all I can say is that these tools could
> do with being converted to using ARGBEGIN{}ARGEND
> (removing the space between the p & r above breaks it, eg.)
> I found bcolor() but got no further. may delve later.
> 
> umbraticus

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T62d5b23c85d6a7c1-M6d7468bb3c7fdaf1e6fd0aef
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] Colors in plot(1)
  2024-11-10 23:51   ` Anthony Sorace
@ 2024-11-11  0:04     ` Aidan K. Wiggins
  2024-11-11 16:15       ` James Cook
  0 siblings, 1 reply; 7+ messages in thread
From: Aidan K. Wiggins @ 2024-11-11  0:04 UTC (permalink / raw)
  To: 9fans

I'd imagine graph could, at least according to plot(6), using co/cf
commands.  (Haphazardly) Changing e1 to e0 in cfill()/color() seemed
to let me change foreground/pen colors at least, so I can do something
like:

        seq 0 5 | graph -a | plot -fb -cw

to get white text on a blue background.

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T62d5b23c85d6a7c1-Me8d3246aab4e37be43a112ec
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] Colors in plot(1)
  2024-11-11  0:04     ` Aidan K. Wiggins
@ 2024-11-11 16:15       ` James Cook
  2024-11-11 21:02         ` a
  2024-11-11 23:28         ` Aidan K. Wiggins
  0 siblings, 2 replies; 7+ messages in thread
From: James Cook @ 2024-11-11 16:15 UTC (permalink / raw)
  To: 9fans; +Cc: 9fans

Aidan K. Wiggins <akw@oneiri.one> wrote:
> I'd imagine graph could, at least according to plot(6), using co/cf
> commands.  (Haphazardly) Changing e1 to e0 in cfill()/color() seemed
> to let me change foreground/pen colors at least, so I can do something
> like:
> 
>         seq 0 5 | graph -a | plot -fb -cw
> 
> to get white text on a blue background.

I wonder if it's not just plot's option parsing that's buggy. The
documentation for di indicates it uses the cfill colour, but this:

	{ echo ra 0 0 100 100; echo cf b; echo di 50 50 50 } | plot

draws a black disc. I am not at all familiar with plot but that
seems wrong: "cf b" should have set the fill colour to blue.

-- 
James

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] Colors in plot(1)
  2024-11-11 16:15       ` James Cook
@ 2024-11-11 21:02         ` a
  2024-11-11 23:28         ` Aidan K. Wiggins
  1 sibling, 0 replies; 7+ messages in thread
From: a @ 2024-11-11 21:02 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 1334 bytes --]

Your example works if you use co instead of cf. I don't know whether to call this a documentation or implementation bug. It certainly seems weird that, say, sb (solid box) uses the fill color while di uses the background color. The documentation seems more consistent, but who knows.

Certainly the documentation seems to have gotten an incomplete conversion from 10th Edition unix and has been that way for Plan 9's history; see the definition of ra, referring to a missing table of max dimensions. I don't have a 10th Edition system handy to check how the implementation behaves here.

In any case, my initial question was based on a misunderstanding of what graph was giving plot. What I want is essentially a ridgeline plot; to get that I think I'd either have to make graph fill a polygon below the vectors (maybe that could just be a filter looking for an m command followed by a bunch of v commands?) or teach plot about a new ridgeline command.

I also had plot's -p wrong, based on a documentation error, but that didn't matter because it's a no-op in our current implementation anyway. 🤷
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T62d5b23c85d6a7c1-M302e62551b8d7418014a47df
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 3036 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] Colors in plot(1)
  2024-11-11 16:15       ` James Cook
  2024-11-11 21:02         ` a
@ 2024-11-11 23:28         ` Aidan K. Wiggins
  1 sibling, 0 replies; 7+ messages in thread
From: Aidan K. Wiggins @ 2024-11-11 23:28 UTC (permalink / raw)
  To: falsifian, 9fans

[-- Attachment #1: Type: text/plain, Size: 526 bytes --]

That's likely the case.  It seems using co in place of cf works in
your example:

{ echo ra 0 0 100 100; echo co b ; echo di 50 50 50; } | plot

But yes, any indication of the documentation leads us to believe cf
should work.  Plot and friends might benefit from a glazing over and
cleaning.
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T62d5b23c85d6a7c1-M8ebd2146817624564531112c
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: message/rfc822, Size: 8741 bytes --]

From: James Cook <falsifian@falsifian.org>
To: 9fans <9fans@9fans.net>
Cc: 9fans@9fans.net
Subject: Re: [9fans] Colors in plot(1)
Date: Mon, 11 Nov 2024 16:15:18 +0000
Message-ID: <2S30NKQO8VMS5.29VNYHQIFVAD5@falsifian.org>

Aidan K. Wiggins <akw@oneiri.one> wrote:
> I'd imagine graph could, at least according to plot(6), using co/cf
> commands.  (Haphazardly) Changing e1 to e0 in cfill()/color() seemed
> to let me change foreground/pen colors at least, so I can do something
> like:
> 
>         seq 0 5 | graph -a | plot -fb -cw
> 
> to get white text on a blue background.

I wonder if it's not just plot's option parsing that's buggy. The
documentation for di indicates it uses the cfill colour, but this:

	{ echo ra 0 0 100 100; echo cf b; echo di 50 50 50 } | plot

draws a black disc. I am not at all familiar with plot but that
seems wrong: "cf b" should have set the fill colour to blue.

-- 
James

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-11-11 23:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-10 22:09 [9fans] Colors in plot(1) Anthony Sorace
2024-11-10 23:20 ` umbraticus
2024-11-10 23:51   ` Anthony Sorace
2024-11-11  0:04     ` Aidan K. Wiggins
2024-11-11 16:15       ` James Cook
2024-11-11 21:02         ` a
2024-11-11 23:28         ` Aidan K. Wiggins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).