Skip to content

Package Structure and API design #9

Closed
@slumnitz

Description

@slumnitz

Ideas and decisions regarding the design of package structure and API for splot

Overall package idea

  1. support PySAL with lightweight plotting functionality:
    • .plot methods for objects called from splot and
    • functionality found under splot.sub_package namespace depending on PySAL object that is plotted
  2. Based on matplotlib and geopandas
  3. splot.mapping offers tools for coropleth, color and mapping support

Decisions (indicating implementation status):

  • integration of splot.plot.py into splot._viz_mpl.py
  • integration of giddy visualisations in splot
  • update and integrate functionality from mapping.py into splot._viz_mpl.py
  • .mpl functions return fig, ax
  • API Structure of splot (See API - Package Structure comment):
    • hierarchy with submodules named after statistics visualised (splot.giddy), common _viz_utils.py for utility functions used by all subpackages
    • integrating splot functionality as .plot methods in sub packages (see Idea Collection: Functionality to support in splot #10 for supported functionality
  • degree of customisation user can access: high degree of customisation through keyword dictionaries
  • dependency on:
    • Matplotlib only
    • Geopandas
    • Seaborn
  • documentation in accordance to general PySAL [submodule contract](url
    http://pysal.org/getting_started.html#submodule-contract)

To be decided:

Open questions/ ideas:

Rejected options:

  • API Structure of plot (See API - Package Structure comment):
    • hierarchy with submodules, one per plotting package (now splot.mpl and splot.bk), chose function names according to statistics they are helping to visualise (e.g. moran_scatterplot(), local_autocorrelation_statistics()...)
  • API Structure of plot (See API - Package Structure comment):
    • same implementations of visualisations in each (e.g. .mpl) submodule:
      * e.g. mplot, plot_choropleth, plot_local_autocorrelation,... for bk and mpl
      * except if one plotting package doesn't have the needed features (e.g. if interactivity is essential, matplotlib may not be able to create such a plot)
  • keywords common to all functions in the same order:
    • e.g. ...(moran_loc, df, attribute, p, region_column, plot_width, plot_height,...)
    • for splot.mpl only: ax
    • for splot.bk only: reverse_colors
  • plot(method="interactive") option, more flexibility by integrating submodules instead of function calls

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionspace for collecting ideas and discuss these

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions