Questions tagged [matlab2tikz]

A tag for TikZ/pgfplots code generated by matlab2tikz. Use this tag *in addition* to pgfplots to stress that your pgfplots code has been generated by matlab2tikz. matlab2tikz as such is out-of-scope of this platform; it is unrelated to TeX.

Filter by
Sorted by
Tagged with
48
votes
8answers
4k views

matlab2tikz logo

As the author of the free and open-source package matlab2tikz, I was going to create a nice-looking logo for the software that is easily recognized on MATLAB's file exchange and representative of ...
9
votes
1answer
1k views

Error when creating a surf plot with matlab2tikz

I'm using matlab2tikz to generate the tikz code for my figures. When compiling the document with the figure code as below, i get an error: Package pgfplots Error: No such element: \...
9
votes
1answer
2k views

How can I import matrix data (2d function) from matlab into pgfplots?

This question arised in Spectrum colormap for multiple curves, but since it is of general interest, I add a separate question and my answer here. Suppose you have a matlab figure which needs to be ...
8
votes
2answers
1k views

Setting the unit vector ratio gives a '! Dimension too large' error

I have a Delaunay-triangulated surface generated in MATLAB, which I would prefer to render in tikz. I use Nico Schlömer's matlab2tikz script to generate the standalone tex file. The MATLAB result ...
8
votes
1answer
2k views

pgfplotsset append style is not appended to tikzpicture axis environment

When using every x tick label/.append style={font=\scriptsize} in combination with \pgfplotsset outside the tikzpicture environment, the pgfplotssetcommand from the preamble will be ignored (...
8
votes
1answer
1k views

Reverse graphics in pgfplots

Issue and Question I encountered that my graphics are all upside down. Now I have to mirror them in pgfplots. How can I perform this step? It is no solution using the option [y dir=reverse] which ...
7
votes
1answer
1k views

Scale markers in external Tikz file

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 ...
6
votes
3answers
3k views

matlab2tikz imagesc TikZ/pgfplots equivalent

I'm using matlab2tikz to export imagesc figures into TikZ/pgfplots code. This process gives me a TikZ file and a rasterized png version of the image with colours matching the colourbar at the time of ...
6
votes
1answer
3k views

New line in pgfplots/tikz not displaying in TeX

I have a multiple-line legend entry to preserve the width of my figure. I can use \newline in Matlab and the legend entry is split between two lines. When I produce a .tikz of the figure however, I ...
6
votes
0answers
10k views

TeX capacity exceeded, sorry [main memory size=5000000] with matlab2tikz and reduce_plot

Yet another Tex Capacity exceeded error. I am generating a matlab scatter plot which without modification resulted in a 64.5 MB printed eps file. Using that plot directly in matlab2tikz resulted in a ...
5
votes
2answers
2k views

Argument to \input or \include statement?

I produce a lot of plots in Matlab which I export to TikZ with matlab2tikz. In matlab2tikz I can specify the plot width and height, for instance. This works out quite nicely, but as I write my ...
5
votes
1answer
6k views

matlab2tikz font size

I Latex, how can I change/reduce the font size on a Matlab figure created by using matlab2tikz? I would like to reduce the font size on the axis numbers, labels, title, legend, etc. It does not ...
5
votes
1answer
2k views

Spectrum colormap for multiple curves

I have been using matlab2tikz to generate a lot of my plots, but I am finding it struggling at this particular job so would like to inquire about how to do it properly in pgfplots / tikz. Essentially ...
5
votes
2answers
3k views

Add legend to pgf plot results in \end{axis} error

I exported a Matlab figure to tikz, using matlab2tikz. It is a simple plot of some lines and I need to label them. matlab2tikz did not add the legend entries automatically for the first time, so I ...
5
votes
1answer
563 views

TikZ plots get recompiled every time when using tikzscale

For my thesis I have a lot of TikZ plots exported from Matlab using the matlab2tikz library. I want to use the tikzscale package together with externalization of the plots to save compiling time. ...
5
votes
0answers
2k views

Matlab2tikz adds extra legend entries [closed]

The legend from a boxplot figure is not being created properly. I get this: Instead of thiS: But really only need 2 legend entries. Any Ideas why all the objects in this plot are being given ...
4
votes
3answers
3k views

Drawing spherical harmonic density plots on the surface of a sphere in tikz/pgfplots

I would like to create spherical harmonic plots in tikz/pgfplots similar to the one below, except without the axes and with labels above every image: It would be good if I could specify different ...
4
votes
2answers
2k views

define manually the position of a pgfplots plot inside the TikZ picture

I just started using matlab2tikz for the graphics in my thesis and got stuck with a probably simple problem: I have a plot of a function and an inset (zoom-in) on it. Both the main plot and the inset ...
4
votes
2answers
5k views

Set the axis range according to the data range, that is, no scales for axis

I use the matlab2tikz package to creat surface in LaTex editor, but it display ugly unlike the Fig. created in the Matlab. Can anyone help me out? Is there a way of adjusting the x,y and z axis ranges ...
4
votes
1answer
676 views

Axis background shading overriding legend

This code in MATLAB: hold on h(1) = area([0 2.5], [125 125]); h(2) = area([2.5 5], [125 125]); set(h(1),'FaceColor',[1.0 0.8 0.6],'EdgeColor',[1.0 0.8 0.6]); set(h(2),'FaceColor',[1.0 0.8 0.4],'...
4
votes
1answer
871 views

Get this error when I run my pgfplots

I got a problem with my pgfcodes. I get this error: ! Package pgfplots Error: Sorry, pgfplots expects stacked plots to have exactly the same number of coordinates. Unfortunately, I encountered at ...
4
votes
1answer
876 views

\vref and input command

You've saved my life in some occasions, I am writing my master thesis and as I am working with MATLAB, I found a very useful MATLAB function which "translate" MATLAB images to TeX tikzpicture. I ...
4
votes
1answer
13k views

Replacing axis labels with text in Tikz

I am plotting 11 points in a scatter plot in Matlab and replacing the x-axis labels 1 - 11 with strings using: figure; grid on; hold on; box on; scatter(2:10,100*d1(1,:),'rs','filled'); scatter(2:10,...
4
votes
1answer
2k views

Dimension too large after exporting box plot with matlab2tikz

When exporting a box plot with matlab2tikz I get no errors, but when running pdflatex I get a "dimension too large" error. This only happens with box plots. Still the box plot shows up as it should, ...
4
votes
1answer
2k views

Package pgfkeys Error: I do not know the key '/tikz/y error plus index'

I am having trouble compiling the attached mwe. I receive the following message: "Package pgfkeys Error: I do not know the key '/tikz/y error plus index' and I am going to ignore it. Perhaps you ...
4
votes
1answer
303 views

Why does pasting the contents of a tikz file into my main file compile properly but not when using \input

If I place the contents of my tikz picture in my main.tex file it works like a charm using \usepgfplotslibrary{external} \tikzexternalize and subsequently: pdflatex --enable-shell \...
4
votes
1answer
198 views

Change font size in matlab2tikz

I am using matlab2tikz to export my Matlab figures in order to be able include them in my LaTeX document. I think the fonts of the tick labels, axis labels, titles and legends are too big. How can I ...
4
votes
0answers
722 views

pgfplots error using matlab2tikz [closed]

I am trying to plot a matlab figure in latex file. so i use this matlab2tikz function. It works really well, until I try to add some customised text on the figure before converting it to tikz file, ...
4
votes
0answers
448 views

image too bright when exporting grayscale matlab images with matlab2tikz [closed]

I am using matlab2tikz to export my MATLAB plots to tikz. This works pretty well as long as I am using the colormap jet inside MATLAB. Unfortunately, as soon as I am using grayscale, the resulting ...
3
votes
1answer
3k views

Problems with axis label and colorbar for pgfplots

I used matlab2tikz to convert a figure from matlab to tikz. When I run this code, I get this addition $.10^-2$ in both X and Y axis. (see figure below ). In addition ytick of the colorbar is also not ...
3
votes
1answer
984 views

matlab2tikz, label on right side of colorbar

How to move the label right of the colorbar? Now it is in the plot itself. This is the matlab-code.... clear all close all clc figure surf(peaks(2)) cb = colorbar cb.Label.String = 'Label' ...
3
votes
2answers
925 views

matlab2tikz spectrogram is too big

I have produced the following spectrogram in MATLAB and I am trying to import it into a LaTeX document after using matlab2tikz. I am fully aware of the issues with maximum memory etc for typesetting, ...
3
votes
2answers
2k views

pgfplots surf plot: don't draw 'NaN'

I generated a checkerboard style suface plot using matlab2tikz. The data contains nan (not a number) values. I want the squares of nan values to be white (as in matlab). When I compile, I get the ...
3
votes
1answer
308 views

A _standard_ way to use matlab2tikz output from a subfolder

In my tex project I use an ./images/xxx/ directory to save stuff generated by matlab2tikz. Sometimes matlab2tikz generates png's. When I try to "\include" the tikz file it fails to import those for an ...
3
votes
2answers
444 views

TikZ: How to get a smooth surface plot without significant increasing needed memory

I want to produce smooth surface plot created with matlab2tikz. However, if I use [shader = faceted interp] instead of [shader = flat corner] the required document memory increases from 34KB to ...
3
votes
3answers
2k views

Matlab2tikz, alignment of subplot ylabel (large distance from plot)

Matlab2tikz came to my attention in the past month and have been using the simple tutorial from HowToTeX. It has worked great so far only one issue remains, I am unable to anchor the ylabel to the ...
3
votes
1answer
3k views

Problem with xticks when importing Matlab figures using matlab2tikz

When importing the following figure using the Matlab2Tikz, I obtain the following output , with the xticks strangely exported . Does any one have an idea how I can prevent this? Maybe by passing an ...
3
votes
1answer
2k views

Using MATLAB area() to shade graph error in matlab2tikz

I generate a graph in MATLAB and want to shade regions. So I use the area() command and set it to display in the right order. MATLAB code for the graph: hold on x = 0:1:5; y = sin(x); plot(x,y); h(...
3
votes
0answers
131 views

Matlab2Tikz+PgfPlots Violating Margins [closed]

I use this command in matlab matlab2tikz('fig_blank.tex','width','\textwidth','height','5cm') in order to make a tikzpicture out of this matlab plot. My MWE in PdfLaTeX \documentclass{article} \...
2
votes
1answer
533 views

how can I explain a MATLAB code in my document like picture?

I have a matlab code and I want explain part of them like picture. or any other idea can do better. \documentclass{article} \usepackage{listings} \usepackage{color} %red, green, blue, yellow, cyan, ...
2
votes
2answers
1k views

Root locus plots using LaTeX

On my homework, I need to create a root locus plot. Wondering if anyone out there has good suggestions for a package that is able to create root locus plots, or a general plotting package that is ...
2
votes
2answers
698 views

Matlab2Tikz FaceColor Surfplot

I would like to export a surf plot, whose face color is for example green, out of MATLAB R2014a to latex with the aid of matlab2tikz. Unfortunately when i run pdflatex the face color now ranges from ...
2
votes
1answer
47 views

matlab2tikz not compiling

In the code generated by matlab2tikz, I am having a problem compiling the code. The error that I get is: ! Missing } inserted. <inserted text> } I am not seeing in the code ...
2
votes
2answers
106 views

Draw part of a pgfplots table based on the amount of points

Here is my problem I have tabular data exported from MATLAB using matlab2tikz. My initial plot is sort of a ribbon plot. Therefore, when exporting it to tikz, the tabular data for each ribbon is of ...
2
votes
1answer
5k views

How to convert a matlab figure to a latex code? (not to a graphic)

First of all sorry for my bad english. I want to convert my matlab figure to a latex code (no graphic). I want the latex code. I know its possible. But i dont know how. Of course i can also export my ...
2
votes
1answer
1k views

Matlab2tikz problem with contourf

I´ve got a problem concerning inserting a Tikz-Plot from Matab into my Tex-file. The matlab-script I use to produce the plot is (Contourf-Plot): %% clear all; clc; format bank; fontname = '...
2
votes
2answers
737 views

Problem with ticks and caption when importing Matlab figures using matlab2tikz

I have created a nice plot in Matlab and converted it into tikz with the matlab2tikz library. It works great but there are two problems: The ticks of the axis are not good. Especially for the y-axis ...
2
votes
1answer
1k views

Adding a textbox to a pgfplot

From Matlab I have a set of data from which i create a graph. The plot with Latex works perfectly fine. To this plot I am adding a coloured square in the background, which is also working. Here a ...
2
votes
1answer
530 views

Remove 10-base x tick labels from matlab2tikz plot

I am trying to extract some plots from Matlab for XeLaTex using Matlab2Tikz. All goes well, except the plot with the loglog scale (I included a figure, see below). The left bottom plot shows a loglog ...
2
votes
2answers
630 views

Subplots do not align properly when using matlab2tikz

I am experiencing some problems with matlab2tikz. I create a subplot in matlab. however, when I convert it to .tex code using matlab2tikz, the subplots are not properly aligned. Code: % This file ...