我正在使用以下代码,但编译结果并非我所期望的。
\begin{figure}[h]
\begin{tikzpicture}
\begin{axis}[xbar,enlargelimits=0.15]
\addplot
[draw=blue,pattern=horizontal lines light blue]
coordinates
{(10,5) (15,10) (5,15) (24,20) (30,25)};
\addplot
[draw=black,pattern=horizontal lines dark blue]
coordinates
{(3,5) (5,10) (15,15) (20,20) (35,25)};
\end{axis}
\end{tikzpicture}
\caption{test}
\end{figure}
特别是,我得到了这个:
而不是这样:
最后,我使用下面的代码进行包和包设置。
%----------------------------------------Tikz-------------------------------
\usepackage{tikz}
\usepackage{pgfplots}
%\usepackage{pgfplotstable}
\pgfplotsset{compat=newest}
\usetikzlibrary{patterns}
评论1:
结果\listfiles
是:
*File List*
report.cls 2007/10/19 v1.4h Standard LaTeX document class
size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
lscape.sty 2000/10/22 v3.01 Landscape Pages (DPC)
graphics.sty 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
trig.sty 1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live
xetex.def 2013/04/29 v0.96 LaTeX color/graphics driver for XeTeX (RRM/JK)
isorot.sty 2000/02/15 v2.1 ISO rotation package
graphicx.sty 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
keyval.sty 1999/03/16 v1.13 key=value parser (DPC)
xkeyval.sty 2012/10/14 v2.6b package option processing (HA)
xkeyval.tex 2012/10/14 v2.6b key=value parser (HA)
polyglossia.sty 2013/06/27 v1.33.4 Babel replacement for XeLaTeX and LuaTeX
etoolbox.sty 2011/01/03 v2.1 e-TeX tools for LaTeX
etex.sty 1998/03/26 v2.0 eTeX basic definition package (PEB)
makecmds.sty 2009/09/03 v1.0a extra command making commands
fontspec.sty 2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTeX
expl3.sty 2014/01/07 v4646 L3 Experimental code bundle wrapper
l3names.sty 2014/01/04 v4640 L3 Namespace for primitives
l3bootstrap.sty 2014/01/04 v4640 L3 Experimental bootstrap code
l3basics.sty 2014/01/04 v4642 L3 Basic definitions
l3expan.sty 2014/01/04 v4642 L3 Argument expansion
l3tl.sty 2013/12/27 v4625 L3 Token lists
l3seq.sty 2013/12/14 v4623 L3 Sequences and stacks
l3int.sty 2013/08/02 v4583 L3 Integers
l3quark.sty 2013/12/14 v4623 L3 Quarks
l3prg.sty 2014/01/04 v4642 L3 Control structures
l3clist.sty 2013/07/28 v4581 L3 Comma separated lists
l3token.sty 2013/08/25 v4587 L3 Experimental token manipulation
l3prop.sty 2013/12/14 v4623 L3 Property lists
l3msg.sty 2013/07/28 v4581 L3 Messages
l3file.sty 2013/10/13 v4596 L3 File and I/O operations
l3skip.sty 2013/07/28 v4581 L3 Dimensions and skips
l3keys.sty 2013/12/08 v4614 L3 Experimental key-value interfaces
l3fp.sty 2014/01/04 v4642 L3 Floating points
l3box.sty 2013/07/28 v4581 L3 Experimental boxes
l3coffins.sty 2013/12/14 v4624 L3 Coffin code layer
l3color.sty 2012/08/29 v4156 L3 Experimental color support
l3luatex.sty 2013/07/28 v4581 L3 Experimental LuaTeX-specific functions
l3candidates.sty 2014/01/06 v4643 L3 Experimental additions to l3kernel
ifpdf.sty 2011/01/30 v2.3 Provides the ifpdf switch (HO)
xparse.sty 2013/12/31 v4634 L3 Experimental document command parser
fontspec-patches.sty 2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTe
X
fixltx2e.sty 2006/09/13 v1.1m fixes to LaTeX
fontspec-xetex.sty 2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTeX
fontenc.sty
eu1enc.def 2010/05/27 v0.1h Experimental Unicode font encodings
eu1lmr.fd 2009/10/30 v1.6 Font defs for Latin Modern
xunicode.sty 2011/09/09 v0.981 provides access to latin accents and many oth
er characters in Unicode lower plane
eu1lmss.fd 2009/10/30 v1.6 Font defs for Latin Modern
fontspec.cfg
ifluatex.sty 2010/03/01 v1.3 Provides the ifluatex switch (HO)
amsmath.sty 2013/01/14 v2.14 AMS math features
amstext.sty 2000/06/29 v2.01
amsgen.sty 1999/11/30 v2.0
amsbsy.sty 1999/11/29 v1.2d
amsopn.sty 1999/12/14 v2.01 operator names
hyperref.sty 2012/11/06 v6.83m Hypertext links for LaTeX
hobsub-hyperref.sty 2012/05/28 v1.13 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty 2012/05/28 v1.13 Bundle oberdiek, subset generic (HO)
hobsub.sty 2012/05/28 v1.13 Construct package bundles (HO)
infwarerr.sty 2010/04/08 v1.3 Providing info/warning/error messages (HO)
ltxcmds.sty 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
ifvtex.sty 2010/03/01 v1.5 Detect VTeX and its facilities (HO)
intcalc.sty 2007/09/27 v1.1 Expandable calculations with integers (HO)
etexcmds.sty 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty 2012/04/25 v1.16 Key value parser (HO)
kvdefinekeys.sty 2011/04/07 v1.3 Define keys (HO)
pdftexcmds.sty 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty 2011/11/25 v1.13 Implements pdfTeX's escape features (HO)
bigintcalc.sty 2012/04/08 v1.3 Expandable calculations on big integers (HO)
bitset.sty 2011/01/30 v1.1 Handle bit-vector datatype (HO)
uniquecounter.sty 2011/01/30 v1.2 Provide unlimited unique counter (HO)
letltxmacro.sty 2010/09/02 v1.4 Let assignment for LaTeX macros (HO)
hopatch.sty 2012/05/28 v1.2 Wrapper for package hooks (HO)
xcolor-patch.sty 2011/01/30 xcolor patch
atveryend.sty 2011/06/30 v1.8 Hooks at the very end of document (HO)
atbegshi.sty 2011/10/05 v1.16 At begin shipout hook (HO)
refcount.sty 2011/10/16 v3.4 Data extraction from label references (HO)
hycolor.sty 2011/01/30 v1.7 Color options for hyperref/bookmark (HO)
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
auxhook.sty 2011/03/04 v1.3 Hooks for auxiliary files (HO)
kvoptions.sty 2011/06/30 v3.11 Key value format for package options (HO)
pd1enc.def 2012/11/06 v6.83m Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive
url.sty 2013/09/16 ver 3.4 Verb mode for urls, etc.
hxetex.def 2012/11/06 v6.83m Hyperref driver for XeTeX
puenc.def 2012/11/06 v6.83m Hyperref: PDF Unicode definition (HO)
stringenc.sty 2011/12/02 v1.10 Convert strings between diff. encodings (HO)
rerunfilecheck.sty 2011/04/15 v1.7 Rerun checks for auxiliary files (HO)
hypcap.sty 2011/02/16 v1.11 Adjusting the anchors of captions (HO)
gloss-greek.ldf polyglossia: module for greek
xgreek-fixes.def
gloss-english.ldf polyglossia: module for english
mcode.sty 2012/08/31 2.3
xcolor.sty 2007/01/21 v2.11 LaTeX color extensions (UK)
color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
listings.sty 2013/08/26 1.5b (Carsten Heinz)
lstmisc.sty 2013/08/26 1.5b (Carsten Heinz)
listings.cfg 2013/08/26 1.5b listings configuration
geometry.sty 2010/09/12 v5.6 Page Geometry
placeins.sty 2005/04/18 v 2.2
float.sty 2001/11/08 v1.3d Float enhancements (AL)
tikz.sty 2010/10/13 v2.10 (rcs-revision 1.76)
pgf.sty 2008/01/15 v2.10 (rcs-revision 1.12)
pgfrcs.sty 2010/10/25 v2.10 (rcs-revision 1.24)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfcore.sty 2010/04/11 v2.10 (rcs-revision 1.7)
pgfsys.sty 2010/06/30 v2.10 (rcs-revision 1.37)
pgfsys.code.tex
pgfsyssoftpath.code.tex 2008/07/18 (rcs-revision 1.7)
pgfsysprotocol.code.tex 2006/10/16 (rcs-revision 1.4)
pgfcore.code.tex
pgfcomp-version-0-65.sty 2007/07/03 v2.10 (rcs-revision 1.7)
pgfcomp-version-1-18.sty 2007/07/23 v2.10 (rcs-revision 1.1)
pgffor.sty 2010/03/23 v2.10 (rcs-revision 1.18)
pgfkeys.sty
pgfkeys.code.tex
pgffor.code.tex
tikz.code.tex
pgfplots.sty 2013/10/03 v1.9 Data Visualization (1.9)
pgf-pie.sty 2011/10/02 v0.2 Some LaTeX macros for pie chart by using PGF/Ti
kz package.
ifthen.sty 2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)
scalefnt.sty
t3cmr.fd 2001/12/31 TIPA font definitions
nameref.sty 2012/10/27 v2.43 Cross-referencing by name of section
gettitlestring.sty 2010/12/03 v1.4 Cleanup title references (HO)
答案1
从你的评论和回答来看,我得出结论,你已经
- 前列腺素 F2.10
- 赛莱特
在这种情况下,我收到日志消息
Package pgf Warning: Your graphic driver pgfsys-xetex.def does not support patterns. This warning is given only once on input line 18.
解决方案是升级到 PGF 3.0.0(PGF 的当前稳定版本)。然后您可以在 中编译模式xelatex
。
请注意,您的解决方案fill=color
无法在我的计算机上生成正确的模式。唯一的解决方案是使用,或者PGF 3.0.0
,如果您确实想坚持使用旧的 PGF,请使用另一个驱动程序(即pdflatex
/dvips
而不是xelatex
)
答案2
经过几个小时的搜索,我发现最好的方法是:
\addplot
[draw=blue,pattern=horizontal lines light blue, fill=red, fill opacity=0.55]
coordinates
{(10,5) (15,10) (5,15) (24,20) (30,25)};
最后我可以继续编译我的代码赛莱特!