Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [matplotlib]

Matplotlib is a 2D plotting library for Python, built on NumPy and often used interactively with IPython. Its "pylab" interface is similar to the plotting functions of MATLAB®.

1
vote
0answers
64 views

How to include figures using Pythontex

I try the solution of G.Poore (https://github.com/gpoore/pythontex/wiki/matplotlib) in order to include easily a lot of figures in a TeX document using Pythontex. Unfortunately I get the following ...
1
vote
1answer
46 views

The one of the Matploltlib example

import numpy as np import matplotlib matplotlib.rcParams['text.usetex'] = True import matplotlib.pyplot as plt t = np.linspace(0.0, 1.0, 100) s = np.cos(4 * np.pi * t) + 2 fig, ax = plt.subplots(...
4
votes
2answers
39 views

How can I put a ring accent below (or inside) a letter in math mode?

I need to put a circle (ring, zero etc.) below or inside a \Lambda letter. I need to do so both in math mode of LaTeX document and in mathtext mode of matplotlib - so my choice of commands is limited....
0
votes
0answers
55 views

Python matplotlib pgf to tex - resizing image box

I am trying to put graph plot that my python code outputs to my document. I initially exported to a .png image by using \includegraphics[width=0.55\textwidth]{myfigure.png} However I am now trying ...
1
vote
0answers
49 views

LaTeX matplotlib pgf shows no colorbar - instead shows colorbar png image filename [duplicate]

Moved from Stack Overflow I'm producing various plots with matplotlib and save them as PGF files. These are then imported in my LaTeX file and compiled using the pgf package. The problem is, I can't ...
0
votes
1answer
321 views

Including a complex Matplotlib.Pytplot figure in Latex [duplicate]

I'm not sure if I should post this on the Python SE or here. I have made a complex figure in Python that is exactly how I want it to be. Now I want to include that figure in my thesis in LaTeX. As of ...
1
vote
1answer
225 views

I do not know the key /tikz/none

I used matplotlib2tikz and now get the Package pgfkeys error: I do not know the key /tikz/none when I compile. I have \RequirePackage{pgfplots} and \RequirePackage[utf8]{inputenc} specified but it ...
1
vote
0answers
290 views

Matplotlib PDF figures blurry when printed

I'm creating my figures with Matplotlib. They are in the standard pdf output format of Matplotlib and I include them with \includegraphics{figure.pdf}. In my python scripts I activated the usetex flag ...
2
votes
1answer
2k views

Matplotlib2tikz Increase spacing between ticks

I am using matplotlib2tikz to plot a barchart. However, the ticks are not spaced out enough. How do I increase the spacing between the results? My code: import matplotlib matplotlib.use("Agg") ...
0
votes
1answer
285 views

Missing { inserted within matplotlib2tikz figure

After using matplotlib to create a bar chart, I use matplotlib2tikz to create a tikz figure. The code is as following: % This file was created by matplotlib2tikz v0.6.13. \begin{tikzpicture} \...
3
votes
1answer
1k views

How to use the \siunitx package within Python/matplotlib?

I'm writing a latex document and I include some matplotlib plots in it, in pgf format with \include{file.pgf}. It has advantages over exporting the matplotlib plot to pdf or eps formats in that the ...
0
votes
0answers
187 views

Eps figure shifted with XeTeX

I have an .eps figure which I produced with PyPlot (~matplotlib) in Julia. I have converted it to pdf with epstopdf fig.eps When I include it in a document it is shifted up- and rightwards. Minimal ...
2
votes
0answers
367 views

Scaling PGF plots and its font independently

I am a PhD student, quite new to the fantastic LaTeX world. Although I have written sevral documents already, I am still a beginner, and definitely not a programmer. I am using Python for my research, ...
1
vote
0answers
65 views

Point to inch conversion different [duplicate]

I'm trying to plot a diagram with matplotlib and embed it in latex. I want the diagram to have the full textwidth so I printed the textwidth in points to my document with \the\textwidth. The value I'...
1
vote
1answer
174 views

How to display D-stroke symbol in matplotlib

I want to display the D-stroke symbol (\DJ) using the following code, but I failed. Could anyone tell me how to make it correct? As shown in the figure, the symbol $\mu$ works well but the $\DJ$ ...
0
votes
0answers
290 views

Installing a missing/corrupt file MiKTeX

I am trying to produce an image on python for my LaTeX document using matplotlib, but it turns out I have a missing (or possibly corrupt) file in my MiKTeX Packages in the Helvetica font package I ...
0
votes
0answers
197 views

epstopdf Error: /undefined in Hebrew

i got a problem with my eps files, which are generated with python/matplotlib. I am not able to convert them anymore to PDF with the epstopdf program: It always gives the following error: Error: /...
0
votes
0answers
1k views

Inserting and correctly scaling PGF figure made with matplotlib [duplicate]

I created a plot in matplotlib and saved it as a PGF file. I insert the figure into Latex with the following: \begin{figure} \centering \input{test_fig.pgf} \end{figure} With \usepackage{...
2
votes
1answer
2k views

drawing state diagrams / graphs in matplotlib with LaTeX?

is there a way to draw the following state diagram in matplotlib? Or instead to embed inside a matplotlib figure LaTeX code that draws these diagrams using a package like tikz? ideally I would like ...
0
votes
0answers
489 views

Matplotlib OSError after manual texlive install

After setting matplotlib.rcParams["text.usetex"] = True in Python, the matplotlib.pyplot.savefig command raises OSError: [Errno 2] No such file or directory: '/home/my_name/cmr9 I believe this ...
2
votes
0answers
295 views

Why do my PDF figures in PDFTeX look bad in print? [closed]

I am using several figures created using Matplotlib in a LaTeX document that I compile with PDFTeX. When I print the compiled PDF, I find that the figure quality is not optimum on some printers, ...
5
votes
0answers
584 views

Export matplotlib triangle mesh to an asymptote surface

This is a followup of a question of mine at stackoverflow partially reproduced here for clarity. I'm playing a bit with scikit-image marching cubes algorithm. Here is a simplified version of the ...
0
votes
0answers
281 views

Linux PNG not compiling on Windows

I'm creating .png image plots using the Python library matplotlib on Ubuntu. On Windows, I'm writing a LaTeX document and want to include that image: \includegraphics{myplot.png} I'm getting the ...
2
votes
0answers
988 views

pgfplot or matplotlib? [closed]

The reason I ask this is because I was trying to draw multiple lines in pgfplots (I was trying to make a drawing showing how Riemann sums and integrals are connected). And after unsuccessfully trying ...
2
votes
1answer
3k views

How can I add the Latex on python path?

I'm using Cent OS i386. I got a error message when I use matplotlib python package. RuntimeError: LaTeX was not able to process the following string: 'lp' So, I did yum install tetex. but it still ...
1
vote
0answers
501 views

Matplotlib symbols

I have recently drawn up a lot of plots in Python (matplotlib), but then I realized that I couldn't find their LaTeX equivalents. I am specifically looking to generate circle, square, and diamond ...
1
vote
1answer
3k views

What is the LaTeX code to put a multiplication symbol into a matplotlib title?

Apologies for a very basic question, but this is something that I always forget, and it's a pain to find with google and the like, so I'm putting it here for everyone's future reference. As far as I ...
3
votes
0answers
948 views

Why isn't pgf honouring my font selections for matplotlib-generated graphics?

I wanted to use a euro symbol in my axis descriptions for matplotlib plots saved as pgf files with the pgf backend. When I use the following code: import numpy as np import matplotlib.pyplot as mplot ...
23
votes
1answer
10k views

Matplotlib's PGF vs Matplotlib2Tikz

I want to generate some plots to be integrated into a LaTeX document compiled with pdflatex. I also want the plot font (legend, title ...) to follow the settings of the LaTeX document. My search so ...
6
votes
1answer
1k views

Arrow-shaped text boxes (for use in ipe vector graphics editor)?

Ipe vector graphics editor I am currently evaluating the ipe vector graphics editor. A very attractive feature is that one can use LaTeX-commands inside its text objects as long as these are legal ...
16
votes
2answers
10k views

How can I import and scale matplotlib plots, keeping fonts the correct size?

I'm working on several pieces of coursework involving lots of plots generated with matplotlib in python scripts. Currently I'm doing this with an iterative process where I set a plot size in the ...
2
votes
1answer
1k views

How to import SVG or EPS files with LaTeX legends on Inkscape?

I usually plot my functions using Matlab or Python (matplotlib) and set labels with LaTeX. Occasionally, the plots have some rendering problem and I edit their SVG or EPS files using Inkscape. The ...
8
votes
0answers
5k views

How to incorporate and scale matplotlib plots in latex using the PGF backend?

I am using the pgf backend of matplotlib to generate pgf files which I want to put into my latex document using tikzscale to be able to resize them easily. Example python code: #!/usr/bin/env python ...
3
votes
0answers
67 views

Matching cmyk colors in plot to LaTeX [duplicate]

I'm plotting something using the Python package matplotlib and I'm using the matplotlib.cm.rainbow colormap. I need to match the same colors in my LaTeX document, but I'm having a difficult time ...
9
votes
1answer
2k views

How to match cmyk colors between matplotlib and LaTeX

I'm plotting something using matplotlib and I'm using the matplotlib.cm.rainbow colormap. I need to match the same colors in my LaTeX document, but I'm having a difficult time making the colors match ...
8
votes
3answers
2k views

Matplotlib PGF images in subdirectory

I have a two-dimensional image plotted by Matplotlib using the PGF backend. It is stored in the figures subdirectory (since I have a lot of images and don't want to clutter up the main folder). As an ...
7
votes
1answer
3k views

How can I remove margins when integrating matplotlib plots with pgfplots?

The python plotting library matplotlib will by default add margins to any plot that it generates. They can be reduced to a certain degree through some options of savefig(), namely bbox_inches='tight' ...
5
votes
0answers
1k views

Externalize pgfpicture [closed]

When I do \tikzexternalize \tikzsetfigurename{foo} \begin{tikzpicture} ... \end{tikzpicture} and compile my LaTeX file with pdflatex --shell-escape, a file foo0.pdf is created the first time and ...
-1
votes
1answer
11k views

Using Latex in Matplotlib plot title/axis label [closed]

Sorry if this is a repost; I'm sure this question gets asked often but I couldn't find exactly what I was after in the search. I'm trying to write a scientific plotting program in matplotlib (using ...
4
votes
0answers
69 views

Vector image (pdf) in TikZ node alters appearance [duplicate]

Possible Duplicate: Tikz changes included graphics I include my pdf vector plots (created with matplotlib) in nodes belonging to a TikZ matrix for positioning (e.g. see TikZ: Image Matrix - ...
1
vote
2answers
566 views

Generate plot with embedded tools useable externally

I use a both latex and M$ Word for my technical reports, depending on the person I have to deliver it. To generate my plot, I love using the tikz2pdf script given by Hans Meine but as far as it ...
2
votes
1answer
984 views

Trying to import a tikz figure generated by matplotlib2tikz, getting dimension too large for y-axis [closed]

I'm trying to use a graph exported by matplotlib2tikz, with the following code in it: \begin{tikzpicture} \begin{axis}[ ylabel={CF [\%]}, xmin=0.5, xmax=7.5, ymin=0.096, ymax=0.144, axis on top, ...
3
votes
1answer
3k views

Subscript size different in LaTeX and Matplotlib

I'm using matplotlib to prepare figures for a LaTeX document. I use TeX-mode in matplotlib. But subscript and superscipt in math mode gets a different size than in my LaTeX document. Rendered with ...
4
votes
1answer
7k views

Which font am I using

I am creating many figures for my LaTeX document using matplotlib with 'text.usetex': True. My full preamble looks like this: rc('font', **{'family':'serif', 'serif':['Computer Modern Roman']}) ...
12
votes
2answers
25k views

Good quality images in pdflatex

Generally I include images in my latex document by the command \includegraphics[scale=0.5]{image.png} However, after doing pdflatex the image quality is always very poor in the resulting pdf file. ...
6
votes
1answer
2k views

concrete font for text in matplotlib

I have matplotlib figures with labels, which are included as PDF in LaTeX document. I would like label text match with the font of the text, which is concrete (via \usepackage{concrete}). I can ...
10
votes
2answers
2k views

Set fonts in matplotlib graphs equal to tex document

I am writing my PhD in LaTeX and I am generating all my graphical content in Python with the matplotlib package. For my TeX document, I am using a math-supported font -- e.g. Kurier Light Condensed -- ...