commit 39812f8fd0148fc705cfbf48b8d2d516c21929ba (tree)
parent e4beb99614ec0909991ec1326857c85c03b3069e
Author: Motiejus Jakštys <motiejus@uber.com>
Date: Sun, 9 May 2021 14:33:53 +0300
improve coloring of visualizations
Diffstat:
3 files changed, 42 insertions(+), 51 deletions(-)
diff --git a/IV/Makefile b/IV/Makefile
@@ -25,10 +25,8 @@ FIGURES = \
fig5-gentle-inflection-after \
inflection-1-gentle-inflection-before \
inflection-1-gentle-inflection-after \
- fig6-selfcrossing-before \
- fig6-selfcrossing-after \
- selfcrossing-1-before \
- selfcrossing-1-after \
+ fig6-selfcrossing \
+ selfcrossing-1 \
isolated-1-exaggerated
RIVERS = \
@@ -119,7 +117,7 @@ fig8-elimination-gen3_3SELECT = wm_debug where name='fig8' AND stage='bbends-pol
fig8-elimination-gen3_3LINESTYLE = dotted
fig5-gentle-inflection-before_WITHDIV = 2
-fig5-gentle-inflection-before_1SELECT = wm_debug where name='fig5' AND stage='bbends' AND gen=1
+fig5-gentle-inflection-before_1SELECT = wm_debug where name='fig5' AND stage='afigures' AND gen=1
fig5-gentle-inflection-before_2SELECT = wm_debug where name='fig5' AND stage='bbends-polygon' AND gen=1
fig5-gentle-inflection-before_3SELECT = wm_debug where name='fig5' AND stage='bbends-polygon' AND gen=1
fig5-gentle-inflection-before_3LINESTYLE = dotted
@@ -130,7 +128,7 @@ fig5-gentle-inflection-after_3SELECT = wm_debug where name='fig5' AND stage='cin
fig5-gentle-inflection-after_3LINESTYLE = dotted
inflection-1-gentle-inflection-before_WIDTHDIV = 2
-inflection-1-gentle-inflection-before_1SELECT = wm_debug where name='inflection-1' AND stage='bbends' AND gen=1
+inflection-1-gentle-inflection-before_1SELECT = wm_debug where name='inflection-1' AND stage='afigures' AND gen=1
inflection-1-gentle-inflection-before_2SELECT = wm_debug where name='inflection-1' AND stage='bbends-polygon' AND gen=1
inflection-1-gentle-inflection-before_3SELECT = wm_debug where name='inflection-1' AND stage='bbends-polygon' AND gen=1
inflection-1-gentle-inflection-before_3LINESTYLE = dotted
@@ -140,31 +138,24 @@ inflection-1-gentle-inflection-after_2SELECT = wm_debug where name='inflection-1
inflection-1-gentle-inflection-after_3SELECT = wm_debug where name='inflection-1' AND stage='cinflections-polygon' AND gen=1
inflection-1-gentle-inflection-after_3LINESTYLE = dotted
-fig6-selfcrossing-before_WIDTHDIV = 2
-fig6-selfcrossing-before_1SELECT = wm_debug where name='fig6' AND stage='afigures' AND gen=1
-fig6-selfcrossing-before_1LINESTYLE = dotted
-fig6-selfcrossing-before_2SELECT = wm_visuals where name='fig6-baseline'
-fig6-selfcrossing-before_3SELECT = wm_debug where name='fig6' AND stage='dcrossings' AND gen=1
-fig6-selfcrossing-before_3COLOR = black
-fig6-selfcrossing-after_WIDTHDIV = 2
-fig6-selfcrossing-after_1SELECT = wm_debug where name='fig6' AND stage='dcrossings' AND gen=1
-
-selfcrossing-1-before_WIDTHDIV = 2
-selfcrossing-1-before_1SELECT = wm_debug where name='selfcrossing-1' AND stage='bbends' AND gen=1
-selfcrossing-1-before_1LINESTYLE = dotted
-selfcrossing-1-before_2SELECT = wm_visuals where name='selfcrossing-1-baseline'
-selfcrossing-1-before_3SELECT = wm_debug where name='selfcrossing-1' AND stage='dcrossings' AND gen=1
-selfcrossing-1-before_3COLOR = black
-selfcrossing-1-after_WIDTHDIV = 2
-selfcrossing-1-after_1SELECT = wm_debug where name='selfcrossing-1' AND stage='dcrossings' AND gen=1
-selfcrossing-1-after_2SELECT = wm_debug where name='selfcrossing-1' AND stage='bbends' AND gen=1
-selfcrossing-1-after_2LINESTYLE = invisible
+fig6-selfcrossing_WIDTHDIV = 2
+fig6-selfcrossing_1SELECT = wm_debug where name='fig6' AND stage='afigures' AND gen=1
+fig6-selfcrossing_1LINESTYLE = dotted
+fig6-selfcrossing_2SELECT = wm_debug where name='fig6' AND stage='dcrossings' AND gen=1
+fig6-selfcrossing_3SELECT = wm_visuals where name='fig6-baseline'
+fig6-selfcrossing_3COLOR = orange
+
+selfcrossing-1_WIDTHDIV = 2
+selfcrossing-1_1SELECT = wm_debug where name='selfcrossing-1' AND stage='afigures' AND gen=1
+selfcrossing-1_1LINESTYLE = dotted
+selfcrossing-1_2SELECT = wm_debug where name='selfcrossing-1' AND stage='dcrossings' AND gen=1
+selfcrossing-1_3SELECT = wm_visuals where name='selfcrossing-1-baseline'
+selfcrossing-1_3COLOR = orange
isolated-1-exaggerated_WIDTHDIV = 2
-isolated-1-exaggerated_1SELECT = wm_debug where name='isolated-1' AND stage='bbends' AND gen=1
+isolated-1-exaggerated_1SELECT = wm_debug where name='isolated-1' AND stage='afigures' AND gen=1
isolated-1-exaggerated_1LINESTYLE = dotted
-isolated-1-exaggerated_2SELECT = wm_debug where name='isolated-1' AND stage='gexaggeration' AND gen=1
-isolated-1-exaggerated_2COLOR = black
+isolated-1-exaggerated_2SELECT = wm_debug where name='isolated-1' AND stage='afigures' AND gen=2
salvis-25k_1SELECT = wm_visuals where name='salvis'
salvis-25k_WIDTHDIV = 1
diff --git a/IV/layer2img.py b/IV/layer2img.py
@@ -10,9 +10,22 @@ from matplotlib import rc
CMAP = 'tab20c'
BOUNDS = ('xmin', 'ymin', 'xmax', 'ymax')
-BLACK, GREEN, ORANGE, PURPLE = '#000000', '#1b9e77', '#d95f02', '#7570b3'
PSQL_CREDS = "host=127.0.0.1 dbname=osm user=osm password=osm"
+COLORS = {
+ 'black': '#000000',
+ 'green': '#1b9e77',
+ 'orange': '#d95f02',
+ 'purple': '#7570b3',
+}
+
+
+def color(string):
+ if not string:
+ string = 'black'
+ return COLORS[string]
+
+
# see `NOTICE` in the LaTeX document; this is the width of the main text block.
TEXTWIDTH_CM = 12.12364
@@ -22,23 +35,25 @@ def inch(cm):
def parse_args():
+ kwcolor = {'type': color, 'default': 'black'}
+
parser = argparse.ArgumentParser(
description='Convert a geometry to an image')
parser.add_argument('--group1-select')
parser.add_argument('--group1-linestyle')
- parser.add_argument('--group1-color', default=BLACK)
+ parser.add_argument('--group1-color', **kwcolor)
parser.add_argument('--group2-select')
parser.add_argument('--group2-linestyle')
- parser.add_argument('--group2-color', default=ORANGE)
+ parser.add_argument('--group2-color', **kwcolor)
parser.add_argument('--group3-select')
parser.add_argument('--group3-linestyle')
- parser.add_argument('--group3-color', default=GREEN)
+ parser.add_argument('--group3-color', **kwcolor)
parser.add_argument('--widthdiv',
default=1, type=float, help='Width divisor')
- parser.add_argument('--quadrant', type=int, choices=(1,2,3,4))
+ parser.add_argument('--quadrant', type=int, choices=(1, 2, 3, 4))
parser.add_argument('-o', '--outfile', metavar='<file>')
return parser.parse_args()
diff --git a/IV/mj-msc.tex b/IV/mj-msc.tex
@@ -926,30 +926,15 @@ copied from the original article.
\begin{figure}[ht]
\centering
- \begin{subfigure}[b]{.49\textwidth}
- \includegraphics[width=\textwidth]{fig6-selfcrossing-before}
- \caption{Bend's baseline (dotted) is crossing a neighboring bend.}
- \end{subfigure}
- \hfill
- \begin{subfigure}[b]{.49\textwidth}
- \includegraphics[width=\textwidth]{fig6-selfcrossing-after}
- \caption{Self-crossing removed.}
- \end{subfigure}
+ \includegraphics[width=.5\textwidth]{fig6-selfcrossing}
+ \caption{Bend's baseline (orange) is crossing a neighboring bend.}
\caption{Originally figure 6: simple case of self-line crossing.}
\label{fig:fig6-selfcrossing}
\end{figure}
\begin{figure}[ht]
\centering
- \begin{subfigure}[b]{.49\textwidth}
- \includegraphics[width=\textwidth]{selfcrossing-1-before}
- \caption{Bend's baseline (dotted) is crossing a non-neighboring bend.}
- \end{subfigure}
- \hfill
- \begin{subfigure}[b]{.49\textwidth}
- \includegraphics[width=\textwidth]{selfcrossing-1-after}
- \caption{Self-crossing removed.}
- \end{subfigure}
+ \includegraphics[width=.5\textwidth]{selfcrossing-1}
\caption{Self-crossing with non-neighboring bend.}
\label{fig:selfcrossing-1-non-neighbor}
\end{figure}