Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate matplotlibrc params file #761

Closed
derollins opened this issue Dec 16, 2023 · 2 comments · Fixed by #773
Closed

Generate matplotlibrc params file #761

derollins opened this issue Dec 16, 2023 · 2 comments · Fixed by #773
Labels
enhancement New feature or request

Comments

@derollins
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
As anticipated in #707 it would be helpful to be able to generate a matplotlibrc params file in a similar way to the config file. It took a while for me to work out how I could change the style of the image output and it currently requires searching around in the code folders to find the file to copy.
Being able to generate your own would make changing important image formatting options, such as dpi and colour, a lot more user friendly.

Describe the solution you'd like

It would be helpful to be able to quickly generate a matplotlibrc params file that can be easily edited in a similar way to --create_config_file .

Describe alternatives you've considered
Otherwise the options could be returned to the config file. I certainly change these options fairly regularly while using topostats.

@derollins derollins added the enhancement New feature or request label Dec 16, 2023
@ns-rse
Copy link
Collaborator

ns-rse commented Dec 18, 2023

I should have just implemented this when I was adding the style file and will add an entry point to create one.

However, whilst DPI can be set in topostats/topostats.mplstyle which was added in #707 the dpi for individual images is explicitly set on a per-image basis using topostats/plotting_dictionary.yaml as, from memory, having a global setting for dpi meant that plotting of some images (cropped ones I think) was very slow.

Which of the two possible files (topostats.mplstyle or topostats/plotting_dictionary.yaml) is it that you have used @derollins ?

@ns-rse
Copy link
Collaborator

ns-rse commented Dec 18, 2023

I have written an entry-point to topostats create-matplotlibrc which will generate a copy of the topostats/topostats.mplstyle file to a user specified directory and filename (defaults are available).

To avoid merge conflicts I have branched off of branch 757 and so once #758 has been merged I can unblock this issue and create a new pull request to merge this new entry point.

ns-rse added a commit that referenced this issue Jan 4, 2024
Merging so I can add in the work done to address #761 .
ns-rse added a commit that referenced this issue Jan 4, 2024
Closes #761

Introduces the `topostats create-matplotlibrc` sub-command/entry point to write the default style
file (`topostats/topostats.mplstyle`) to disk for modification and subsequent usage. The path and filename can be
customised when invoking.

This doesn't necessarily mean that all aspects of image plotting are controlled since we set default filenames, titles
and DPI and whether an image is in the `core` set via the `topostats/plotting_dictionary.yaml` file.

Documentation has been added that, hopefully, clarifies how to use this and points users users to the relevant
Matplotlib documentation.

Any further tweaking beyond the current state I feel pulls us towards writing a whole API for Matplotlib which is
something that I am keen to avoid as users would be better served using the examples shown in the Notebook on [plotting
scans](https://github.com/AFM-SPM/TopoStats/blob/main/notebooks/03-Plotting-scans.ipynb) to customise their plots to
their own preferences.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants