callumrollo / glidertest

Diagnostic test of glider data quality and required processing
MIT License
0 stars 4 forks source link

Plotting updates #129

Closed eleanorfrajka closed 1 week ago

eleanorfrajka commented 1 week ago

Ok - I fiddled around a little to change the aspect ratio in plots (main change). There may be a more elegant way to do this, but it was because the mplstyle only has one figure size option. I would like a way to have full width and half width plots or otherwise a little more overall control on the figure size generated.

Hence - two more variables at the top of plots.py for the widths, and a couple figures where I then used the width to generate within the figure plot) an appropriate height of the figure.

Also a couple label changes.

-- I'll need to fix the tests.

eleanorfrajka commented 1 week ago

Ok - one change I made in here, which isn't nice, is a selection of the plot width (full_width or half_width) and then scaling the figure height based on the width (since what is plotted looks best with a specified aspect ratio).

Chiara suggested a better way to do this would be to have a single figsize in the mplstyle sheet, and then a boolean within the plot to decide whether to make it full width or half width. But, I can't figure out how to nicely get values out of the style sheet. It looks like yaml, so could read as a yaml, but this would mean needing to import another package.

Or - maybe just allow the figure to generate with the default size, and then pull out the figure width and rescale within the plot?

review-notebook-app[bot] commented 1 week ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

callumrollo commented 1 week ago

Love the conditional time axis formatter! I agree with Chiara that it probably belongs in utilities

With regards to setting user-defined figure sizes, don't stress too much about it. One of the reasons we return fig, ax is so that the user can e.g. resize the plot afterwards to match whatever style they want e.g. with figure.set_size_inches

This gives lots of flexibility, without needing to add a bunch of optional arguments to each funtion

image

This is something we should demonstrate in the notebook I think!