C/C++ want to do simple graphics in C with libplot unix standard library.

senenmut

Active Member

Reaction score: 18
Messages: 140

UNIX RULES - not gnu
look at this description :
"Several utilities were inspired by Unix plotting utilities. A graph utility and various plot filters were present in the first releases of Unix from Bell Laboratories. By the time of Version 7 Unix, `graph', `plot', `spline', and several device-dependent versions of `libplot' were a standard Unix features. The first display device supported by the package was a Tektronix 611 storage scope. By the early 1980s, numerous other devices were supported. "

look at this descriction of Oracle UNIX System V : here is the link : oracle UNIX SYSTEM V

i want to write very simple command line tools in C with the UNIX plot library.
with this i want to use the following commands :
- openpl()
- line(x1, y1, x2, y2)
- closepl()

back to the roots.

the library libplot is installed in the NOMADBSD compilation.
anyhow there are no man pages or descriptions there.

need some man instructions for this very simple onboard library.
 

ekvz

Well-Known Member

Reaction score: 281
Messages: 431

How did you come to the conclusion that it is available in NomadBSD? From looking over their repository i've seen nothing that would point to pulling it in and a quick websearch turned up nothing but the occational reference in relation to commercial UNIX versions. It obviously stemming from the dawn of times and also being marked as deprecated by the linked Solaris reference doesn't give me a lot of hope either.

To be honest i have some doubts about a lot of instructions turning up. If you know where to get sources (i guess at the very least Solaris should have them) your best bet might be to compile those yourself and inspect the headers. There might also be a (small) chance that the GNU library is similar enough to use it as a reference. Resources for this on seem to be plenty. I just wouldn't hold my breath for it actually being a clone or something along those lines.

One thing i'd keep in mind though: This thing seems to actually target real hardware. Unless you have one of the supported devices (which might by now be 40+ years old if you are unlucky) this library could very well be more or less useless.
 
OP
senenmut

senenmut

Active Member

Reaction score: 18
Messages: 140

ok that true.

i meant PLplot is in the UNIX package.

thats the right strategy to do graphics for simple use up to a point in C.

not HD or high definition games of course.

Only make the job done in a short time for little tools makes sense in that context.

And its LGPL the best you can get instead of full GNU.
 

kpedersen

Son of Beastie

Reaction score: 2,161
Messages: 3,003

There is also GraphViz (https://graphviz.org/)

It has a tacky name but a pretty decent legacy. Graphviz is a package of open-source tools initiated by AT&T Labs Research for drawing graphs specified in DOT language scripts

Licensed under the Eclipse Common Public License (a "weaker" copyleft license than GPL)

It (or more specifically its dot program) is used by Doxygen underneath to draw the "extra fancy" diagrams. You might already have it installed.
 
OP
senenmut

senenmut

Active Member

Reaction score: 18
Messages: 140

ok.
by the way , there is the traditional plotting library : bsd-plotutils available.

Has someone any descriptions for that one ?

no man pages on NOMADBSD.
pkg search bsd-plot
bsd-plotutils-1-4-2_2 Traditional plotting utilities

the first way for me is to work with onboard libraries no cross platform.
if bsd-plotutils has any kind of documentation i will use it.

you know the television advertisement :
" In 'hihaliba' they are still programming.
I have done the job already - lying on the beach with tequila sunrise"
 

ralphbsz

Son of Beastie

Reaction score: 2,407
Messages: 3,281

I've heard about the fact that AT&T Unix (which is *NOT* the same as BSD, look at the history) had some graphics utilities early on. You have to remember that the very origin of the Unix project (Richie and Thompson) was to write the software to drive a phototypesetter at Bell Labs. And graphics was all the rage in that day and age. As one example, the original Unix was written on a PDP-11, and in those days one of the major manufacturers of graphics hardware was Grinnell, which built Unibus-attached graphics hardware, initially for the PDP, later for the VAX. For example, the images on this web page (from the early 80s) are probably screen shots from a Grinnell: http://www-personal.umich.edu/~jcv/imb/imbp3.html (but they were generated not in C on Unix, but in Fortran on RSX-11 or later VMS).

In the 70s, when Unix was first being created (at Bell labs), graphics was the hot topic. For examples look at CATIA (a big CAD program, initially came out of France, later was an IBM product using mainframes), or look at the sciences. I used to use UGS (Unified Graphics System, a low-level graphics library) and TopDrawer (a graphing program, somewhat comparable to today's gnuplot), both came from SLAC. There was also hbook/hplot (from CERN, data analysis and graphing packages, as Fortran-linkable libraries) and GEM (from DESY, another graphic package). For rendering, there was lots of code (search for Evans & Sutherland on the web).

I have no idea whether any source of the Bell labs libraries remains. I think the user-space usage of the OS was not part of the release that was shipped from Bell labs to Berkeley, and the original graphics code may only exist in Bell labs. The best place to look is the source code of the dot graphics utility, which can be easily downloaded; I know that dot is very old and it may retain some original code.

I think today if you want a very simple graphics library which allows drawing of individual lines, dots and characters, the best way to do it is to call X11 primitives directly. The manuals for that used to be published in a 10-volume set which in the 90s everyone had on their bookshelf; they should be cheap to find on the used book market, and the X11 code still exists and is in use today. I wrote quite a bit of code using the X11 libraries in the last 80s, and it is slow and painful, as the calling conventions are bizarre.
 
OP
senenmut

senenmut

Active Member

Reaction score: 18
Messages: 140

ok , but why is the bsd-plotutility library then there with no description.
should i leave it and state it as "only be there for nothing" ?
 

ralphbsz

Son of Beastie

Reaction score: 2,407
Messages: 3,281

I have no idea. This is free software ... it has as good a description as the author or maintainance or porting volunteer decided to write. Plus, I have no idea what this libplot library even is; given how much interest there has been in computer graphics in the last 30+ years, I'm sure there have been hundreds of libraries whose name is "plot". Here's my suggestion: read the source code. Look, this is open software for a reason. If you are uninterested in reading source code, you might as well use a closed-source OS.

OK, so I just went and read the source for fun, or to be honest, the first 10 lines. Here is what it says:
Traditional plotting utilities and libraries taken from 4.3BSD with some improvements.
...
It's not compatible with old libplot due to ...
So this demonstrates that there is an older library also called libplot, which is incompatible. The other interesting thing is to look inside the source code for the device support. I see drivers for crt (probably some ncurses-like 80x24 resolution), DEC's Gigi terminal (I haven't seen one of those in the flesh in 30 years, they look like a VT100 keyboard but have way more electronics in them), the HP 7221 (same age), Imagen plotters (fun, anyone remember mixing liquid toner for those?), and Tektronix 4013/4014. I'm not sure any original 401x devices survive in functioning shape (those storage tubes have phosphor aging problems), but at least you can get Tek4014 emulators, for example in xterm. So running this library might be a difficult experiment in acquiring or emulating antique hardware first. Personally, I would start by downloading the Tek4014 control sequence documentation, making sure you have an xterm with Tek40xx emulator, and testing some simple graphics commands by hand (by echoing pre-constructed graphics commands to the terminal). Then compile and link plotlib, configure it for 4014 mode, and see (with a hex dump) what it outputs.

So let me give you a (humorous) hint: The Computer History museum is located at the corner of Highway 101 and Shoreline drive, in a building that used to be part of Silicon Graphics (<- look at the name of that company). I think they're closed for Covid, but in a few months you might be able to actually see some of the devices required for your retrocomputing project in the flesh.
 
OP
senenmut

senenmut

Active Member

Reaction score: 18
Messages: 140

so i broke in the museum at night and make an attemt to keep some of the hightech hardware away.
 
OP
senenmut

senenmut

Active Member

Reaction score: 18
Messages: 140

let me state the thing from my point of view,

for graphics programming up to a point (except high definition-games etc)
in C many programmer are diving to Cairo Library because it is simple to program.
The amount of code is small and recognisable. My view is that it is to much connected to GTK Library.
The openGL Graphics Library is high end and a huge amount of code lines is necessary for one thing.
I have seen the examples.
Thus i decided to take the PLPlot Library for Graphics Programming.
The code examples are readable and normal portion of lines.
LGPL is on the edge of choice that is still liberty to the programmer.
And it is written in C.
So the main bindings are C. Other languages are coming in later range.
PLPLOT GRAPHICS HOMEPAGE

program simple barcharts and status bars etc. FAST.

Remember : " In 'huilahiba' they are still programming.
while another programmer can lie on the sunbeach"
 

ralphbsz

Son of Beastie

Reaction score: 2,407
Messages: 3,281

The real question, which you should explain first, is what you want. Do you want a drawing library, where you draw lines, points, text? How about images and video? How about animation? Or do you want graphs? How much complexity of the graphs? If you look at the documentation for something like Mathematica or MatLab, is that what you're after? You are saying "barcharts and status bars". Do you want integration with data analysis software? How about performance? Is this a batch operation (where you spend a few days coding, then spend 1 minute running the program, and then a fully formed picture appears), or does it need to be interactive and responsive, or good enough for animation? What output media do you need? Today, the answer is often "a screen" (which is typically in a browser, or alternatively Xwindows in the guise of a GUI environment such as Gnome or KDE), and sometimes "paper" (which today nearly always means postscript.

Rule #0 of software engineering: Do not begin making any design or implementation decisions until you understand the requirements. You have not told us what the requirements are. So I'm doing educated guesses.

Here would be my suggestions: Gnuplot, Dot, Pyplot, MatPlotLib, Mathematica, Tcl/Tk, Jupyter, Kivy. There is no way I would waste my time on doing it with drawing primitives.

The other this is that you seem to be a member of the "simplicity" religion, you say C only, and you don't like GTK because it's too complex. That's like trying to build a gothic cathedral, using only matchsticks. Yes, the pioneers of computer graphics in the 1960s did that. They were heroes, and geniuses. Just like Seymore Cray, who entered a whole operating system without using a keyboard (he toggled it into the front panel switches of the Cyber, or some story like that). But you also have to recognize that these guys got very little done, it took an enormous amount of time, and they were geniuses. Just as an example: I know some of the people who implemented the first relational database (System R). It took them many years. There is a famous memo from Jim Gray about research having to be 10 years ahead of product deployment. Today I just open a database shell and type "SELECT * FROM SALES WHERE customer = 'Smith'", without first having to spend 10 years of R&D. You seem to be wanting to go back to the origin. That's fun as a hobby, perhaps instructive as an educational homework assignment, but pointless as an engineering discipline. 35 years ago, I still learned 360 and Cyber assembly as part of the operating systems class, and how to draw lines and points by sending control sequences to serial terminals and writing registers on CPU-attached devices, today that's ludicrous.
 
OP
senenmut

senenmut

Active Member

Reaction score: 18
Messages: 140

hi,
as i said. i do only C programming and take plplot for simple charts and graphics.
job already done on the beach. tequila.
thats what i do. nothing more but still not lesser.
running on UNIX.

PS.
Gnu's must stay outside the selling shop.
 

kpedersen

Son of Beastie

Reaction score: 2,161
Messages: 3,003

Here would be my suggestions: Gnuplot, Dot, Pyplot, MatPlotLib, Mathematica, Tcl/Tk, Jupyter, Kivy.
[...]
The other this is that you seem to be a member of the "simplicity" religion

To the average Windows or macOS user, some of your suggestions may also seem to belong to the cult of simplicity!

Simplicity is relative I suppose. (I also like to believe it still involves a keyboard ;))
 

ekvz

Well-Known Member

Reaction score: 281
Messages: 431

The real question, which you should explain first, is what you want. Do you want a drawing library, where you draw lines, points, text? How about images and video? How about animation? Or do you want graphs? How much complexity of the graphs? If you look at the documentation for something like Mathematica or MatLab, is that what you're after? You are saying "barcharts and status bars". Do you want integration with data analysis software? How about performance? Is this a batch operation (where you spend a few days coding, then spend 1 minute running the program, and then a fully formed picture appears), or does it need to be interactive and responsive, or good enough for animation? What output media do you need? Today, the answer is often "a screen" (which is typically in a browser, or alternatively Xwindows in the guise of a GUI environment such as Gnome or KDE), and sometimes "paper" (which today nearly always means postscript.

Rule #0 of software engineering: Do not begin making any design or implementation decisions until you understand the requirements. You have not told us what the requirements are. So I'm doing educated guesses.

Here would be my suggestions: Gnuplot, Dot, Pyplot, MatPlotLib, Mathematica, Tcl/Tk, Jupyter, Kivy. There is no way I would waste my time on doing it with drawing primitives.

The other this is that you seem to be a member of the "simplicity" religion, you say C only, and you don't like GTK because it's too complex. That's like trying to build a gothic cathedral, using only matchsticks. Yes, the pioneers of computer graphics in the 1960s did that. They were heroes, and geniuses. Just like Seymore Cray, who entered a whole operating system without using a keyboard (he toggled it into the front panel switches of the Cyber, or some story like that). But you also have to recognize that these guys got very little done, it took an enormous amount of time, and they were geniuses. Just as an example: I know some of the people who implemented the first relational database (System R). It took them many years. There is a famous memo from Jim Gray about research having to be 10 years ahead of product deployment. Today I just open a database shell and type "SELECT * FROM SALES WHERE customer = 'Smith'", without first having to spend 10 years of R&D. You seem to be wanting to go back to the origin. That's fun as a hobby, perhaps instructive as an educational homework assignment, but pointless as an engineering discipline. 35 years ago, I still learned 360 and Cyber assembly as part of the operating systems class, and how to draw lines and points by sending control sequences to serial terminals and writing registers on CPU-attached devices, today that's ludicrous.

Very good points. I am also quite curious as to what's the actual goal here. It's next to impossible to make a reasonable suggestion without knowing what the problem at hand is and i am also getting the impression of some rather arbitrary scale being used for evaluating options but then there is way to many unknown variables to be sure of anything...

as i said. i do only C programming and take plplot for simple charts and graphics.

No offense but that is very much non descriptive. Why the need to do it in C? For fun? Any actual requirement? What kind of charts? Where is the data coming from? Graphics in what relation? You see there is a ton of questionmarks.

Also it's somewhat strange how a library that seemingly just entered the picture like 1h ago (seemingly because i can't know if you have any previous experience with it or not) is already deemed to be the obvious solution. Have you written anything using it yet?
 
OP
senenmut

senenmut

Active Member

Reaction score: 18
Messages: 140

tons of questions ? why ?
i am a C programmer.
want to write little application for UNIX only.
need to make barcharts and progress charts.
for example : a calculation program and display of results in a barchart.
the data can come from anywhere. everything can be calculated.
for the quality of the library see the EXAMPLES on homepage yourself.
compare it with other libraries and you will see that it might be a good choice.
nothing is perfect but...
it must work. it must be ready fast. code should fit the style of the programmer.
it is somehow a personal preference too.
 

ekvz

Well-Known Member

Reaction score: 281
Messages: 431

tons of questions ? why ?
i am a C programmer.
want to write little application for UNIX only.
need to make barcharts and progress charts.
for example : a calculation program and display of results in a barchart.
the data can come from anywhere. everything can be calculated.
for the quality of the library see the EXAMPLES on homepage yourself.
compare it with other libraries and you will see that it might be a good choice.
nothing is perfect but...
it must work. it must be ready fast. code should fit the style of the programmer.
it is somehow a personal preference too.

I see i guess... Well, to be perfectly honest there is some things that strike me as odd but as long as it works for you why would i bother? You seem to have made up your mind anyways.
 

ralphbsz

Son of Beastie

Reaction score: 2,407
Messages: 3,281

it must work. it must be ready fast.
OK, so your requirements are: Working code in minimum time. You say that you have data and want to analyze it. In that case, I would completely stop using any form of programming language. There are tons of data analysis packages with built-in graphing tools around. Buy or download any one of them, you will have graphs faster and better than anything that requires writing code.

Next: Your choice of programming language. You want things fast? Stop using C. You're better off learning a more productive way to use a computer. I would go with R or Python (in particular in the SciPy variant). Learning SQL is probably a good idea too, because your input data is probably best described as a data base, and querying it the correct way is the most efficient way to analyze it.

Oh wait, you're not trying to be productive and write quality code, you are interested in your pseudo-religious belief in simplicity. OK, we can serve those wishes too. I'll come up with solutions that only require coding in C below, but be warned: they won't be good.

