-
Notifications
You must be signed in to change notification settings - Fork 9
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
set plot style #150
set plot style #150
Conversation
I had a spaguetti of branches so I had to make a new one only with this change :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a bit hesitant about making the m_tools/MOOD style of plotting the default in FMskill. I think it would be better to have a global parameter:
or similar to control the look and feel of the plots. |
@ecomodeller : I fixed the location based on fig size, now it should stay in place |
@jsmariegaard : Fully agree with your suggestion. However, can we get help with setting this up? :-) Or do you have a good example to adopt from? |
In order to get broad adoption we to make sure that fmskill is easily customizable to match the slightly different needs of various users, maybe get some inspiration configuration from pandas https://pandas.pydata.org/docs/user_guide/options.html, I think the need for customization is wider than simply the style of the plots. |
I guess I was wondering: Is there a quick way into this now :-) How about we simply add Maybe it would be even desirable to also have these customization arguments in each method, where the global customization only sets the default (maybe you want a one-off plot look different without changing the global settings)? |
I support Hendrik's idea |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ecomodeller: I added the requested changes
I found a way to implement this I think |
@jsmariegaard I implemented a and if the previous (default) style is preferred, the user can either restart the kernel or |
Good stuff @daniel-caichac-DHI ! Can we not set |
@Hendrik1987 I think we can, I just did not think about it , let me fix it |
@ecomodeller , I don't think it needs to be 100%. But yes, it would be ultimately be the goal to have similar info in the title. But I think we need to first fix the |
FYI, I am working on a general concept for global settings in FMskill. Will make it a PR either today or tomorrow. We can then merge that first, before finishing this PR. |
Following @Hendrik1987 comments, indeed it does not need to be 100% equivalent (we would need to calculate the Peak Ratio for that as well), and as of now we can with the But what we don't want is to have two plots that look completely different, because then we basically cannot use FMSkill for production in combination with MOOD plots, and that's one of our goals. |
@jsmariegaard are we ok to merge this PR now??? |
I finally, got around to work on the global options, they are coming along in #158 - we will merge the global options first, before finishing this PR. |
@daniel-caichac-DHI #158 have now been merged - have a look at https://github.com/DHI/fmskill/blob/main/tests/test_settings.py and https://github.com/DHI/fmskill/blob/main/fmskill/plot.py on how to use. We still need to define a function fmskill.set_style() or similar to invoke a number of functions at the same time. But at least we now have a way to handle options in fmskill :) |
By the way, it may be simpler to start a new branch following the new way of specifying settings rather than solve all the merge conflicts in this one... |
sure, the amount of conflicts will make it easier to make a new branch.
|
I tried to add some examples of how to register options at the top of https://github.com/DHI/fmskill/blob/main/fmskill/plot.py (and used correspondingly inside the scatter method). That you'll need to do first for all the options you wish to change. Then we can make a new function in the settings module. Let's call it set_plot_style() for now. This method takes a name as an argument (e.g. MOOD) and contains a dict of the changes that need to be made compared to the default settings. At the bottom of this function, you can apply the options all at once by providing the dict as an argument to fmskill.set_option(). Does it make sense? |
I am trying to understand, but if I want to have say I think that with a single example I could set all the others params |
From the user perspective, only this will be needed:
As a developer, contributing a new style, you will have to check that all the things you want to change are already registered as an option. If they are, you can just go ahead and create a dictionary with those options. In settings.py you can add this:
|
Hi,
I would like to change the default matplotlib style for scatter plots in order to match other plots from DHI, as now fmskill looks too different.
This is how it looks now
And just by changing some line colors and sizes of markers and locations, I get this, which aligns with other tools (eg MOOD plots)

Still not 100% identical but quite almost there at least (both plots are different data by the way)