MBravoS / splotch

Simple PLOTs, Contours and Histograms is a small package with wrapper functions designed to simplify plotting calls from matplotlib.
BSD 3-Clause "New" or "Revised" License
5 stars 0 forks source link

Specifying which axis to plot #2

Closed AstroRobin closed 5 years ago

AstroRobin commented 5 years ago

In the case where the figure has multiple subplots, it would be great to have a setaxis option which specifies exactly which axis to plot onto by parsing in a pyplot axis object. You may also want to consider the fact that one may not want the current axis to change just because a splot command was used, in this case it would be best to only temporarily change the axis for the scope of the function . Each plot function could then set the current axis with a call similar to:

if (setaxis != None):
    curaxis = plt.gca() # gets the current axis
    plt.sca(setaxis) # sets the axis to the one specified

make plots

if (setaxis != None):
    plt.sca(curaxis) # return to the previous current axis
MBravoS commented 5 years ago

Thanks for the suggestion. This is implemented now on 0.2.3.