Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Build misc examples#6868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
tacaswell merged 11 commits intomatplotlib:v2.xfromjenshnielsen:buildmiscexamples
Aug 7, 2016
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
11 commits
Select commitHold shift + click to select a range
a2b21a8
Run misc examples as part of docs build
jenshnielsenJul 31, 2016
1535bb0
Don't try to run image_thumbnail example as part of docs build
jenshnielsenJul 31, 2016
2df20fc
Multiprocess example depends on gtk so don't run it during docss build
jenshnielsenJul 31, 2016
0c42d2f
rc_traits example depends on traits so don't run it during docss build
jenshnielsenJul 31, 2016
b172ec6
Remove out of datelongshort example
jenshnielsenJul 31, 2016
222ed14
np.dtype does not support unicode strings on python 2.7 so encode bef…
jenshnielsenJul 31, 2016
cbec32b
interkeys should be called on the dict and not the keys
jenshnielsenJul 31, 2016
0ba12c6
Revert "Remove out of datelongshort example"
jenshnielsenJul 31, 2016
c9caa48
Make longshort python3 compatible
jenshnielsenJul 31, 2016
90d6bac
dtype names must be strings and not unicode in python2
jenshnielsenJul 31, 2016
b926d50
Feedback from review
jenshnielsenAug 7, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletionsdoc/conf.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -138,6 +138,7 @@
('axes_grid', 'axes_grid toolkit'),
('units', 'units'),
('widgets', 'widgets'),
('misc', 'Miscellaneous examples'),
]


Expand Down
1 change: 1 addition & 0 deletionsexamples/misc/image_thumbnail.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
# -*- noplot -*-
"""
You can use matplotlib to generate thumbnails from existing images.
matplotlib natively supports PNG files on the input side, and other
Expand Down
10 changes: 5 additions & 5 deletionsexamples/misc/longshort.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,18 +3,18 @@
csv file, computing the daily returns, appending the results to the
record arrays, joining on date
"""
import urllib
from six.movesimport urllib
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab

# grab the price data off yahoo
u1 = urllib.urlretrieve('http://ichart.finance.yahoo.com/table.csv?s=AAPL&d=9&e=14&f=2008&g=d&a=8&b=7&c=1984&ignore=.csv')
u2 = urllib.urlretrieve('http://ichart.finance.yahoo.com/table.csv?s=GOOG&d=9&e=14&f=2008&g=d&a=8&b=7&c=1984&ignore=.csv')
u1 = urllib.request.urlretrieve('http://ichart.finance.yahoo.com/table.csv?s=AAPL&d=9&e=14&f=2008&g=d&a=8&b=7&c=1984&ignore=.csv')
u2 = urllib.request.urlretrieve('http://ichart.finance.yahoo.com/table.csv?s=GOOG&d=9&e=14&f=2008&g=d&a=8&b=7&c=1984&ignore=.csv')

# load the CSV files into record arrays
r1 = mlab.csv2rec(file(u1[0]))
r2 = mlab.csv2rec(file(u2[0]))
r1 = mlab.csv2rec(open(u1[0]))
r2 = mlab.csv2rec(open(u2[0]))

# compute the daily returns and add these columns to the arrays
gains1 = np.zeros_like(r1.adj_close)
Expand Down
1 change: 1 addition & 0 deletionsexamples/misc/multiprocess.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
# -*- noplot -*-
# Demo of using multiprocessing for generating data in one process and plotting
# in another.
# Written by Robert Cimrman
Expand Down
1 change: 1 addition & 0 deletionsexamples/misc/rc_traits.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
# -*- noplot -*-
# Here is some example code showing how to define some representative
# rc properties and construct a matplotlib artist using traits.
# matplotlib does not ship with enthought.traits, so you will need to
Expand Down
14 changes: 9 additions & 5 deletionslib/matplotlib/mlab.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2387,8 +2387,10 @@ def rec_append_fields(rec, names, arrs, dtypes=None):
dtypes = dtypes * len(arrs)
else:
raise ValueError("dtypes must be None, a single dtype or a list")

newdtype = np.dtype(rec.dtype.descr + list(zip(names, dtypes)))
old_dtypes = rec.dtype.descr
if six.PY2:
old_dtypes = [(name.encode('utf-8'), dt) for name, dt in old_dtypes]
newdtype = np.dtype(old_dtypes + list(zip(names, dtypes)))
newrec = np.recarray(rec.shape, dtype=newdtype)
for field in rec.dtype.fields:
newrec[field] = rec[field]
Expand DownExpand Up@@ -2596,8 +2598,10 @@ def mapped_r2field(name):
if desc[0] not in key]
r2desc = [(mapped_r2field(desc[0]), desc[1]) for desc in r2.dtype.descr
if desc[0] not in key]
newdtype = np.dtype(keydesc + r1desc + r2desc)

all_dtypes = keydesc + r1desc + r2desc
if six.PY2:
all_dtypes = [(name.encode('utf-8'), dt) for name, dt in all_dtypes]
newdtype = np.dtype(all_dtypes)
newrec = np.recarray((common_len + left_len + right_len,), dtype=newdtype)

if defaults is not None:
Expand All@@ -2613,7 +2617,7 @@ def mapped_r2field(name):

if jointype != 'inner' and defaults is not None:
# fill in the defaults enmasse
newrec_fields = list(six.iterkeys(newrec.dtype.fields.keys))
newrec_fields = list(six.iterkeys(newrec.dtype.fields))
for k, v in six.iteritems(defaults):
if k in newrec_fields:
newrec[k] = v
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp