Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Permit to set the color of the background independently in plot3 from…
Browse files Browse the repository at this point in the history
… sage.monoids.beta_adic_monoid

Avoid the recalculation of la in getBetaAdic2
  • Loading branch information
mercatp committed Aug 13, 2014
1 parent 6779b7e commit 23ba6f2
Showing 1 changed file with 26 additions and 19 deletions.
45 changes: 26 additions & 19 deletions src/sage/monoids/beta_adic_monoid.pyx
Expand Up @@ -266,23 +266,28 @@ cdef BetaAdic2 getBetaAdic2 (self, la=None, ss=None, tss=None, prec=53, add_lett
tss = tss.emonde0_simplify()
if verb:
print tss
a = {}
for v in ss.vertices():
a[v] = Automaton(ss)
a[v].I = [list(ss.I)[0]]
a[v].F = [v]
if verb:
print "Compute the transposition..."
a[v] = a[v].transpose().determinize()
if verb:
print a[v]
print "simplify..."
a[v] = a[v].emonde0_simplify()
if la is None:
if hasattr(self, 'la'):
la = self.la
if la is None:
#compute la
a = {}
for v in ss.vertices():
a[v] = Automaton(ss)
a[v].I = [list(ss.I)[0]]
a[v].F = [v]
if verb:
print "Compute the transposition..."
a[v] = a[v].transpose().determinize()
if verb:
print a[v]
print "simplify..."
a[v] = a[v].emonde0_simplify()
if verb:
print a[v]
la = [tss]+a.values()
if verb:
print a[v]
la = [tss]+a.values()
if verb:
self.la = la
self.la = la

C = set(self.C)
if add_letters:
Expand Down Expand Up @@ -690,7 +695,7 @@ class BetaAdicMonoid(Monoid_class):
FreeAutomate(b.a)
FreeBetaAdic(b)

def plot3 (self, n=None, la=None, ss=None, tss=None, sx=800, sy=600, ajust=True, prec=53, colormap = 'hsv', opacity = 1., add_letters=True, verb=False):
def plot3 (self, n=None, la=None, ss=None, tss=None, sx=800, sy=600, ajust=True, prec=53, colormap = 'hsv', backcolor=None, opacity = 1., add_letters=True, verb=False):
r"""
Draw the limit set of the beta-adic monoid with colors.
Expand Down Expand Up @@ -780,7 +785,9 @@ class BetaAdicMonoid(Monoid_class):
if n is None:
n = -1

# Manage colors and opacity
# Manage colors
if backcolor is None:
backcolor = (.5, .5, .5, .5)
cdef ColorList cl
cl = NewColorList(b.na)
if isinstance(colormap, dict):
Expand All @@ -796,7 +803,7 @@ class BetaAdicMonoid(Monoid_class):
if not colormap in cm.datad.keys():
raise RuntimeError("Color map %s not known (type sorted(colors) for valid names)" % colormap)
colormap = cm.__dict__[colormap]
cl[0] = getColor(colormap(1.))
cl[0] = getColor(backcolor)
for i in range(b.na-1):
cl[i+1] = getColor(colormap(float(i)/float(b.na-1)))
else:
Expand Down

0 comments on commit 23ba6f2

Please sign in to comment.