Text with superscript in matplotlib, rendered as a single string - matplotlib

When making tick labels with superscripts (e.g. on a log-log plot), matplotlib renders each digit in a label as a separate text object in PDF. Is there a way to make matplotlib render entire label as one string, with characters of different kinds (regular and superscript)?
It is important when trying to edit/resize plot in a vector editor. Currently I have to re-do all tick labels manually as the split tick labels get misaligned.

You may refer to the official tutorial using Latex language [https://matplotlib.org/users/usetex.html]

Related

How to adjust area text bounding box without altering kerning or spacing between words?

I am creating svg figures using ggplot in R, then fine-tuning them in Adobe Illustrator.
Any attempt to expand area text in Illustrator (i.e. plot title or axis labels) causes the words to be spaced further apart.
How can I keep the word spacing constant while increasing the size of the area text bounding box, so that all the text can be seen?
The images show what happens when I try to expand the text box.
Increase Letter Spacing to fit the text your desired need. Let me know if you have any questions.
This turns out to be a problem with the bounding boxes drawn by the graphics device in R Studio. It cannot be undone by Illustrator.
The simplest (though non-reproducible) solution is just to delete the text box in Illustrator and add a new one manually, then type your text. It is fast and if you insist on reproducible work it is necessary to learn the ins and outs of the theme arguments in ggplot to specify the sizes. I also recommend the latex2expr package for typing LaTeX math notation into ggplot arguments.

Matplotlib: Grid is too tight for small plot

I want to make the plot smaller, so it can save some space in print. However, when I make it smaller, the grid will be too tight:
Honestly, I don't get it. Why can't matplotlib auto-detect that this image is too small that the lable should be with a bigger interval?
So, How can I make the grid more sparse, so the lables won't overlap with each other?
Additionally, the title will also collapse with the labels. I can set it manually, by plt.suptitle(title, y=1.08). So it will look better
But I'm wondering if there is anyway to do it automatically?
Note: I'm using seaborn, but I tried with pure matplotlib, same problem.

How to use toon shader to convert 3D models to patent drawings

USPTO requires patent drawings to be black and white lines images.
I'm using blender to make 3D models. At first I got this:
The problem is it's grayscale with no black lines.There's a answer to suggest using toon shader. Convert 3D models to patent digrams
I checked "Edge" and set "Threshold" to max 255 in "Render" tab, I got:
It's getting better but need more edges to be drawn. I searched and found a tutorial http://www.minimaexpresion.es/?p=1070&lang=en , then I got:
It's too complicated for me and I don't know how to use render layers. So I tried another tutorial http://download.blender.org/documentation/oldsite/oldsite.blender3d.org/80_Blender%20tutorial%20Toon%20Shading.html , which says I should assign different materials with different colors to different objects, so I tried and got this:
It leaves only one way to give a shot: render layers. Is there any simple methods to make it work? I only want this and convert it to indexed colors with black and white palette:
And the "Freestyle" only has one option about line thickness:
You were close in the second image. Instead of using the Edge postprocessor, look in the Render panel check the box labelled "Freestyle".
Then in the Render Layers panel there will be a list of configurable options for Freestyle, including how thick you want the lines and the minimum angle required to render an edge.
The best results are if you use mostly shadeless materials with simple textures (just solid colour).

How to save Photoshop slices as rectangles to a text file?

Is it possible to get slice rectangles in pixels using Photoshop scripting? I'd like to be able to save user slice rectangles as text in the following format: x, y, width, height for each slice on a new line.
I'm absolutely new to Photoshop scripting, so I don't know how to do it, or if it's possible at all.
There is not real way of controlling slices with JavaScript; there are ways around it.
However, this link may be of use to you.

Is it possible to remove the background of a text block in pdf using ghostscript

I am trying to convert a pdf into tif using ghost script. Is it possible to remove the background (grey color) of a text block (back font color) in a pdf using ghost script? I would like to replace the grey background to white.
Appreciate your help!!
I don't think you'll get a generic solution to your problem because there are many different ways such a background may be coded in your PDF and there is no sure way to distinguish such a background from a rectangular form of some vector image.
PDF essentially offers a set of tools for positioning glyphs and vector graphics in some rectangle (page) to display and some additional tools to add some interactivity (e.g. forms). Thus, a colored background in a PDF generally is created by drawing a line along the edge of the area of the background, fill this form with the desired color, and position glyphs and graphics (text and images) atop it. There are other operators, too, which can be used, though, and many variants of their use, and generally the form created is not marked as background.
In the answer Dingo refers to in his comment a rectangle covering the whole page, actually even a bit more (in case of a fairly common choice of a media box), is drawn (m: move to a corner; 4*l: draw the 4 edge lines; h: close the path; f fill the form).
Thus, please make the PDF in question available for inspection, maybe there is some specific solution for your file.