Twin Axes Demo

Twin Axes Demo

Source: twin_axes_demo.f90

Demonstrates twinx and twiny for multiple axes on one figure.

The demo plots three synthetic time series and assigns each to a different axis:

  • Left y-axis: primary signal (temperature-like)
  • Right y-axis: secondary signal with log scaling
  • Top x-axis: cumulative index with log scaling

Run the example via:

Outputs are written to output/example/fortran/twin_axes_demo/ in PNG and ASCII formats.

Files

  • twin_axes_demo.f90 - Source code
  • Generated media in output/example/fortran/twin_axes_demo/

Running

make example ARGS="twin_axes_demo"

Output

Twin Axes Demo

twin_axes_demo.png

ASCII output:

                                 Twin axis demo
+--------------------------------------------------------------------------------+
|      1                                Cumulative index (log scale)             |
| 22                                                                             |
| |                                                                              |
| |                                                          -- Primary axis     |
| |0                                                         -- Secondary axis   |
| |                                                                              |
| |                                                                              |
| |8                                                                             |
| |                                                                              |
| |                                                                              |
| |6                                                                             |
| |                                                                              |
| |                                                                              |
| |4                                                                             |
| |                                                                              |
| |                                                                              |
| |2                                                                             |
| |        -------------                                  ##########     -----## |
| |      ---           ---                            ####         ##  ---    #  |
| |0  ---                 ---                   ######              ##-      ##  |
| | ---                     ---        ### #####                  ---##      #   |
| |--                  #  #  #-#-# ## #                         ---   #      #   |
| |-----#-----#-----#-------------------------------------------------##----##-  |
| 0        4          8         12         16        20         24        28     |
+--------------------------------------------------------------------------------+
                                  Time (hours)
Temperature (relative)

Download ASCII

Download PDF