Skip to content

Instantly share code, notes, and snippets.

@waynr
Last active August 29, 2015 14:04
Show Gist options
  • Save waynr/cbfa5bf5bad0ab30d246 to your computer and use it in GitHub Desktop.
Save waynr/cbfa5bf5bad0ab30d246 to your computer and use it in GitHub Desktop.
Potential group nesting problem in Diagrams?
Display the source blob
Display the rendered blob
Raw
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="400.0" height="99.99999999999997" font-size="1" viewBox="0 0 400 100" stroke="rgb(0,0,0)" stroke-opacity="1"><g><g fill="rgb(0,0,0)" fill-opacity="0.0"><g stroke="rgb(0,0,0)" stroke-opacity="1.0" stroke-width="0.7999999999999999" stroke-linecap="butt" stroke-linejoin="miter" font-size="1.0em" stroke-miterlimit="10.0"><g><g><path d="M 400.0,49.99999999999999 c 0.0,-27.614237491539672 -22.38576250846032,-50.0 -49.999999999999986 -50.0c -27.614237491539672,-1.6908843777454448e-15 -50.0,22.38576250846032 -50.0 49.999999999999986c -3.3817687554908896e-15,27.614237491539672 22.385762508460317,50.0 49.99999999999998 50.0c 27.614237491539672,5.0726531332363345e-15 50.0,-22.385762508460314 50.00000000000001 -49.999999999999986Z" /></g><g fill="rgb(255,0,0)" fill-opacity="1.0" stroke-width="0.0"><g fill="rgb(255,0,0)" fill-opacity="1.0"><g fill="rgb(255,0,0)" fill-opacity="1.0"><path d="M 352.0,49.99999999999999 c 0.0,-1.104569499661587 -0.8954305003384128,-1.9999999999999998 -1.9999999999999993 -1.9999999999999998c -1.104569499661587,-6.763537510981778e-17 -1.9999999999999998,0.8954305003384125 -1.9999999999999998 1.9999999999999991c -1.3527075021963556e-16,1.104569499661587 0.8954305003384125,1.9999999999999998 1.9999999999999987 1.9999999999999998c 1.104569499661587,2.0290612532945335e-16 1.9999999999999998,-0.8954305003384124 2.0000000000000004 -1.9999999999999991Z" /></g></g></g></g><g><g fill="rgb(255,0,0)" fill-opacity="1.0" stroke-width="0.0"><g fill="rgb(255,0,0)" fill-opacity="1.0"><g fill="rgb(255,0,0)" fill-opacity="1.0"><path d="M 300.0,49.99999999999999 c 0.0,-27.614237491539672 -22.38576250846032,-50.0 -49.999999999999986 -50.0c -27.614237491539672,-1.6908843777454448e-15 -50.0,22.38576250846032 -50.0 49.999999999999986c -3.3817687554908896e-15,27.614237491539672 22.385762508460317,50.0 49.99999999999998 50.0c 27.614237491539672,5.0726531332363345e-15 50.0,-22.385762508460314 50.00000000000001 -49.999999999999986Z" /></g></g></g><g fill="rgb(0,128,0)" fill-opacity="1.0" stroke-width="0.0"><g fill="rgb(0,128,0)" fill-opacity="1.0"><g fill="rgb(0,128,0)" fill-opacity="1.0"><path d="M 200.0,49.99999999999999 c 0.0,-27.614237491539672 -22.38576250846032,-50.0 -49.999999999999986 -50.0c -27.614237491539672,-1.6908843777454448e-15 -50.0,22.38576250846032 -50.0 49.999999999999986c -3.3817687554908896e-15,27.614237491539672 22.385762508460317,50.0 49.99999999999998 50.0c 27.614237491539672,5.0726531332363345e-15 50.0,-22.385762508460314 50.00000000000001 -49.999999999999986Z" /></g></g></g></g><g><path d="M 100.0,49.99999999999999 c 0.0,-27.614237491539672 -22.38576250846032,-50.0 -49.999999999999986 -50.0c -27.614237491539672,-1.6908843777454448e-15 -50.0,22.38576250846032 -50.0 49.999999999999986c -3.3817687554908896e-15,27.614237491539672 22.385762508460317,50.0 49.99999999999998 50.0c 27.614237491539672,5.0726531332363345e-15 50.0,-22.385762508460314 50.00000000000001 -49.999999999999986Z" /></g><g fill="rgb(0,255,255)" fill-opacity="1.0"><g fill="rgb(0,255,255)" fill-opacity="1.0"><g fill="rgb(0,255,255)" fill-opacity="1.0"><path d="M 75.0,75.0 l -5.551115123125783e-15,-50.0 h -50.0 l -5.551115123125783e-15,50.0 Z" /></g></g></g></g></g></g></svg>
\begin{code}
{-# LANGUAGE NoMonomorphismRestriction #-}
import Diagrams.Prelude
import Diagrams.Backend.SVG.CmdLine
blue_dotted :: Diagram B R2
blue_dotted = circle 1 # fc blue
# lw veryThick
# lc purple
# dashingG [0.2,0.05] 0
green_circle :: Diagram B R2
green_circle = circle 1 # fc green # lw none
red_circle :: Diagram B R2
red_circle = circle 1 # fc red # lw none
double_circle :: Diagram B R2
double_circle = green_circle ||| red_circle
square_one :: Diagram B R2
square_one = square 1 # fc aqua `atop` circle 1
example = square_one ||| double_circle ||| circle 1 # showOrigin
main = mainWith example
\end{code}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment