SourceForge logo
SourceForge logo
Menu

matplotlib-devel

From: Alexander H. <al...@ph...> - 2011年12月18日 19:44:54
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.
From: Alexander H. <mat...@2s...> - 2011年12月18日 19:49:16
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.
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /