Home > Net >  Changing mplfinance chart styling when "returnfig=True" is not being accepted anywhere in
Changing mplfinance chart styling when "returnfig=True" is not being accepted anywhere in

Time:07-06

I am trying to change the axis titles and font size in multiple charts that are plotted using mpf.plot and fig.add_axes to place them on screen.

I have understood the process and examples given in this link enter image description here

CodePudding user response:

The are two ways to gain access to the Figure and Axes objects that mplfinance uses. These two ways are documented here.

1. If you use returnfig=True it means that mpf.plot() is creating the Figure and Axes objects internally, and returning them to you for further manipulation before you eventually call mpf.show() or fig.savefig() to complete the plot.

2. However, if you create your own Figure and Axes objects externally to mpf.plot(), even if you use mpf.figure() to create the Figure object, then mpf.plot() does not own the Figure and Axes objects, and so cannot return them to you!
In fact, you already have them and own them so there is no point to returning them! This is why, when mpf.plot() detects that you have passed Axes into it (thus it is in "External Axes Mode") then it will reject the kwarg returnfig because in that context it doesn't make any sense to return a Figure and Axes that you already have.

  • Related