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®.

Filter by
Sorted by
Tagged with
1
vote
1answer
26 views

What is the best way to include matplotlib plots?

I work on both Windows and Linux. I already include SVG graphics that I create in Inkscape with \usepackage{svg}. For maintainablitly reasons I would welcome to re-use that for matplotlib plots, but I ...
0
votes
0answers
19 views

Matplotlib same LaTeX format for text and float-to-string part

I am trying to work on the legend of my graph: As you can see that I used the dollar symbol for timestep to make it latex (I hope I am not wrong) but I am unable to get the same font/format for the ...
1
vote
1answer
100 views

Include “contour” package into matlplotlib and set title using it

I transfer the initial post from stackoverflow since one said it is rather a question for Tex exchange (I am going do delete the initial one). Here is this post : In a matplotlib script, I try to ...
0
votes
0answers
19 views

Preamble performing similar to revtex typesetting

I use python matplotlib package for creation of figures and I can indicate prefferable latex preamble for compilation of text (e.g. axes labels). Although I cannot use revtex class itself (\...
0
votes
0answers
85 views

Formatting Matplotlib figure with subplots for Latex

I'm having trouble getting my plot to span the entire \textwidth. Here is an equivalent MWE of what I'm getting when I compile. Matplotlib code: (set_size is a function taken from here, but that doesn'...
0
votes
1answer
404 views

How to get Latex bold greek symbol with matplotlib for a title above a subplot [closed]

I have the following subplot (indexed by mand ngiven) : ax = g.subplots[m,n] I tried to set in bold Latex all the Latex expression $1 sigma \pm 0.1$. I have set up at the beginning of matplotlib ...
0
votes
1answer
51 views

Less xticks in pgfplots loglog

I use tikzplotlib to produce pfgplots figures from matplotlib. Here's the output I get trying to produces a loglog plot: Obviously there is something wrong with the x axis ticks. I would like to have ...
0
votes
1answer
77 views

Matplotlib PGF Export: Error Dimension too large

I have an issue I could not find any other threads on, only for people who create their pgf plot manually. I have created a boxplot using matplotlib and Seaborn. I want to export this plot to TeX, so ...
1
vote
1answer
134 views

using plot with legend saved with tikzplotlib gives Error in latex

I am generating a plot with matplotlib and save it with tikzplotlib to use it later in latex. It works fine till the point where I use a legend in the plot. Then latex gives me the following Error ...
0
votes
1answer
34 views

Including .pgf plots with sans serif fonts in a serif document

I am creating the plots and figures for my thesis using matplotlib and save them as .pgf files that I include using \begin{figure} \input{myfigure.pgf} \caption{A caption} \end{figure} ...
2
votes
1answer
1k views

Desperate - Can't save image as eps in matplotlib when using tex since new install

I want to save a plot from matplotlib as an eps file, which has worked previously with no problem. However, today I reinstalled latex and ever since, I have trouble with eps. I have the following MWE ...
0
votes
1answer
37 views

How to refer to non-existing subfigure?

I ploted a big figure with several subfigures in it using matplotlib, because the library provides many features that are difficult to implement in tex (like shared label and shared axis). However, I ...
0
votes
0answers
26 views

Crop a pgf image to extents

I'm generating a fair bit of plots with matplotlib for my document. For consistent white space between plots, images, etc. I'd like to crop the plot images which are pgf to the extents of the plot "...
1
vote
0answers
589 views

PGF generated plot via Matplotlib and using relative font sizes when input to LaTeX

I can produce plots on matplotlib and export them to pgf successfully. But I believe that by first defining a base font size on matplotlib rcParams (11pt for example), and then defining things like ...
0
votes
0answers
249 views

How to force sans-serif fonts in matplotlib with xelatex PGF backend

This is a slightly borderline question for matplotlib-xelatex combination. I ma having an issue forcing a sans-serif font family in a png/pdf output of my matplotlib. I wanted to use tex rendering ...
1
vote
0answers
2k views

Including python matplotlib plots in LaTeX documents and inheriting document font properties

I am trying to get a standardised method to import plots from matplotlib into my LaTeX document, borrowing text formatting from the main document (so I want to avoid pure PDF). I am currently ...
1
vote
1answer
219 views

Scale down the size of a PGF figure

I've created a plot using matplotlib in Python and saved it to a PGF which I've then embedded in my LaTeX document. I'd like it to be a bit smaller, as is it won't centre and it forces down a section'...
2
votes
2answers
4k views

Matplotlib error: No such file or directory: 'latex': 'latex'

I am running a public code downloaded from GitHub, but I have a problem when it gets to the end and it has to plot the results using LaTeX. I get the following error: FileNotFoundError: [Errno 2] ...
1
vote
1answer
216 views

Reference in latex document to part of Matplotlib (pgf) generated figure

I have a Python script which draws a plot similar to this: fig = plt.figure() ax = plt.axes() x = np.linspace(-2,2,10) y = x**2 ax.plot(x, y, label='$x^2$', color="#07529a", linewidth=2.0) # <--...
1
vote
0answers
695 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 ...
2
votes
1answer
1k 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
181 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....
2
votes
0answers
270 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
893 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
1k 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 ...
2
votes
0answers
655 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
8k 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
575 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} \...
6
votes
1answer
5k 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
278 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
835 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, ...
2
votes
0answers
663 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
408 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$ ...
1
vote
0answers
5k 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{...
3
votes
1answer
5k 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
645 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 ...
3
votes
0answers
534 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, ...
6
votes
0answers
868 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 ...
2
votes
0answers
1k 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
9k 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
721 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 ...
2
votes
1answer
8k 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
1k 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 ...
37
votes
1answer
19k views

Matplotlib's PGF vs tikzplotlib

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 ...
7
votes
1answer
2k 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 ...
19
votes
2answers
18k 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 ...
9
votes
0answers
6k 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
143 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 ...
10
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 ...