+
    ,i2                     	   ^ RI t ^ RIHt ^ RIt^ RIt^ RIt^ RIHt	 ^ RI
t
^ RIt^ RIHt ^ RIHtHt ^ RIHt ^ RIHt ^ RIHt ^ RIHtHtHt ^ R	IHtHtH t H!t! ]! R
 4      w  t"t#/ ^ 3R lt$]!]]
PJ                  PM                  R4      R 4       4       4       t'R t(]!]
PJ                  PM                  R4      ]! R.RR7      R 4       4       4       t) ]PT                  ! R4      PV                  ]	! R4      8  t,] ]
PJ                  P]                  ]! R4      '       * RR7      ]
PJ                  P]                  ]! R4      '       * RR7      ]
PJ                  PM                  R4      ]! R.R],'       d   RM^ R7      R 4       4       4       4       4       t/]!] ]P`                  Pc                  R4      ]
PJ                  PM                  R4      R 4       4       4       4       t2]!]P`                  Pc                  R4      ]
PJ                  PM                  R4      R  4       4       4       t3]!]
PJ                  PM                  R4      ]! R!.RR7      R" 4       4       4       t4]!]P`                  Pc                  R4      ]
PJ                  PM                  R4      R# 4       4       4       t5]P`                  Pc                  R4      ]
PJ                  PM                  R4      ]
PJ                  Pm                  R$]
Pn                  ! R%].R&7      ]
Pn                  ! R'] .R&7      ]
Pn                  ! R(]!.R&7      .4      R) 4       4       4       t8]P`                  Pc                  R4      ]
PJ                  PM                  R4      ]
PJ                  Pm                  R$]
Pn                  ! R%].R&7      ]
Pn                  ! R'] .R&7      ]
Pn                  ! R(]!.R&7      .4      R* 4       4       4       t9]!R+ 4       t:]!R, 4       t;]!R- 4       t<]!]R. 4       4       t=]!R/ 4       t>]! R0.R17      ]
PJ                  Pm                  R2R:4      ]
PJ                  PM                  R4      R3 4       4       4       t?]
PJ                  PM                  R4      R4 4       t@]!]
PJ                  P]                  ]! R54      '       * R6R7      ]
PJ                  PM                  R4      ]! R7.RRR87      R9 4       4       4       4       tAR#   ]PZ                   d    Rt, ELi ; i);    N)BytesIO)parse)_has_tex_package_check_for_pgf)ImageComparisonFailure)compare_images)PdfPages)_image_directoriescheck_figures_equalimage_comparison)needs_ghostscriptneeds_pgf_lualatexneeds_pgf_pdflatexneeds_pgf_xelatexc                      R # )z
dummy func r       C/usr/lib/python3/dist-packages/matplotlib/tests/test_backend_pgf.py<lambda>r      s    lr   c                    \         P                  P                  \        V 4      p\        P
                  ! V3/ VB  \         P                  P                  \        R V ,          4      p\        P                  ! \         P                  P                  \        V 4      V4       \        WCVR7      pV'       d   \        V4      hR# )zexpected_%stolN)ospathjoin
result_dirpltsavefigshutilcopyfilebaseline_dirr   r   )fnamesavefig_kwargsr   actualexpectederrs   &&&   r   compare_figurer'      s|    WW\\*e,FKK).)ww||J(=>H
OOBGGLLu5x@
s
3C
$S)) r   pgfc                    \         P                  ! 4       pVP                  R R R4       \        4       pVP	                  VRRR7       VP                  ^ 4       \         P                  ! V4      pV^8H  P                  4       '       d   Q hR# )      ?z%_^ $a_b^c$pngr(   )formatbackendN)r   figuretextr   r   seekimreadall)tmp_pathfigbufts   &   r   test_tex_special_charsr7   %   sg     **,CHHR]#
)CKKE5K1HHQK

3AQ||~~~r   c                     \         P                  ! 4        \        P                  ! ^ ^^4      p \         P                  ! W ^,          R4       \         P                  ! V ^V ^,          ,
          R4       \         P
                  ! RR.RR.RRRR7       \         P                  ! . RO. ROR	4       \         P                  ! R
.R.R^R7       \         P                  ! R
RRR^R7       \         P                  ! RRRR7       \         P                  ! ^^R^RR7       \         P                  ! ^ ^4       \         P                  ! ^ ^4       R# )r   zb-zg>        g?z//	lightgrayred)hatch	facecolor	edgecolorbg?r*   ro)
markersizeu/   unicode (ü, °, §) and math ($\mu_i = x_i^2$)right)hafontsizez*sans-serif, blue, $\frac{\sqrt{x}}{y^2}$..
sans-serifblue)familycolorz2should be clipped as default clip_box is Axes bboxT)rD   clip_onN)   rJ   皙?rK   rJ   )   rM   r   rL   )r   r.   nplinspaceplotfill_betweenfillr/   ylabelxlimylim)xs    r   create_figurerW   2   s    JJL
Aq"A HHQQ HHQAqD$ b"XBxt{$&HH 137 HHcUSE4A.HHS#W"&JJ="&2HHQG$( HHQNHHQNr   zpgf_xelatex.pdfdefault)stylec                  d    R RRR/p \         P                  P                  V 4       \        4        R# )font.familyserifpgf.rcfontsFNmplrcParamsupdaterW   )
rc_xelatexs    r   test_xelatexrc   O   s,      (JLL
#Or   gsz9.50Ttype1eczneeds type1ec.sty)reasonucszneeds ucs.styzpgf_pdflatex.pdfgQk'@)rY   r   c                  l    R RRRRRRR/p \         P                  P                  V 4       \        4        R# )	r[   r\   r]   Fpgf.texsystempdflatexpgf.preamblez4\usepackage[utf8x]{inputenc}\usepackage[T1]{fontenc}Nr^   )rc_pdflatexs    r   test_pdflatexrm   a   s=     !' %"J! %@BK
 LL$Or   c                     R RR^RRR^
RRRR	/R R
R^
RRR^RRRRRR/.p \         '       d   ^ R.M^ ^ .p\        V 4       F  w  r#\        P                  ! V4      ;_uu_ 4        R FP  w  rEV\        P                  R,          9   g   K#  \        V4      '       d   K6  \        P                  ! RV R24       KR  	  \        4        \        RV^,            R2W,          R7       RRR4       K  	  R#   + '       g   i     K  ; i)r[   rE   z	font.sizezfigure.subplot.leftg?zlines.markersizer]   Fri   xelatex	monospaceg?rj   rk   zG\usepackage[utf8x]{inputenc}\usepackage[T1]{fontenc}\usepackage{sfmath}gffffff*@zneeds z.stypgf_rcupdate.pdfr   N))sfmathrs   )utf8xrg   )
_old_gs_version	enumerater_   
rc_contextr`   r   pytestskiprW   r'   )rc_setsr   irc_set	substringpkgs         r   test_rcupdater   r   s    
 |R%r"Bu, {R%r"Bu "8:;G '1d)QFCw'	^^F##"J	n!== 0 5 5KK&T 23 #K O\!a%536B $# (###s   !!C.C.AC..C?c                  p   \         P                  P                  R 4       \        P                  P                  RRRR/4       \        P                  ! ^^4      w  rV^ ,          P                  RR.RR.4       V^ ,          P                  ^ ^4       V^ ,          P                  ^ ^4       V^,          P                  ^ ^.^^.4       V^,          P                  \         P                  P                  RR7      ^R^
.R	7       V^,          P                  R
4       V P                  \!        4       RR7       R# )i!N,r[   r\   r]   Fr9   g}Ô%ITi  )size)binsrangelogpdfr,   Ni)rN   randomseedr_   r`   ra   r   subplotsrP   set_xlimset_ylimscatterhistnormal
set_xscaler   r   )r4   axss     r   test_pathclipr      s     IINN8LLFG||Aq!HCFKKUb%[)FOOAqFOOAqFNNAq6Aq6"FKK		  d +"S"IKFFeKK	%K(r   zpgf_mixedmode.pdfc                     \         P                  P                  R RRR/4       \        P                  R^R1R^R13,          w  r\
        P                  ! V^,          V ^,          ,           4      P                  R4       R# )r[   r\   r]   Fy              D@TN)r_   r`   ra   rN   ogridr   pcolorset_rasterized)YXs     r   test_mixedmoder      sc     LLFG88BqHb3h&'DAJJq!tad{**40r   c                     \         P                  P                  R RRR/4       \        P                  ! ^^4      w  p w  rVP                  \        ^4      4       VP                  \        ^4      4       \        P                  ! 4        VP                  4       P                  V P                  P                  4       4      p\        RRV/^ R7       R# )r[   r\   r]   Fzpgf_bbox_inches.pdfbbox_inches)r#   r   N)r_   r`   ra   r   r   rP   r   tight_layoutget_window_extenttransformeddpi_scale_transinvertedr'   )r4   ax1ax2bboxs       r   test_bbox_inchesr      s     LLFGll1a(OC#HHU1XHHU1X  "..s/B/B/K/K/MND(-9Nr   systemlualatex)marksrj   ro   c                 @   R RRRRV /p\         P                  P                  V4       \        P                  ! 4       w  r#VP                  \        ^4      4       VP                  4        \        P                  ! RR7      w  rEVP                  \        ^4      4       VP                  4        \        P                  P                  \        RV  R24      pRR	R
