latex

Highlight the best value of each row in python pandas to_latex

Highlight the best value of each row in python pandas to_latex Question: I am using pandas to automatically generate tables using to_latex(), and I want to highlight (either bold, italics, etc.) the best value (either max, min) of each row. Is there a way to do that? I found this issue in their github, however …

Total answers: 3

Matplotlib: use TeX only if is available

Matplotlib: use TeX only if is available Question: I would like to run the following snippet: import matplotlib.pyplot as plt params = {‘text.usetex’: True} plt.rcParams.update(params) but be able to fall back to ‘text.usetex’ = False if latex or another requirement (ghostscript comes to mind) is not installed on the machine. What is the most pythonic …

Total answers: 2

Is there a non-math version of matplotlib.ticker.LogFormatterSciNotation?

Is there a non-math version of matplotlib.ticker.LogFormatterSciNotation? Question: I am trying to plot a graph with a logarithmic y-axis using pgf_with_latex, i.e. all text formatting is done by pdflatex. In my matplotlib rc Parameters I define a font to be used. Here comes my problem: The standard matplotlib.ticker.LogFormatterSciNotation formatter used math text and therefore a …

Total answers: 2

Is it possible to show `print` output as LaTeX in jupyter notebook?

Is it possible to show `print` output as LaTeX in jupyter notebook? Question: I was writing a very simple script to count ellipsoid area and volume and some other things. I was presenting my output printing it out like this: print(‘Dims: {}x{}mnArea: {}m^2nVolume: {}m^3’.format(a, round(b,2), P, V)) What, of course, gave this output (with sample …

Total answers: 3

matplotlib 3d axes ticks, labels, and LaTeX

matplotlib 3d axes ticks, labels, and LaTeX Question: I am running this sample script, with the following modifications: import matplotlib as mpl from mpl_toolkits.mplot3d import Axes3D import numpy as np import matplotlib.pyplot as plt mpl.rcParams[‘legend.fontsize’] = 10 fig = plt.figure() ax = fig.gca(projection=’3d’) theta = np.linspace(-4 * np.pi, 4 * np.pi, 100) z = np.linspace(-2, …

Total answers: 2

How do I make sans serif superscript or subscript text in matplotlib?

How do I make sans serif superscript or subscript text in matplotlib? Question: I want to use a subscript in an axis label in a matplotlib figure. Using LaTeX I would set it as $N_i$, which gives me the italic serif font. I know I can get non-italic mathfont with mathrm. But I would like …

Total answers: 3

Any Python Library Produces Publication Style Regression Tables

Any Python Library Produces Publication Style Regression Tables Question: I’ve been using Python for regression analysis. After getting the regression results, I need to summarize all the results into one single table and convert them to LaTex (for publication). Is there any package that does this in Python? Something like estout in Stata that gives …

Total answers: 3

Matplotlib not using latex font while text.usetex==True

Matplotlib not using latex font while text.usetex==True Question: I want to create labels to my plots with the latex computer modern font. However, the only way to persuade matplotlib to use the latex font is by inserting something like: title(r’$mathrm{test}$’) This is of course ridiculous, I tell latex to start math mode, and then exit …

Total answers: 3

Numpy 2d and 1d array to latex bmatrix

Numpy 2d and 1d array to latex bmatrix Question: I’m looking for a clean way to migrate numpy arrays to latex bmatrix. It should work for both 2d arrays and horizontal and vertical 1d array. Example A = array([[12, 5, 2], [20, 4, 8], [ 2, 4, 3], [ 7, 1,10]]) print A #2d array …

Total answers: 11