Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A feature which will make the map overlay better with the cross section plot is to remove the labels from its left and bottom axes (via a Coastlines icon).

Putting it all together

These two plots can be combined by using a Display Window icon. Create one, edit it and create two views inside it. Drop your Geographic View icon into one and your Cross Section View into the other. Position them in a similar way as shown in the example plot. Once saved, this icon can be visualised and the final result created by dropping the various icons into the two views in the Display Window.

Creating a Macro

Create a macro from this plot, either from the Generate Macro button in the Display Window, or by creating a new Macro icon and dropping the various icons into the Macro Editor. In either case, pay attention to the plot() command. If there is a display window variable called dw (for example) generated by the plot_superpage() command, and it has multiple pages (in this case we have two - one for each view), then we need to call the plot() command once for each page.

As an example, if we want to plot data with visdefs into the second page, we would write

Code Block
languagepy
plot(dw[2], data, visdefs)

Using a macro gives us an opportunity to improve the maintainability of the plot. In particular, we currently duplicate the coordinates of the cross section transect line - it is defined once in the Cross Section View icon and again in the Input Visualiser icon which is used to draw the line on the map. Put the coordinates into a variable at the top of the macro, then replace the two references to the line coordinates with this variable. Note that this may not work without another small modification - if the Cross Section View code is inside a function, then it will not be able to see any variables defined outside of the function. We can either set the variable to be global by putting the keyword global in front of it, or else pass it as an argument to the function. The second is usually the preferred option.