Skip to content

Commit

Permalink
updated legend switches
Browse files Browse the repository at this point in the history
  • Loading branch information
ggmichael committed Sep 1, 2023
1 parent d0f273e commit 4ca978f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/craterstats/Cratercount.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def ReadSCCfile(self):
if 'Perimeter' in s.keys():
self.perimeter = float(s['Perimeter'])
if 'Total_perimeter' in s.keys(): #for Thomas Heyer's OpenCraterTool
self.perimeter = float(s['Total_perimeter'])
self.perimeter = float(re.findall('\s*[\d\.]*',s['Total_perimeter'])[0])
self.diam=[diam[e] for e in q]
self.fraction=[frac[e] for e in q]
self.prebinned=0
Expand Down
2 changes: 1 addition & 1 deletion src/craterstats/Craterplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def overplot(self,cps):
ax = cps.fig.add_axes(pos3)
self.pdf.plot(ax,pt_size=cps.scaled_pt_size,color=cps.palette[self.colour])

if '#' in cps.legend:
if 'c' in cps.legend:
if self.cratercount.buffered:
legend_label += ['{:.1f}'.format(self.n_event)]
else:
Expand Down
7 changes: 4 additions & 3 deletions src/craterstats/Craterplotset.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,10 @@ def draw(self):
skip=False
continue
if e=='fit':
h1.append((h[i],h[i+1]))
b1.append(b[i+1])
skip=True
skip = True
if set(self.legend) & set('crN') != set():
h1.append((h[i],h[i+1]))
b1.append(b[i+1])
else:
h1.append(h[i])
b1.append(e)
Expand Down
2 changes: 1 addition & 1 deletion src/craterstats/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def get_parser():
parser.add_argument("-yrange", help="y-axis range, log(min) log(max)", nargs=2)
parser.add_argument("-isochrons", help="comma-separated isochron list in Ga, e.g. 1,3,3.7a,4a (optional combined suffix to modify label: n - suppress; a - above; s - small)")
parser.add_argument("-show_isochrons", choices=['0', '1'], help="1 - show; 0 - suppress")
parser.add_argument("-legend", help="any combination of: n - name; a - area; # - number of craters; r - range; N - N(d_ref) value")
parser.add_argument("-legend", help="0 - suppress; or any combination of: n - name, a - area, c - number of craters, r - range, N - N(d_ref) value")
parser.add_argument("-cite_functions", choices=['0','1'], help="1 - show; 0 - suppress")
parser.add_argument("-mu", choices=['0','1'], help="1 - show; 0 - suppress")
parser.add_argument("-style", choices=['natural', 'root-2'], help="diameter axis style")
Expand Down
2 changes: 1 addition & 1 deletion src/craterstats/config/default.plt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set={
equilibrium=''
invert=0
isochrons=''
legend='na#r'
legend='nacr'
mu=1
presentation='differential'
print_dimensions='7.5x7.5'
Expand Down
3 changes: 3 additions & 0 deletions src/craterstats/str_diameter_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ def str_diameter_range(d,sf=2):
"""

# \u2013 en-dash \u2009 short space
if np.isinf(d[1]):
return 'unconstrained'

if d[1] >=1:
s = gm.sigfigs(d, sf)
return '{0[0]}\u2013{0[1]} km'.format(s)
Expand Down

0 comments on commit 4ca978f

Please sign in to comment.