[matplotlib-devel] fix to markers.py

2011-12-18 Thread Alexander Heger
In [1]: matplotlib.__version__
Out[1]: '1.2.x'


~/matplotlib/lib/matplotlib>diff  markers.py_broken markers.py
190c190
< path = Path(verts)
---
 > path = Path(self._marker)

PS - I tried to log into
https://github.com/matplotlib/matplotlib/issues
using my mailing list password to create a bug report, but it would not 
accept it, so you get it this way.

DOCUMENTATION NOTES

1) in the table for marker vertices it states

http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.lines.Line2D.set_marker

verts   a list of (x, y) pairs in range (0, 1)

it really should be just normalized or abs(1), (0,0) being center, and 
hence the (x,y) values should be in the range (-1,+1).  Would be good to 
add an example

x=np.linspace(0,1,10)**2
plot(x,c='r',marker=((-1.,-1),(1.,-1),(1.,1.),(-1,1.),(-1,-1)),ms=10)

2) the source also support to just provide a path as a marker, which (a) 
is cool, and (b) seemed natural as internal many things are done a 
paths, and even complies paths are generated from the $...$ syntax math. 
  In any case, this should be added to the documentation for allowed markers

patha matplotlib.path.Path object

import matplotlib.path as path
x = np.linspace(0,1,10)**2
p = path.Path(((-1.,-1),(1.,-1),(1.,1.),(-1,1.),(-1,-1)))
plot(x,c='r',marker=p,ms=10)

or a cool example that you may want tot add to the library...

import matplotlib.path as path

# define codes
P = path.Path
Pm = P.MOVETO
Pl = P.LINETO
Pc = P.CLOSEPOLY
c = [Pm] + [Pl]*3 + [Pc]
cx=c*2

# define basic path
r=np.array(((-1.,-1),(1.,-1),(1.,1.),(-1,1.),(-1,-1)))
# we add second closed path of half size but reverse parity
rh=0.5*r[::-1]
rx = np.vstack((r,rh))
p = path.Path(rx,codes=cx)

x = np.linspace(0,1,10)**2
plot(x,c='r',marker=p,ms=10)

PS - I guess I need to figure out how to do such updates w/o requesting 
action from the lest eventually.

Just to emphasize (2a): COOL!!!

Wishlist:
Can we add a "transform" parameter to overwrite self._transform?
I suppose this would have to go many places.

"set_marker_transform"

Maybe add to MarkerStyle

from transforms import Transform
def self.set_transform(self, transform = IdentityTransform()):
 assert isinstance(x, Transform)
 self._transfrom = transfrom()


Maybe less fancy, and better for starters, to add an angle

"set_marker_rotation(angle)"

using

Affine2D().rotate_deg(angle)


-Alexander

--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] another change request to markers.py

2011-12-18 Thread Alexander Heger
Sorry for the multiple mailings.

in makers.py I request to change

  def _set_custom_marker(self, path):
  verts = path.vertices
  rescale = max(np.max(np.abs(verts[:,0])),
np.max(np.abs(verts[:,1])))
  self._transform = Affine2D().scale(1.0 / rescale)
  self._path = path

to

  def _set_custom_marker(self, path):
  verts = path.vertices
  rescale = np.max(np.sqrt(np.square(verts[:,0]) +
np.square(verts[:,1])))
  self._transform = Affine2D().scale(1.0 / rescale)
  self._path = path

such that the symbol *radius* is normalized to 1.0

This way my previous example give better results if the symbol is rotated:

import matplotlib.path as path
from matplotlib.transforms import Affine2D

# define codes
P = path.Path
Pm = P.MOVETO
Pl = P.LINETO
Pc = P.CLOSEPOLY
c = [Pm] + [Pl]*3 + [Pc]
cx=c*2

# define basic path
r=np.array(((-1.,-1),(1.,-1),(1.,1.),(-1,1.),(-1,-1)))
# we add second closed path of half size but reverse parity
rh=0.5*r[::-1]
rx = np.vstack((r,rh))
p = path.Path(rx,codes=cx)

x = np.linspace(0,1,10)**2
plot(x,c='r',marker=p,ms=10)

pr = p.transformed(Affine2D().rotate_deg(45.))
plot(x,c='r',marker=pr,ms=10)

show()

I think this is how it is "meant" to be, but maybe you have to add a
parameter to allow people recover the current behavior in that case.

-Alexander


I just like round cows better than square cows.

--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] another change request to markers.py

2011-12-19 Thread Alexander Heger
in makers.py I request to change

 def _set_custom_marker(self, path):
 verts = path.vertices
 rescale = max(np.max(np.abs(verts[:,0])), 
np.max(np.abs(verts[:,1])))
 self._transform = Affine2D().scale(1.0 / rescale)
 self._path = path

to

 def _set_custom_marker(self, path):
 verts = path.vertices
 rescale = np.max(np.sqrt(np.square(verts[:,0]) + 
np.square(verts[:,1])))
 self._transform = Affine2D().scale(1.0 / rescale)
 self._path = path

such that the symbol *radius* is normalized to 1.0

This way my previous example give better results if the symbol is rotated:

import matplotlib.path as path
from matplotlib.transforms import Affine2D

# define codes
P = path.Path
Pm = P.MOVETO
Pl = P.LINETO
Pc = P.CLOSEPOLY
c = [Pm] + [Pl]*3 + [Pc]
cx=c*2

# define basic path
r=np.array(((-1.,-1),(1.,-1),(1.,1.),(-1,1.),(-1,-1)))
# we add second closed path of half size but reverse parity
rh=0.5*r[::-1]
rx = np.vstack((r,rh))
p = path.Path(rx,codes=cx)

x = np.linspace(0,1,10)**2
plot(x,c='r',marker=p,ms=10)

pr = p.transformed(Affine2D().rotate_deg(45.))
plot(x,c='r',marker=pr,ms=10)

show()

I think this is how it is "meant" to be, but maybe you have to add a 
parameter to allow people recover the current behavior in that case.

-Alexander


I just like round cows better than square cows.

--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] quick bug fix

2012-09-25 Thread Alexander Heger
Could you please change in the current branch in

axes.py, line 7585
(Axes.pcolorfast)


 nr, nc = C.shape
to
 nr, nc = C.shape[:2]


this way one can pass [nx,ny,3] or [nx,ny,4] arrays to the routine - for 
which the PcolorImage it calls is made (style == "pcolorimage")

-Alexander

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] quick bug fix

2012-09-27 Thread Alexander Heger

I am not sure what I need to do to get any bug fixes included into mpl.
All previous attempts failed.
Is it a community effort?

I now attached a patch.

-Alexander

On 25/09/12 23:58, Alexander Heger wrote:

Could you please change in the current branch in

axes.py, line 7585
(Axes.pcolorfast)


  nr, nc = C.shape
to
  nr, nc = C.shape[:2]


this way one can pass [nx,ny,3] or [nx,ny,4] arrays to the routine - for
which the PcolorImage it calls is made (style == "pcolorimage")

-Alexander

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel



>From e555f98ca915eb89c7df1cff21261efb506fc29a Mon Sep 17 00:00:00 2001
From: Alexander Heger 
Date: Fri, 28 Sep 2012 15:08:27 +1000
Subject: [PATCH] BF - fix pcolor fast to allow direct color

---
 lib/matplotlib/axes.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/matplotlib/axes.py b/lib/matplotlib/axes.py
index 56017a2..6a4a87d 100644
--- a/lib/matplotlib/axes.py
+++ b/lib/matplotlib/axes.py
@@ -7582,7 +7582,7 @@ class Axes(martist.Artist):
 if norm is not None: assert(isinstance(norm, mcolors.Normalize))
 
 C = args[-1]
-nr, nc = C.shape
+nr, nc = C.shape[:2]
 if len(args) == 1:
 style = "image"
 x = [0, nc]
-- 
1.7.11.4


--
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] bugfix in matplotlib/ticker.py (python 3.x)

2013-05-10 Thread Alexander Heger
from the current version.

this causes trouble if the axis is very big, with values of, day 1e35.

diff -u /home/alex/mpl/usr/lib64/python3.3/site-packages/matplotlib/ticker.py~
/home/alex/mpl/usr/lib64/python3.3/site-packages/matplotlib/ticker.py
--- /home/alex/mpl/usr/lib64/python3.3/site-packages/matplotlib/ticker.py~
 2013-05-10 16:43:44.0 +1000
+++ /home/alex/mpl/usr/lib64/python3.3/site-packages/matplotlib/ticker.py
  2013-05-10 17:44:35.385288785 +1000
@@ -536,7 +536,7 @@
 _locs = list(self.locs) + [vmin, vmax]
 else:
 _locs = self.locs
-locs = (np.asarray(_locs) - self.offset) / 10 ** self.orderOfMagnitude
+locs = (np.asarray(_locs) - self.offset) / 10. ** self.orderOfMagnitude
 loc_range = np.ptp(locs)
 if len(self.locs) < 2:
 # We needed the end points only for the loc_range calculation.

