Source: errorbar_demo.f90
Demonstrates error bar plotting with both symmetric and asymmetric errors for scientific data visualization.
! Basic symmetric errors
call fig%errorbar(x, y, yerr=yerr, label='Data with errors')
! Asymmetric errors
call fig%errorbar(x, y, yerr_lower=y_lower, yerr_upper=y_upper)
! Custom styling
call fig%errorbar(x, y, yerr=yerr, capsize=8.0_wp, &
elinewidth=2.0_wp, marker='o', color=[1.0, 0.0, 0.0])
The demo generates examples showing: - Basic error bars with measurement uncertainty - Multiple datasets with different error magnitudes - Custom styling and professional scientific presentation
Perfect for scientific plotting where uncertainty visualization is essential.
errorbar_demo.f90 - Source codeoutput/example/fortran/errorbar_demo/make example ARGS="errorbar_demo"

Symmetric Y Error Bars (from asymmetric)
Y values
+--------------------------------------------------------------------------------+
| 4.0 |
| | |
| | |
| | - - --- Average errors |
| 3.5 - - |
| | |
| | - - |
| 3.0 - |
| | - - - |
| | - - - - |
| | - - - - - - - |
| 2.5 - - - - |
| | - - - - - - |
| | - - - - |
| | - - - |
| 2.0 - - - - - |
| | - - - - - |
| | - - - |
| | - - - |
| 1.5- - - |
| | - |
| | - |
| 1.0- |
| | - |
| | - |
| | |
| 0.5 - |
| | - |
| +--+-------+--------+--------+--------+--------+--------+--------+-------+---- |
| 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 |
+--------------------------------------------------------------------------------+
X values

Symmetric X Error Bars
Y values
+--------------------------------------------------------------------------------+
| 3 |
| | |
| | |
| | -- -- - --- Data with X errors |
| | - -- - -- |
| 2 ---- - |
| | - -- |
| | - - |
| | -- ---- |
| | -- - - |
| 1 - |
| | - |
| | - |
| | ---- |
| 0 - |
| | - |
| | - |
| | - |
| | - |
| -1 -- - |
| | - |
| | - |
| | -- |
| -2 - |
| | - |
| | - -- |
| | -- |
| | -- -- -- -- |
| +-----------+--------------+--------------+--------------+--------------+----- |
| -3 2 4 6 8 10 |
+--------------------------------------------------------------------------------+
X values

Basic Symmetric Y Error Bars
Y values
+--------------------------------------------------------------------------------+
| |
| | |
| | |
| 3 - --- Data with Y errors |
| | - - |
| | - - - -- -- - |
| 2 -- - - -- - |
| | - - - - -- - |
| | -- - - --- |
| | - - - |
| 1 -- --- |
| | - - - |
| | - -- - |
| | -- |
| 0 -- |
| | - - |
| | -- |
| | -- - |
| -1 -- |
| | -- |
| | - - |
| | -- - |
| -2 --- |
| | - - - - |
| | - -- - - |
| | - -- -- -- - |
| -3 - - |
| | - - |
| +---------+---------------+---------------+---------------+--------------+---- |
| 2 4 6 8 10 |
+--------------------------------------------------------------------------------+
X values

Combined X and Y Error Bars
Y values
+--------------------------------------------------------------------------------+
| |
| | |
| | |
| 3 - --- Data with XY errors |
| | - - |
| | - - -- -- - - |
| 2 - -- - - - -- |
| | -- - - - - - |
| | -- - - --- |
| | - - -- - |
| 1 -- - --- |
| | - - - |
| | - -- - |
| | -- |
| 0 - -- |
| | - - |
| | - |
| | -- - |
| -1 -- |
| | ---- |
| | - - |
| | -- - |
| -2 - -- |
| | - -- - - |
| | - -- - - |
| | - -- -- -- -- |
| -3 - - |
| | - - |
| +-----------+--------------+--------------+--------------+--------------+----- |
| 2 4 6 8 10 |
+--------------------------------------------------------------------------------+
X values

Customized Error Bars with Markers
Y values
+--------------------------------------------------------------------------------+
| |
| | |
| | |
| 3 % %% -o- Custom styling |
| | % %% % |
| | % %% % % o% %% % |
| 2 o% % % %o % |
| | % % % %% % %% %%% |
| | %%% %% %% % %%% |
| | %%% % o |
| 1 o% %%% |
| | % %%% % |
| | %%% %%%%% |
| | %% |
| 0 o% |
| | %%%% |
| | %% |
| | %% %% |
| -1 %% |
| | o% |
| | % %%% |
| | %% %% % |
| -2 %%% |
| | o % %% % %%% |
| | % %% % % |
| | %% % %o %% %% o |
| -3 % % |
| | %% % %%% |
| +---------+---------------+---------------+---------------+--------------+---- |
| 2 4 6 8 10 |
+--------------------------------------------------------------------------------+
X values

Scientific Data with Error Bars
Signal amplitude
+--------------------------------------------------------------------------------+
| |
| | |
| | |
| 3.0- |
| | - |
| | # |
| | --- |
| | - - |
| | - -- |
| 2.5 -- |
| | #-- |
| | -- - |
| | - -- |
| | --# |
| 2.0 --- - |
| | - --- |
| | -# |
| | ---- - |
| | - -- |
| | -#--- - |
| 1.5 --- |
| | - -#-- - |
| | -----# - |
| | - ----- - |
| | - -#----- - |
| 1.0 - --#----- |
| | - ---# |
| | -#- Experimental data - |
| +--+--------+---------+---------+---------+---------+---------+--------+------ |
| 0.0 2.5 5.0 7.5 10.0 12.5 15.0 17.5 |
+--------------------------------------------------------------------------------+
Time (s)