Skip to content

Instantly share code, notes, and snippets.

@pwuertz
Created August 14, 2012 17:27
Show Gist options
  • Save pwuertz/3351009 to your computer and use it in GitHub Desktop.
Save pwuertz/3351009 to your computer and use it in GitHub Desktop.
matplotlib svg with horizontally anchored text elements
Display the source blob
Display the rendered blob
Raw
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Created with matplotlib (http://matplotlib.org/) -->
<svg height="432pt" version="1.1" viewBox="0 0 576 432" width="576pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<style type="text/css">
*{stroke-linecap:square;stroke-linejoin:round;}
</style>
</defs>
<g id="figure_1">
<g id="patch_1">
<path d="
M0 432
L576 432
L576 0
L0 0
z
" style="fill:#ffffff;"/>
</g>
<g id="axes_1">
<g id="patch_2">
<path d="
M72 388.8
L518.4 388.8
L518.4 43.2
L72 43.2
z
" style="fill:#ffffff;"/>
</g>
<g id="line2d_1">
<defs>
<path d="
M0 1.5
C0.397805 1.5 0.77937 1.34195 1.06066 1.06066
C1.34195 0.77937 1.5 0.397805 1.5 0
C1.5 -0.397805 1.34195 -0.77937 1.06066 -1.06066
C0.77937 -1.34195 0.397805 -1.5 0 -1.5
C-0.397805 -1.5 -0.77937 -1.34195 -1.06066 -1.06066
C-1.34195 -0.77937 -1.5 -0.397805 -1.5 0
C-1.5 0.397805 -1.34195 0.77937 -1.06066 1.06066
C-0.77937 1.34195 -0.397805 1.5 0 1.5
z
" id="mec7afe23ad" style="stroke:#0000ff;stroke-linecap:butt;stroke-width:0.5;"/>
</defs>
<g clip-path="url(#p7ff5b81e1d)">
<use style="fill:#0000ff;stroke:#0000ff;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mec7afe23ad" y="388.8"/>
<use style="fill:#0000ff;stroke:#0000ff;stroke-linecap:butt;stroke-width:0.5;" x="183.6" xlink:href="#mec7afe23ad" y="302.4"/>
<use style="fill:#0000ff;stroke:#0000ff;stroke-linecap:butt;stroke-width:0.5;" x="295.2" xlink:href="#mec7afe23ad" y="216.0"/>
<use style="fill:#0000ff;stroke:#0000ff;stroke-linecap:butt;stroke-width:0.5;" x="406.8" xlink:href="#mec7afe23ad" y="129.6"/>
<use style="fill:#0000ff;stroke:#0000ff;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#mec7afe23ad" y="43.2"/>
</g>
</g>
<g id="matplotlib.axis_1">
<g id="xtick_1">
<g id="line2d_2">
<defs>
<path d="
M0 0
L0 -4" id="mcb557df647" style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;"/>
</defs>
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mcb557df647" y="388.8"/>
</g>
</g>
<g id="line2d_3">
<defs>
<path d="
M0 0
L0 4" id="mdad270ee8e" style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;"/>
</defs>
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mdad270ee8e" y="43.2"/>
</g>
</g>
<g id="text_1">
<text style="font-family:Bitstream Vera Sans;font-size:12.0px;font-style:normal;text-anchor:middle;" transform="rotate(-0.000000, 72.000000, 401.705000)" x="72.0" y="401.705">0.0</text>
</g>
</g>
<g id="xtick_2">
<g id="line2d_4">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="127.8" xlink:href="#mcb557df647" y="388.8"/>
</g>
</g>
<g id="line2d_5">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="127.8" xlink:href="#mdad270ee8e" y="43.2"/>
</g>
</g>
<g id="text_2">
<text style="font-family:Bitstream Vera Sans;font-size:12.0px;font-style:normal;text-anchor:middle;" transform="rotate(-0.000000, 127.800000, 401.705000)" x="127.8" y="401.705">0.5</text>
</g>
</g>
<g id="xtick_3">
<g id="line2d_6">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="183.6" xlink:href="#mcb557df647" y="388.8"/>
</g>
</g>
<g id="line2d_7">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="183.6" xlink:href="#mdad270ee8e" y="43.2"/>
</g>
</g>
<g id="text_3">
<text style="font-family:Bitstream Vera Sans;font-size:12.0px;font-style:normal;text-anchor:middle;" transform="rotate(-0.000000, 183.600000, 401.705000)" x="183.6" y="401.705">1.0</text>
</g>
</g>
<g id="xtick_4">
<g id="line2d_8">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="239.4" xlink:href="#mcb557df647" y="388.8"/>
</g>
</g>
<g id="line2d_9">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="239.4" xlink:href="#mdad270ee8e" y="43.2"/>
</g>
</g>
<g id="text_4">
<text style="font-family:Bitstream Vera Sans;font-size:12.0px;font-style:normal;text-anchor:middle;" transform="rotate(-0.000000, 239.400000, 401.547500)" x="239.4" y="401.5475">1.5</text>
</g>
</g>
<g id="xtick_5">
<g id="line2d_10">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="295.2" xlink:href="#mcb557df647" y="388.8"/>
</g>
</g>
<g id="line2d_11">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="295.2" xlink:href="#mdad270ee8e" y="43.2"/>
</g>
</g>
<g id="text_5">
<text style="font-family:Bitstream Vera Sans;font-size:12.0px;font-style:normal;text-anchor:middle;" transform="rotate(-0.000000, 295.200000, 401.705000)" x="295.2" y="401.705">2.0</text>
</g>
</g>
<g id="xtick_6">
<g id="line2d_12">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="351.0" xlink:href="#mcb557df647" y="388.8"/>
</g>
</g>
<g id="line2d_13">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="351.0" xlink:href="#mdad270ee8e" y="43.2"/>
</g>
</g>
<g id="text_6">
<text style="font-family:Bitstream Vera Sans;font-size:12.0px;font-style:normal;text-anchor:middle;" transform="rotate(-0.000000, 351.000000, 401.705000)" x="351.0" y="401.705">2.5</text>
</g>
</g>
<g id="xtick_7">
<g id="line2d_14">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="406.8" xlink:href="#mcb557df647" y="388.8"/>
</g>
</g>
<g id="line2d_15">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="406.8" xlink:href="#mdad270ee8e" y="43.2"/>
</g>
</g>
<g id="text_7">
<text style="font-family:Bitstream Vera Sans;font-size:12.0px;font-style:normal;text-anchor:middle;" transform="rotate(-0.000000, 406.800000, 401.705000)" x="406.8" y="401.705">3.0</text>
</g>
</g>
<g id="xtick_8">
<g id="line2d_16">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="462.6" xlink:href="#mcb557df647" y="388.8"/>
</g>
</g>
<g id="line2d_17">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="462.6" xlink:href="#mdad270ee8e" y="43.2"/>
</g>
</g>
<g id="text_8">
<text style="font-family:Bitstream Vera Sans;font-size:12.0px;font-style:normal;text-anchor:middle;" transform="rotate(-0.000000, 462.600000, 401.705000)" x="462.6" y="401.705">3.5</text>
</g>
</g>
<g id="xtick_9">
<g id="line2d_18">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#mcb557df647" y="388.8"/>
</g>
</g>
<g id="line2d_19">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#mdad270ee8e" y="43.2"/>
</g>
</g>
<g id="text_9">
<text style="font-family:Bitstream Vera Sans;font-size:12.0px;font-style:normal;text-anchor:middle;" transform="rotate(-0.000000, 518.400000, 401.705000)" x="518.4" y="401.705">4.0</text>
</g>
</g>
<g id="text_10">
<text style="font-family:Bitstream Vera Sans;font-size:12.0px;font-style:normal;text-anchor:middle;" transform="rotate(-0.000000, 295.200000, 415.993750)" x="295.2" y="415.99375">x-label</text>
</g>
</g>
<g id="matplotlib.axis_2">
<g id="ytick_1">
<g id="line2d_20">
<defs>
<path d="
M0 0
L4 0" id="mc8fcea1516" style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;"/>
</defs>
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mc8fcea1516" y="388.8"/>
</g>
</g>
<g id="line2d_21">
<defs>
<path d="
M0 0
L-4 0" id="m0d5b0a6425" style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;"/>
</defs>
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#m0d5b0a6425" y="388.8"/>
</g>
</g>
<g id="text_11">
<text style="font-family:Bitstream Vera Sans;font-size:12.0px;font-style:normal;text-anchor:end;" transform="rotate(-0.000000, 68.000000, 393.166562)" x="68.0" y="393.1665625">0.0</text>
</g>
</g>
<g id="ytick_2">
<g id="line2d_22">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mc8fcea1516" y="345.6"/>
</g>
</g>
<g id="line2d_23">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#m0d5b0a6425" y="345.6"/>
</g>
</g>
<g id="text_12">
<text style="font-family:Bitstream Vera Sans;font-size:12.0px;font-style:normal;text-anchor:end;" transform="rotate(-0.000000, 68.000000, 349.966563)" x="68.0" y="349.9665625">0.5</text>
</g>
</g>
<g id="ytick_3">
<g id="line2d_24">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mc8fcea1516" y="302.4"/>
</g>
</g>
<g id="line2d_25">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#m0d5b0a6425" y="302.4"/>
</g>
</g>
<g id="text_13">
<text style="font-family:Bitstream Vera Sans;font-size:12.0px;font-style:normal;text-anchor:end;" transform="rotate(-0.000000, 68.000000, 306.766563)" x="68.0" y="306.7665625">1.0</text>
</g>
</g>
<g id="ytick_4">
<g id="line2d_26">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mc8fcea1516" y="259.2"/>
</g>
</g>
<g id="line2d_27">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#m0d5b0a6425" y="259.2"/>
</g>
</g>
<g id="text_14">
<text style="font-family:Bitstream Vera Sans;font-size:12.0px;font-style:normal;text-anchor:end;" transform="rotate(-0.000000, 68.000000, 263.487813)" x="68.0" y="263.4878125">1.5</text>
</g>
</g>
<g id="ytick_5">
<g id="line2d_28">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mc8fcea1516" y="216.0"/>
</g>
</g>
<g id="line2d_29">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#m0d5b0a6425" y="216.0"/>
</g>
</g>
<g id="text_15">
<text style="font-family:Bitstream Vera Sans;font-size:12.0px;font-style:normal;text-anchor:end;" transform="rotate(-0.000000, 68.000000, 220.366562)" x="68.0" y="220.3665625">2.0</text>
</g>
</g>
<g id="ytick_6">
<g id="line2d_30">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mc8fcea1516" y="172.8"/>
</g>
</g>
<g id="line2d_31">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#m0d5b0a6425" y="172.8"/>
</g>
</g>
<g id="text_16">
<text style="font-family:Bitstream Vera Sans;font-size:12.0px;font-style:normal;text-anchor:end;" transform="rotate(-0.000000, 68.000000, 177.166562)" x="68.0" y="177.1665625">2.5</text>
</g>
</g>
<g id="ytick_7">
<g id="line2d_32">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mc8fcea1516" y="129.6"/>
</g>
</g>
<g id="line2d_33">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#m0d5b0a6425" y="129.6"/>
</g>
</g>
<g id="text_17">
<text style="font-family:Bitstream Vera Sans;font-size:12.0px;font-style:normal;text-anchor:end;" transform="rotate(-0.000000, 68.000000, 133.966562)" x="68.0" y="133.9665625">3.0</text>
</g>
</g>
<g id="ytick_8">
<g id="line2d_34">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mc8fcea1516" y="86.4"/>
</g>
</g>
<g id="line2d_35">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#m0d5b0a6425" y="86.4"/>
</g>
</g>
<g id="text_18">
<text style="font-family:Bitstream Vera Sans;font-size:12.0px;font-style:normal;text-anchor:end;" transform="rotate(-0.000000, 68.000000, 90.766562)" x="68.0" y="90.7665625">3.5</text>
</g>
</g>
<g id="ytick_9">
<g id="line2d_36">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="72.0" xlink:href="#mc8fcea1516" y="43.2"/>
</g>
</g>
<g id="line2d_37">
<g>
<use style="stroke:#000000;stroke-linecap:butt;stroke-width:0.5;" x="518.4" xlink:href="#m0d5b0a6425" y="43.2"/>
</g>
</g>
<g id="text_19">
<text style="font-family:Bitstream Vera Sans;font-size:12.0px;font-style:normal;text-anchor:end;" transform="rotate(-0.000000, 68.000000, 47.566562)" x="68.0" y="47.5665625">4.0</text>
</g>
</g>
<g id="text_20">
<text style="font-family:Bitstream Vera Sans;font-size:12.0px;font-style:normal;text-anchor:middle;" transform="rotate(-90.000000, 42.800000, 216.000000)" x="42.8" y="216.0">y-label</text>
</g>
</g>
<g id="patch_3">
<path d="
M72 43.2
L518.4 43.2" style="fill:none;stroke:#000000;"/>
</g>
<g id="patch_4">
<path d="
M518.4 388.8
L518.4 43.2" style="fill:none;stroke:#000000;"/>
</g>
<g id="patch_5">
<path d="
M72 388.8
L518.4 388.8" style="fill:none;stroke:#000000;"/>
</g>
<g id="patch_6">
<path d="
M72 388.8
L72 43.2" style="fill:none;stroke:#000000;"/>
</g>
<g id="text_21">
<text style="font-family:Bitstream Vera Sans;font-size:12.0px;font-style:normal;text-anchor:middle;" transform="rotate(-45.000000, 293.432233, 214.232233)" x="293.432233047" y="214.232233047">- xXgXx -</text>
</g>
</g>
</g>
<defs>
<clipPath id="p7ff5b81e1d">
<rect height="345.6" width="446.4" x="72.0" y="43.2"/>
</clipPath>
</defs>
</svg>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment