Adjusting OGSTools plot font size globally

Hi,

I’d like to adjust the font size in OGSTools (0.6.0) globally.

E.g. I have the following (incomplete) code:

import ogstools as ot
ot.plot.plot_setup_defaults.fontsize = 6  # does not seem to work

...

var_conc = ot.variables.Variable("concentration")

# adding fontsize=... here would work, but it's not a global setting
fig = bulk_mesh_result.plot_contourf(var_conc)

# just for the sake of completeness of the plot below...
ax = fig.gca()
quiv = ax.quiver(bulk_mesh_result.points[:,0], bulk_mesh_result.points[:,1],
          bulk_mesh_result.point_data["v"][:,0], bulk_mesh_result.point_data["v"][:,1],
          pivot="mid")

# I want a smaller plot
fig.set_size_inches(8,6)

The resulting plot looks suboptimal:

What am I doing wrong?
Thank you in advance.

Best regards,
Christoph

Hi,
you could use update_font_sizes from utils module:

import ogstools as ot
ot.plot.utils.update_font_sizes(ax, fontsize=6)

Though you may still need to adjust the sizes of some elements manually.
Best regards,
Feliks

If you want a smaller plot, you may be better of passing dpi=50 (or something like that) to plot_contourf instead of set_size_inches. And instead of your ax.quiver where you need to specify everything you can also do
bulk_mesh_result.plot_quiver(ax=fig.axes[0], variable="v", glyph_type="line")`

1 Like

Thank you for your suggestions. I’ll try that.

I am aware of plot_quiver(), but it has a hard-coded scale in its implementation, which did not work for me.