Home > tikz pgf > Modify tikzpicture plot outside .tikz file

# Modify tikzpicture plot outside .tikz file

March 9Hits:3

I am not sure if my title gets through what I'm after, but basically I am using matlab2tikz to generate some plots for me and am wondering how you can do some modifications from outside the .tikz file.

e.g a .tikz from matlab2tikz will be like:

\begin{tikzpicture} \begin{axis}[% width=4.52083333333333in, height=3.565625in, scale only axis, xmin=1, xmax=511, xlabel={$\text{q (um}^\text{-}\text{1)}$}, ymin=0.5, ymax=1, ylabel={Normalized RMS error}] \addplot [color=blue,solid,line width=1.0pt,forget plot] table[row sep=crcr]{ 1    -57.943745    \\ 2    .more data 3    .more data }; \end{axis} \end{tikzpicture}% 


I am importing and scaling the files in my document as follows (copied from Dimension too large from matlab2tikz, and aligning graph axis ):

\begin{table}[h!]        \begin{center}      \begin{tabular}{ c  p{6cm}  p{6cm}  }      \toprule       A & B & C \\       \cmidrule(r){1-1}\cmidrule(lr){2-2}\cmidrule(l){3-3}       text                     &            \scalebox{0.4}{\input{images/exp5nrmse.tikz}}       \scalebox{0.4}{\input{images/exp5diff.tikz}}       \scalebox{0.4}{\input{images/exp5diff.tikz}}]       &        \scalebox{0.4}{\input{images/exp5nrmse.tikz}}       \\ \bottomrule       \end{tabular}       \caption{DDM Results}       \label{tbl:myLboro}       \end{center} \end{table} 


Is it possible to change things like picture width, height, x and y label positions and things without having to edit the actual .tikz files. I ask because the presented code's graphs do not line up, and I would like to never have to touch the contents of the .tikz files to fix this issue. Picture of the problem below (the red lines I added in paint show the misalignment):

You can always define styles.

There are lots of styles available, among them

• every axis post : allows to override all options after \begin{axis} set in your .tikz file
• every tikzpicture : allows to define default options for every tikz picture. Useful keys could be trim axis left, trim axis right, and baseline. Please refer to Section "Alignment Options" of the pgfplots manual to learn how they can be used to fix alignment issues in plots.

These plots will be applied to all input pictures without the need to edit them.

However, it might seem confusing to assign, say, \pgfplotsset{every axis post/.style={width=4cm}} in the preamble if all your .tikz files define a width on their own... are you sure that you do not want to edit the files? Perhaps matlab2tikz can add some standard options?

Note that a best-practice would be to write

\begin{axis}[super style]



whenever you start an axis, combined with some preamble statement of sorts \pgfplotsset{super style/.style={title=My Title}}. Clearly, this would need modifications to your .tikz files.

## Related Articles

• ### Modify tikzpicture plot outside .tikz fileMarch 9

I am not sure if my title gets through what I'm after, but basically I am using matlab2tikz to generate some plots for me and am wondering how you can do some modifications from outside the .tikz file. e.g a .tikz from matlab2tikz will be like: \begi

• ### How to include arrows in a .tikz file, which is generated with matlab2tikz?August 29

I made a plot with matlab. Then I generated a .tikz file with matlab2tikz. Now i want to insert arrows in the .tikz file and also write something left of the arrow. I can make arrows and text in the plot, but matlab2tikz don't know the textbox. So th

• ### Scale markers in external Tikz fileApril 2

I use external .tikz files to include graphics in my LaTeX document. These .tikz files are generated by matlab2tikz. The scatter plots that come out though have very small markers. I want to scale these markers. Right now I include the .tikz file as

• ### Overlay two .tikz files from inputMarch 11

I have some plots generated from matlab2tikz which I would like to overlay. Each plot is a seperate .tikz file which I input using \input. My code currently is: \pgfplotsset{ every axis/.append style={ scale only axis, }, /tikz/every picture/.append

• ### Problem importing Octave Plot using TiKZ - pgfkeys Error on gpcolorApril 11

I am trying to include a set of Octave generated plots in a report, however I am constantly receiving the same error from pgf about it not recognizing \gpcolor A MWE would be \documentclass{article} \usepackage{pgf} \usepackage{pgfplots} %\usepackage

• ### pgfplots multiple plots in one fileDecember 8

In pgfplots is it possible to have several plots in one datafile? The goal is to add about 20 plots, which has different number of points and not the same x-value, to the same axis. (app. 350 points) One posible solution is to have the plots in separ

• ### 3D surface plots in TikZAugust 1

I need to plot a surface plot using TikZ. I have the (x,y) coordinate and the corresponding function value in a table form. I have not done 3D plots before in TikZ and hence I would appreciate any help. I would want a surf plot like this, but I do no

• ### How to create and include .tikz files in your manuscript?November 23

Recently, I learnt about the matlab code matlab2tikz. The output of this code is a .tikz file that can be used, I guess, alongside standard figure packages with a simple line \input{mysphere.tikz} in the figure environment. This got me wondering if .

• ### Change axis number format for external tikz fileApril 3

I'm using \input{filename.tikz} to include .tikz graphs created by matlab2tikz in my LaTeX document. As shown in a comment on this question it is possible to change the plot marker size when the document is inputted, without altering the original .ti

• ### How to remove the frame of a plot in tikz but keep the axes?April 8

I want to have a plot in tikz, with the horizantal an vertical directed axes, without numbering and without frame. Right now my code is as follows: \documentclass{article} \usepackage{paralist,pst-func, pst-plot, pst-math, pstricks-add,pgfplots} \use

• ### Create 3D heatmap desity plot using TikZNovember 7

My question is very similar to "Create heatmap with PSTricks or TikZ", but this time in 3D. So I have tabulary data as follows: x | y | z | value 1.2 | 1.3 | 1.4 | 1.20 0.2 | 0.3 | 0.4 | 3.20 ... With this data I want to create 3D density plot o

• ### How to scale a tikzpicture in an external file for a beamer slide?December 16

I have this tikz diagram in a separate document. I use the standalone package to include it into my presentation. However, I experience several problems: Setting the included picture size Scaling the picture so that it matches the visible frame area

• ### How to put TikZ file from Matlab to Latex? June 20

I made TikZ file in Matlab using function matlab2tikz so I want to put that figure in my Latex document. I am using this code: \documentclass{article} \usepackage{tikz} \usepackage{graphicx} \usepackage{pgfplots} \begin{document} \begin{figure} \cent

• ### Sort files by date modified, but folders always before files in Windows Explorer?January 28

I can sort files and directories in Windows Explorer by date modified. I always let recent files display first. But when I sort by date modified, directories are always displayed after the files. Is it possible to sort files by date modified, but dis

• ### How do I Modify Contents of a WSP File?April 4

I've been provided a WSP file that contains a webpart created by another developer. I have been requested to make modifications to the webpart and repackage as a WSP file again. What steps must be taken to import the contents of my WSP file into Visu

• ### Grant MODIFY on "All Subfolders and Files" with icacls, but only give Read to top level folderMay 9

One of our Windows servers that has some user folders on it has some pretty screwed up permissions. What I want it for SYSTEM and Domain Admins to have full control of all folders. I want the users to have read only on the top-level folder (which is

• ### How to modify/create values in XML files using PowerShell?March 3

I would like to know if is it possible to modify/create values in XML files using PowerShell. Basically I'm interested in: Modify values in the XML file or create them if they don't exist (i.e. I need to search the item, create if not exists and modi