Skip to content

Parameter Management #238

@jinglinpeng

Description

@jinglinpeng

Is your feature request related to a problem? Please describe.
Currently the parameters are added casually in each function. The goal of this issue is to provide a unified approach to manage the parameters.

Describe the solution you'd like

We can have a configuration for each type of plot, and have a class named FigConfig to include all the configs. We have a default value for each config, and user could customize it by setter functions or a dict. For example,

# built by setter
fig_config = FigConfig()
                .set_hist(bins = 10, kde = True)
                .set_bar(show = False)

It means the 1) for hist: the bin number is 10, and the kde curve will be displayed with hist plot. 2) for bar chart: it does not show bar chart.

Similarly, user could build the config using a dict:

# built by dict.
fig_config = FigConfig({"hist.bins": 10,
                        "hist.show": True,
                        "bar.show": False})

We allow user customize plots by either input FigConfig or a dict:

plot(df, x, config = fig_config)

# when config is dict, we internally transform it into FigConfig.
plot(df, x, config = {"hist.bins": 10, 
                      "hist.show": True, 
                      "bar.show": False})

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions