Matplotlib chop off plot title text - matplotlib

I am using Python and Matlotlib to draw some plots but unfortunately the plot title text is cut off by the window size. even the plt.tight_layout() can't fix the problem. The text is shown correctly by manually increasing the window width.
here' s a picture with the plot problem enter image description here
Any suggestions to have the code to fix it automatically without manually resizing window width?
Any help is appreciated,
Thanks!
plot title text is shown cut off. it seems that the windows width is not set automatically to include all the text.

Related

How to resize the legend label in Matplotlib Graph

I wish to resize the Population label seen in the legend, I want the circle to be smaller than it is right now. How do I do that ?
There are many ways to do this, but the easiest is to set the desired size in the legend. That size will be a manual setting.
plt.legend(markerscale=0.5)

ngx chart resizing issue

Original screen,
Hi I am able to stretch the chart and increase the width but as soon as I hit button to shrink the width to original state; the chart is not resized .Its still using the expanded dimension
Above are screenshots of overlapping charts.
Anyone please help.

Resize height of picture and extend width

i have some picture which is 675x503. I would like to make more width on it and let's say to 1024 and in height to 400. How to do that without cutting my image and keep quality? I just would like to have this image on my website top. I got photoshop 6. I tried with Image->image size but its not what i need.
If you don't want to cut the picture at all, this will distort the image due to different height and width ratios. If this is not an issue, you could simply hit ctrl(or cmd)+t when the layer with the picture is selected. It will let you resize and rotate the entire image. There is also an option in the Image -> Image Size menu called "Bicubic Sharper", found in the drop-down list at the bottom of the menu(Photoshop CS6). It's meant for image reduction and should also solve your problem.

Getting the bounding box of each glyph in pdf - iOS

I've been trying to highlight text in a pdf. After a lot of research and experiments, it seems like I have to find the bounding box of each glyphs, create an overlay where the actual drawing is happening, and highlight the text by filling the CGRect with the info from bounding box and fill it with color. Now, I am stumped with the bounding box.
I've been using the PDFKitten to search and highlight the text. Now I want to use it to select and highlight the text. What I don't understand is how does it use the bounding box ( as well as other information like ascent, descent, capHeight, etc.) to fill highlight the searched word. When I tried to access the FontDescriptor class to get the info, it displays this:
2012-06-28 16:32:20.626 er[2408:15203] x:-665, y:-325, width:2000, height:1006
2012-06-28 16:32:20.627 er[2408:15203] x:-157, y:-250, width:1126, height:952
2012-06-28 16:32:20.628 er[2408:15203] x:-628, y:-376, width:2000, height:1010
It is very confusing so if anyone can clarify this, it will be very much appreciated.
You cannot use font descriptor information to get bounding box for the glyph.
PDFKitten takes care of finding width and height of the each glyph using RenderingState model.
You can use the same to find the location of the word while scanning the PDF.
Font dictionary provides the widths for the glyph. You can use cid to get the correct width of the glyph.
Try to look into highlighting code of the PDFKitten.

How to create letterpress effect?

I'm looking to implement something like the famous "letterpress" effect in my application. Here's what I'm talking about: (just a quick example made in PShop)
As you can see, it looks like it's pressed into the background. I wonder if it's possible to do something like this on the Mac dynamically. Is there a way? Thanks!
You can do the gradient fill portion of the text using the code I provide in this answer. Check the coordinate space first, because I described that for the iPhone, which has an inverted Y axis when compared to the Mac's normal Quartz coordinates.
The text is first used to create a clipping path, and the gradient is drawn within that path.
As far as the internal shadow, you might be able to draw this after the gradient is drawn by using CGContextSetShadowWithColor() with an appropriate downward offset and black color, then drawing the text again using just the stroke of the text. deanWombourne has some sample code for a similar task in his answer here.
Draw the text with a normal font to create a black and white bitmap of the text.
Draw another image that is is the same size and completely filled with the gray-to-white gradient you have above.
Create a completely white image with the same size as your other images.
Draw your back and white text image (1) onto the white image (3) with NSCompositeDestinationOut.
This gives you a white image with your text cut out.
Draw the white image with the text cut out on top of the gradient image and apply a shadow while drawing.