X Tutup
Skip to content

Stock demo Fixed#7529

Closed
sirlittle wants to merge 10 commits intomatplotlib:masterfrom
sirlittle:stock_demo
Closed

Stock demo Fixed#7529
sirlittle wants to merge 10 commits intomatplotlib:masterfrom
sirlittle:stock_demo

Conversation

@sirlittle
Copy link
Copy Markdown
Contributor

I fixed some of the issues brought up by #7457

"""
ticker1, ticker2 = 'INTC', 'AAPL'

file1 = cbook.get_sample_data('INTC.dat.gz')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to import cbook

tacaswell
tacaswell previously approved these changes Nov 29, 2016
@tacaswell tacaswell added this to the 2.0.1 (next bug fix release) milestone Nov 29, 2016
Copy link
Copy Markdown
Member

@QuLogic QuLogic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example does not currently run.


file1 = cbook.get_sample_data('INTC.dat.gz')
file2 = cbook.get_sample_data('AAPL.dat.gz')
M1 = fromstring(file1.read(), '<d')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These calls and following lines are missing the np. prefix (because the original data_helper.py imported them poorly.)

I think it can use np.fromfile directly instead of fromstring and a read.

d1, p1 = M1[:, 0], M1[:, 1]
d2, p2 = M2[:, 0], M2[:, 1]
return (d1, p1, d2, p2)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another blank line.

same plot.

"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another blank line.

from matplotlib.ticker import MultipleLocator
from data_helper import get_two_stock_data

"""
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can put the example's docstring at the beginning of the file; also, add the titling format as indicated here.


fig, ax = plt.subplots()
lines = plt.plot(d1, p1, 's', d2, p2, 'o')
lines1 = plt.plot(d1, p1, 'b', label="INTC")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to ax instead of plt while you're here.

@tacaswell tacaswell dismissed their stale review November 29, 2016 22:02

Reportedly does not run, should have just dismissed by review earlier rather than approving.

@NelleV NelleV changed the title Stock demo Fixed [MRG] Stock demo Fixed Nov 29, 2016
Copy link
Copy Markdown
Member

@QuLogic QuLogic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple minor typos.

Stock Demo Plots
================

The following example displays Matplotlibs capabilities of creating
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Matplotlib's

================

The following example displays Matplotlibs capabilities of creating
graphs that can be used for stocks. The example specfically uses
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

specifically

@QuLogic
Copy link
Copy Markdown
Member

QuLogic commented Nov 29, 2016

cc @anntzer who wrote original ticket in case there's anything missing there.

@NelleV
Copy link
Copy Markdown
Member

NelleV commented Nov 29, 2016

Fixed.

plt.ylabel('Normalized price')
plt.xlim(0, 3)
lines1 = ax.plot(d1, p1, 'b', label="INTC")
lines2 = ax.plot(d2, p2, 'r', label="AAPL")
Copy link
Copy Markdown
Contributor

@anntzer anntzer Nov 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would maintain the default color cycle (so just don't use color specifications).
The straight lines that connect the days also look a bit ugly.

In general it would help if you could post the new figure to the thread.

@NelleV
Copy link
Copy Markdown
Member

NelleV commented Nov 30, 2016

Here is the new figure:

figure_1

@efiring
Copy link
Copy Markdown
Member

efiring commented Nov 30, 2016

I'm sorry to be critical of this, but it doesn't serve as a good showcase for matplotlib, and there is nothing stock-specific about it. What is its purpose? In one respect it is worse than the original: it is not appropriate to use a continuous line across the no-data intervals. Using points is the easiest way to avoid this problem.
Overall, we have too many gallery entries, so this would be a good candidate for deletion.
If it is not to be deleted, then I suggest that any revision must at least get rid of the lines across the night periods, and should have a proper date/time abcissa and labels.

@codecov-io
Copy link
Copy Markdown

Current coverage is 61.88% (diff: 100%)

Merging #7529 into master will not change coverage

@@             master      #7529   diff @@
==========================================
  Files           173        173          
  Lines         56140      56140          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits          34743      34743          
  Misses        21397      21397          
  Partials          0          0          

Powered by Codecov. Last update b9c3b64...751128c

@NelleV
Copy link
Copy Markdown
Member

NelleV commented Nov 30, 2016

I am fine with that decision.

@NelleV NelleV changed the title [MRG] Stock demo Fixed [WIP] Stock demo Fixed Nov 30, 2016
@anntzer
Copy link
Copy Markdown
Contributor

anntzer commented Nov 30, 2016

Agreed.

@NelleV NelleV changed the title [WIP] Stock demo Fixed [MRG] Stock demo Fixed Nov 30, 2016
@tacaswell
Copy link
Copy Markdown
Member

Can this be squashed to a single commit (as the end result is to remove the example)?

@NelleV
Copy link
Copy Markdown
Member

NelleV commented Nov 30, 2016

I don't feel comfortable force-pushing to a repository that isn't mine. Can we activate the squash and merge button?

@QuLogic
Copy link
Copy Markdown
Member

QuLogic commented Nov 30, 2016

If we squash and merge (which I'm in favour of, because why keep those extraneous changes), no matter if it's via the button or a forced push or a new PR, @sirlittle will have to reset something because this PR is on his master branch. Just a heads up.

@QuLogic
Copy link
Copy Markdown
Member

QuLogic commented Dec 5, 2016

I cherry-picked the deletion onto #7559.

@QuLogic QuLogic closed this Dec 5, 2016
@QuLogic QuLogic changed the title [MRG] Stock demo Fixed Stock demo Fixed Dec 18, 2016
@QuLogic QuLogic modified the milestones: 2.0 (style change major release), 2.0.1 (next bug fix release) Dec 18, 2016
@QuLogic
Copy link
Copy Markdown
Member

QuLogic commented Dec 18, 2016

This is merged now; @sirlittle please remember to reset your master branch before making new changes (and preferably start new features/bugfixes on a separate branch). Please stop by the gitter room if you have any questions about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

X Tutup