Combining pictures with python - python-3.x

Im currently working on a project where an object is placed on a 60cm x 60cm plate. This plate is divided into 4 sections where every section is 30cm x 30cm. Every section has its own camera that photoghraphs this 30cm x 30cm section (Actually its 31cm x 31cm so that the sections overlap a bit to eliminate the risk of missing some part):
I want to combine the pictures into 1 picture via python as if just 1 picture was taken from above.
So the result should like this (note that the picture of the whole tool is just a picture I took and not edited together from the 4 single pictures):
Input:
Top Left:
Top Right:
Bottom Left:
Bottom Right:
Expected output:
On the pictures I placed green cords to show the 30cm x 30cm segments.
Additional Info: The tool is placed on a LED panel to increase contrast. Also markers, for example black lines that divide the sections, could be placed if this opens new possibilities to code. This could look something like this:

Related

Excel Chart Scatter Straight Line and show length based on 3rd series

I'm trying to create a scatter straight line chart to visually show how a retaining wall looks in elevation view. I have a top of wall dimension and bottom of wall dimension and the length of each wall section. I am able to use the top and bottom of wall dimension but having trouble showing the length of the run. I have tried to add the wall length as another data point, but doesn't work, it just skews the other two points. Tried to use a cumulative run length, helper column, but couldn't get that value to populate the x axis properly. I added some notes in red in the image below. Spent a few hours and appreciate any help.
I perhaps wouldn't use excel for diagramming this, but I think you would need to add more points and interpolate the values. If your minimum wall length is 25, then you could use 25 as your base. Wall 1 is 100, so you need 4 points (100 / 25). Wall 3 is 150 so you need 6 points. Plus 1 point for each wall to accommodate start/stop.
For missing values in wall 1 top, you would take (230-224.3)/4 = 1.425. Then add 1.425 to the value above it.
It would look something like this:
And this would need to be a line chart, where column A can represent the X-axis for labeling.

Shading Area Between Two Line Charts and Axes

I am on day #2 of searching the web and, while I have found plenty of hits that seem like they should work, none of them seem to apply to my particular situation.
I have an Excel chart with two series displayed. One is a sort of exponential decay curve, and one is a constant that intersects with the exponential curve, but does not continue past it (the final x-value of the orange line is estimated to make it look like it intersects the blue curve):
The raw data for the blue curve is as follows (leaving off data labels for confidentiality reasons, but x-values are on the left and y-values are on the right):
The orange line is simply set at 24 all the way across until it intersects with the blue curve.
So here's the problem I need to solve: I need to fill in all of the area below the blue curve with one color, and I need to fill in the area below the orange line with another color. Everything above the blue curve needs to be blank (transparent). Here's an illustration of what I want:
I know in order to get the coloring/shading I need to use an area chart. However, when I try to change the chart type to Area the scales of the axes change for each series and they no longer match up, and I am unable to edit the axes (can't set min, max, etc) to make them match up again. Additionally, only the area directly beneath the constant line fills in (as expected), but I am looking for a way to fill in the area between the orange line, the blue curve, and the axes:
How might one go about doing what I need to do?
If there's any other information I could provide that would be of help, please let me know and I'll be sure to add it in.
EDIT:
I can extend the orange line to follow the blue line off to the right, which may help fill in the lower area. However, when I switch to an area chart I still get the issue with mismatched axes with scale I can't edit:
Notice how the "567" point (the x-value where the orange line should intersect the blue curve) is spaced evenly between "500" and "600", rather than scaling slightly to the right of center as I would have expected.
How do I keep the spacing of one tick every 100 units on the x-axis but keep the datapoint for 567?
You could find the intersection point's coordinates (graphically or analitically), then split your data in two separate series within the same graph as follows :
Edit post comment section :
For some reason x-values are considered by default as text.
Righ click the x-axis > format > Select date on the axis
Then play with the principal and base in days/months to have the intervals you want.
Good parameters for this data :
main : 100 in days
base : in days
I would just have two identical charts : one does the blue and the other the orange then lay the orange chart on top of the blue and make it transparent ... worked a treat in the past...

Linking data in line chart from x and y

Here is the issue:
X has 0 - 8
I need them to start bottom left corner, and also you see all the legends stop on same vertical line but need to be at different stop points so in theory X and Y need to have 0 - 8 and then draw the legend / items from 0,0 to the X,Y set point so if 4.54 X and Y should be 4.54.
Anyone have any ideas? I have added screenshot below.
I tried and managed to get something like this, but it's not quite right. I need to start 0,0 (bottom left) and have straight lines up until the right value by X and Y
UPDATE
I have also attempted a point value system which think might help. Although a point 0.00 value series I guess is required, I need to set the display like it is on the left just showing 0 - 8 and same for bottom but working on the 0.00 series basis?
I really can't imagine what you want to achieve by this. What you want to do is basically drawing eight y = x lines on the SAME plane, which is visually meaningless. As far as I can tell from what you provide, your last try is right approach. You just need to edit the X-axis format. I made something similar based on 0.1 point system. Under this approach, I had to MANUALLY edit each series' ranges, which was also painful.

In Stata, how can I combine box plots of different widths?

I'm trying to combine several box plots across categories of different size.
Here is an example illustrating problem:
sysuse auto
graph box mpg, by(rep78, rows(1)) name(g1, replace )
graph box mpg, by(foreign, rows(1)) name(g2, replace )
graph combine g1 g2 , ycom r(2)
This gives me the following results.
All works according to the manual so for but I have two problems with this output.
Firstly - aesthetics. Personally, I think plot with the same width across rows would look better.
Secondly, and more importantly - on more complex graphs the font size for categories, axes, etc. is also sized proportionally. So even if I specify, let's say - medium size of axis label on all graphs - some of them will be slightly bigger or smaller.
I was wondering if there is an option to programmatically force width of second row of box plots to have the same size as the first one.
Is this you want? It is based on a trick, but the trick is quite general.
sysuse auto, clear
expand 2
gen what = cond(_n <= 74, rep78, 6 + foreign)
label def what 6 Domestic 7 Foreign
label val what what
graph box mpg, by(what, note("Repair record and Foreign") row(2) holes(8 9 10))
The logic is that
The two categorical variables are combined lengthwise. That ensures that each box plot will be the same size.
By specifying holes, we persuade graph box to put graphs on two rows.
I guess that your label size problem will disappear once 1 is solved.
For even more flexibility, you may need to abandon graph box and use twoway instead. A detailed discussion was given by me in the Stata Journal in 2009: you can go straight to http://www.stata-journal.com/sjpdf.html?articlenum=gr0039

Box plot with labels and axes, fitted to a div with fixed dimensions

Following the provided example I built a function that draws a box plot to a jQuery accordion tab, which has a certain fixed height & width. The amount of distinct categories varies greatly depending on the incoming data. Currently I'd like to achieve the following in the plotting:
1) Add axes and display labels, like in this picture
2) Always fit the boxes to container width and height. Currently I see that if there are too many categories, some of them end on the second row, ensuring they're not fully seen. In the picture, the div contains 7 boxes but only 4 fit on one row:
The question is how can these two be implemented? I couldn't even figure out a way to reliably reduce the padding between the boxes without eating into the side numbers on the boxes.
I adopted the original d3.js example to include axes:
http://bl.ocks.org/jensgrubert/7789216
Instead of using individual svg elements as in Mike's implementation, here all boxplots are rendered with in one root element. This makes it easy to add axes.
Best,
Jens
For the time being I'm using a hack found at Highcharts forum (jsfiddle here). There's also a box plot implementation made with Raphael.js that looks cool (github, example)

Resources