GenericMappingTools/pygmt

Better way to configure axis (instead of B/frame)

leouieda opened this issue · 0 comments

Description of the desired feature

Currently, tickmarks, titles, axis labels, gridlines and others are all set using the frame argument (-B ). This leads to huge unreadable strings and sometimes even to multiple entries for frame (which we handle via lists right now).

There should be a better way of doing this. In GMT.jl, they have added an axis function that creates the string for you. Alternatively, we could add set_xlabel style methods to gmt.Figure. I don't think this will work because that's not how GMT handles things. We would have to hold on to these arguments and pass them along to a later module call.

What we could do is add xlabel, title etc arguments to gmt.Figure which would be converted to one or more -B entries. They would be stored and passed along to the first method call. The same could be done for projection, region, X and Y. One drawback is that the argument list for Figure would get quite large and the complexity of creating a new figure would also increase. Another drawback is the our Figure isn't really a figure. GMT draws things on a canvas and so every single plotting command can have it's own axes.

The best option might be to have a Frame/Axes class or function that converts sane arguments (xlabel, title, grid) into the correct -B. We could optionally allow the frame argument to be a dictionary, which we would pass along to our function/class.