# Support for plotting data in Fortran

**URL:** <https://fortran-lang.discourse.group/t/support-for-plotting-data-in-fortran/4328>\
**Category:** Uncategorized\
**Created:** [September 14, 2022, 11:41pm UTC](https://fortran-lang.discourse.group/t/support-for-plotting-data-in-fortran/4328 "2022-09-14T23:41:38Z")\
**Posts on this page:** 14\
**Page:** 2

<div class="post-metadata">

**Author:** ![RonShepard](https://avatars.discourse-cdn.com/v4/letter/r/a3d4f5/32.png) [@RonShepard](https://fortran-lang.discourse.group/u/RonShepard)\
**Post date:** [September 16, 2022, 3:58pm UTC](https://fortran-lang.discourse.group/t/support-for-plotting-data-in-fortran/4328/21 "2022-09-16T15:58:31Z")

</div>

> [@Pap](#):
>
> Sadly, I never managed to see anything…

I think about 5% of the people are like that. One of my coworkers at the time had monocular vision, and he could never see the 3D images either.

At first, I had to concentrate on the images a few seconds before my brain could get in the right mode. But after a few days of working with the images, it became almost instantaneous. Now after 30 years, I’m back to staring at them for a few seconds first.

---

<div class="post-metadata">

**Author:** ![wclodius](https://avatars.discourse-cdn.com/v4/letter/w/87869e/32.png) [@wclodius](https://fortran-lang.discourse.group/u/wclodius)\
**Post date:** [September 16, 2022, 4:34pm UTC](https://fortran-lang.discourse.group/t/support-for-plotting-data-in-fortran/4328/22 "2022-09-16T16:34:53Z")

</div>

I don’t think object orientation is necessary for a good plotting package. For over a decade I used the Interactive Data Language (IDL). From the start this had very good imperative plotting procedures that I loved. Then in the late 1990s it adopted object orientation. The adoption of object orientation for a new plotting library was a disaster. The syntax was not particularly intuitive. However, a bigger problem, which admittedly had nothing to do with object orientation, was that the implementation did not match the documentation. It was obvious that at some point they had a “we have got to ship this sometime” moment and it was shipped in an incomplete state. However they never fully corrected this. and as a result people were happily using procedural graphics over object oriented graphics for more than a decade later.  
FWIW a problem with incorporating graphics into a standard language is that it tends to be very documentation heavy. Another problem is, that if you want to have real time graphics, it is useful to have environment dependent options. File output options can also depend on the file type.

---

<div class="post-metadata">

**Author:** ![rgba](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/rgba/32/2115_2.png) [@rgba](https://fortran-lang.discourse.group/u/rgba)\
**Post date:** [September 16, 2022, 6:33pm UTC](https://fortran-lang.discourse.group/t/support-for-plotting-data-in-fortran/4328/23 "2022-09-16T18:33:32Z")

</div>

> [@Pap](#):
>
> You are entering a very subjective area now (except this time you try to make it look like science later on.)

> [@Pap](#):
>
> At least my decision to call it a “non-starter” is based on a little more than… colormaps on a website.

There are surely subjective aspects, but let’s not try to dismiss the (few?) objective ones. I should have provided paper reference straight away I guess:

> **[A colour scheme for the display of astronomical intensity images](https://arxiv.org/abs/1108.5083)**
>
> I describe a colour scheme that is appropriate for the screen display of intensity images. This -- unlike many currently available schemes -- is designed to be monotonically increasing in terms of its perceived brightness. Also, when printed on a...

> **[Optimizing colormaps with consideration for color vision deficiency to enable...](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0199239)**
>
> Color vision deficiency (CVD) affects more than 4% of the population and leads to a different visual perception of colors. Though this has been known for decades, colormaps with many colors across the visual spectra are often used to represent data,...

[http://dx.doi.org/10.5670/oceanog.2016.66](http://dx.doi.org/10.5670/oceanog.2016.66)

[https://www.nature.com/articles/s41467-020-19160-7](https://www.nature.com/articles/s41467-020-19160-7)

By community attention I just meant that people doing research in color theory most likely develop their new findings in popular modern packages, which is not surprising at all. Old packages, that surely had good reasons for their defaults, i. e.

> [@urbanjost](#):
>
> when the main color output device was a pen plotter, or a low-resolution screen.

I totally get this and agree it was the right choice at the time.

But now, despite obviously giving the possibility to customize everything (I mean, you can always pass a list of rgba values or hex codes…), they are slow to catch on sensible defaults, which is really the only point I was making about colors. _Default_ line palette and _default_ colormaps.

> [@Pap](#):
>
> For the former, I would pick a dark background (and yes, “rainbow colors” if I so wish,)

You can do whatever you wish, of course, but please be aware that even at an early stage of inspection looking at your preliminary data with a deeply skewed colormap would introduce a significant risk of getting equally skewed preliminary impressions, and in the extreme case jeopardize the research process itself. It can be late to realize a feature in the data was just a colormap artifact when you are preparing the definitive figure for the paper! Even more important if you ore one of your collaborators has color deficiency or you want to print with low quality hardware or even in black white: rainbow colormaps would become basically unreadable, newer perceptually uniform colormaps would generate a smooth, monotonic, constant derivative grey scale map i. e. exactly what you want.

If you don’t buy these points please just read the paper above, especially the lates nature communication or the one about matplotlib’s new defaults.

You need good defaults because you cannot expect any scientist to be a color theory expert and we all want the scientific community to avoid color-related pitfalls, right?

Finally, I’d give you a personal viewpoint (because yes, there are _many_ subjective aspects). I personally don’t like the Gnuplot syntax, but I use Gnuplot a lot for portability reasons on HPC servers (yes the marvelous “dumb” terminal). I almost equally dislike Python (even if I find it a little easier to navigate) and I’m actually personally frustrated a bit by matplotlib’s popularity.  
What I like for plotting is matlab, which unfortunately has not-so-good colormaps so, since I didn’t want to surrender to Python, I just [collected myself](https://github.com/bellomia/colorlab) a bunch of open source implementations in a unified user API, which for my projects substitutes always the default one. So yes, what I most agree with is:

> [@urbanjost](#):
>
> They really should look at changing those defaults.

where “they” includes matlab too.

(You cannot expect every user to roll his own colormap package for every plotting library right?)

---

<div class="post-metadata">

**Author:** ![rgba](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/rgba/32/2115_2.png) [@rgba](https://fortran-lang.discourse.group/u/rgba)\
**Post date:** [September 16, 2022, 7:14pm UTC](https://fortran-lang.discourse.group/t/support-for-plotting-data-in-fortran/4328/24 "2022-09-16T19:14:28Z")

</div>

> [@Pap](#):
>
> At least my decision to call it a “non-starter” is based on a little more than… colormaps on a website.

Anyway aren’t plotting libraries all about visuals? Why is it so strange to evaluate them on a visual basis?

But yes, for intensive plotting, which is nothing but very intensive I/O I also agree that we should avoid interpreted approaches. A wrapper to matplotlib or similar is only really useful if all you want is to generate plots after all calculations are done and I agree that can well be done by just exiting the fortran program and starting a Gnuplot, Python or whatever session.

The only convenience about doing it from inside a fortran program is to avoid passing manually the data though dat files, which are terribly storage inefficient, or even more refined formats, like HDF5, which instead introduce the problem of successfully interface to the storage standard from both sides.

So I agree the choice for intensive plotting is not trivial at all…

---

<div class="post-metadata">

**Author:** ![RonShepard](https://avatars.discourse-cdn.com/v4/letter/r/a3d4f5/32.png) [@RonShepard](https://fortran-lang.discourse.group/u/RonShepard)\
**Post date:** [September 16, 2022, 7:32pm UTC](https://fortran-lang.discourse.group/t/support-for-plotting-data-in-fortran/4328/25 "2022-09-16T19:32:34Z")

</div>

> Color vision deficiency (CVD) affects more than 4% of the population and leads to a different visual perception of colors.

I think this includes the various kinds of color-blindness, such as the common genetic red-green condition. I was surprised to learn a while back that the opposite is also true, there is a genetic condition that allows some people (mostly, or maybe all, women) to see more colors.

---

<div class="post-metadata">

**Author:** ![rgba](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/rgba/32/2115_2.png) [@rgba](https://fortran-lang.discourse.group/u/rgba)\
**Post date:** [September 16, 2022, 7:36pm UTC](https://fortran-lang.discourse.group/t/support-for-plotting-data-in-fortran/4328/27 "2022-09-16T19:36:35Z")

</div>

Ok, there is much much more than I thought around… and some of these appear really nice to experiment with!

Thanks a lot for your work on searching, parsing and cataloging the ecosystem. It’s really useful!

---

<div class="post-metadata">

**Author:** ![FortranFan](https://avatars.discourse-cdn.com/v4/letter/f/96bed5/32.png) [@FortranFan](https://fortran-lang.discourse.group/u/FortranFan)\
**Post date:** [September 16, 2022, 7:44pm UTC](https://fortran-lang.discourse.group/t/support-for-plotting-data-in-fortran/4328/28 "2022-09-16T19:44:16Z")

</div>

> [@RonShepard](#):
>
> There is a saying “The devil is in the details,” which I think applies here. …

I agree.

However Fortran at this stage can do well by focusing on the other saying, **getting the basics right.**

Incorporating any kind of direct support toward graphics in the language standard is likely a fool’s errand now.

However, the language standard can include a few basic goodies that will make it easier much to develop user libraries or to advance community `stdlib` efforts toward graphics that will also make it easier for the practitioners to consume them.

Consider something as simple and basic as **`ENUM`** : a good-featured `ENUM` facility can make it so easy and convenient to work with plotting and graphics libraries. Alas, Fortran 202X falls so short even with this.

And an **intrinsic bit type** in Fortran, one that would help out so much toward user library solutions toward graphics, appears entirely out of reach for the current practitioners in their programming lifetimes.

It is such a shame how the practitioners of Fortran keep getting shortchanged by the base language and its committee by continuing to overlook certain basic facilities, all in the name of disdain or wanting to do that which is less work for vendors at the cost of practitioner needs. It should not be like this.

---

<div class="post-metadata">

**Author:** ![Pap](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/pap/32/1305_2.png) [@Pap](https://fortran-lang.discourse.group/u/Pap)\
**Post date:** [September 16, 2022, 8:30pm UTC](https://fortran-lang.discourse.group/t/support-for-plotting-data-in-fortran/4328/29 "2022-09-16T20:30:15Z")

</div>

> [@rgba](#):
>
> You need good defaults because you cannot expect any scientist to be a color theory expert and we all want the scientific community to avoid color-related pitfalls, right?

I’m mostly interested on eps images (plots) for publications. None of those has color, at least in my domain of interest. On the fly plots are useful sometimes, but I don’t think you need a PhD in color theory to pick the right palette for such plots, given they just serve a quick inspection during runtime.

> [@rgba](#):
>
> Anyway aren’t plotting libraries all about visuals? Why is it so strange to evaluate them on a visual basis?

Because you should give them a serious try before concluding anything concrete about PLplot or DISLIN. The colormaps they have in their website are not very representative, I guess they made them that way to get more “eye-candy” images for obvious reasons - which apparently had the opposite effect to you than what they would expect.

Since you seem very interested on colormaps, and know more about color theory, I would be interested to hear your opinion about PLplot’s and DISLIN’s default color schemes - but again, don’t judge by demo images in websites, this requires a serious try first, which in turn requires time, and we are not in lockdown anymore to have plenty of it. 😄

> [@rgba](#):
>
> I almost equally dislike Python (even if I find it a little easier to navigate) and I’m actually personally frustrated a bit by matplotlib’s popularity.

Weird, you gave me the impression you are yet another “Python zealot” - you know, the ones ready to attack if someone says anything even slightly negative about Python. Every community has such zealots, but for some reason Python seems to have even more of them, or at least that’s what I have seen. Just to clarify, it’s still a small minority of the Python community, it just seems to be bigger in numbers, simply because the Python community is larger than others. And again, that’s what I have seen, it’s not concrete Statistics.

I apologize if I misunderstood.

Now, about matplotlib… I never tried it. I avoided saying anything about it for that reason, I only said that I wouldn’t consider a foreign package since I don’t have to, plus it’s interpreted. I must also admit that I am a bit… allergic to anything starting with “mat”, if you get what I mean - which I’m sure you do.

---

<div class="post-metadata">

**Author:** ![Pap](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/pap/32/1305_2.png) [@Pap](https://fortran-lang.discourse.group/u/Pap)\
**Post date:** [September 16, 2022, 9:06pm UTC](https://fortran-lang.discourse.group/t/support-for-plotting-data-in-fortran/4328/30 "2022-09-16T21:06:34Z")

</div>

I just got an automated message saying my last post was flagged as “inappropriate” without any explanation why, and what exactly was the offending part. I honestly don’t see anything inappropriate in this post, in fact I think it was a friendly one, mainly addressed to @rgba.  
I am also not sure I am willing to tolerate censorship. If this one is flagged as well, there won’t be a third. Ever.

Edit: The post was restored, it turns out it was not intended for deletion (just flagged), and it was deleted by mistake.

---

<div class="post-metadata">

**Author:** ![rgba](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/rgba/32/2115_2.png) [@rgba](https://fortran-lang.discourse.group/u/rgba)\
**Post date:** [September 16, 2022, 9:16pm UTC](https://fortran-lang.discourse.group/t/support-for-plotting-data-in-fortran/4328/31 "2022-09-16T21:16:23Z")

</div>

Oh. Well I agree that this was all together a completely friendly discussion about different opinions, what you would want an ideal disagreement to be. If that helps…

---

<div class="post-metadata">

**Author:** ![rgba](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/rgba/32/2115_2.png) [@rgba](https://fortran-lang.discourse.group/u/rgba)\
**Post date:** [September 16, 2022, 9:25pm UTC](https://fortran-lang.discourse.group/t/support-for-plotting-data-in-fortran/4328/32 "2022-09-16T21:25:51Z")

</div>

> [@Pap](#):
>
> but I don’t think you need a PhD in color theory

Yeah a PhD maybe is too much, but I’d rather avoid picking a choice all together and just trust the defaults. Of course there is always a range of expectations about sensible default vs easy and powerful customizations. Normally “power users of that particular aspect” prefer the latter and they know what they do, so that’s perfectly fine. “Normal” users wrt to that feature would instead prefer a nice default to put their trust on. It’s really the same as with linters/formatters, linear algebra packages (full blown low level calls to lapack/arpack/etc vs “poor man” easy wrappers like Armadillo, Matlab, Numpy etc), and finally with others aspect of plotting, like having crazy full control the tikz style vs wrapping Gnuplot in a very limited but friendly script like [Eplot](https://github.com/chriswolfvision/eplot). If you “know nothing” about the low level details the “poor man” things can drive you a looong way, and faster then trying and drowning in the big power houses (thinking especially about Arpack here 🙈). If you instead are an expert you would find yourself very limited by the “easy and opinionated approach” and flee away fast.

---

<div class="post-metadata">

**Author:** ![rgba](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/rgba/32/2115_2.png) [@rgba](https://fortran-lang.discourse.group/u/rgba)\
**Post date:** [September 16, 2022, 9:33pm UTC](https://fortran-lang.discourse.group/t/support-for-plotting-data-in-fortran/4328/33 "2022-09-16T21:33:13Z")

</div>

> [@Pap](#):
>
> Because you should give them a serious try before concluding anything concrete

> [@Pap](#):
>
> which in turn requires time, and we are not in lockdown anymore to have plenty of it.

Yes, that’s exactly the point. If you look at Beliavsky’s list there is so much to try out, hence you really need to make them “fail fast” before spending too much time on it. These big-number early selections are always inherently flawed but… I think that’s it in this world full of stuff to do and scarce in time.

> [@Pap](#):
>
> The colormaps they have in their website are not very representative, I guess they made them that way to get more “eye-candy” images for obvious reasons

Ok, specifically on this I totally got my eye off the ball apparently. From my reasoning I would expect the homepage of a plotting library to give the feel of what the daily experience plotting with it is, namely the defaults and some “ordinary” setups. Maybe have a “fancy stuff” page put somewhere else, for the curious/interested. But of course any entity would have its own idea of “marketing” and representation.

> [@Pap](#):
>
> Weird, you gave me the impression you are yet another “Python zealot”

Oh no, no, really not 🤠.

> [@Pap](#):
>
> but for some reason Python seems to have even more of them

Maybe just that the community is insanely big? Like collecting all kind of people, including these…?

> [@Pap](#):
>
> allergic to anything starting with “mat

Hehe! Matlab has its own _huge_ pitfalls, especially regarding structured/modular programming and I love to spend my time bashing those aspects (like really, just lookup how their namespaces work, with popcorn!). It’s really a toxic ✨ love/hate ✨relationship after all… With Fortran is more about a mature warm friendship maybe haha.

---

<div class="post-metadata">

**Author:** ![Pap](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/pap/32/1305_2.png) [@Pap](https://fortran-lang.discourse.group/u/Pap)\
**Post date:** [September 16, 2022, 11:46pm UTC](https://fortran-lang.discourse.group/t/support-for-plotting-data-in-fortran/4328/34 "2022-09-16T23:46:47Z")

</div>

> [@rgba](#):
>
> If you look at Beliavsky’s list there is so much to try out, hence you really need to make them “fail fast” before spending too much time on it.

I understand completely, in fact I must admit I did something similar several times. There are only 24 hours in a day, so to speak. However, “summary trials” like those unavoidably lead to some “false negatives”.

> [@rgba](#):
>
> But of course any entity would have its own idea of “marketing” and representation.

Yes, apparently the good guys behind PLplot are not exactly skilled CEOs - and I am not sure this is a compliment or not.

> [@rgba](#):
>
> Maybe just that the community is insanely big? Like collecting all kind of people, including these…?

This is in fact a very logical explanation.

> [@rgba](#):
>
> Matlab has its own _huge_ pitfalls, especially regarding structured/modular programming and I love to spend my time bashing those aspects

The thing that bothers me about Matlab is it tends to replace programming in a high-level language, while it’s typically orders of magnitude slower. It also encourages people (usually novices in research) to use it as a collection of “black boxes”. There is nothing wrong with using a ready-made numerical method hidden behind a single Matlab command, because not everybody wants to be a numerical analyst. But they should know what exactly that black box does, and what are its limits. In many cases, they don’t. I mean, when you have a big fat red button in front of you that will solve your problem at hand, you are eager to push it, right? The solution is one click away, who cares about the details. People doing such things don’t go far away, of course.  
And to be honest that’s not a Matlab problem, specifically. Similar platforms, like Scilab and Octave can be used that way. Even Computer Algebra Systems, originally created for symbolic computations, are used that way well.

---

<div class="post-metadata">

**Author:** ![Harper](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@Harper](https://fortran-lang.discourse.group/u/Harper)\
**Post date:** [September 17, 2022, 12:04am UTC](https://fortran-lang.discourse.group/t/support-for-plotting-data-in-fortran/4328/35 "2022-09-17T00:04:03Z")

</div>

Decades ago when the main language wars seemed to be Fortran vs Algol vs Pascal I heard someone ask a head of a mathematical department what programming language he used. The answer: “Graduate student.”

[Previous page](https://fortran-lang.discourse.group/t/support-for-plotting-data-in-fortran/4328.md?page=1)
