Ticket #4985 (closed enhancement: fixed)

Opened 4 years ago

Last modified 4 years ago

[with patch, positive review] Expand documentation for list_plot to point out the utility of zip

Reported by: jason Owned by: was
Priority: minor Milestone: sage-3.4.1
Component: graphics Keywords:
Cc: jhpalmieri Work issues:
Report Upstream: Reviewers:
Authors: Merged in:
Dependencies: Stopgaps:

Description

We should expand the documentation for list_plot so that questions like on the latter half of this thread don't happen:

 http://groups.google.com/group/sage-support/browse_thread/thread/e523b8ade175746c

Basically, we should explain how to use zip like thus:

list_plot(zip(list of x-coords, list of y-coords))

so that people from Matlab don't get confused by the very unhelpful error message. Maybe the error message ought to be changed too.

Attachments

4985.patch Download (1.1 KB) - added by jhpalmieri 4 years ago.

Change History

comment:1 Changed 4 years ago by wdj

Good idea, IMHO. I wonder if it also a good idea to add plot_list as an alias to the namespace so people who hunt for plot commands (and the documentation for them) using tab completion can find this more easily?

comment:2 Changed 4 years ago by jhpalmieri

  • Cc jhpalmieri added
  • Priority changed from major to minor
  • Summary changed from Expand documentation for list_plot to point out the utility of zip to [with patch, needs review] Expand documentation for list_plot to point out the utility of zip

Here's a patch, adding to the list_plot docstring. I feel neutral, or maybe a little negative, about the suggestion to add plot_list as an alias. Would we then need to do the same for list_plot3d? Anyway, that can be dealt with as a separate ticket.

By the way, I wasn't sure what "the very unhelpful error message" is. We might consider testing whether the second argument to list_plot (which is "plotjoined", should be boolean) is a list or tuple, and then print a warning, because perhaps someone ran "list_plot([list1], [list2])" without meaning to. Opinions?

Changed 4 years ago by jhpalmieri

comment:3 Changed 4 years ago by jason

Nice! Positive review.

comment:4 Changed 4 years ago by jason

  • Summary changed from [with patch, needs review] Expand documentation for list_plot to point out the utility of zip to [with patch, positive review] Expand documentation for list_plot to point out the utility of zip

(applies cleanly to 3.4, doctests in plot.py pass, and the plot looks right).

comment:5 Changed 4 years ago by jason

#5594 is for the suggestion by jhpalmieri above.

comment:6 Changed 4 years ago by mabshoff

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone changed from sage-3.4.2 to sage-3.4.1

Merged in Sage 3.4.1.alpha0.

Cheers,

Michael

Note: See TracTickets for help on using tickets.