RRRRRR\        P                  ! R^^\        P                  ! \        P                  ! ^ 4      4      R7      RR/p\        WgR7      ;_uu_ 4       pVP!                  V4       VP!                  V4       VP!                  V4       VP#                  4       ^8X  g   Q h RRR4       R#   + '       g   i     R# ; i)r[   r\   r]   Fri   figsize	pdfpages_rr   AuthormeTitleMultipage PDF with pgfSubject	Test pageKeywordstest,pdf,multipageModDate  tzinfoTrappedUnknownmetadataN)rJ   rL   )r_   r`   ra   r   r   rP   r   r   r   r   r   r   datetimetimezone	timedeltar	   r   get_pagecount)	r   rl   fig1r   fig2r   r   mdr   s	   &        r   test_pdf_pagesr      sK    	wuK
 LL$IDHHU1XV,IDHHU1X77<<
ixt$<=D$);(8$$!Qx001C1CA1FGI9
B 
$	$	$DDD  "a''' 
%	$	$	$s   6AFF	c                 P   \         P                  ! R 4      pV P                  RR4       \        P                  P                  RV/4       \        P                  ! 4       w  r4VP                  \        ^4      4       RRRRRR	R
RR\        P                  ! R^^\        P                  ! \        P                  ! ^ 4      4      R7      RR/p\        P                  P                  \         RV R24      p\#        WeR7      ;_uu_ 4       pVP%                  V4       RRR4       VP&                  P)                  V4      ;_uu_ 4       pVP*                  P-                  4        UU	u/ uF  w  rV\/        V	4      bK  	  p
pp	RRR4       RX
9   d   V
R RV
9   d   V
R V
P1                  R4      pVR\        P2                   28X  g   VR8X  d   RV9   g   Q hV
RRRRRR\        P2                   R 2R!RR"R#R$R	R%RR&R'/8X  g   Q hR#   + '       g   i     L; iu up	pi   + '       g   i     L; i)(pikepdfSOURCE_DATE_EPOCH0ri   r   r   r   r   r   r   r   r   r   r   r   r   Truepdfpages_meta_check_rr   r   Nz/PTEX.FullBannerz/PTEX.Fullbannerz	/ProducerzMatplotlib pgf backend vr   LuaTeXz/Authorz/CreationDatezD:19700101000000Zz/CreatorzMatplotlib vz, https://matplotlib.orgz	/Keywordsz/ModDatezD:19680801000000Zz/Subjectz/Titlez/Trappedz/True)rx   importorskipsetenvr_   r`   ra   r   r   rP   r   r   r   r   r   r   r   r   r	   r   Pdfopendocinfoitemsstrpop__version__)monkeypatchr   r   r4   axr   r   r   kvinfoproducers   &&          r   test_pdf_pages_metadata_checkr      s    !!),G*C0LL&12llnGCGGE!H 	$);(8$$!Qx001C1CA1FGI6
B 77<<
&:6($$GHD	$	$	$C 
% 
		$		3&)kk&7&7&9:&9da3q6	&9: 
  T!#$T!#$ xx$H1#//1BCCj X%9; ; 4,l3??"33KL)'K*G	 	 	 	# 
%	$ ; 
 	s*   G<H H
7H<H	HH%	c                    V R ,          p\        V4      ;_uu_ 4       p RRR4       VP                  4       '       d   Q hV R,          p\        V4      ;_uu_ 4       pVP                  \        P                  ! 4       4       RRR4       VP                  4       '       g   Q hR#   + '       g   i     L; i  + '       g   i     L=; i)za.pdfNzb.pdf)r	   existsr   r   r.   )r3   fnr   s   &  r   test_multipage_keep_emptyr   !  s     
G	B	" 
yy{{? 
G	B	"CJJL! 
99;;; 
 
s   B"%B5"B2	5C	c                     \         P                  ! 4       p V P                  R 4       \        P                  ! \
        4      ;_uu_ 4        V P                  \        4       RR7       RRR4       \         P                  ! 4       p V P                  R4       V P                  \        4       RR7       R#   + '       g   i     LS; i)z\oopsr(   r   Nz
this is ok)r   r.   suptitlerx   raises
ValueErrorr   r   )r4   s    r   test_tex_restart_after_errorr   0  ss    
**,CLL	z	"	"GIe, 
# **,CLLKK	%K( 
#	"s   	B00C 	c                      \         P                  ! 4       w  rVP                  ^ ^.^^..4       V P                  \	        4       RRRR7       R# )r   r   r(   tight)r,   r-   r   N)r   r   imshowr   r   )r4   r   s     r   test_bbox_inches_tightr   <  s>    llnGCII1v1vKK	%GKLr   c                      \        4       p \        P                  ! 4       P                  V R RRR7       V P	                  ^ 4       \        P
                  ! V 4      pVR,          ^ 8H  P                  4       '       g   Q hR# )r+   r(   T)r,   r-   transparentN).rJ   )r   r   r.   r   r0   r1   r2   )r5   r6   s     r   test_png_transparencyr   C  s]     )CJJLUEtLHHQK

3AfIN!!!!r   c                 p   V P                  R 4      ;_uu_ 4        R\        P                  R&   \        P                  ! RRR4       \        P
                  ! \        4       RR7       RRR4       RV P                   Uu. uF  qP                  4       NK  	  up9   g   Q hR#   + '       g   i     LB; iu upi )	WARNINGzthis-font-does-not-existr[   r*   zhello, worldr(   r   Nz/Ignoring unknown font: this-font-does-not-exist)	at_levelr_   r`   r   figtextr   r   records
getMessage)caplogrs   & r   test_unknown_fontr   M  s    		#	#&@]#BN+GIe, 
$ = &A0 .1A0 0 0 0	 
$	#A0s   AB =B3 B0	r   )
extensions	texsystemc                     \        V4      '       g   \        P                  ! VR ,           4       V\        P                  R&   V P                  RRR4       VP                  RRR4       R# )z + pgf is requiredri   r*   z$-1$u   $−1$N)r   rx   ry   r_   r`   r/   )fig_testfig_refr   s   &&&r   test_minus_signs_with_texr   W  sP     )$$I 445$-CLL!MM"b&!LLR,-r   c                     \         P                  ! RR7      w  rVP                  . 4       VP                  . 4       VP	                  R4       VP                  ^ ^.4      w  pVP                  ^^^*R7       \        4       ;_uu_ 4       pV P                  VRR7       VP                  4       P                  4       pRRR4       RpVX9   g   Q hR#   + '       g   i     L; i)	rJ   r   F)scalelength
randomnessr(   r   NaR  \pgfpathmoveto{\pgfqpoint{0.375000in}{0.300000in}}%
\pgfpathlineto{\pgfqpoint{2.700000in}{2.700000in}}%
\usepgfmodule{decorations}%
\usepgflibrary{decorations.pathmorphing}%
\pgfkeys{/pgf/decoration/.cd, segment length = 0.150000in, amplitude = 0.100000in}%
\pgfmathsetseed{42}%
\pgfdecoratecurrentpath{random steps}%
\pgfusepath{stroke}%)rJ   rJ   )r   r   
set_xticks
set_yticksset_frame_onrP   set_sketch_paramsr   r   getvaluedecode)r4   r   handlefdr5   baselines         r   test_sketch_paramsr  b  s    ll6*GCMM"MM"OOEggq!foGF
1RB?	bBu%kkm""$ 
H s?? 
s   2CC	zunicode-mathzneeds unicode-math.styzpgf_document_font_size.pdf)rY   remove_textc                     \         P                  P                  R RRRRR/4       \        P                  ! 4        \        P
                  ! . RR7       \        P
                  ! . RR7       \        P                  ! 4        R	# )
ri   ro   r]   Frk   z\usepackage{unicode-math}zM$this is a very very very long math label a \times b + 10^{-3}$ and some text)labelz:\normalsize the document font size is \the\fontdimen6\fontN)r_   r`   ra   r   r.   rP   legendr   r   r   test_document_font_sizer  ~  sg     LLu4 
 JJLHHR$ HHRP JJLr   )rj   ro   r   )Br   ior   r   r   numpyrN   packaging.versionr   parse_versionrx   
matplotlibr_   matplotlib.pyplotpyplotr   matplotlib.testingr   r   matplotlib.testing.exceptionsr   matplotlib.testing.comparer   matplotlib.backends.backend_pgfr	   matplotlib.testing.decoratorsr
   r   r   matplotlib.testing._markersr   r   r   r   r!   r   r'   markr-   r7   rW   rc   _get_executable_infoversionru   ExecutableNotFoundErrorskipifrm   rY   contextr   r   r   r   parametrizeparamr   r   r   r   r   r   r   r   r  r  r   r   r   <module>r"     s$     	   4    ? @ 5 4? ? 
 ..BC j *, * U   : U$%Y7 8    &..v1FF  (33<OP(//HU%&i.eA77  I Q  9UC    C8 9U)   )" U&'y91 :  1 9U    9U
LL$6#78
LL$6#78
LL#4"56$ 
 (   (F 9U
LL$6#78
LL$6#78
LL#4"56$ 
/  /d   ) ) M M "  " 0 0 (&IJU.  K ). U 6 ((1I   U/0	tT U  Q	 "" Os   %S SS