Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Frida
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coenen, Joachim
Frida
Commits
c4333e49
Commit
c4333e49
authored
7 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
improved ticks and tacks for small log ranges
parent
8efd9814
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pub/plot/axis.cpp
+27
-11
27 additions, 11 deletions
pub/plot/axis.cpp
pub/plot/axis.hpp
+5
-3
5 additions, 3 deletions
pub/plot/axis.hpp
pub/plot/ps_plotter.cpp
+5
-4
5 additions, 4 deletions
pub/plot/ps_plotter.cpp
with
37 additions
and
18 deletions
pub/plot/axis.cpp
+
27
−
11
View file @
c4333e49
...
...
@@ -309,20 +309,31 @@ double CAxis::pc(double v) const { return 10 * value2plotcoord(v); }
double
CAxis
::
pcerr
(
double
v
,
double
dv
)
const
{
return
10
*
value2ploterror
(
v
,
dv
);
}
//! Sets Tacks,
*
ntpt, *ticklim to a nice division of the plot range.
//! Sets Tacks, ntpt,
nt4t,
*ticklim to a nice division of the plot range.
void
CAxis
::
calc_ticks
(
vector
<
double
>&
Tacks
,
int
&
ntpt
,
double
*
ticklim
)
const
void
CAxis
::
calc_ticks
(
vector
<
double
>&
Tacks
,
int
&
ntpt
,
int
&
nt4t
,
double
*
ticklim
)
const
{
if
(
logflag
)
calc_logticks
(
Tacks
,
ntpt
,
ticklim
);
calc_logticks
(
Tacks
,
ntpt
,
nt4t
,
ticklim
);
else
calc_linticks
(
Tacks
,
ntpt
,
ticklim
);
calc_linticks
(
Tacks
,
ntpt
,
nt4t
,
ticklim
);
}
//! Sets Tacks,
*
ntpt, *ticklim to a nice division of the plot range.
//! Sets Tacks, ntpt,
nt4t,
*ticklim to a nice division of the plot range.
void
CAxis
::
calc_linticks
(
vector
<
double
>&
Tacks
,
int
&
ntpt
,
double
*
ticklim
)
const
void
CAxis
::
calc_linticks
(
vector
<
double
>&
Tacks
,
int
&
ntpt
,
int
&
nt4t
,
double
*
ticklim
)
const
{
double
dtack
;
calc_lintacks
(
Tacks
,
ntpt
,
dtack
);
ticklim
[
0
]
=
Tacks
.
front
()
-
dtack
;
ticklim
[
1
]
=
Tacks
.
back
()
+
dtack
;
nt4t
=
Tacks
.
size
()
+
2
;
}
//! Sets Tacks, *ntpt, and dtack
void
CAxis
::
calc_lintacks
(
vector
<
double
>&
Tacks
,
int
&
ntpt
,
double
&
dtack
)
const
{
if
(
inf
>=
sup
)
throw
"BUG detected by calc_linticks: inf="
+
S
(
inf
)
+
" >= sup="
+
S
(
sup
);
...
...
@@ -330,7 +341,6 @@ void CAxis::calc_linticks(vector<double>& Tacks, int& ntpt, double* ticklim) con
int
ir
=
(
int
)((
r
<
0
)
?
r
-
1
:
r
);
double
rd
=
r
-
ir
;
// fractional part of r
double
rdr
=
pow
(
10.
,
rd
);
double
dtack
;
if
(
rdr
>
9.99999
)
{
dtack
=
2.5
*
pow
(
10.
,
ir
);
// spacing between tacks
ntpt
=
5
;
// ticks per tack
...
...
@@ -356,14 +366,12 @@ void CAxis::calc_linticks(vector<double>& Tacks, int& ntpt, double* ticklim) con
for
(
double
d
=
dtack
*
(
floor
(
inf
/
dtack
)
-
1
);
d
<
dtack
*
(
ceil
(
sup
/
dtack
)
+
1
);
d
+=
dtack
)
if
(
vsub
<=
d
&&
d
<=
vsup
)
Tacks
.
push_back
(
d
);
ticklim
[
0
]
=
Tacks
.
front
()
-
dtack
;
ticklim
[
1
]
=
Tacks
.
back
()
+
dtack
;
}
//! Sets Tacks,
*
ntpt, *ticklim to a nice division of the plot range.
//! Sets Tacks, ntpt,
nt4t,
*ticklim to a nice division of the plot range.
void
CAxis
::
calc_logticks
(
vector
<
double
>&
Tacks
,
int
&
ntpt
,
double
*
ticklim
)
const
void
CAxis
::
calc_logticks
(
vector
<
double
>&
Tacks
,
int
&
ntpt
,
int
&
nt4t
,
double
*
ticklim
)
const
{
if
(
inf
>=
sup
)
throw
"BUG detected by calc_logticks: inf="
+
S
(
inf
)
+
" >= sup="
+
S
(
sup
);
...
...
@@ -404,6 +412,7 @@ void CAxis::calc_logticks(vector<double>& Tacks, int& ntpt, double* ticklim) con
if
(
d1
<=
r0
&&
r0
<=
d2
)
Tacks
.
push_back
(
r0
);
}
nt4t
=
Tacks
.
size
()
+
2
;
// set tick limits (may exceed actual tick range)
int
ntack
=
Tacks
.
size
();
...
...
@@ -426,4 +435,11 @@ void CAxis::calc_logticks(vector<double>& Tacks, int& ntpt, double* ticklim) con
}
else
{
ntpt
=
-
incr
;
// this one has special semantics: it means 'incr' ticks per tack
}
// for narrow ranges, overwrite tacks
if
(
ntack
<
2
)
{
double
dtack
;
int
ntpt_dummy
;
calc_lintacks
(
Tacks
,
ntpt_dummy
,
dtack
);
}
}
This diff is collapsed.
Click to expand it.
pub/plot/axis.hpp
+
5
−
3
View file @
c4333e49
...
...
@@ -43,7 +43,9 @@ public:
void
set_xgrid
(
std
::
vector
<
double
>&
x
,
int
n
)
const
;
double
pc
(
double
v
)
const
;
double
pcerr
(
double
v
,
double
dv
)
const
;
void
calc_ticks
(
std
::
vector
<
double
>&
Tacks
,
int
&
ntpt
,
double
*
ticklim
)
const
;
void
calc_linticks
(
std
::
vector
<
double
>&
Tacks
,
int
&
ntpt
,
double
*
ticklim
)
const
;
void
calc_logticks
(
std
::
vector
<
double
>&
Tacks
,
int
&
ntpt
,
double
*
ticklim
)
const
;
void
calc_ticks
(
std
::
vector
<
double
>&
Tacks
,
int
&
ntpt
,
int
&
nt4t
,
double
*
ticklim
)
const
;
private
:
void
calc_linticks
(
std
::
vector
<
double
>&
Tacks
,
int
&
ntpt
,
int
&
nt4t
,
double
*
ticklim
)
const
;
void
calc_lintacks
(
std
::
vector
<
double
>&
Tacks
,
int
&
ntpt
,
double
&
dtack
)
const
;
void
calc_logticks
(
std
::
vector
<
double
>&
Tacks
,
int
&
ntpt
,
int
&
nt4t
,
double
*
ticklim
)
const
;
};
This diff is collapsed.
Click to expand it.
pub/plot/ps_plotter.cpp
+
5
−
4
View file @
c4333e49
...
...
@@ -158,9 +158,10 @@ namespace {
string
ps_ticktack
(
const
CAxis
*
A
)
{
vector
<
double
>
Tacks
;
int
ntpt
;
int
ticks_per_tack
;
int
ntacks4ticks
;
double
ticklim
[
2
];
A
->
calc_ticks
(
Tacks
,
ntpt
,
ticklim
);
A
->
calc_ticks
(
Tacks
,
ticks_per_tack
,
ntacks4ticks
,
ticklim
);
string
ret
;
int
ntack
=
Tacks
.
size
();
...
...
@@ -187,8 +188,8 @@ namespace {
%
A
->
name
%
(
float
)
ticklim
[
1
]
%
A
->
name
%
(
ntack
+
2
)
%
ntpt
%
ntack
s4ticks
%
ticks_per_tack
%
(
A
->
logflag
?
"Log"
:
"Lin"
));
return
ret
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment