View Issue Details

IDProjectCategoryView StatusLast Update
0003527OpenFOAMPatchpublic2020-08-07 10:27
Reporterhandrake0724 Assigned Tohenry  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Versiondev 
Fixed in Versiondev 
Summary0003527: incorrect gnuplot option specified in gnuplotGraph::write
DescriptionIt seems like gnuplotGraph writer is using incorrect option for offset.
I am using gnuplot 5.2 and the usage for title read for example ,

set title {"<title-text>"} {offset <offset>} {font "<font>{,<size>}"}
               {{textcolor | tc} {lt <line_type> | default}} {{no}enhanced}

<offset> value should be used with offset keyword but in the code, <offset> value is used without offset keyword.
As a result, the result file, *.gplt does not work correctly.

set output statement writes contents if set term statement is active.
so current setup in the code write a empty file since set term is commented.
as a suggestion, how about svg instead of postscript for set term because ps representation sometimes does not show as intended depending on viewer implementation, especially MS Windows

Applying these changes, the diff would be as follows:

 void Foam::gnuplotGraph::write(const graph& g, Ostream& os) const
 {
- os << "#set term postscript color" << endl
- << "set output \"" << word(g.title()) << ".ps\"" << endl
- << "set title " << g.title() << " 0,0" << endl << "show title" << endl
- << "set xlabel " << g.xName() << " 0,0" << endl << "show xlabel" << endl
- << "set ylabel " << g.yName() << " 0,0" << endl << "show ylabel" << endl
+ os << "#set term svg" << endl
+ << "#set output \"" << word(g.title()) << ".svg\"" << endl
+ << "set title " << g.title() << " offset 0,0" << endl << "show title" << endl
+ << "set xlabel " << g.xName() << " offset 0,0" << endl << "show xlabel" << endl
+ << "set ylabel " << g.yName() << " offset 0,0" << endl << "show ylabel" << endl
         << "plot";
TagsNo tags attached.

Activities

henry

2020-08-05 12:02

manager   ~0011445

I can reproduce the issues on the boxTurb16 case. It is setup to display the graph from which you can write to any of the supported formats. I can change it to write postscript as this is the most common format but I can't assume everyone would rather have SVG. Maybe it would be better not to assume the format and leave the "set term" out. Alternatively users can easily introduce their own variants of the gnuplot writer to set the format and formatting anyway they want.

henry

2020-08-07 10:27

manager   ~0011447

Resolved by commit cbad0026974a8613df43b4cf2b532fb6be6eb376

Issue History

Date Modified Username Field Change
2020-08-05 02:45 handrake0724 New Issue
2020-08-05 12:02 henry Note Added: 0011445
2020-08-07 10:27 henry Assigned To => henry
2020-08-07 10:27 henry Status new => resolved
2020-08-07 10:27 henry Resolution open => fixed
2020-08-07 10:27 henry Fixed in Version => dev
2020-08-07 10:27 henry Note Added: 0011447