want to write little application for UNIX only.
need to make barcharts and progress charts.
Suggestion: In your C program, simply output a text output file in the format that's correct for either gnuplot or dot. Gnuplot has the big advantage that it will do bar charts super easily, and will handle things like titles, axes, labels on the axes, very easily, without you having to code it. Dot doesn't give you that, but it gives you more control about where the visual elements go.

Now, I already know that you will be super annoyed at me for this suggestion. Because in reality you are not interested in making graphs, or getting things done fast, or being productive.
 
OP
senenmut

senenmut

Active Member

Reaction score: 18
Messages: 140

hi fellers,
i changed my mind again.
Because i am a C Programmer i use MOTIF for GUI programming. that's stable.
as i see the mustle and hustle in PLPLOT Library about the other languages i changed my mind.
the endless discussions about cross platform and a ton of languages i hate.

now i become much simpler as ever before.

i will use the XCB Library for graphics. he he
then i can write a C command line application and display the results in graphics.

yes , you have heared true : a command line program in C.
you write a program in traditional C manner and do graphics such like traditional style.
without GUI.
fast faster XCB

here is the tutorial :
XCB Tutorial


or absolute simple that no one could believe it :

-write a AWK program
-write a file
-grap the file with c program
-display graphics with xcb

citation "you simple bastard , i hit you one on the mussle"
 

vigole

Daemon

Reaction score: 1,559
Messages: 1,392

What about using lib/turtle.py with python? it's very simple. It's written in python, but it's under python/cpython directory. That's got to count for something.
 
OP
senenmut

senenmut

Active Member

Reaction score: 18
Messages: 140

thank you vigole,

but i work only with compiled languages.

thank's anyway
 

ralphbsz

Son of Beastie

Reaction score: 2,407
Messages: 3,281

but i work only with compiled languages.
Can you explain why?

In particular: If you are going to do graphics involving a complex toolkit (such as Motif) to do the display, most of the data will be interpreted multiple times, as it flies from subsystem to subsystem.
 

Alain De Vos

Son of Beastie

Reaction score: 765
Messages: 2,518

Good question. Some use compiled because of library stability over longer periods.
Type checking ? Could be, when you don't pass void pointers.
 

vigole

Daemon

Reaction score: 1,559
Messages: 1,392

I have a thing for Intel64 ISA documentations and assembly language. I didn't want to use the word fetish, but I think I did! In the meantime, it doesn't hold me back to choose the right sledgehammer for the job.

A few month back, I had to assemble some sort of data presentation. Something like this: DB (sqlite!) => Statistical Analysis => Graph (on windows). I learnt python and 2 related libraries, and finished the job. There was no other way, to finish in time. Frankly it didn't worth it at all. That was a stupid project and I did a dumb move. It was a show-off! I shouldn't volunteer in the first place. But python saved the day.

Onward. Now, I've learnt python and few 3rd-party python libraries. I've finished the project successfully in a python-ian way! But it doesn't implies that I have to apply same logic to every single other situations. For example, I shall not touch those stupid frameworks such as Django to write server-side web applications. Also I will not download python-based PoC (1), run it on a RPi, write an article on a blog and pontificate on the YouTube: "oooh, Look at me, I'm a hacker!" (2).

back to the roots.
Where's the root? Why do you think C is the root? What about Intel Instruction sets and registers? There's also GPU, FPU and Intel Instruction Set Extensions e.g. SIMD, SSE(2|3|4), AVX(2|512) so forth and so on! Where is the limit?

BTW:
lib/turtle.py
On the lib/turtle.py topic, I have to admit, I wasn't serious.

Footnotes:

(1) PoC or Proof of Concept: such a dumb and lame phrase. Hearing It make me to throw up on my sneakers.
(2) I'm not in the loop, but I like to know what's the trend at the moment? making Wireshark video, installing Kali or talking about SEO.
 

ekvz

Well-Known Member

Reaction score: 281
Messages: 431

Good question. Some use compiled because of library stability over longer periods.
Type checking ? Could be, when you don't pass void pointers.

Good question indeed. My crystal ball thinks it's none of the above though but who knows maybe i am in for a surprise.
 
Top