Skip to content

Commit 2e15acf

Browse files
committed
fixed bad scaling with singleton plots
svn path=/trunk/matplotlib/; revision=344
1 parent 5ef4e11 commit 2e15acf

File tree

10 files changed

+34
-16
lines changed

10 files changed

+34
-16
lines changed

.matplotlibrc

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ interactive : False # see http://matplotlib.sourceforge.net/interactive.htm
3636
lines.linewidth : 0.5 # line width in points
3737
lines.linestyle : - # solid line
3838
lines.color : b # blue; color format or hex string
39+
lines.marker : None # the default marker
3940
lines.markerfacecolor : b
4041
lines.markeredgecolor : k
4142
lines.markeredgewidth : 0.5

CHANGELOG

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
New entries should be added at the top
22
=======
3+
2004-06-15 Improved (yet again!) axis scaling to properly handle
4+
singleton plots - JDH
35

46
2004-06-15 Restored the old FigureCanvasGTK.draw() - SC
57

MANIFEST

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ GOALS
55
INSTALL
66
INTERACTIVE
77
KNOWN_BUGS
8+
MANIFEST
89
MANIFEST.in
910
Makefile
1011
README

Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# Copyright (C) 2003 <jdhunter@ace.bsd.uchicago.edu>
33
# $Header$
44
# $Log$
5+
# Revision 1.35 2004/06/15 17:29:53 jdh2358
6+
# fixed bad scaling with singleton plots
7+
#
58
# Revision 1.34 2004/06/09 13:47:55 jdh2358
69
# added CXX ft2font
710
#
@@ -119,7 +122,7 @@ clean:
119122
${PYTHON} setup.py clean;\
120123
find . -name "_tmp*.py" | xargs rm -f;\
121124
find . \( -name "*~" -o -name "*.pyc" \) | xargs rm -f;\
122-
find examples \( -name "*.png" -o -name "*.ps" -o -name "*.jpg" -o -name "*.eps" \) | xargs rm -f
125+
find examples \( -name "*.png" -o -name "*.ps" -o -name "*.jpg" -o -name "*.eps" -o -name "*.tar" -name "*.gz" \) | xargs rm -f
123126
find unit \( -name "*.png" -o -name "*.ps" -o -name "*.jpg" -o -name "*.eps" \) | xargs rm -f
124127
find . \( -name "#*" -o -name ".#*" -o -name ".*~" -o -name "*~" \) | xargs rm -f
125128

TODO

+1-1
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,6 @@
430430

431431
-- upload 0.54.2 zip
432432

433-
-- need a new way to indicate linestyle
433+
-- DONE need a new way to indicate linestyle
434434

435435
-- update website re debian

examples/backend_driver.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def drive(backend):
8080
times = {}
8181
backends = ['PS', 'GD', 'Paint', 'Agg', 'Template']
8282
#backends.extend([ 'GTK', 'WX', 'TkAgg'])
83-
#backends = [ 'Agg']
83+
backends = [ 'Agg']
8484
#backends = [ 'Agg', 'PS', 'Template']
8585

8686
for backend in backends:

examples/legend_demo2.py

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
ylabel('volts')
1818
title('Damped oscillation')
1919
#savefig('legend_demo2')
20+
#axis([0,2,-1,1])
2021
show()
2122

2223

examples/scatter_demo2.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
delta1 = diff(intc.open)/intc.open[0]
99

10-
volume = (10*intc.volume[:-2]/intc.volume[0])**2
10+
volume = (15*intc.volume[:-2]/intc.volume[0])**2
1111
close = 0.003*intc.close[:-2]/0.003*intc.open[:-2]
1212
p = scatter(delta1[:-1], delta1[1:], c=close, s=volume)
1313
set(p, 'alpha', 0.75)

src/_transforms.cpp

+18-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include <functional>
2-
#include <numeric>
32
#include "_transforms.h"
43

54

@@ -155,17 +154,19 @@ Interval::update(const Py::Tuple &args) {
155154
double minx = _val1->val();
156155
double maxx = _val2->val();
157156

157+
double thisval;
158158
if (ignore) {
159-
minx = std::numeric_limits<double>::max();
160-
maxx = std::numeric_limits<double>::min();
159+
thisval = Py::Float(vals[0]);
160+
minx = thisval;
161+
maxx = thisval;
161162
}
162163

163-
double thisval;
164+
164165
for (size_t i=0; i<Nval; ++i) {
165166
thisval = Py::Float(vals[i]);
166167

167-
if (thisval<minx) minx=thisval;
168-
if (thisval>maxx) maxx=thisval;
168+
if (thisval<minx) minx = thisval;
169+
if (thisval>maxx) maxx = thisval;
169170
}
170171

171172

@@ -340,14 +341,19 @@ Bbox::update(const Py::Tuple &args) {
340341
double miny = _ll->yval();
341342
double maxy = _ur->yval();
342343

344+
Py::Tuple tup;
343345
if (ignore) {
344-
minx = std::numeric_limits<double>::max();
345-
maxx = std::numeric_limits<double>::min();
346-
miny = std::numeric_limits<double>::max();
347-
maxy = std::numeric_limits<double>::min();
346+
tup = xys[0];
347+
double x = Py::Float(tup[0]);
348+
double y = Py::Float(tup[1]);
349+
350+
minx=x;
351+
maxx=x;
352+
miny=y;
353+
maxy=y;
348354
}
349355

350-
Py::Tuple tup;
356+
351357
for (size_t i=0; i<Nx; ++i) {
352358
tup = xys[i];
353359
double x = Py::Float(tup[0]);
@@ -357,6 +363,7 @@ Bbox::update(const Py::Tuple &args) {
357363
if (x>maxx) maxx=x;
358364
if (y<miny) miny=y;
359365
if (y>maxy) maxy=y;
366+
360367
}
361368

362369

unit/pathologies/single_point.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#!/usr/bin/env python
22
from matplotlib.matlab import *
33

4-
figure(1)
4+
subplot(211)
55
plot([0],[0],'o')
6+
7+
subplot(212)
8+
plot([1],[1],'o')
69
show()

0 commit comments

Comments
 (0)