Opened 12 years ago
Closed 12 years ago
#1575 closed defect (fixed)
[with patch, with positive review] plotting -- fix vector plotting
Reported by: | was | Owned by: | jason |
---|---|---|---|
Priority: | major | Milestone: | sage-2.10.1 |
Component: | graphics | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | Work issues: | ||
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
On Dec 19, 2007 12:24 PM, Jason Grout <> wrote: > I'm teaching linear algebra next semester and plan to use Sage. In > trying the "obvious" way to plot a vector: > > sage: v=vector([1,2]) > sage: v.plot().show() > > I get what looks like a step function of the coordinates. Yes, that's what it is. This is very useful, e.g., when using vectors of data, computing Fourier transforms of them, etc. And it works in arbitrary dimensions. > Instead, I > have to do: > > sage: v=vector([1,2]) > sage: arrow((0,0),v).show() > > which doesn't seem quite so natural to an undergraduate linear algebra > student. First, is there an easier way to plot a vector (yes, I know I > don't have to define v above and could just give the coordinates to > arrow, but usually I'll be doing something with v as a vector)? Is it > reasonable to redefine v.plot() to return the arrow for a vector with 3 > or fewer dimensions, or is there some bigger reason to have things the > way they are now? I think that would be bad, because it's potentially confusing and unsystematic. However, the following -- which you will like -- would be acceptable to me: Redefine v.plot() so for dimensions <= 3 it does what you describe above, i.e., draws an arrow, but for dimensions >= 4 it gives an error message. Then add an option to plot called "step", which if set to True restores the current behavior. In fact, this was my intention all along, and somehow I screwed up. The current plot signature for vectors is: def plot(self, xmin=0, xmax=1, eps=None, res=None, connect=True, step=False, **kwds): Notice that step=False is already there! -- William
Attachments (2)
Change History (10)
comment:1 Changed 12 years ago by
- Owner changed from was to jason grout
comment:2 Changed 12 years ago by
- Owner changed from jason grout to jason
- Status changed from new to assigned
Changed 12 years ago by
comment:3 Changed 12 years ago by
- Milestone changed from sage-2.9.2 to sage-2.9.1
comment:4 Changed 12 years ago by
- Summary changed from plotting -- fix vector plotting to [with patch] plotting -- fix vector plotting
comment:5 Changed 12 years ago by
I just discovered that Arrow has been changed to arrow3d in sage 2.9.3. The patch should be updated accordingly.
Changed 12 years ago by
comment:6 Changed 12 years ago by
I've renamed the "type" option to "plot_type" and fixed the Arrow issue (the graphics interface changed around 2.9.3) and the doctest "eps" issue.
The vector-plot-updated.patch should be applied instead of vector-plot.patch.
comment:7 Changed 12 years ago by
- Summary changed from [with patch] plotting -- fix vector plotting to [with patch, with positive review] plotting -- fix vector plotting
Looks good; doctests pass.
comment:8 Changed 12 years ago by
- Resolution set to fixed
- Status changed from assigned to closed
vector-plot-updated.patch merged in Sage 2.10.1.rc1.
Note: See
TracTickets for help on using
tickets.
In vector-plot.patch, plot is redefined to behave thusly:
The old plot function was renamed plot_step.