Skip to content

Guidelines for figure authoring - #4813

Open
henrikt-ma wants to merge 1 commit into
modelica:masterfrom
henrikt-ma:figure-style-guide
Open

henrikt-ma wants to merge 1 commit into
modelica:masterfrom
henrikt-ma:figure-style-guide

Conversation

@henrikt-ma

@henrikt-ma henrikt-ma commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Guidelines for figures are needed now that we are about to add figures to examples on a large scale, as noted in #4811.

Specifically, #4811 (comment) requested that the guidelines should be introduced in a separate PR (this one).

Note that the use of a right $y$ axis is currently not supported by the specification. This is the topic of modelica/ModelicaSpecification#3938.

@beutlich beutlich added L: UsersGuide Issue addresses Modelica.UsersGuide documentation Issue addresses the documentation labels Sep 16, 2026
@maltelenz

Copy link
Copy Markdown
Contributor

The guidelines seem sensible to me, but I'll wait for other opinions before leaving an approving review in case there are dissenting opinions.

@AHaumer AHaumer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @henrikt-ma valuable work!
Just one minor change: The destination of this link is not found.
<a href="modelica://Modelica.UsersGuide.Conventions.Documentation.Figures">Figures embedded in HTML documentation</a>
After fixing that (I don't know what you wanted to link) I'll approve it!
Anyhow, I'll try to update my PR #4811 following these recommendations.

@tobolar

tobolar commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Just one minor change: The destination of this link is not found.
Figures embedded in HTML documentation

I suppose this is a link to line 1848 of the same file Modelica/UsersGuide/Conventions.mo.

annotation (Documentation(info="<html>
<p>
The use of figures in example models shall consider the following guidelines.
Figures are defined in the <code>figures</code> sub-annotation of the <code>Documentation</code> annotation, explained in detail in <a href=\"https://specification.modelica.org/maint/3.6/annotations.html#annotations-for-figures\">Section&nbsp;18.2.2 <em>Figures</em> of the Modelica&nbsp;3.6 specification</a>.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Figures are defined in the <code>figures</code> sub-annotation of the <code>Documentation</code> annotation, explained in detail in <a href=\"https://specification.modelica.org/maint/3.6/annotations.html#annotations-for-figures\">Section&nbsp;18.2.2 <em>Figures</em> of the Modelica&nbsp;3.6 specification</a>.
Figures are defined in the <code>figures</code> sub-annotation of the <code>Documentation</code> annotation, explained in detail in
<a href=\"https://specification.modelica.org/maint/3.6/annotations.html#annotations-for-figures\">Section&nbsp;18.2.2 <em>Figures</em> of the Modelica&nbsp;3.6 specification</a>.

The full specification of the markup is given in the Modelica specification, but things to keep in mind include:
</p>
<ol>
<li>A newline means paragraph break; line breaks within a paragraph are not possible.</li>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this relevant even when long captions shall be avoided?


<p>
When a figure contains multiple plots, let each plot be described by one paragraph in the caption, and start each paragraph with a plain reference to the plot it describes (for example, <code>%(plot:tracking)</code>), followed by one space, and then the paragraph text.
See <a href=\"modelica://Modelica.Blocks.Examples.PID_Controller\">PID_Controller</a> for an example.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to have a code snippet here. (Who wants to search for it in PID_Controller?)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or both - a code snippet with the paragraphs, and stating is from PID_Controller.
I don't think you need the full plot in the snippet, and thus it makes sense to have a reference for that.

Obviously a code snippet may get out of sync - but I don't think it is too problematic in this case.

Comment on lines +1944 to +1953
<li><p>
Conveying the axis unit (not allowed according to the Modelica specification).
</p></li>
<li><p>
As substitute for curve legends, or showing information already present in the curve legends.
</p></li>
<li><p>
Quantity names, for the sake of consistency across the library.
(Nothing prevents a tool from using <code>quantity</code> attributes of the plotted variables to automatically and consistently present quantity names when no <code>label</code> is given.)
</p></li>

@tobolar tobolar Sep 21, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just about the code indentation:

Suggested change
<li><p>
Conveying the axis unit (not allowed according to the Modelica specification).
</p></li>
<li><p>
As substitute for curve legends, or showing information already present in the curve legends.
</p></li>
<li><p>
Quantity names, for the sake of consistency across the library.
(Nothing prevents a tool from using <code>quantity</code> attributes of the plotted variables to automatically and consistently present quantity names when no <code>label</code> is given.)
</p></li>
<li>
Conveying the axis unit (not allowed according to the Modelica specification).
</li>
<li>
As substitute for curve legends, or showing information already present in the curve legends.
</li>
<li>
Quantity names, for the sake of consistency across the library.
(Nothing prevents a tool from using <code>quantity</code> attributes of the plotted variables to automatically and
consistently present quantity names when no <code>label</code> is given.)
</li>

@tobolar tobolar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@henrikt-ma Thanks for preparing this valuable guidelines.

My comments

  1. The Titles and Captions would be necessary even for one figure with just one plot, right? This seems tough to me.
  2. For Identifiers, a possible recommended simple identifiers could be fig-i (i=1,..) and plot-i-j (j=1,...)? (and without index where just one figure)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Issue addresses the documentation L: UsersGuide Issue addresses Modelica.UsersGuide

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants