improve coloring of visualizations

This commit is contained in:
Motiejus Jakštys 2021-05-19 22:57:50 +03:00 committed by Motiejus Jakštys
parent f7979c2685
commit f7f345d5cc
3 changed files with 41 additions and 50 deletions

View File

@ -25,10 +25,8 @@ FIGURES = \
fig5-gentle-inflection-after \ fig5-gentle-inflection-after \
inflection-1-gentle-inflection-before \ inflection-1-gentle-inflection-before \
inflection-1-gentle-inflection-after \ inflection-1-gentle-inflection-after \
fig6-selfcrossing-before \ fig6-selfcrossing \
fig6-selfcrossing-after \ selfcrossing-1 \
selfcrossing-1-before \
selfcrossing-1-after \
isolated-1-exaggerated isolated-1-exaggerated
RIVERS = \ RIVERS = \
@ -119,7 +117,7 @@ fig8-elimination-gen3_3SELECT = wm_debug where name='fig8' AND stage='bbends-pol
fig8-elimination-gen3_3LINESTYLE = dotted fig8-elimination-gen3_3LINESTYLE = dotted
fig5-gentle-inflection-before_WITHDIV = 2 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_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_3SELECT = wm_debug where name='fig5' AND stage='bbends-polygon' AND gen=1
fig5-gentle-inflection-before_3LINESTYLE = dotted 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 fig5-gentle-inflection-after_3LINESTYLE = dotted
inflection-1-gentle-inflection-before_WIDTHDIV = 2 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_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_3SELECT = wm_debug where name='inflection-1' AND stage='bbends-polygon' AND gen=1
inflection-1-gentle-inflection-before_3LINESTYLE = dotted 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_3SELECT = wm_debug where name='inflection-1' AND stage='cinflections-polygon' AND gen=1
inflection-1-gentle-inflection-after_3LINESTYLE = dotted inflection-1-gentle-inflection-after_3LINESTYLE = dotted
fig6-selfcrossing-before_WIDTHDIV = 2 fig6-selfcrossing_WIDTHDIV = 2
fig6-selfcrossing-before_1SELECT = wm_debug where name='fig6' AND stage='afigures' AND gen=1 fig6-selfcrossing_1SELECT = wm_debug where name='fig6' AND stage='afigures' AND gen=1
fig6-selfcrossing-before_1LINESTYLE = dotted fig6-selfcrossing_1LINESTYLE = dotted
fig6-selfcrossing-before_2SELECT = wm_visuals where name='fig6-baseline' fig6-selfcrossing_2SELECT = wm_debug where name='fig6' AND stage='dcrossings' AND gen=1
fig6-selfcrossing-before_3SELECT = wm_debug where name='fig6' AND stage='dcrossings' AND gen=1 fig6-selfcrossing_3SELECT = wm_visuals where name='fig6-baseline'
fig6-selfcrossing-before_3COLOR = black fig6-selfcrossing_3COLOR = orange
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_WIDTHDIV = 2
selfcrossing-1-before_1SELECT = wm_debug where name='selfcrossing-1' AND stage='bbends' AND gen=1 selfcrossing-1_1SELECT = wm_debug where name='selfcrossing-1' AND stage='afigures' AND gen=1
selfcrossing-1-before_1LINESTYLE = dotted selfcrossing-1_1LINESTYLE = dotted
selfcrossing-1-before_2SELECT = wm_visuals where name='selfcrossing-1-baseline' selfcrossing-1_2SELECT = wm_debug where name='selfcrossing-1' AND stage='dcrossings' AND gen=1
selfcrossing-1-before_3SELECT = wm_debug where name='selfcrossing-1' AND stage='dcrossings' AND gen=1 selfcrossing-1_3SELECT = wm_visuals where name='selfcrossing-1-baseline'
selfcrossing-1-before_3COLOR = black selfcrossing-1_3COLOR = orange
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
isolated-1-exaggerated_WIDTHDIV = 2 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_1LINESTYLE = dotted
isolated-1-exaggerated_2SELECT = wm_debug where name='isolated-1' AND stage='gexaggeration' AND gen=1 isolated-1-exaggerated_2SELECT = wm_debug where name='isolated-1' AND stage='afigures' AND gen=2
isolated-1-exaggerated_2COLOR = black
salvis-25k_1SELECT = wm_visuals where name='salvis' salvis-25k_1SELECT = wm_visuals where name='salvis'
salvis-25k_WIDTHDIV = 1 salvis-25k_WIDTHDIV = 1

View File

@ -10,9 +10,22 @@ from matplotlib import rc
CMAP = 'tab20c' CMAP = 'tab20c'
BOUNDS = ('xmin', 'ymin', 'xmax', 'ymax') 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" 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. # see `NOTICE` in the LaTeX document; this is the width of the main text block.
TEXTWIDTH_CM = 12.12364 TEXTWIDTH_CM = 12.12364
@ -22,23 +35,25 @@ def inch(cm):
def parse_args(): def parse_args():
kwcolor = {'type': color, 'default': 'black'}
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description='Convert a geometry to an image') description='Convert a geometry to an image')
parser.add_argument('--group1-select') parser.add_argument('--group1-select')
parser.add_argument('--group1-linestyle') 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-select')
parser.add_argument('--group2-linestyle') 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-select')
parser.add_argument('--group3-linestyle') parser.add_argument('--group3-linestyle')
parser.add_argument('--group3-color', default=GREEN) parser.add_argument('--group3-color', **kwcolor)
parser.add_argument('--widthdiv', parser.add_argument('--widthdiv',
default=1, type=float, help='Width divisor') 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>') parser.add_argument('-o', '--outfile', metavar='<file>')
return parser.parse_args() return parser.parse_args()

View File

@ -926,30 +926,15 @@ copied from the original article.
\begin{figure}[ht] \begin{figure}[ht]
\centering \centering
\begin{subfigure}[b]{.49\textwidth} \includegraphics[width=.5\textwidth]{fig6-selfcrossing}
\includegraphics[width=\textwidth]{fig6-selfcrossing-before} \caption{Bend's baseline (orange) is crossing a neighboring bend.}
\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}
\caption{Originally figure 6: simple case of self-line crossing.} \caption{Originally figure 6: simple case of self-line crossing.}
\label{fig:fig6-selfcrossing} \label{fig:fig6-selfcrossing}
\end{figure} \end{figure}
\begin{figure}[ht] \begin{figure}[ht]
\centering \centering
\begin{subfigure}[b]{.49\textwidth} \includegraphics[width=.5\textwidth]{selfcrossing-1}
\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}
\caption{Self-crossing with non-neighboring bend.} \caption{Self-crossing with non-neighboring bend.}
\label{fig:selfcrossing-1-non-neighbor} \label{fig:selfcrossing-1-non-neighbor}
\end{figure} \end{figure}