Skip to content

Commit

Permalink
fixed bad scaling with singleton plots
Browse files Browse the repository at this point in the history
svn path=/trunk/matplotlib/; revision=344
  • Loading branch information
jdh2358 committed Jun 15, 2004
1 parent 5ef4e11 commit 2e15acf
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 16 deletions.
1 change: 1 addition & 0 deletions .matplotlibrc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ interactive : False # see http://matplotlib.sourceforge.net/interactive.htm
lines.linewidth : 0.5 # line width in points
lines.linestyle : - # solid line
lines.color : b # blue; color format or hex string
lines.marker : None # the default marker
lines.markerfacecolor : b
lines.markeredgecolor : k
lines.markeredgewidth : 0.5
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
New entries should be added at the top
=======
2004-06-15 Improved (yet again!) axis scaling to properly handle
singleton plots - JDH

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

Expand Down
1 change: 1 addition & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ GOALS
INSTALL
INTERACTIVE
KNOWN_BUGS
MANIFEST
MANIFEST.in
Makefile
README
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# Copyright (C) 2003 <jdhunter@ace.bsd.uchicago.edu>
# $Header$
# $Log$
# Revision 1.35 2004/06/15 17:29:53 jdh2358
# fixed bad scaling with singleton plots
#
# Revision 1.34 2004/06/09 13:47:55 jdh2358
# added CXX ft2font
#
Expand Down Expand Up @@ -119,7 +122,7 @@ clean:
${PYTHON} setup.py clean;\
find . -name "_tmp*.py" | xargs rm -f;\
find . \( -name "*~" -o -name "*.pyc" \) | xargs rm -f;\
find examples \( -name "*.png" -o -name "*.ps" -o -name "*.jpg" -o -name "*.eps" \) | xargs rm -f
find examples \( -name "*.png" -o -name "*.ps" -o -name "*.jpg" -o -name "*.eps" -o -name "*.tar" -name "*.gz" \) | xargs rm -f
find unit \( -name "*.png" -o -name "*.ps" -o -name "*.jpg" -o -name "*.eps" \) | xargs rm -f
find . \( -name "#*" -o -name ".#*" -o -name ".*~" -o -name "*~" \) | xargs rm -f

Expand Down
2 changes: 1 addition & 1 deletion TODO
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,6 @@

-- upload 0.54.2 zip

-- need a new way to indicate linestyle
-- DONE need a new way to indicate linestyle

-- update website re debian
2 changes: 1 addition & 1 deletion examples/backend_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def drive(backend):
times = {}
backends = ['PS', 'GD', 'Paint', 'Agg', 'Template']
#backends.extend([ 'GTK', 'WX', 'TkAgg'])
#backends = [ 'Agg']
backends = [ 'Agg']
#backends = [ 'Agg', 'PS', 'Template']

for backend in backends:
Expand Down
1 change: 1 addition & 0 deletions examples/legend_demo2.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
ylabel('volts')
title('Damped oscillation')
#savefig('legend_demo2')
#axis([0,2,-1,1])
show()


Expand Down
2 changes: 1 addition & 1 deletion examples/scatter_demo2.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

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

volume = (10*intc.volume[:-2]/intc.volume[0])**2
volume = (15*intc.volume[:-2]/intc.volume[0])**2
close = 0.003*intc.close[:-2]/0.003*intc.open[:-2]
p = scatter(delta1[:-1], delta1[1:], c=close, s=volume)
set(p, 'alpha', 0.75)
Expand Down
29 changes: 18 additions & 11 deletions src/_transforms.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include <functional>
#include <numeric>
#include "_transforms.h"


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

double thisval;
if (ignore) {
minx = std::numeric_limits<double>::max();
maxx = std::numeric_limits<double>::min();
thisval = Py::Float(vals[0]);
minx = thisval;
maxx = thisval;
}

double thisval;

for (size_t i=0; i<Nval; ++i) {
thisval = Py::Float(vals[i]);

if (thisval<minx) minx=thisval;
if (thisval>maxx) maxx=thisval;
if (thisval<minx) minx = thisval;
if (thisval>maxx) maxx = thisval;
}


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

Py::Tuple tup;
if (ignore) {
minx = std::numeric_limits<double>::max();
maxx = std::numeric_limits<double>::min();
miny = std::numeric_limits<double>::max();
maxy = std::numeric_limits<double>::min();
tup = xys[0];
double x = Py::Float(tup[0]);
double y = Py::Float(tup[1]);

minx=x;
maxx=x;
miny=y;
maxy=y;
}

Py::Tuple tup;

for (size_t i=0; i<Nx; ++i) {
tup = xys[i];
double x = Py::Float(tup[0]);
Expand All @@ -357,6 +363,7 @@ Bbox::update(const Py::Tuple &args) {
if (x>maxx) maxx=x;
if (y<miny) miny=y;
if (y>maxy) maxy=y;

}


Expand Down
5 changes: 4 additions & 1 deletion unit/pathologies/single_point.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/usr/bin/env python
from matplotlib.matlab import *

figure(1)
subplot(211)
plot([0],[0],'o')

subplot(212)
plot([1],[1],'o')
show()

0 comments on commit 2e15acf

Please sign in to comment.