question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`chain_prop` docstring entry missing in `matplotlib` `plot_trace()`

See original GitHub issue

Describe the bug chain_prop argument entry in matplotlib backend of plot_trace() docstring is missing.

It exists downstream at https://github.com/arviz-devs/arviz/blob/57aeded2fff88a646939fc36e5b2a86a0cf718b0/arviz/plots/traceplot.py and could be reproduced. But I’d like more information about valid properties that can be cycled. Can linestyle, color, lw, alpha, etc be used?

Also, somewhat related, I think that with the black formatting, this chunk at https://github.com/arviz-devs/arviz/blob/57aeded2fff88a646939fc36e5b2a86a0cf718b0/arviz/plots/backends/matplotlib/traceplot.py#L148-L155

would be clearer to read as:

        if chain_prop is None:
            chain_prop = {"linestyle": ("solid", "dotted", "dashed", "dashdot")}

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
hectormzcommented, Jun 10, 2021

And the docstring examples need to be updated since compact=True is the default now.

Examples 2 and 5 (https://arviz-devs.github.io/arviz/api/generated/arviz.plot_trace.html) should be updated.

Example 2 should be (to illustrate what changing compact achieves):

az.plot_trace(data, compact=False)

and Example 5 should be

lines = [("theta_t", {'school': "Choate"}, [-1])]
az.plot_trace(data, var_names=('theta_t', 'theta'), coords=coords, lines=lines, compact=False)

or

lines = [("theta_t", {}, [-1])]
az.plot_trace(data, var_names=('theta_t', 'theta'), coords=coords, lines=lines)

and maybe consider whether the function should actually be changed to accommodate an ‘over-specified’ lines

lines = (('theta_t',{'school': "Choate"}, [-1]),)

az.plot_trace(data, var_names=('theta_t', 'theta'), coords=coords, lines=lines)
1reaction
hectormzcommented, Jun 9, 2021

Right, basically anything on this matplotlib page is valid:

chain_prop={"linestyle": ("-","--"), "color":("red","green", "blue", "purple"), "linewidth":(1,4)},
chain_prop="color",
chain_prop={"dashes":((2,4),(1,5))}
chain_prop={"marker":["o","^"]}
chain_prop=None # defaults to pre-defined `linestyle` if `compact` is True

I realize that the high-level docstring should be updated to describe it as a dict instead of tuple:

    chain_prop: str or dict {str: array_like}, optional
        Tuple containing the property name and the property values to distinguish diferent chains

and maybe compact_prop needs to be updated, too

Read more comments on GitHub >

github_iconTop Results From Across the Web

matplotlib: drawing lines between points ignoring missing data
I have a set of data which I want plotted as a line-graph. For each series, some data ...
Read more >
Writing documentation — Matplotlib 3.6.2 documentation
Most documentation is either in the docstrings of individual classes and ... If there are multiple code elements with the same name (e.g....
Read more >
Chapter 4. Visualization with Matplotlib - O'Reilly
Matplotlib is a multiplatform data visualization library built on NumPy arrays, … ... for more details, I'd suggest viewing the docstring of the...
Read more >
Python Plotting With Matplotlib (Guide)
Pylab and pyplot: which is which? Key concepts of matplotlib's design; Understanding plt.subplots(); Visualizing arrays with matplotlib; Plotting with the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found