Title: CHANGE FEATURE: Allow a custom template RST for plot methods · Issue #5 · psyplot/psyplot · GitHub
Open Graph Title: CHANGE FEATURE: Allow a custom template RST for plot methods · Issue #5 · psyplot/psyplot
X Title: CHANGE FEATURE: Allow a custom template RST for plot methods · Issue #5 · psyplot/psyplot
Description: Summary Plot methods should be documented using a template rather than a hard-coded docstring. Reason You could easily add more examples and explanation Current behaviour Plot methods are registered using psyplot.project.register_plotter...
Open Graph Description: Summary Plot methods should be documented using a template rather than a hard-coded docstring. Reason You could easily add more examples and explanation Current behaviour Plot methods are registere...
X Description: Summary Plot methods should be documented using a template rather than a hard-coded docstring. Reason You could easily add more examples and explanation Current behaviour Plot methods are registere...
Opengraph URL: https://github.com/psyplot/psyplot/issues/5
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"CHANGE FEATURE: Allow a custom template RST for plot methods","articleBody":"#### Summary\r\nPlot methods should be documented using a template rather than a hard-coded docstring.\r\n\r\n#### Reason\r\nYou could easily add more examples and explanation\r\n\r\n#### Current behaviour\r\nPlot methods are registered using `psyplot.project.register_plotter` and the documentation is generated via the `psyplot.project.ProjectPlotter._gen_doc` method. This only gives a minimal possibility to modify the plot method, you can only set the `example_call` and the `show_examples`\r\nparameter.\r\n\r\n#### New behaviour\r\nInstead of hard-coded keywords, such as `example_call` and `show_examples`, one should create a template for the description and another template for the epilog.\r\n\r\nThose templates could then be specified in the `register_plotter` call and the `psyplot.project.ProjectPlotter._register_plotter` method takes ``**kwargs`` that are than used to format the template via ``template_str.format(**kwargs)``\r\n\r\n#### Examples\r\nDefault template for the main docstring\r\n\u003cdetails\u003e\r\n\r\n```reStructuredText\r\n{summary}\r\n\r\n{description}\r\n\r\nTo plot data from a netCDF file type::\r\n\r\n \u003e\u003e\u003e psy.plot.{identifier}({example_call})\r\n```\r\n\u003c/details\u003e\r\n\r\n***\r\n\r\nDefault template for the epilog\r\n\u003cdetails\u003e\r\n\r\n```reStructuredText\r\nExamples\r\n--------\r\nTo explore the formatoptions and their documentations, use the\r\n``keys``, ``summaries`` and ``docs`` methods. For example::\r\n\r\n \u003e\u003e\u003e import psyplot.project as psy\r\n\r\n # show the keys corresponding to a group or multiple\r\n # formatopions\r\n \u003e\u003e\u003e psy.plot.{identifier}.keys('labels')\r\n\r\n # show the summaries of a group of formatoptions or of a\r\n # formatoption\r\n \u003e\u003e\u003e psy.plot.{identifier}.summaries('title')\r\n\r\n # show the full documentation\r\n \u003e\u003e\u003e psy.plot.{identifier}.docs('plot')\r\n\r\n # or access the documentation via the attribute\r\n \u003e\u003e\u003e psy.plot.%(identifier)s.plot\r\n```\r\n\u003c/details\u003e\r\n\r\n***\r\n\r\nNew function call for `ProjectPlotter._register_plotter`\r\n\r\n\u003cdetails\u003e\r\n\r\n```python\r\ndef _register_plotter(cls, identifier, module, plotter_name,\r\n plotter_cls=None, summary='', prefer_list=False,\r\n default_slice=None, default_dims={},\r\n example_call=\"filename, name=['my_variable'], ...\",\r\n description_template='description.rst',\r\n epilog_template='epilog.rst',\r\n plugin=None):\r\n \"\"\"show_examples should be depreceated\"\"\"\r\n```\r\n\u003c/details\u003e\r\n","author":{"url":"https://github.com/Chilipp","@type":"Person","name":"Chilipp"},"datePublished":"2018-04-12T20:58:02.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/5/psyplot/issues/5"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:092362e4-a834-a9f6-720f-8efc10075811 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DBBC:108ED4:54C15E5:740424F:698CFA5F |
| html-safe-nonce | 3045ec3777612aa387a35cff64323c0fd69bc795e5482933daba12201b5467f3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQkJDOjEwOEVENDo1NEMxNUU1Ojc0MDQyNEY6Njk4Q0ZBNUYiLCJ2aXNpdG9yX2lkIjoiMzM4NzgwNzkwMjA2MDA1MTAzOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a039436680ace4c2a0db263128f6a22885b7d2d8e64fa77b75b8fd810d769323 |
| hovercard-subject-tag | issue:313884981 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/psyplot/psyplot/5/issue_layout |
| twitter:image | https://opengraph.githubassets.com/de3ca2be4ed17aeeaf54362d1541ab425a2a0d2ccad6a672e9486fd49f6e8b1b/psyplot/psyplot/issues/5 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/de3ca2be4ed17aeeaf54362d1541ab425a2a0d2ccad6a672e9486fd49f6e8b1b/psyplot/psyplot/issues/5 |
| og:image:alt | Summary Plot methods should be documented using a template rather than a hard-coded docstring. Reason You could easily add more examples and explanation Current behaviour Plot methods are registere... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Chilipp |
| hostname | github.com |
| expected-hostname | github.com |
| None | 09447bc7ef1f50c40a646f48e82dfbd31133c28c940bfee5a938619ac0191038 |
| turbo-cache-control | no-preview |
| go-import | github.com/psyplot/psyplot git https://github.com/psyplot/psyplot.git |
| octolytics-dimension-user_id | 60222268 |
| octolytics-dimension-user_login | psyplot |
| octolytics-dimension-repository_id | 87944102 |
| octolytics-dimension-repository_nwo | psyplot/psyplot |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 87944102 |
| octolytics-dimension-repository_network_root_nwo | psyplot/psyplot |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 02f0047575af3d968e1dea9cf0b6015a852cddfe |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width