--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] python3 bug in __init__.py - plus fix

2013-10-10 Thread Alexander Heger
I am using Fedora 19, 64 bit, and the distribution's python 3.3.2, and
the most recent version of mpl from git

there seems to be a bug in the starup routine where proper conversion
from bytes to string (as needed for Python 3) is not done

the problem is in

/matplotlib/__init__.py, line 459 ... 460

459 gs_exec, gs_v = checkdep_ghostscript()
460 if compare_versions(gs_v, gs_sugg): pass

ipdb> gs_exec,  gs_v
('gs', b'9.07')

where clearly gs_v needs to be str

Could you please make checkdep_ghostscript() to be python3-save by
changing line 334 from

v = stdout[:-1]

to

v = stdout[:-1].decode('ascii')

(my apologies not following the bug report procedures; I hope you can
consider it anyway)

-Alexander


~/python/source3>ip
Python 3.3.2 (default, Aug 23 2013, 19:00:04)
Type "copyright", "credits" or "license" for more information.

IPython 0.13.2 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help  -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.
[TerminalIPythonApp] GUI event loop or pylab initialization failed
---
TypeError Traceback (most recent call last)
/usr/lib/python3.3/site-packages/IPython/core/pylabtools.py in
find_gui_and_backend(gui)
194 """
195
--> 196 import matplotlib
197
198 if gui and gui != 'auto':

/home/alex/mpl/usr/lib64/python3.3/site-packages/matplotlib/__init__.py
in ()
975
976 rcParams['ps.usedistiller'] =
checkdep_ps_distiller(rcParams['ps.usedistiller'])
--> 977 rcParams['text.usetex'] = checkdep_usetex(rcParams['text.usetex'])
978
979 if rcParams['axes.formatter.use_locale']:

/home/alex/mpl/usr/lib64/python3.3/site-packages/matplotlib/__init__.py
in checkdep_usetex(s)
458
459 gs_exec, gs_v = checkdep_ghostscript()
--> 460 if compare_versions(gs_v, gs_sugg): pass
461 elif compare_versions(gs_v, gs_req):
462 verbose.report(('ghostscript-%s found. ghostscript-%s
or later is '

/home/alex/mpl/usr/lib64/python3.3/site-packages/matplotlib/__init__.py
in compare_versions(a, b)
116 "return True if a is greater than or equal to b"
117 if a:
--> 118 a = distutils.version.LooseVersion(a)
119 b = distutils.version.LooseVersion(b)
120 if a>=b: return True

/usr/lib64/python3.3/distutils/version.py in __init__(self, vstring)
308 def __init__ (self, vstring=None):
309 if vstring:
--> 310 self.parse(vstring)
311
312

/usr/lib64/python3.3/distutils/version.py in parse(self, vstring)
316 # use by __str__
317 self.vstring = vstring
--> 318 components = [x for x in self.component_re.split(vstring)
319   if x and x != '.']
320 for i, obj in enumerate(components):

TypeError: can't use a string pattern on a bytes-like object

--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] RFC: candidates for a new default colormap

2015-06-04 Thread Alexander Heger
I think the very dark tones in Options A and B would make it harder to
add annotations on top, so C and D are better for that.  Between C and
D I find that C looks slightly more "energetic", D is too rather calm
though nice.  When used in talks, you can see the green laser pointer
better on top of C.

-Alexander

On 3 June 2015 at 11:46, Nathaniel Smith  wrote:
> Hi all,
>
> As was hinted at in a previous thread, Stéfan van der Walt and I have
> been using some Fancy Color Technology to attempt to design a new
> colormap intended to become matplotlib's new default. (Down with jet!)
>
> Unfortunately, while our Fancy Color Technology includes a
> computational model of perceptual distance, it does not include a
> computational model of aesthetics. So this is where you come in.
>
> We've put up three reasonable candidates at:
> https://bids.github.io/colormap/
> (along with some well-known colormaps for comparison), and we'd like
> your feedback.
>
> They are all optimal on all of the objective criteria we know how to
> measure. What we need judgements on is which one you like best, both
> aesthetically and as a way of visualizing data. (There are some sample
> plots to look at there, plus you can download them and play with them
> on your own data if you want.)
>
> We especially value input from anyone with anomalous color vision.
> There are some simulations there, but computational models are
> inherently limited here. (It's difficult to ask someone with
> colorblindness "does this look to you, the same way this other picture
> looks to me?")
>
> -n
>
> --
> Nathaniel J. Smith -- http://vorpus.org
>
> --
> ___
> Matplotlib-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

--
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel