1

I have a tikz picture I have converted from Matlab using matlab2tikz. I am attempting to use the tikz externalize feature as I have many plots to compile in a larger document.

When I compile the below, the tikz picture does not appear in the PDF. No errors are displayed and the process exits normally. I am using Texmaker and MiKTeX on a Windows operating system.

\documentclass[12pt,a4paper]{report}

\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\usetikzlibrary{plotmarks}
\usetikzlibrary{arrows.meta}
\usepgfplotslibrary{patchplots}
\usepackage{grffile}
\usepackage{amsmath}
\newlength\fwidth
\newlength\fheight

\usepgfplotslibrary{external}
\usetikzlibrary{external}
\tikzexternalize

\begin{document}

\begin{figure}
    \centering
    \setlength\fwidth{0.9\textwidth}
    \setlength\fheight{250pt}
    \input{data1.tex}
\end{figure}

\end{document}

The tikz picture 'data1.tex' is

% This file was created by matlab2tikz.
%
%The latest updates can be retrieved from
%  http://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz-matlab2tikz
%where you can also make suggestions and rate matlab2tikz.
%
\definecolor{mycolor1}{rgb}{0.13333,0.28235,0.43922}%
%
\begin{tikzpicture}

\begin{axis}[%
width=0.951\fwidth,
height=\fheight,
at={(0\fwidth,0\fheight)},
scale only axis,
xmin=0,
xmax=1.2,
xtick={\empty},
ymin=3500,
ymax=4500,
ytick={\empty},
axis background/.style={fill=white}
]
\end{axis}

\begin{axis}[%
width=0.951\fwidth,
height=\fheight,
at={(0\fwidth,0\fheight)},
scale only axis,
xmin=0,
xmax=1.2,
xminorticks=true,
tick align=outside,
xlabel style={font=\color{white!15!black}},
xlabel={Time (s)},
ymin=3500,
ymax=4500,
yminorticks=true,
ylabel style={font=\color{white!15!black}},
ylabel={Load (N)},
axis x line*=bottom,
axis y line*=left
]
\addplot [color=mycolor1, line width=0.2pt, forget plot]
  table[row sep=crcr]{%
0   3810.052986\\
0.0124999999998181  3810.052986\\
0.0137500000000728  3809.88868652622\\
0.0150000000003274  3809.42203227988\\
0.0162499999996726  3808.69238952351\\
0.0187500000001819  3806.60160353078\\
0.0225000000000364  3802.47716727952\\
0.0262499999998909  3797.90131152025\\
0.0287500000004002  3793.7618264452\\
0.0337499999995998  3783.62257304109\\
0.0462500000003274  3758.5697905226\\
0.0474999999996726  3756.91783991307\\
0.0487499999999272  3755.8400302318\\
0.0500000000001819  3755.454506\\
0.0512500000004366  3755.61727915123\\
0.0524999999997817  3756.08977817325\\
0.0537500000000364  3756.84827241858\\
0.0562499999996362  3759.12832398925\\
0.0587500000001455  3762.26758868336\\
0.0625  3768.172224\\
0.0637500000002547  3771.07467639132\\
0.0649999999995998  3775.36218163981\\
0.0675000000001091  3787.34963285879\\
0.0712499999999636  3811.07671955647\\
0.0775000000003274  3856.33055094827\\
0.0825000000004366  3902.32219515923\\
0.0900000000001455  3976.51279157011\\
0.0950000000002547  4034.79332449758\\
0.0974999999998545  4055.76100351253\\
0.0987500000001091  4061.80261648915\\
0.100000000000364   4063.96881\\
0.101249999999709   4063.803041124\\
0.102499999999964   4063.353097032\\
0.104999999999563   4061.884858416\\
0.108750000000327   4059.327281472\\
0.109999999999673   4058.664205968\\
0.111249999999927   4058.214261876\\
0.112500000000182   4058.048493\\
0.113750000000437   4058.9182095272\\
0.114999999999782   4061.40199456338\\
0.116250000000036   4065.3118012904\\
0.118749999999636   4076.65729254444\\
0.1225000000004 4099.66952165351\\
0.125   4116.813123\\
0.126250000000255   4128.3192374552\\
0.128749999999854   4164.38896685573\\
0.133749999999964   4248.9395151096\\
0.135000000000218   4264.36718903662\\
0.136249999999563   4274.6666696728\\
0.137499999999818   4278.415853\\
0.138750000000073   4278.29300134192\\
0.140000000000327   4277.93129475351\\
0.141249999999673   4277.34100581346\\
0.143750000000182   4275.51577119338\\
0.146249999999782   4272.89947811141\\
0.148750000000291   4269.57430719731\\
0.149999999999636   4267.671574\\
0.151249999999891   4263.37023754004\\
0.152500000000146   4254.99057870544\\
0.154999999999745   4229.41064332762\\
0.161250000000109   4153.84127809422\\
0.164999999999964   4125.66988455414\\
0.168749999999818   4099.79217931459\\
0.171250000000327   4086.39078983055\\
0.172499999999673   4081.67011224854\\
0.173749999999927   4078.63606519865\\
0.175000000000182   4077.563613\\
0.176250000000437   4078.957299504\\
0.177499999999782   4082.740162872\\
0.180000000000291   4095.084243336\\
0.183750000000146   4116.586835112\\
0.1850000000004 4122.161581128\\
0.186249999999745   4125.944444496\\
0.1875  4127.338131\\
0.188750000000255   4125.95683597163\\
0.1899999999996 4122.09259332134\\
0.191249999999854   4116.16486670138\\
0.193750000000364   4099.79681616147\\
0.203749999999673   4021.58510655811\\
0.207500000000437   3988.27467661999\\
0.210000000000036   3971.94748424666\\
0.211250000000291   3967.21668260437\\
0.212499999999636   3965.516129\\
0.213749999999891   3967.86612662809\\
0.215000000000146   3974.36674132654\\
0.217499999999745   3996.52355281963\\
0.225000000000364   4076.9058\\
0.232500000000073   4126.38836727293\\
0.234999999999673   4138.50646565351\\
0.236249999999927   4142.98863276897\\
0.238750000000437   4148.60682970983\\
0.242500000000291   4154.6412816477\\
0.244999999999891   4157.69036559534\\
0.2475000000004 4159.98450429533\\
0.25    4161.544408\\
0.2524999999996 4162.49113449566\\
0.255000000000109   4163.09406421762\\
0.258749999999964   4163.88582721896\\
0.261249999999563   4164.69323974485\\
0.262499999999818   4165.272015\\
0.263750000000073   4166.53101426425\\
0.265000000000327   4168.820696864\\
0.267499999999927   4175.396195612\\
0.271249999999782   4186.14009088775\\
0.272500000000036   4188.860312096\\
0.273750000000291   4190.69336283825\\
0.274999999999636   4191.365264\\
0.276249999999891   4190.26954707119\\
0.277500000000146   4187.20528184423\\
0.2787500000004 4182.50679665832\\
0.28125 4169.54447976652\\
0.288749999999709   4125.62600175413\\
0.296250000000327   4086.31373558401\\
0.300000000000182   4064.626623\\
0.302499999999782   4046.39515452573\\
0.308750000000146   3994.14514751176\\
0.3100000000004 3986.55415533418\\
0.311249999999745   3981.08361071377\\
0.3125  3978.233847\\
0.3149999999996 3976.12833565319\\
0.317500000000109   3974.91333354505\\
0.321249999999964   3973.48462121885\\
0.322500000000218   3972.82175718374\\
0.323749999999563   3971.94406423434\\
0.324999999999818   3970.778633\\
0.326250000000073   3968.5790301389\\
0.327500000000327   3964.81092154334\\
0.329999999999927   3953.55014507089\\
0.333749999999782   3931.02617436663\\
0.340000000000146   3889.66695684078\\
0.3462499999996 3837.24591929663\\
0.347499999999854   3830.07488556019\\
0.348750000000109   3825.35043391381\\
0.350000000000364   3823.647789\\
0.351249999999709   3825.69834181456\\
0.352499999999964   3831.49023184732\\
0.353750000000218   3840.48380648192\\
0.356249999999818   3865.91739909111\\
0.361249999999927   3931.46008441104\\
0.363750000000437   3966.69029448496\\
0.366250000000036   4018.19434820086\\
0.371250000000146   4128.94719060608\\
0.3725000000004 4148.50085682468\\
0.373749999999745   4161.45852328944\\
0.375   4166.149099\\
0.376250000000255   4164.23485879966\\
0.3774999999996 4158.89559876769\\
0.380000000000109   4140.36278262306\\
0.383749999999964   4102.00568100781\\
0.387499999999818   4065.503707\\
0.390000000000327   4042.22771256126\\
0.395000000000437   3990.92880724094\\
0.397500000000036   3972.50474976031\\
0.398750000000291   3967.19881899634\\
0.399999999999636   3965.296858\\
0.401249999999891   3969.26917152\\
0.402500000000146   3980.05116536\\
0.404999999999745   4015.23451368\\
0.4087499999996 4076.52163656\\
0.409999999999854   4092.41089064\\
0.411250000000109   4103.19288448\\
0.412500000000364   4107.165198\\
0.413749999999709   4107.01140206447\\
0.414999999999964   4106.56671750479\\
0.416250000000218   4105.85619919131\\
0.418749999999818   4103.73788078434\\
0.421250000000327   4100.85688580638\\
0.425000000000182   4095.543835\\
0.426250000000437   4092.51363461975\\
0.427499999999782   4087.58465734084\\
0.430000000000291   4074.11981812844\\
0.433750000000146   4052.74077032869\\
0.4350000000004 4047.38872337521\\
0.436249999999745   4043.79443009553\\
0.4375  4042.480252\\
0.438750000000255   4043.21502096438\\
0.4399999999996 4045.24966446001\\
0.442500000000109   4052.20059466002\\
0.449999999999818   4077.782884\\
0.453749999999673   4085.08918687839\\
0.460000000000036   4095.83574298948\\
0.462499999999636   4101.244881\\
0.465000000000146   4107.95584917681\\
0.46875 4120.10632742159\\
0.473750000000109   4138.85457211153\\
0.476249999999709   4149.45113895068\\
0.479999999999563   4171.75185100566\\
0.483750000000327   4193.31762717497\\
0.484999999999673   4198.4136933257\\
0.486249999999927   4201.77449408785\\
0.487500000000182   4202.986628\\
0.488750000000437   4200.408000956\\
0.489999999999782   4193.408870408\\
0.492500000000291   4170.569602304\\
0.496250000000146   4130.785070768\\
0.4975000000004 4120.470562592\\
0.498749999999745   4113.471432044\\
0.5 4110.892805\\
0.501250000000255   4112.54000068396\\
0.5024999999996 4117.13151958296\\
0.505000000000109   4133.04711810888\\
0.508749999999964   4165.87538427798\\
0.512499999999818   4196.847039\\
0.515000000000327   4216.26912377216\\
0.520000000000437   4258.65773337912\\
0.522500000000036   4273.81202299304\\
0.523750000000291   4278.17023754804\\
0.524999999999636   4279.731479\\
0.526249999999891   4278.245698676\\
0.527500000000146   4274.212866368\\
0.529999999999745   4261.053097784\\
0.5337499999996 4238.129629928\\
0.534999999999854   4232.186508632\\
0.536250000000109   4228.153676324\\
0.537500000000364   4226.667896\\
0.538749999999709   4228.178234676\\
0.539999999999964   4232.277725368\\
0.542499999999563   4245.655010784\\
0.546250000000327   4268.957378928\\
0.547499999999673   4274.998733632\\
0.548749999999927   4279.098224324\\
0.550000000000182   4280.608563\\
0.551250000000437   4280.48844368607\\
0.552499999999782   4280.13566883048\\
0.553750000000036   4279.56161306251\\
0.556249999999636   4277.79515730658\\
0.558750000000146   4275.28007345254\\
0.561249999999745   4272.10735853466\\
0.5625  4270.302826\\
0.563750000000255   4266.44170685832\\
0.5649999999996 4259.11672923978\\
0.567500000000109   4237.16663446798\\
0.572500000000218   4185.7059380564\\
0.574999999999818   4168.56108\\
0.577500000000327   4158.94917468187\\
0.581250000000182   4148.38083846495\\
0.585000000000036   4138.44926523327\\
0.587499999999636   4129.969383\\
0.590000000000146   4118.82531836718\\
0.59375 4098.51971294303\\
0.601249999999709   4056.77576449685\\
0.609999999999673   4011.39324265317\\
0.612500000000182   4001.915116\\
0.614999999999782   3995.12694555973\\
0.618749999999636   3987.65691779387\\
0.621250000000146   3982.67463767165\\
0.623749999999745   3976.24221742705\\
0.625   3972.094259\\
0.626250000000255   3966.45676726861\\
0.628749999999854   3949.78906285795\\
0.633749999999964   3906.22694558701\\
0.636249999999563   3885.81491863638\\
0.645000000000437   3828.38737139483\\
0.647500000000036   3817.35435839828\\
0.648750000000291   3814.23260341827\\
0.649999999999636   3813.12278\\
0.651249999999891   3814.590141588\\
0.652500000000146   3818.572980184\\
0.654999999999745   3831.569611392\\
0.6587499999996 3854.208904464\\
0.659999999999854   3860.078350816\\
0.661250000000109   3864.061189412\\
0.662500000000364   3865.528551\\
0.663749999999709   3864.60520862218\\
0.664999999999964   3862.09255344332\\
0.667499999999563   3853.84353640997\\
0.672499999999673   3835.26029773329\\
0.673749999999927   3832.43207503966\\
0.675000000000182   3831.103003\\
0.678750000000036   3829.91932332299\\
0.681249999999636   3829.33349908077\\
0.683750000000146   3828.92799913271\\
0.6850000000004 3828.79760858868\\
0.686249999999745   3828.71798450182\\
0.6875  3828.691022\\
0.688750000000255   3830.89733779118\\
0.6899999999996 3836.88653397753\\
0.692500000000109   3856.43506041258\\
0.696249999999964   3890.51378350927\\
0.697500000000218   3899.36309967011\\
0.698749999999563   3905.38290876062\\
0.699999999999818   3907.628584\\
0.702500000000327   3907.70736606589\\
0.704999999999927   3907.76874250912\\
0.707500000000437   3907.81265501942\\
0.708749999999782   3907.82804407774\\
0.710000000000036   3907.83904528647\\
0.711250000000291   3907.84565135682\\
0.712499999999636   3907.847855\\
0.713749999999891   3907.510177632\\
0.715000000000146   3906.593624776\\
0.717499999999745   3903.602768088\\
0.7212499999996 3898.392888696\\
0.722499999999854   3897.042179224\\
0.723750000000109   3896.125626368\\
0.725000000000364   3895.787949\\
0.726249999999709   3897.18854621079\\
0.727499999999964   3901.08847313169\\
0.729999999999563   3914.57512783508\\
0.744999999999891   4017.16055153292\\
0.7475000000004 4029.07020920431\\
0.748749999999745   4032.48686284121\\
0.75    4033.709412\\
0.751250000000255   4030.651897092\\
0.7524999999996 4022.352928056\\
0.755000000000109   3995.272081728\\
0.758749999999964   3948.098994576\\
0.760000000000218   3935.868934944\\
0.761249999999563   3927.569965908\\
0.762499999999818   3924.512451\\
0.763750000000073   3924.52134493951\\
0.765000000000327   3924.54797204713\\
0.766249999999673   3924.59225025654\\
0.767499999999927   3924.65409750139\\
0.770000000000437   3924.83017083209\\
0.772500000000036   3925.07553550852\\
0.774999999999636   3925.389535\\
0.776249999999891   3928.65556508845\\
0.777500000000146   3937.21964772348\\
0.779999999999745   3964.92651318391\\
0.7837499999996 4013.00059641546\\
0.784999999999854   4025.44684272087\\
0.786250000000109   4033.88909103649\\
0.787500000000364   4036.998477\\
0.788749999999709   4033.72917804871\\
0.789999999999964   4024.62878153319\\
0.792499999999563   3993.17969783958\\
0.802499999999782   3835.16788496665\\
0.807499999999891   3764.91593118783\\
0.8100000000004 3736.8340947045\\
0.811249999999745   3726.3221149967\\
0.813750000000255   3713.12776004259\\
0.817500000000109   3697.8197793646\\
0.819999999999709   3689.96161830973\\
0.822500000000218   3684.75826883658\\
0.823749999999563   3683.36029596029\\
0.824999999999818   3682.875803\\
0.826250000000073   3684.594887696\\
0.827500000000327   3689.260974728\\
0.829999999999927   3704.487153464\\
0.833749999999782   3731.010174488\\
0.835000000000036   3737.886513272\\
0.836250000000291   3742.552600304\\
0.837499999999636   3744.271685\\
0.838749999999891   3743.84707096556\\
0.840000000000146   3742.62745999311\\
0.8412500000004 3740.69419877893\\
0.84375 3735.01211241058\\
0.8462499999996 3727.45158543084\\
0.850000000000364   3714.012286\\
0.851249999999709   3707.68197014809\\
0.853750000000218   3687.3274706362\\
0.859999999999673   3624.40460837167\\
0.861249999999927   3615.38706481777\\
0.862500000000182   3609.200745\\
0.867500000000291   3592.48054470963\\
0.869999999999891   3586.09051904642\\
0.8725000000004 3581.81557138881\\
0.873749999999745   3580.65914908185\\
0.875   3580.256973\\
0.876250000000255   3584.19658041715\\
0.8774999999996 3595.16493896764\\
0.880000000000109   3633.0851272629\\
0.895000000000437   3920.2800141931\\
0.897500000000036   3953.46921114436\\
0.898750000000291   3962.98774976685\\
0.899999999999636   3966.393213\\
0.901249999999891   3961.3219132\\
0.902500000000146   3947.5569566\\
0.904999999999745   3902.6397298\\
0.9087499999996 3824.3968186\\
0.909999999999854   3804.1116194\\
0.911250000000109   3790.3466628\\
0.912500000000364   3785.275363\\
0.913749999999709   3786.68394947858\\
0.914999999999964   3790.6958999683\\
0.916250000000218   3796.99050105008\\
0.918749999999818   3815.14480131366\\
0.922499999999673   3851.47829567318\\
0.925000000000182   3878.026998\\
0.926250000000437   3895.13900131275\\
0.928750000000036   3946.93235112314\\
0.933750000000146   4065.99056190992\\
0.9350000000004 4087.5604582717\\
0.936249999999745   4101.93778770142\\
0.9375  4107.165198\\
0.938750000000255   4105.274204868\\
0.9399999999996 4100.141509224\\
0.942500000000109   4083.392712912\\
0.946249999999964   4054.217390304\\
0.947500000000218   4046.653417776\\
0.948749999999563   4041.520722132\\
0.949999999999818   4039.629729\\
0.951250000000073   4039.66628310345\\
0.952500000000327   4039.77529175003\\
0.953749999999673   4039.95577444413\\
0.954999999999927   4040.2067506901\\
0.957500000000437   4040.91626185515\\
0.960000000000036   4041.89598128013\\
0.962499999999636   4043.138065\\
0.963749999999891   4047.81284237298\\
0.965000000000146   4059.31688955187\\
0.967499999999745   4095.91499096085\\
0.9712499999996 4158.92040182787\\
0.972499999999854   4175.18660541797\\
0.973750000000109   4186.21092467255\\
0.975000000000364   4190.268909\\
0.976249999999709   4190.13685304025\\
0.977499999999964   4189.767216952\\
0.978750000000218   4189.19979842175\\
0.981249999999818   4187.63080478125\\
0.991250000000036   4180.03350317325\\
0.994999999999891   4176.739011216\\
0.9975000000004 4175.119914152\\
0.998749999999745   4174.65029048775\\
1   4174.481397\\
1.00125000000025    4175.8432967602\\
1.0024999999996 4179.60145052961\\
1.00500000000011    4192.34124702882\\
1.01124999999956    4231.73290476182\\
1.01375000000007    4240.99952866125\\
1.01624999999967    4247.71151608485\\
1.02375000000029    4265.85733484742\\
1.02499999999964    4269.864284\\
1.02624999999989    4275.06340205637\\
1.0287500000004 4289.4776309312\\
1.0337499999996 4320.87248133051\\
1.03499999999985    4326.44386356597\\
1.03625000000011    4330.14020091293\\
1.03750000000036    4331.479437\\
1.03874999999971    4330.98962355169\\
1.03999999999996    4329.60534093045\\
1.04125000000022    4327.45432572183\\
1.04374999999982    4321.36304388457\\
1.04749999999967    4309.66904136181\\
1.05125000000044    4297.0478459828\\
1.05375000000004    4284.41697285174\\
1.05875000000015    4257.12481170218\\
1.0600000000004 4252.29693612555\\
1.06124999999975    4249.09621254031\\
1.0625  4247.937184\\
1.06375000000025    4251.099071876\\
1.0649999999996 4259.681338968\\
1.06750000000011    4287.686631584\\
1.07124999999996    4336.470044528\\
1.07250000000022    4349.117596032\\
1.07374999999956    4357.699863124\\
1.07499999999982    4360.861751\\
1.07625000000007    4360.03336087946\\
1.07750000000033    4357.64544239808\\
1.07874999999967    4353.84387337621\\
1.08125000000018    4342.58329499248\\
1.08374999999978    4327.41864829116\\
1.08749999999964    4299.904412\\
1.08874999999989    4285.14689328087\\
1.0912500000004 4232.70036946084\\
1.0962499999996 4101.90565387179\\
1.09749999999985    4077.52418531393\\
1.09875000000011    4061.17133500454\\
1.10000000000036    4055.19797\\
1.10124999999971    4056.075931112\\
1.10249999999996    4058.458968416\\
1.10499999999956    4066.235195408\\
1.10875000000033    4079.780881136\\
1.10999999999967    4083.292725584\\
1.11124999999993    4085.675762888\\
1.11250000000018    4086.553724\\
1.11375000000044    4085.92445802468\\
1.11499999999978    4084.11363000329\\
1.11625000000004    4081.23669479272\\
1.11874999999964    4072.74632223159\\
1.12125000000015    4061.37697919635\\
1.125   4040.945355\\
1.12625000000025    4030.33884021393\\
1.12874999999985    3993.51708463565\\
1.13374999999996    3902.66618837528\\
1.13500000000022    3885.79099218871\\
1.13624999999956    3874.48134421933\\
1.13749999999982    3870.352513\\
1.13875000000007    3871.18059242348\\
1.14000000000033    3873.49072841682\\
1.14249999999993    3881.51255645047\\
1.14624999999978    3898.13188738353\\
1.14999999999964    3913.987443\\
1.15250000000015    3924.14754911671\\
1.15750000000025    3946.60441715754\\
1.15999999999985    3954.68062439918\\
1.16125000000011    3957.00742498852\\
1.16250000000036    3957.841644\\
1.16374999999971    3956.67582506534\\
1.16499999999996    3953.44215564122\\
1.16749999999956    3942.35398960366\\
1.17500000000018    3900.611911\\
1.18000000000029    3878.80688195451\\
1.18249999999989    3868.67387799634\\
1.1850000000004 3861.33787755878\\
1.18624999999975    3859.25406533466\\
1.1875  3858.511878\\
1.18875000000025    3858.9424166185\\
1.1899999999996 3860.232716848\\
1.19124999999985    3862.3808052495\\
1.19250000000011    3865.384708384\\
1.19499999999971    3873.952065096\\
1.19750000000022    3885.918999472\\
1.19999999999982    3901.269724\\
};
\end{axis}
\end{tikzpicture}%

My PdfLaTeX build command is:

pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.tex

If I disable externalization, the plot appears as intended.

Why is the plot not appearing in the PDF when externalize is used?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.